src/mess/machine/abc77.c
| r10763 | r10764 | |
| 1 | /* |
| 2 | |
| 3 | Luxor ABC77 |
| 4 | |
| 5 | */ |
| 6 | |
| 7 | #define ADDRESS_MAP_MODERN |
| 8 | |
| 1 | 9 | #include "emu.h" |
| 2 | 10 | #include "abc77.h" |
| 3 | 11 | #include "cpu/mcs48/mcs48.h" |
| 12 | #include "machine/devhelpr.h" |
| 4 | 13 | #include "sound/discrete.h" |
| 14 | #include "sound/speaker.h" |
| 5 | 15 | |
| 6 | | /*************************************************************************** |
| 7 | | PARAMETERS |
| 8 | | ***************************************************************************/ |
| 9 | 16 | |
| 10 | | #define I8035_TAG "z16" |
| 11 | 17 | |
| 12 | | /*************************************************************************** |
| 13 | | TYPE DEFINITIONS |
| 14 | | ***************************************************************************/ |
| 18 | //************************************************************************** |
| 19 | // MACROS / CONSTANTS |
| 20 | //************************************************************************** |
| 15 | 21 | |
| 16 | | typedef struct _abc77_t abc77_t; |
| 17 | | struct _abc77_t |
| 18 | | { |
| 19 | | devcb_resolved_write_line out_txd_func; |
| 20 | | devcb_resolved_write_line out_clock_func; |
| 21 | | devcb_resolved_write_line out_keydown_func; |
| 22 | #define I8035_TAG "z16" |
| 23 | #define DISCRETE_TAG "discrete" |
| 22 | 24 | |
| 23 | | device_t *cpu; /* CPU of the 8035 */ |
| 24 | 25 | |
| 25 | | int txd; /* transmit data */ |
| 26 | | int keylatch; /* keyboard row latch */ |
| 27 | | int clock; /* transmit clock */ |
| 28 | | int hys; /* hysteresis */ |
| 29 | | int reset; /* reset */ |
| 30 | 26 | |
| 31 | | /* timers */ |
| 32 | | emu_timer *reset_timer; /* reset timer */ |
| 33 | | }; |
| 27 | //************************************************************************** |
| 28 | // DEVICE DEFINITIONS |
| 29 | //************************************************************************** |
| 34 | 30 | |
| 35 | | /*************************************************************************** |
| 36 | | INLINE FUNCTIONS |
| 37 | | ***************************************************************************/ |
| 31 | const device_type ABC77 = abc77_device_config::static_alloc_device_config; |
| 38 | 32 | |
| 39 | | INLINE abc77_t *get_safe_token(device_t *device) |
| 40 | | { |
| 41 | | assert(device != NULL); |
| 42 | | assert(device->type() == ABC77); |
| 43 | 33 | |
| 44 | | return (abc77_t *)downcast<legacy_device_base *>(device)->token(); |
| 45 | | } |
| 46 | 34 | |
| 47 | | INLINE const abc77_interface *get_interface(device_t *device) |
| 48 | | { |
| 49 | | assert(device != NULL); |
| 50 | | assert((device->type() == ABC77)); |
| 35 | //************************************************************************** |
| 36 | // DEVICE CONFIGURATION |
| 37 | //************************************************************************** |
| 51 | 38 | |
| 52 | | return (const abc77_interface *) device->baseconfig().static_config(); |
| 53 | | } |
| 39 | GENERIC_DEVICE_CONFIG_SETUP(abc77, "Luxor ABC 77") |
| 54 | 40 | |
| 55 | | /*************************************************************************** |
| 56 | | IMPLEMENTATION |
| 57 | | ***************************************************************************/ |
| 58 | 41 | |
| 59 | | /*------------------------------------------------- |
| 60 | | DISCRETE_SOUND( abc77 ) |
| 61 | | -------------------------------------------------*/ |
| 42 | //------------------------------------------------- |
| 43 | // device_config_complete - perform any |
| 44 | // operations now that the configuration is |
| 45 | // complete |
| 46 | //------------------------------------------------- |
| 62 | 47 | |
| 63 | | static const discrete_555_desc abc77_ne556_a = |
| 48 | void abc77_device_config::device_config_complete() |
| 64 | 49 | { |
| 65 | | DISC_555_OUT_SQW | DISC_555_OUT_DC, |
| 66 | | 5, // B+ voltage of 555 |
| 67 | | DEFAULT_555_VALUES |
| 68 | | }; |
| 50 | // inherit a copy of the static data |
| 51 | const abc77_interface *intf = reinterpret_cast<const abc77_interface *>(static_config()); |
| 52 | if (intf != NULL) |
| 53 | *static_cast<abc77_interface *>(this) = *intf; |
| 69 | 54 | |
| 70 | | static DISCRETE_SOUND_START( abc77 ) |
| 71 | | DISCRETE_INPUT_LOGIC(NODE_01) |
| 72 | | DISCRETE_555_ASTABLE(NODE_02, NODE_01, RES_K(2.7), RES_K(15), CAP_N(22), &abc77_ne556_a) |
| 73 | | DISCRETE_OUTPUT(NODE_02, 5000) |
| 74 | | DISCRETE_SOUND_END |
| 55 | // or initialize to defaults if none provided |
| 56 | else |
| 57 | { |
| 58 | memset(&m_out_txd_func, 0, sizeof(m_out_txd_func)); |
| 59 | memset(&m_out_clock_func, 0, sizeof(m_out_clock_func)); |
| 60 | memset(&m_out_keydown_func, 0, sizeof(m_out_keydown_func)); |
| 61 | } |
| 75 | 62 | |
| 76 | | /*------------------------------------------------- |
| 77 | | TIMER_DEVICE_CALLBACK( clock_tick ) |
| 78 | | -------------------------------------------------*/ |
| 63 | m_shortname = "abc77"; |
| 64 | } |
| 79 | 65 | |
| 80 | | static TIMER_DEVICE_CALLBACK( clock_tick ) |
| 81 | | { |
| 82 | | device_t *device = timer.machine->device(ABC77_TAG); |
| 83 | | abc77_t *abc77 = get_safe_token(device); |
| 84 | 66 | |
| 85 | | abc77->clock = !abc77->clock; |
| 67 | //------------------------------------------------- |
| 68 | // ROM( abc77 ) |
| 69 | //------------------------------------------------- |
| 86 | 70 | |
| 87 | | devcb_call_write_line(&abc77->out_clock_func, abc77->clock); |
| 88 | | } |
| 71 | ROM_START( abc77 ) |
| 72 | ROM_LOAD( "65-02486.z10", 0x0000, 0x0800, NO_DUMP ) // Swedish |
| 73 | ROM_LOAD( "keyboard.z14", 0x0800, 0x0800, NO_DUMP ) // non-Swedish |
| 74 | ROM_END |
| 89 | 75 | |
| 90 | | /*------------------------------------------------- |
| 91 | | TIMER_CALLBACK( reset_tick ) |
| 92 | | -------------------------------------------------*/ |
| 93 | 76 | |
| 94 | | static TIMER_CALLBACK( reset_tick ) |
| 77 | //------------------------------------------------- |
| 78 | // rom_region - device-specific ROM region |
| 79 | //------------------------------------------------- |
| 80 | |
| 81 | const rom_entry *abc77_device_config::rom_region() const |
| 95 | 82 | { |
| 96 | | device_t *device = (device_t *)ptr; |
| 97 | | abc77_t *abc77 = get_safe_token(device); |
| 98 | | |
| 99 | | cpu_set_input_line(abc77->cpu, INPUT_LINE_RESET, CLEAR_LINE); |
| 83 | return ROM_NAME( abc77 ); |
| 100 | 84 | } |
| 101 | 85 | |
| 102 | | /*------------------------------------------------- |
| 103 | | abc77_clock_r - read serial clock |
| 104 | | -------------------------------------------------*/ |
| 105 | 86 | |
| 106 | | static READ8_HANDLER( abc77_clock_r ) |
| 107 | | { |
| 108 | | device_t *device = space->machine->device(ABC77_TAG); |
| 109 | | abc77_t *abc77 = get_safe_token(device); |
| 87 | //------------------------------------------------- |
| 88 | // ADDRESS_MAP( abc77_mem ) |
| 89 | //------------------------------------------------- |
| 110 | 90 | |
| 111 | | return abc77->clock; |
| 112 | | } |
| 91 | static ADDRESS_MAP_START( abc77_map, ADDRESS_SPACE_PROGRAM, 8, abc77_device ) |
| 92 | AM_RANGE(0x000, 0xfff) AM_ROM AM_REGION("abc77:z16", 0) |
| 93 | ADDRESS_MAP_END |
| 113 | 94 | |
| 114 | | /*------------------------------------------------- |
| 115 | | abc77_data_r - read keyboard matrix |
| 116 | | -------------------------------------------------*/ |
| 117 | 95 | |
| 118 | | static READ8_HANDLER( abc77_data_r ) |
| 119 | | { |
| 120 | | device_t *device = space->machine->device(ABC77_TAG); |
| 121 | | abc77_t *abc77 = get_safe_token(device); |
| 96 | //------------------------------------------------- |
| 97 | // ADDRESS_MAP( abc77_io ) |
| 98 | //------------------------------------------------- |
| 122 | 99 | |
| 123 | | static const char *const keynames[] = { "ABC77_X0", "ABC77_X1", "ABC77_X2", "ABC77_X3", "ABC77_X4", "ABC77_X5", "ABC77_X6", "ABC77_X7", "ABC77_X8", "ABC77_X9", "ABC77_X10", "ABC77_X11" }; |
| 100 | static ADDRESS_MAP_START( abc77_io, ADDRESS_SPACE_IO, 8, abc77_device ) |
| 101 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVREAD(DEVICE_SELF_OWNER, abc77_device, p1_r) |
| 102 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_DEVWRITE(DEVICE_SELF_OWNER, abc77_device, p2_w) |
| 103 | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_DEVREAD(DEVICE_SELF_OWNER, abc77_device, t1_r) |
| 104 | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ_PORT("DSW") |
| 105 | ADDRESS_MAP_END |
| 124 | 106 | |
| 125 | | return input_port_read(device->machine, keynames[abc77->keylatch]); |
| 126 | | } |
| 127 | 107 | |
| 128 | | /*------------------------------------------------- |
| 129 | | abc77_data_w - keyboard control |
| 130 | | -------------------------------------------------*/ |
| 108 | //------------------------------------------------- |
| 109 | // DISCRETE_SOUND( abc77 ) |
| 110 | //------------------------------------------------- |
| 131 | 111 | |
| 132 | | static WRITE8_HANDLER( abc77_data_w ) |
| 112 | static const discrete_555_desc abc77_ne556_a = |
| 133 | 113 | { |
| 134 | | device_t *device = space->machine->device(ABC77_TAG); |
| 135 | | device_t *discrete = space->machine->device("discrete"); |
| 136 | | abc77_t *abc77 = get_safe_token(device); |
| 114 | DISC_555_OUT_SQW | DISC_555_OUT_DC, |
| 115 | 5, // B+ voltage of 555 |
| 116 | DEFAULT_555_VALUES |
| 117 | }; |
| 137 | 118 | |
| 138 | | abc77->keylatch = data & 0x0f; |
| 119 | static DISCRETE_SOUND_START( abc77 ) |
| 120 | DISCRETE_INPUT_LOGIC(NODE_01) |
| 121 | DISCRETE_555_ASTABLE(NODE_02, NODE_01, RES_K(2.7), RES_K(15), CAP_N(22), &abc77_ne556_a) |
| 122 | DISCRETE_OUTPUT(NODE_02, 5000) |
| 123 | DISCRETE_SOUND_END |
| 139 | 124 | |
| 140 | | if (abc77->keylatch == 1) |
| 141 | | { |
| 142 | | watchdog_reset(device->machine); |
| 143 | | } |
| 144 | 125 | |
| 145 | | /* beep */ |
| 146 | | discrete_sound_w(discrete, NODE_01, BIT(data, 4)); |
| 126 | //------------------------------------------------- |
| 127 | // MACHINE_DRIVER( abc77 ) |
| 128 | //------------------------------------------------- |
| 147 | 129 | |
| 148 | | /* transmit data */ |
| 149 | | devcb_call_write_line(&abc77->out_txd_func, BIT(data, 5)); |
| 150 | | abc77->txd = BIT(data, 5); |
| 130 | static MACHINE_CONFIG_FRAGMENT( abc77 ) |
| 131 | // keyboard cpu |
| 132 | MCFG_CPU_ADD(I8035_TAG, I8035, XTAL_4_608MHz) |
| 133 | MCFG_CPU_PROGRAM_MAP(abc77_map) |
| 134 | MCFG_CPU_IO_MAP(abc77_io) |
| 151 | 135 | |
| 152 | | /* key down */ |
| 153 | | devcb_call_write_line(&abc77->out_keydown_func, BIT(data, 6)); |
| 136 | // watchdog |
| 137 | MCFG_WATCHDOG_TIME_INIT(MCS48_ALE_CLOCK(XTAL_4_608MHz)) |
| 154 | 138 | |
| 155 | | /* hysteresis */ |
| 156 | | abc77->hys = BIT(data, 7); |
| 157 | | } |
| 139 | // discrete sound |
| 140 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 141 | MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) |
| 142 | MCFG_SOUND_CONFIG_DISCRETE(abc77) |
| 143 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "abc77:mono", 0.80) |
| 144 | MACHINE_CONFIG_END |
| 158 | 145 | |
| 159 | | /*------------------------------------------------- |
| 160 | | ADDRESS_MAP( abc77_map ) |
| 161 | | -------------------------------------------------*/ |
| 162 | 146 | |
| 163 | | static ADDRESS_MAP_START( abc77_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 164 | | AM_RANGE(0x000, 0xfff) AM_ROM |
| 165 | | ADDRESS_MAP_END |
| 147 | //------------------------------------------------- |
| 148 | // machine_config_additions - device-specific |
| 149 | // machine configurations |
| 150 | //------------------------------------------------- |
| 166 | 151 | |
| 167 | | /*------------------------------------------------- |
| 168 | | ADDRESS_MAP( abc77_io_map ) |
| 169 | | -------------------------------------------------*/ |
| 152 | machine_config_constructor abc77_device_config::machine_config_additions() const |
| 153 | { |
| 154 | return MACHINE_CONFIG_NAME( abc77 ); |
| 155 | } |
| 170 | 156 | |
| 171 | | static ADDRESS_MAP_START( abc77_io_map, ADDRESS_SPACE_IO, 8 ) |
| 172 | | AM_RANGE(0x00, 0x3f) AM_RAM |
| 173 | | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(abc77_data_r) |
| 174 | | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(abc77_data_w) |
| 175 | | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(abc77_clock_r) |
| 176 | | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ_PORT("ABC77_DSW") |
| 177 | | ADDRESS_MAP_END |
| 178 | 157 | |
| 179 | | /*------------------------------------------------- |
| 180 | | INPUT_PORTS( abc77 ) |
| 181 | | -------------------------------------------------*/ |
| 158 | //------------------------------------------------- |
| 159 | // INPUT_PORTS( abc77 ) |
| 160 | //------------------------------------------------- |
| 182 | 161 | |
| 183 | 162 | INPUT_PORTS_START( abc77 ) |
| 184 | | PORT_START("ABC77_X0") |
| 163 | PORT_START("X0") |
| 185 | 164 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 186 | 165 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 187 | 166 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 188 | 167 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 189 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE |
| 168 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 190 | 169 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) |
| 191 | 170 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 192 | 171 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 193 | 172 | |
| 194 | | PORT_START("ABC77_X1") |
| 173 | PORT_START("X1") |
| 195 | 174 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 196 | 175 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 197 | 176 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r10763 | r10764 | |
| 201 | 180 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 202 | 181 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 203 | 182 | |
| 204 | | PORT_START("ABC77_X2") |
| 183 | PORT_START("X2") |
| 205 | 184 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 206 | 185 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>') |
| 207 | 186 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') |
| r10763 | r10764 | |
| 211 | 190 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 212 | 191 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 213 | 192 | |
| 214 | | PORT_START("ABC77_X3") |
| 193 | PORT_START("X3") |
| 215 | 194 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00E9) PORT_CHAR(0x00C9) |
| 216 | 195 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?') |
| 217 | 196 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) |
| r10763 | r10764 | |
| 221 | 200 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 222 | 201 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 223 | 202 | |
| 224 | | PORT_START("ABC77_X4") |
| 203 | PORT_START("X4") |
| 225 | 204 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') |
| 226 | 205 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 227 | 206 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| r10763 | r10764 | |
| 231 | 210 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') |
| 232 | 211 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') |
| 233 | 212 | |
| 234 | | PORT_START("ABC77_X5") |
| 213 | PORT_START("X5") |
| 235 | 214 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 236 | 215 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') |
| 237 | 216 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| r10763 | r10764 | |
| 241 | 220 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 242 | 221 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') |
| 243 | 222 | |
| 244 | | PORT_START("ABC77_X6") |
| 223 | PORT_START("X6") |
| 245 | 224 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 246 | 225 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 247 | 226 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| r10763 | r10764 | |
| 251 | 230 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 252 | 231 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 253 | 232 | |
| 254 | | PORT_START("ABC77_X7") |
| 233 | PORT_START("X7") |
| 255 | 234 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 \xC2\xA4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0x00A4) |
| 256 | 235 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 257 | 236 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| r10763 | r10764 | |
| 261 | 240 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 262 | 241 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 263 | 242 | |
| 264 | | PORT_START("ABC77_X8") |
| 243 | PORT_START("X8") |
| 265 | 244 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') |
| 266 | 245 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 267 | 246 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| r10763 | r10764 | |
| 271 | 250 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 272 | 251 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 273 | 252 | |
| 274 | | PORT_START("ABC77_X9") |
| 275 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 276 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) |
| 277 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 278 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 279 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 280 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD RETURN") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) |
| 253 | PORT_START("X9") |
| 254 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 255 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) |
| 256 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 257 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 258 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 259 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad RETURN") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) |
| 281 | 260 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 282 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 261 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 283 | 262 | |
| 284 | | PORT_START("ABC77_X10") |
| 285 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 286 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 287 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 288 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 289 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 290 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 291 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 263 | PORT_START("X10") |
| 264 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 265 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 266 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 267 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 268 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 269 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 270 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 292 | 271 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 293 | 272 | |
| 294 | | PORT_START("ABC77_X11") |
| 273 | PORT_START("X11") |
| 295 | 274 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 296 | 275 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| 297 | 276 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) |
| r10763 | r10764 | |
| 301 | 280 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) |
| 302 | 281 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) |
| 303 | 282 | |
| 304 | | PORT_START("ABC77_DSW") |
| 283 | PORT_START("DSW") |
| 305 | 284 | PORT_DIPNAME( 0x01, 0x01, "Keyboard Program" ) |
| 306 | 285 | PORT_DIPSETTING( 0x00, "Internal (8048)" ) |
| 307 | 286 | PORT_DIPSETTING( 0x01, "External PROM" ) |
| r10763 | r10764 | |
| 311 | 290 | PORT_DIPNAME( 0x04, 0x04, "External PROM" ) |
| 312 | 291 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 313 | 292 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 314 | | PORT_DIPNAME( 0x18, 0x18, "Keyboard Type" ) |
| 293 | PORT_DIPNAME( 0x18, 0x18, "Keyboard Language" ) |
| 315 | 294 | PORT_DIPSETTING( 0x00, "Danish" ) |
| 316 | 295 | PORT_DIPSETTING( 0x10, DEF_STR( French ) ) |
| 317 | 296 | PORT_DIPSETTING( 0x08, DEF_STR( German ) ) |
| r10763 | r10764 | |
| 319 | 298 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED) |
| 320 | 299 | INPUT_PORTS_END |
| 321 | 300 | |
| 322 | | /*------------------------------------------------- |
| 323 | | MACHINE_DRIVER( abc77 ) |
| 324 | | -------------------------------------------------*/ |
| 325 | 301 | |
| 326 | | static MACHINE_CONFIG_FRAGMENT( abc77 ) |
| 327 | | /* keyboard cpu */ |
| 328 | | MCFG_CPU_ADD(I8035_TAG, I8035, XTAL_4_608MHz) |
| 329 | | MCFG_CPU_PROGRAM_MAP(abc77_map) |
| 330 | | MCFG_CPU_IO_MAP(abc77_io_map) |
| 302 | //------------------------------------------------- |
| 303 | // input_ports - device-specific input ports |
| 304 | //------------------------------------------------- |
| 331 | 305 | |
| 332 | | /* watchdog */ |
| 333 | | MCFG_WATCHDOG_TIME_INIT(attotime::from_hz(XTAL_4_608MHz/(3*5))) |
| 306 | const input_port_token *abc77_device_config::input_ports() const |
| 307 | { |
| 308 | return INPUT_PORTS_NAME( abc77 ); |
| 309 | } |
| 310 | |
| 334 | 311 | |
| 335 | | /* serial clock timer */ |
| 336 | | MCFG_TIMER_ADD_PERIODIC("serial", clock_tick, MCS48_ALE_CLOCK(XTAL_4_608MHz)) |
| 337 | 312 | |
| 338 | | /* discrete sound */ |
| 339 | | MCFG_SOUND_ADD("discrete", DISCRETE, 0) |
| 340 | | MCFG_SOUND_CONFIG_DISCRETE(abc77) |
| 341 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 342 | | MACHINE_CONFIG_END |
| 313 | //************************************************************************** |
| 314 | // INLINE HELPERS |
| 315 | //************************************************************************** |
| 343 | 316 | |
| 344 | | /*------------------------------------------------- |
| 345 | | ROM( abc77 ) |
| 346 | | -------------------------------------------------*/ |
| 317 | //------------------------------------------------- |
| 318 | // serial_output - |
| 319 | //------------------------------------------------- |
| 347 | 320 | |
| 348 | | ROM_START( abc77 ) |
| 349 | | ROM_REGION( 0x1000, I8035_TAG, 0 ) |
| 350 | | ROM_LOAD( "65-02486.z10", 0x0000, 0x0800, NO_DUMP ) /* 2716 ABC55/77 keyboard controller Swedish EPROM */ |
| 351 | | ROM_LOAD( "keyboard.z14", 0x0800, 0x0800, NO_DUMP ) /* 2716 ABC55/77 keyboard controller non-Swedish EPROM */ |
| 352 | | ROM_FILL( 0, 0x1000, 0 ) |
| 353 | | ROM_END |
| 321 | inline void abc77_device::serial_output(int state) |
| 322 | { |
| 323 | if (m_txd != state) |
| 324 | { |
| 325 | m_txd = state; |
| 354 | 326 | |
| 355 | | /*------------------------------------------------- |
| 356 | | abc77_rxd_w - keyboard serial data in |
| 357 | | -------------------------------------------------*/ |
| 327 | devcb_call_write_line(&m_out_txd_func, m_txd); |
| 328 | } |
| 329 | } |
| 358 | 330 | |
| 359 | | WRITE_LINE_DEVICE_HANDLER( abc77_rxd_w ) |
| 331 | |
| 332 | //------------------------------------------------- |
| 333 | // serial_clock - |
| 334 | //------------------------------------------------- |
| 335 | |
| 336 | inline void abc77_device::serial_clock() |
| 360 | 337 | { |
| 361 | | abc77_t *abc77 = get_safe_token(device); |
| 338 | m_clock = !m_clock; |
| 362 | 339 | |
| 363 | | cpu_set_input_line(abc77->cpu, MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); |
| 340 | devcb_call_write_line(&m_out_clock_func, m_clock); |
| 364 | 341 | } |
| 365 | 342 | |
| 366 | | /*------------------------------------------------- |
| 367 | | abc77_txd_r - keyboard serial data out |
| 368 | | -------------------------------------------------*/ |
| 369 | 343 | |
| 370 | | READ_LINE_DEVICE_HANDLER( abc77_txd_r ) |
| 344 | //------------------------------------------------- |
| 345 | // keydown - |
| 346 | //------------------------------------------------- |
| 347 | |
| 348 | inline void abc77_device::key_down(int state) |
| 371 | 349 | { |
| 372 | | abc77_t *abc77 = get_safe_token(device); |
| 350 | if (m_keydown != state) |
| 351 | { |
| 352 | devcb_call_write_line(&m_out_keydown_func, state); |
| 353 | m_keydown = state; |
| 354 | } |
| 355 | } |
| 373 | 356 | |
| 374 | | return abc77->txd; |
| 357 | |
| 358 | |
| 359 | //************************************************************************** |
| 360 | // LIVE DEVICE |
| 361 | //************************************************************************** |
| 362 | |
| 363 | //------------------------------------------------- |
| 364 | // abc77_device - constructor |
| 365 | //------------------------------------------------- |
| 366 | |
| 367 | abc77_device::abc77_device(running_machine &_machine, const abc77_device_config &config) |
| 368 | : device_t(_machine, config), |
| 369 | m_maincpu(*this, I8035_TAG), |
| 370 | m_discrete(*this, DISCRETE_TAG), |
| 371 | m_config(config) |
| 372 | { |
| 375 | 373 | } |
| 376 | 374 | |
| 377 | | /*------------------------------------------------- |
| 378 | | abc77_reset_w - keyboard reset |
| 379 | | -------------------------------------------------*/ |
| 380 | 375 | |
| 381 | | WRITE_LINE_DEVICE_HANDLER( abc77_reset_w ) |
| 376 | //------------------------------------------------- |
| 377 | // device_start - device-specific startup |
| 378 | //------------------------------------------------- |
| 379 | |
| 380 | void abc77_device::device_start() |
| 382 | 381 | { |
| 383 | | abc77_t *abc77 = get_safe_token(device); |
| 382 | // allocate timers |
| 383 | m_serial_timer = timer_alloc(TIMER_SERIAL); |
| 384 | m_serial_timer->adjust(MCS48_ALE_CLOCK(XTAL_4_608MHz*2), 0, MCS48_ALE_CLOCK(XTAL_4_608MHz*2)); |
| 384 | 385 | |
| 385 | | if (abc77->reset && !state) |
| 386 | | { |
| 387 | | int t = 1.1 * RES_K(100) * CAP_N(100) * 1000; // t = 1.1 * R1 * C1 |
| 388 | | int ea = BIT(input_port_read(device->machine, "ABC77_DSW"), 7); |
| 386 | m_reset_timer = timer_alloc(TIMER_RESET); |
| 389 | 387 | |
| 390 | | /* trigger reset */ |
| 391 | | cpu_set_input_line(abc77->cpu, INPUT_LINE_RESET, ASSERT_LINE); |
| 392 | | abc77->reset_timer->adjust(attotime::from_msec(t)); |
| 388 | // resolve callbacks |
| 389 | devcb_resolve_write_line(&m_out_txd_func, &m_config.m_out_txd_func, this); |
| 390 | devcb_resolve_write_line(&m_out_clock_func, &m_config.m_out_clock_func, this); |
| 391 | devcb_resolve_write_line(&m_out_keydown_func, &m_config.m_out_keydown_func, this); |
| 392 | } |
| 393 | 393 | |
| 394 | | cpu_set_input_line(abc77->cpu, MCS48_INPUT_EA, ea ? CLEAR_LINE : ASSERT_LINE); |
| 395 | | } |
| 396 | 394 | |
| 397 | | abc77->reset = state; |
| 395 | //------------------------------------------------- |
| 396 | // device_reset - device-specific reset |
| 397 | //------------------------------------------------- |
| 398 | |
| 399 | void abc77_device::device_reset() |
| 400 | { |
| 401 | int t = 1.1 * RES_K(100) * CAP_N(100) * 1000; // t = 1.1 * R1 * C1 |
| 402 | int ea = BIT(input_port_read(this, "DSW"), 7); |
| 403 | |
| 404 | // trigger reset |
| 405 | cpu_set_input_line(m_maincpu, INPUT_LINE_RESET, ASSERT_LINE); |
| 406 | m_reset_timer->adjust(attotime::from_msec(t)); |
| 407 | |
| 408 | cpu_set_input_line(m_maincpu, MCS48_INPUT_EA, ea ? CLEAR_LINE : ASSERT_LINE); |
| 398 | 409 | } |
| 399 | 410 | |
| 400 | | /*------------------------------------------------- |
| 401 | | DEVICE_START( abc77 ) |
| 402 | | -------------------------------------------------*/ |
| 403 | 411 | |
| 404 | | static DEVICE_START( abc77 ) |
| 412 | //------------------------------------------------- |
| 413 | // device_timer - handler timer events |
| 414 | //------------------------------------------------- |
| 415 | |
| 416 | void abc77_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 405 | 417 | { |
| 406 | | abc77_t *abc77 = get_safe_token(device); |
| 407 | | const abc77_interface *intf = get_interface(device); |
| 418 | switch (id) |
| 419 | { |
| 420 | case TIMER_SERIAL: |
| 421 | serial_clock(); |
| 422 | break; |
| 423 | |
| 424 | case TIMER_RESET: |
| 425 | cpu_set_input_line(m_maincpu, INPUT_LINE_RESET, CLEAR_LINE); |
| 426 | break; |
| 427 | } |
| 428 | } |
| 408 | 429 | |
| 409 | | /* resolve callbacks */ |
| 410 | | devcb_resolve_write_line(&abc77->out_txd_func, &intf->out_txd_func, device); |
| 411 | | devcb_resolve_write_line(&abc77->out_clock_func, &intf->out_clock_func, device); |
| 412 | | devcb_resolve_write_line(&abc77->out_keydown_func, &intf->out_keydown_func, device); |
| 413 | 430 | |
| 414 | | /* find our CPU */ |
| 415 | | abc77->cpu = device->subdevice(I8035_TAG); |
| 431 | //------------------------------------------------- |
| 432 | // p1_r - |
| 433 | //------------------------------------------------- |
| 416 | 434 | |
| 417 | | /* allocate reset timer */ |
| 418 | | abc77->reset_timer = device->machine->scheduler().timer_alloc(FUNC(reset_tick), (FPTR *) device); |
| 435 | READ8_MEMBER( abc77_device::p1_r ) |
| 436 | { |
| 437 | /* |
| 438 | |
| 439 | bit description |
| 440 | |
| 441 | P10 Z17 Y0 |
| 442 | P11 Z17 Y1 |
| 443 | P12 Z17 Y2 |
| 444 | P13 Z17 Y3 |
| 445 | P14 Z17 Y4 |
| 446 | P15 Z17 Y5 |
| 447 | P16 Z17 Y6 |
| 448 | P17 Z17 Y7 |
| 449 | |
| 450 | */ |
| 419 | 451 | |
| 420 | | /* register for state saving */ |
| 421 | | device->save_item(NAME(abc77->keylatch)); |
| 422 | | device->save_item(NAME(abc77->clock)); |
| 423 | | device->save_item(NAME(abc77->hys)); |
| 424 | | device->save_item(NAME(abc77->txd)); |
| 425 | | device->save_item(NAME(abc77->reset)); |
| 452 | static const char *const keynames[] = { "X0", "X1", "X2", "X3", "X4", "X5", "X6", "X7", "X8", "X9", "X10", "X11" }; |
| 453 | |
| 454 | return input_port_read(this, keynames[m_keylatch]); |
| 426 | 455 | } |
| 427 | 456 | |
| 428 | | /*------------------------------------------------- |
| 429 | | DEVICE_GET_INFO( abc77 ) |
| 430 | | -------------------------------------------------*/ |
| 431 | 457 | |
| 432 | | DEVICE_GET_INFO( abc77 ) |
| 458 | //------------------------------------------------- |
| 459 | // p2_w - |
| 460 | //------------------------------------------------- |
| 461 | |
| 462 | WRITE8_MEMBER( abc77_device::p2_w ) |
| 433 | 463 | { |
| 434 | | switch (state) |
| 464 | /* |
| 465 | |
| 466 | bit description |
| 467 | |
| 468 | P20 Z2 A0 |
| 469 | P21 Z2 A1 |
| 470 | P22 Z2 A2 |
| 471 | P23 Z2 A3 |
| 472 | P24 NE556 2,6 |
| 473 | P25 TxD |
| 474 | P26 _KEYDOWN |
| 475 | P27 Z17 HYS |
| 476 | |
| 477 | */ |
| 478 | |
| 479 | m_keylatch = data & 0x0f; |
| 480 | |
| 481 | if (m_keylatch == 1) |
| 435 | 482 | { |
| 436 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 437 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 438 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(abc77_t); break; |
| 483 | watchdog_reset(machine); |
| 484 | } |
| 439 | 485 | |
| 440 | | /* --- the following bits of info are returned as pointers --- */ |
| 441 | | case DEVINFO_PTR_ROM_REGION: info->romregion = rom_abc77; break; |
| 442 | | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = MACHINE_CONFIG_NAME(abc77); break; |
| 486 | // beep |
| 487 | discrete_sound_w(m_discrete, NODE_01, BIT(data, 4)); |
| 443 | 488 | |
| 444 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 445 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(abc77); break; |
| 446 | | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 447 | | case DEVINFO_FCT_RESET: /* Nothing */ break; |
| 489 | // transmit data |
| 490 | serial_output(BIT(data, 5)); |
| 448 | 491 | |
| 449 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 450 | | case DEVINFO_STR_NAME: strcpy(info->s, "Luxor ABC-77"); break; |
| 451 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "Luxor ABC"); break; |
| 452 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 453 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 454 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 492 | // key down |
| 493 | key_down(BIT(data, 6)); |
| 494 | |
| 495 | // hysteresis |
| 496 | m_hys = BIT(data, 7); |
| 497 | } |
| 498 | |
| 499 | |
| 500 | //------------------------------------------------- |
| 501 | // t1_r - |
| 502 | //------------------------------------------------- |
| 503 | |
| 504 | READ8_MEMBER( abc77_device::t1_r ) |
| 505 | { |
| 506 | return m_clock; |
| 507 | } |
| 508 | |
| 509 | |
| 510 | //------------------------------------------------- |
| 511 | // rxd_w - |
| 512 | //------------------------------------------------- |
| 513 | |
| 514 | WRITE_LINE_MEMBER( abc77_device::rxd_w ) |
| 515 | { |
| 516 | cpu_set_input_line(m_maincpu, MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); |
| 517 | } |
| 518 | |
| 519 | |
| 520 | //------------------------------------------------- |
| 521 | // txd_r - |
| 522 | //------------------------------------------------- |
| 523 | |
| 524 | READ_LINE_MEMBER( abc77_device::txd_r ) |
| 525 | { |
| 526 | return m_txd; |
| 527 | } |
| 528 | |
| 529 | |
| 530 | //------------------------------------------------- |
| 531 | // reset_w - |
| 532 | //------------------------------------------------- |
| 533 | |
| 534 | WRITE_LINE_MEMBER( abc77_device::reset_w ) |
| 535 | { |
| 536 | if (m_reset && !state) |
| 537 | { |
| 538 | device_reset(); |
| 455 | 539 | } |
| 540 | |
| 541 | m_reset = state; |
| 456 | 542 | } |
| 457 | | |
| 458 | | DEFINE_LEGACY_DEVICE(ABC77, abc77); |