trunk/src/emu/bus/pc_kbd/pcat84.c
| r0 | r26018 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:Curt Coder |
| 3 | /********************************************************************** |
| 4 | |
| 5 | IBM Model F PC/AT 84-key / 3270PC 122-key keyboard emulation |
| 6 | |
| 7 | Copyright MESS Team. |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | |
| 10 | *********************************************************************/ |
| 11 | |
| 12 | /* |
| 13 | |
| 14 | TODO: |
| 15 | |
| 16 | - cpu LC timing |
| 17 | - 3270PC keys |
| 18 | |
| 19 | */ |
| 20 | |
| 21 | /* |
| 22 | |
| 23 | Part No Layout |
| 24 | ------------------- |
| 25 | 6450225 UK 84-key |
| 26 | 6110344 UK 122-key |
| 27 | |
| 28 | */ |
| 29 | |
| 30 | #include "pcat84.h" |
| 31 | |
| 32 | |
| 33 | |
| 34 | //************************************************************************** |
| 35 | // MACROS / CONSTANTS |
| 36 | //************************************************************************** |
| 37 | |
| 38 | #define I8048_TAG "m5" |
| 39 | |
| 40 | |
| 41 | |
| 42 | //************************************************************************** |
| 43 | // DEVICE DEFINITIONS |
| 44 | //************************************************************************** |
| 45 | |
| 46 | const device_type PC_KBD_IBM_PC_AT_84 = &device_creator<ibm_pc_at_84_keyboard_device>; |
| 47 | const device_type PC_KBD_IBM_3270PC_122 = &device_creator<ibm_3270pc_122_keyboard_device>; |
| 48 | |
| 49 | |
| 50 | //------------------------------------------------- |
| 51 | // ROM( ibm_pc_at_84_keyboard ) |
| 52 | //------------------------------------------------- |
| 53 | |
| 54 | ROM_START( ibm_pc_at_84_keyboard ) |
| 55 | ROM_REGION( 0x400, I8048_TAG, 0 ) |
| 56 | /* |
| 57 | Keyboard Part No 6450225 |
| 58 | |
| 59 | PH 1503099 |
| 60 | D 878154 |
| 61 | 8441 D H |
| 62 | */ |
| 63 | ROM_LOAD( "1503099.m5", 0x000, 0x400, CRC(1e921f37) SHA1(5f722bdb3b57f5a532c02a5c3f78f30d785796f2) ) |
| 64 | ROM_END |
| 65 | |
| 66 | |
| 67 | //------------------------------------------------- |
| 68 | // rom_region - device-specific ROM region |
| 69 | //------------------------------------------------- |
| 70 | |
| 71 | const rom_entry *ibm_pc_at_84_keyboard_device::device_rom_region() const |
| 72 | { |
| 73 | return ROM_NAME( ibm_pc_at_84_keyboard ); |
| 74 | } |
| 75 | |
| 76 | |
| 77 | //------------------------------------------------- |
| 78 | // ROM( ibm_3270pc_122_keyboard ) |
| 79 | //------------------------------------------------- |
| 80 | |
| 81 | ROM_START( ibm_3270pc_122_keyboard ) |
| 82 | ROM_REGION( 0x400, I8048_TAG, 0 ) |
| 83 | /* |
| 84 | Keyboard Part No 6110344 |
| 85 | |
| 86 | PH 1385001 |
| 87 | D |
| 88 | 8512 D H |
| 89 | */ |
| 90 | ROM_LOAD( "1385001.m5", 0x000, 0x400, CRC(c19767e9) SHA1(a3701e4617383a4de0fd5e2e86c4b74beaf94a7b) ) |
| 91 | ROM_END |
| 92 | |
| 93 | |
| 94 | //------------------------------------------------- |
| 95 | // rom_region - device-specific ROM region |
| 96 | //------------------------------------------------- |
| 97 | |
| 98 | const rom_entry *ibm_3270pc_122_keyboard_device::device_rom_region() const |
| 99 | { |
| 100 | return ROM_NAME( ibm_3270pc_122_keyboard ); |
| 101 | } |
| 102 | |
| 103 | |
| 104 | //------------------------------------------------- |
| 105 | // ADDRESS_MAP( kb_io ) |
| 106 | //------------------------------------------------- |
| 107 | |
| 108 | static ADDRESS_MAP_START( ibm_pc_at_84_keyboard_io, AS_IO, 8, ibm_pc_at_84_keyboard_device ) |
| 109 | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READNOP AM_WRITE(bus_w) |
| 110 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w) |
| 111 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(p2_r, p2_w) |
| 112 | AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r) |
| 113 | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) |
| 114 | ADDRESS_MAP_END |
| 115 | |
| 116 | |
| 117 | //------------------------------------------------- |
| 118 | // MACHINE_DRIVER( ibm_pc_at_84_keyboard ) |
| 119 | //------------------------------------------------- |
| 120 | |
| 121 | static MACHINE_CONFIG_FRAGMENT( ibm_pc_at_84_keyboard ) |
| 122 | MCFG_CPU_ADD(I8048_TAG, I8048, 5364000) |
| 123 | MCFG_CPU_IO_MAP(ibm_pc_at_84_keyboard_io) |
| 124 | MACHINE_CONFIG_END |
| 125 | |
| 126 | |
| 127 | //------------------------------------------------- |
| 128 | // machine_config_additions - device-specific |
| 129 | // machine configurations |
| 130 | //------------------------------------------------- |
| 131 | |
| 132 | machine_config_constructor ibm_pc_at_84_keyboard_device::device_mconfig_additions() const |
| 133 | { |
| 134 | return MACHINE_CONFIG_NAME( ibm_pc_at_84_keyboard ); |
| 135 | } |
| 136 | |
| 137 | |
| 138 | //------------------------------------------------- |
| 139 | // INPUT_PORTS( ibm_pc_at_84_keyboard ) |
| 140 | //------------------------------------------------- |
| 141 | |
| 142 | INPUT_PORTS_START( ibm_pc_at_84_keyboard ) |
| 143 | PORT_START("DR00") |
| 144 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) |
| 145 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) |
| 146 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) |
| 147 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) |
| 148 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 149 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| 150 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 151 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 152 | |
| 153 | PORT_START("DR01") |
| 154 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) |
| 155 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) |
| 156 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) |
| 157 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) |
| 158 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) |
| 159 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 160 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 161 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 162 | |
| 163 | PORT_START("DR02") |
| 164 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) |
| 165 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 166 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 167 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) |
| 168 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 169 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 170 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 171 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 172 | |
| 173 | PORT_START("DR03") |
| 174 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 175 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 176 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 177 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 178 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 179 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') |
| 180 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 181 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 182 | |
| 183 | PORT_START("DR04") |
| 184 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 185 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 186 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 187 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 188 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 189 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 190 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 191 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 192 | |
| 193 | PORT_START("DR05") |
| 194 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 195 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 196 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 197 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 198 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 199 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 200 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 201 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 202 | |
| 203 | PORT_START("DR06") |
| 204 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 205 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 206 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 207 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 208 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 209 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') |
| 210 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 211 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 212 | |
| 213 | PORT_START("DR07") |
| 214 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 215 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 216 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 217 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| 218 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') |
| 219 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') |
| 220 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 221 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 222 | |
| 223 | PORT_START("DR08") |
| 224 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 225 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 226 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 227 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 228 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') |
| 229 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') |
| 230 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 231 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 232 | |
| 233 | PORT_START("DR09") |
| 234 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 235 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 236 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 237 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') |
| 238 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 239 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') |
| 240 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 241 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 242 | |
| 243 | PORT_START("DR10") |
| 244 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) |
| 245 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') |
| 246 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 247 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 248 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') |
| 249 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 250 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 251 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 252 | |
| 253 | PORT_START("DR11") |
| 254 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 255 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 256 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 257 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') |
| 258 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 259 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 260 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 261 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 262 | |
| 263 | PORT_START("DR12") |
| 264 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 265 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 266 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 267 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 268 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 269 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 270 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 271 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 272 | |
| 273 | PORT_START("DR13") |
| 274 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 275 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 276 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 277 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 278 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 279 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 280 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 281 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 282 | |
| 283 | PORT_START("DR14") |
| 284 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 285 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 286 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 287 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 288 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 289 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 290 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 291 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) |
| 292 | |
| 293 | PORT_START("DR15") |
| 294 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 295 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) |
| 296 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 PgDn") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 297 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 298 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad * PrtSc") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) |
| 299 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 PgUp") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 300 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock Break") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) |
| 301 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Sys Req") |
| 302 | INPUT_PORTS_END |
| 303 | |
| 304 | |
| 305 | //------------------------------------------------- |
| 306 | // input_ports - device-specific input ports |
| 307 | //------------------------------------------------- |
| 308 | |
| 309 | ioport_constructor ibm_pc_at_84_keyboard_device::device_input_ports() const |
| 310 | { |
| 311 | return INPUT_PORTS_NAME( ibm_pc_at_84_keyboard ); |
| 312 | } |
| 313 | |
| 314 | |
| 315 | //------------------------------------------------- |
| 316 | // INPUT_PORTS( ibm_3270pc_122_keyboard ) |
| 317 | //------------------------------------------------- |
| 318 | |
| 319 | INPUT_PORTS_START( ibm_3270pc_122_keyboard ) |
| 320 | PORT_INCLUDE(ibm_pc_at_84_keyboard) |
| 321 | |
| 322 | PORT_START("KBDIDA") |
| 323 | PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW ) |
| 324 | PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW ) |
| 325 | PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW ) |
| 326 | PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW ) |
| 327 | PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW ) |
| 328 | PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW ) |
| 329 | |
| 330 | PORT_START("KBDIDB") |
| 331 | PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW ) |
| 332 | PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW ) |
| 333 | PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW ) |
| 334 | PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW ) |
| 335 | PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW ) |
| 336 | PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW ) |
| 337 | INPUT_PORTS_END |
| 338 | |
| 339 | |
| 340 | //------------------------------------------------- |
| 341 | // input_ports - device-specific input ports |
| 342 | //------------------------------------------------- |
| 343 | |
| 344 | ioport_constructor ibm_3270pc_122_keyboard_device::device_input_ports() const |
| 345 | { |
| 346 | return INPUT_PORTS_NAME( ibm_3270pc_122_keyboard ); |
| 347 | } |
| 348 | |
| 349 | |
| 350 | |
| 351 | //************************************************************************** |
| 352 | // LIVE DEVICE |
| 353 | //************************************************************************** |
| 354 | |
| 355 | //------------------------------------------------- |
| 356 | // ibm_pc_at_84_keyboard_device - constructor |
| 357 | //------------------------------------------------- |
| 358 | |
| 359 | ibm_pc_at_84_keyboard_device::ibm_pc_at_84_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 360 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 361 | device_pc_kbd_interface(mconfig, *this), |
| 362 | m_maincpu(*this, I8048_TAG), |
| 363 | m_dr00(*this, "DR00"), |
| 364 | m_dr01(*this, "DR01"), |
| 365 | m_dr02(*this, "DR02"), |
| 366 | m_dr03(*this, "DR03"), |
| 367 | m_dr04(*this, "DR04"), |
| 368 | m_dr05(*this, "DR05"), |
| 369 | m_dr06(*this, "DR06"), |
| 370 | m_dr07(*this, "DR07"), |
| 371 | m_dr08(*this, "DR08"), |
| 372 | m_dr09(*this, "DR09"), |
| 373 | m_dr10(*this, "DR10"), |
| 374 | m_dr11(*this, "DR11"), |
| 375 | m_dr12(*this, "DR12"), |
| 376 | m_dr13(*this, "DR13"), |
| 377 | m_dr14(*this, "DR14"), |
| 378 | m_dr15(*this, "DR15"), |
| 379 | m_kbdida(*this, "KBDIDA"), |
| 380 | m_kbdidb(*this, "KBDIDB"), |
| 381 | m_db(0), |
| 382 | m_cnt(0), |
| 383 | m_sense(0), |
| 384 | m_t1(1) |
| 385 | { |
| 386 | } |
| 387 | |
| 388 | ibm_pc_at_84_keyboard_device::ibm_pc_at_84_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 389 | : device_t(mconfig, PC_KBD_IBM_PC_AT_84, "IBM PC/AT Keyboard", tag, owner, clock, "kb_pcat84", __FILE__), |
| 390 | device_pc_kbd_interface(mconfig, *this), |
| 391 | m_maincpu(*this, I8048_TAG), |
| 392 | m_dr00(*this, "DR00"), |
| 393 | m_dr01(*this, "DR01"), |
| 394 | m_dr02(*this, "DR02"), |
| 395 | m_dr03(*this, "DR03"), |
| 396 | m_dr04(*this, "DR04"), |
| 397 | m_dr05(*this, "DR05"), |
| 398 | m_dr06(*this, "DR06"), |
| 399 | m_dr07(*this, "DR07"), |
| 400 | m_dr08(*this, "DR08"), |
| 401 | m_dr09(*this, "DR09"), |
| 402 | m_dr10(*this, "DR10"), |
| 403 | m_dr11(*this, "DR11"), |
| 404 | m_dr12(*this, "DR12"), |
| 405 | m_dr13(*this, "DR13"), |
| 406 | m_dr14(*this, "DR14"), |
| 407 | m_dr15(*this, "DR15"), |
| 408 | m_kbdida(*this, "KBDIDA"), |
| 409 | m_kbdidb(*this, "KBDIDB"), |
| 410 | m_db(0), |
| 411 | m_cnt(0), |
| 412 | m_sense(0), |
| 413 | m_t1(1) |
| 414 | { |
| 415 | } |
| 416 | |
| 417 | ibm_3270pc_122_keyboard_device::ibm_3270pc_122_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 418 | : ibm_pc_at_84_keyboard_device(mconfig, PC_KBD_IBM_3270PC_122, "IBM 3270PC Keyboard", tag, owner, clock, "kb_3270pc", __FILE__) { } |
| 419 | |
| 420 | |
| 421 | //------------------------------------------------- |
| 422 | // device_start - device-specific startup |
| 423 | //------------------------------------------------- |
| 424 | |
| 425 | void ibm_pc_at_84_keyboard_device::device_start() |
| 426 | { |
| 427 | set_pc_kbdc_device(); |
| 428 | |
| 429 | // state saving |
| 430 | save_item(NAME(m_db)); |
| 431 | save_item(NAME(m_cnt)); |
| 432 | save_item(NAME(m_sense)); |
| 433 | save_item(NAME(m_t1)); |
| 434 | } |
| 435 | |
| 436 | |
| 437 | //------------------------------------------------- |
| 438 | // device_reset - device-specific reset |
| 439 | //------------------------------------------------- |
| 440 | |
| 441 | void ibm_pc_at_84_keyboard_device::device_reset() |
| 442 | { |
| 443 | m_maincpu->reset(); |
| 444 | } |
| 445 | |
| 446 | |
| 447 | //------------------------------------------------- |
| 448 | // bus_w - |
| 449 | //------------------------------------------------- |
| 450 | |
| 451 | WRITE8_MEMBER( ibm_pc_at_84_keyboard_device::bus_w ) |
| 452 | { |
| 453 | /* |
| 454 | |
| 455 | bit description |
| 456 | |
| 457 | 0 SENSE 0 |
| 458 | 1 SENSE 1 |
| 459 | 2 SENSE 2 |
| 460 | 3 CNT 0 |
| 461 | 4 CNT 1 |
| 462 | 5 CNT 2 |
| 463 | 6 CNT 3 |
| 464 | 7 CNT G |
| 465 | |
| 466 | */ |
| 467 | |
| 468 | m_db = data; |
| 469 | |
| 470 | if (!BIT(data, 7)) |
| 471 | { |
| 472 | m_cnt = (data >> 3) & 0x0f; |
| 473 | } |
| 474 | } |
| 475 | |
| 476 | |
| 477 | //------------------------------------------------- |
| 478 | // p1_r - |
| 479 | //------------------------------------------------- |
| 480 | |
| 481 | READ8_MEMBER( ibm_pc_at_84_keyboard_device::p1_r ) |
| 482 | { |
| 483 | /* |
| 484 | |
| 485 | bit description |
| 486 | |
| 487 | 0 |
| 488 | 1 |
| 489 | 2 KBDID A1 |
| 490 | 3 KBDID A2 |
| 491 | 4 KBDID A3 |
| 492 | 5 KBDID A4 |
| 493 | 6 KBDID A5 |
| 494 | 7 KBDID A6 |
| 495 | |
| 496 | */ |
| 497 | |
| 498 | UINT8 data = 0; |
| 499 | |
| 500 | data |= m_kbdida->read() << 2; |
| 501 | |
| 502 | return data; |
| 503 | } |
| 504 | |
| 505 | |
| 506 | //------------------------------------------------- |
| 507 | // p1_w - |
| 508 | //------------------------------------------------- |
| 509 | |
| 510 | WRITE8_MEMBER( ibm_pc_at_84_keyboard_device::p1_w ) |
| 511 | { |
| 512 | /* |
| 513 | |
| 514 | bit description |
| 515 | |
| 516 | 0 SENSE G |
| 517 | 1 T1 |
| 518 | 2 |
| 519 | 3 |
| 520 | 4 |
| 521 | 5 |
| 522 | 6 |
| 523 | 7 |
| 524 | |
| 525 | */ |
| 526 | |
| 527 | if (!BIT(data, 0)) |
| 528 | { |
| 529 | m_sense = m_db & 0x07; |
| 530 | } |
| 531 | |
| 532 | m_t1 = BIT(data, 1); |
| 533 | } |
| 534 | |
| 535 | |
| 536 | //------------------------------------------------- |
| 537 | // p2_r - |
| 538 | //------------------------------------------------- |
| 539 | |
| 540 | READ8_MEMBER( ibm_pc_at_84_keyboard_device::p2_r ) |
| 541 | { |
| 542 | /* |
| 543 | |
| 544 | bit description |
| 545 | |
| 546 | 0 KBDID B1 |
| 547 | 1 KBDID B2 |
| 548 | 2 KBDID B3 |
| 549 | 3 KBDID B4 |
| 550 | 4 KBDID B5 |
| 551 | 5 KBDID B6 |
| 552 | 6 |
| 553 | 7 |
| 554 | |
| 555 | */ |
| 556 | |
| 557 | UINT8 data = 0xc0; |
| 558 | |
| 559 | data |= m_kbdidb->read(); |
| 560 | |
| 561 | return data; |
| 562 | } |
| 563 | |
| 564 | |
| 565 | //------------------------------------------------- |
| 566 | // p2_w - |
| 567 | //------------------------------------------------- |
| 568 | |
| 569 | WRITE8_MEMBER( ibm_pc_at_84_keyboard_device::p2_w ) |
| 570 | { |
| 571 | /* |
| 572 | |
| 573 | bit description |
| 574 | |
| 575 | 0 SCROLL LED |
| 576 | 1 NUM LED |
| 577 | 2 CAPS LED |
| 578 | 3 |
| 579 | 4 |
| 580 | 5 |
| 581 | 6 CLOCK |
| 582 | 7 DATA |
| 583 | |
| 584 | */ |
| 585 | |
| 586 | output_set_led_value(LED_SCROLL, BIT(data, 0)); |
| 587 | output_set_led_value(LED_NUM, BIT(data, 1)); |
| 588 | output_set_led_value(LED_CAPS, BIT(data, 2)); |
| 589 | |
| 590 | m_pc_kbdc->data_write_from_kb(!BIT(data, 7)); |
| 591 | m_pc_kbdc->clock_write_from_kb(!BIT(data, 6)); |
| 592 | } |
| 593 | |
| 594 | |
| 595 | //------------------------------------------------- |
| 596 | // t0_r - |
| 597 | //------------------------------------------------- |
| 598 | |
| 599 | READ8_MEMBER( ibm_pc_at_84_keyboard_device::t0_r ) |
| 600 | { |
| 601 | return !data_signal(); |
| 602 | } |
| 603 | |
| 604 | |
| 605 | //------------------------------------------------- |
| 606 | // t1_r - |
| 607 | //------------------------------------------------- |
| 608 | |
| 609 | READ8_MEMBER( ibm_pc_at_84_keyboard_device::t1_r ) |
| 610 | { |
| 611 | return key_depressed(); |
| 612 | } |
| 613 | |
| 614 | |
| 615 | //------------------------------------------------- |
| 616 | // key_depressed - |
| 617 | //------------------------------------------------- |
| 618 | |
| 619 | int ibm_pc_at_84_keyboard_device::key_depressed() |
| 620 | { |
| 621 | UINT8 data = 0xff; |
| 622 | |
| 623 | switch (m_cnt) |
| 624 | { |
| 625 | case 0: data = m_dr00->read(); break; |
| 626 | case 1: data = m_dr01->read(); break; |
| 627 | case 2: data = m_dr02->read(); break; |
| 628 | case 3: data = m_dr03->read(); break; |
| 629 | case 4: data = m_dr04->read(); break; |
| 630 | case 5: data = m_dr05->read(); break; |
| 631 | case 6: data = m_dr06->read(); break; |
| 632 | case 7: data = m_dr07->read(); break; |
| 633 | case 8: data = m_dr08->read(); break; |
| 634 | case 9: data = m_dr09->read(); break; |
| 635 | case 10: data = m_dr10->read(); break; |
| 636 | case 11: data = m_dr11->read(); break; |
| 637 | case 12: data = m_dr12->read(); break; |
| 638 | case 13: data = m_dr13->read(); break; |
| 639 | case 14: data = m_dr14->read(); break; |
| 640 | case 15: data = m_dr15->read(); break; |
| 641 | } |
| 642 | |
| 643 | return m_t1 && BIT(data, m_sense); |
| 644 | } |
trunk/src/emu/bus/pc_kbd/ec1841.c
| r0 | r26018 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | EC-1841 92-key keyboard emulation |
| 4 | |
| 5 | Sends 9 non-standard scan codes (54..5C) and reassigns 3 standard |
| 6 | ones (2A, 36, 3A). EC-1841 BIOS converts scan codes into Cyrillic |
| 7 | by default; 'Lat' key (mapped to F11) switches it to Latin mode. |
| 8 | 'Rus' (F12) switches back. |
| 9 | |
| 10 | Copyright MESS Team. |
| 11 | Visit http://mamedev.org for licensing and usage restrictions. |
| 12 | |
| 13 | *********************************************************************/ |
| 14 | |
| 15 | #include "ec1841.h" |
| 16 | |
| 17 | #define VERBOSE_DBG 0 /* general debug messages */ |
| 18 | |
| 19 | #define DBG_LOG(N,M,A) \ |
| 20 | do { \ |
| 21 | if(VERBOSE_DBG>=N) \ |
| 22 | { \ |
| 23 | logerror("%11.6f at %s: ",machine().time().as_double(),machine().describe_context()); \ |
| 24 | logerror A; \ |
| 25 | } \ |
| 26 | } while (0) |
| 27 | |
| 28 | |
| 29 | |
| 30 | //************************************************************************** |
| 31 | // MACROS / CONSTANTS |
| 32 | //************************************************************************** |
| 33 | |
| 34 | #define I8048_TAG "i8048" |
| 35 | |
| 36 | |
| 37 | |
| 38 | //************************************************************************** |
| 39 | // DEVICE DEFINITIONS |
| 40 | //************************************************************************** |
| 41 | |
| 42 | const device_type PC_KBD_EC_1841 = &device_creator<ec_1841_keyboard_device>; |
| 43 | |
| 44 | |
| 45 | //------------------------------------------------- |
| 46 | // ROM( ec_1841_keyboard ) |
| 47 | //------------------------------------------------- |
| 48 | |
| 49 | ROM_START( ec_1841_keyboard ) |
| 50 | ROM_REGION( 0x400, I8048_TAG, 0 ) |
| 51 | // XXX add P/N etc |
| 52 | ROM_LOAD( "1816be48.bin", 0x000, 0x400, CRC(e9abfe44) SHA1(1db430c72c2d007ea0b8ae2514ff15c96baba308) ) |
| 53 | ROM_END |
| 54 | |
| 55 | |
| 56 | //------------------------------------------------- |
| 57 | // rom_region - device-specific ROM region |
| 58 | //------------------------------------------------- |
| 59 | |
| 60 | const rom_entry *ec_1841_keyboard_device::device_rom_region() const |
| 61 | { |
| 62 | return ROM_NAME( ec_1841_keyboard ); |
| 63 | } |
| 64 | |
| 65 | |
| 66 | //------------------------------------------------- |
| 67 | // ADDRESS_MAP( kb_io ) |
| 68 | //------------------------------------------------- |
| 69 | |
| 70 | static ADDRESS_MAP_START( ec_1841_keyboard_io, AS_IO, 8, ec_1841_keyboard_device ) |
| 71 | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(bus_w) |
| 72 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w) |
| 73 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w) |
| 74 | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) |
| 75 | ADDRESS_MAP_END |
| 76 | |
| 77 | |
| 78 | //------------------------------------------------- |
| 79 | // MACHINE_DRIVER( ec_1841_keyboard ) |
| 80 | //------------------------------------------------- |
| 81 | |
| 82 | static MACHINE_CONFIG_FRAGMENT( ec_1841_keyboard ) |
| 83 | // XXX check |
| 84 | MCFG_CPU_ADD(I8048_TAG, I8048, MCS48_LC_CLOCK(IND_U(47), CAP_P(20.7))) |
| 85 | MCFG_CPU_IO_MAP(ec_1841_keyboard_io) |
| 86 | MACHINE_CONFIG_END |
| 87 | |
| 88 | |
| 89 | //------------------------------------------------- |
| 90 | // machine_config_additions - device-specific |
| 91 | // machine configurations |
| 92 | //------------------------------------------------- |
| 93 | |
| 94 | machine_config_constructor ec_1841_keyboard_device::device_mconfig_additions() const |
| 95 | { |
| 96 | return MACHINE_CONFIG_NAME( ec_1841_keyboard ); |
| 97 | } |
| 98 | |
| 99 | |
| 100 | //------------------------------------------------- |
| 101 | // INPUT_PORTS( ec_1841_keyboard ) |
| 102 | //------------------------------------------------- |
| 103 | |
| 104 | INPUT_PORTS_START( ec_1841_keyboard ) |
| 105 | PORT_START("MD00") |
| 106 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 107 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) |
| 108 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 109 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 110 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?59?") // 0x59 = Inf |
| 111 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 112 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 113 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 114 | |
| 115 | PORT_START("MD01") |
| 116 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 117 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 118 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 119 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 120 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 121 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 122 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 123 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 124 | |
| 125 | PORT_START("MD02") |
| 126 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 127 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 128 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 129 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 130 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) // 0x5a = R/L (R) |
| 131 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 132 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 133 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 134 | |
| 135 | PORT_START("MD03") |
| 136 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') |
| 137 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 138 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 139 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 140 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) // 0x5b = Rus |
| 141 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 PgUp") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 142 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 143 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 144 | |
| 145 | PORT_START("MD04") |
| 146 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 147 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 148 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 149 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 150 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 151 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 152 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 153 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 154 | |
| 155 | PORT_START("MD05") |
| 156 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 157 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 158 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 159 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 160 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| 161 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 162 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 163 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 164 | |
| 165 | PORT_START("MD06") |
| 166 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 167 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 168 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 169 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 170 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) |
| 171 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 172 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 173 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 174 | |
| 175 | PORT_START("MD07") |
| 176 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') |
| 177 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| 178 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 179 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') |
| 180 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) |
| 181 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 182 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 183 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 184 | |
| 185 | PORT_START("MD08") |
| 186 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') |
| 187 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 188 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 189 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?2a?") |
| 190 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) |
| 191 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 192 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 193 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 194 | |
| 195 | PORT_START("MD09") |
| 196 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') |
| 197 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 198 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 199 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?5c?") // 0x5c = YO |
| 200 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) |
| 201 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 PgDn") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 202 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 203 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 204 | |
| 205 | PORT_START("MD10") |
| 206 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') |
| 207 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 208 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 209 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 210 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) |
| 211 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 212 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 213 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 214 | |
| 215 | PORT_START("MD11") |
| 216 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') |
| 217 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?36?") |
| 218 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') |
| 219 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 220 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) |
| 221 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 222 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 223 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 224 | |
| 225 | PORT_START("MD12") |
| 226 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') |
| 227 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?3a?") |
| 228 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') |
| 229 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 0x55 |
| 230 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) |
| 231 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) |
| 232 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 233 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 234 | |
| 235 | PORT_START("MD13") |
| 236 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') |
| 237 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 238 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 239 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // 0x56 |
| 240 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) |
| 241 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 242 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 243 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 244 | |
| 245 | PORT_START("MD14") |
| 246 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') |
| 247 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PRTSCR) |
| 248 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) |
| 249 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) // 0x57 = Lat |
| 250 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) |
| 251 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 252 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 253 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 254 | |
| 255 | PORT_START("MD15") |
| 256 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 257 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) |
| 258 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 0x54 |
| 259 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) // 0x58 = R/L (L) |
| 260 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock Break") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) |
| 261 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 262 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 263 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 264 | INPUT_PORTS_END |
| 265 | |
| 266 | |
| 267 | //------------------------------------------------- |
| 268 | // input_ports - device-specific input ports |
| 269 | //------------------------------------------------- |
| 270 | |
| 271 | ioport_constructor ec_1841_keyboard_device::device_input_ports() const |
| 272 | { |
| 273 | return INPUT_PORTS_NAME( ec_1841_keyboard ); |
| 274 | } |
| 275 | |
| 276 | |
| 277 | |
| 278 | //************************************************************************** |
| 279 | // LIVE DEVICE |
| 280 | //************************************************************************** |
| 281 | |
| 282 | //------------------------------------------------- |
| 283 | // ec_1841_keyboard_device - constructor |
| 284 | //------------------------------------------------- |
| 285 | |
| 286 | ec_1841_keyboard_device::ec_1841_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 287 | : device_t(mconfig, PC_KBD_EC_1841, "EC-1841 Keyboard", tag, owner, clock, "kb_ec1841", __FILE__), |
| 288 | device_pc_kbd_interface(mconfig, *this), |
| 289 | m_maincpu(*this, I8048_TAG), |
| 290 | m_md00(*this, "MD00"), |
| 291 | m_md01(*this, "MD01"), |
| 292 | m_md02(*this, "MD02"), |
| 293 | m_md03(*this, "MD03"), |
| 294 | m_md04(*this, "MD04"), |
| 295 | m_md05(*this, "MD05"), |
| 296 | m_md06(*this, "MD06"), |
| 297 | m_md07(*this, "MD07"), |
| 298 | m_md08(*this, "MD08"), |
| 299 | m_md09(*this, "MD09"), |
| 300 | m_md10(*this, "MD10"), |
| 301 | m_md11(*this, "MD11"), |
| 302 | m_md12(*this, "MD12"), |
| 303 | m_md13(*this, "MD13"), |
| 304 | m_md14(*this, "MD14"), |
| 305 | m_md15(*this, "MD15"), |
| 306 | m_bus(0xff), |
| 307 | m_p1(0xff), |
| 308 | m_p2(0xff), |
| 309 | m_q(1) |
| 310 | { |
| 311 | } |
| 312 | |
| 313 | |
| 314 | //------------------------------------------------- |
| 315 | // device_start - device-specific startup |
| 316 | //------------------------------------------------- |
| 317 | |
| 318 | void ec_1841_keyboard_device::device_start() |
| 319 | { |
| 320 | set_pc_kbdc_device(); |
| 321 | |
| 322 | // state saving |
| 323 | save_item(NAME(m_bus)); |
| 324 | save_item(NAME(m_p1)); |
| 325 | save_item(NAME(m_p2)); |
| 326 | save_item(NAME(m_q)); |
| 327 | } |
| 328 | |
| 329 | |
| 330 | //------------------------------------------------- |
| 331 | // device_reset - device-specific reset |
| 332 | //------------------------------------------------- |
| 333 | |
| 334 | void ec_1841_keyboard_device::device_reset() |
| 335 | { |
| 336 | } |
| 337 | |
| 338 | |
| 339 | //------------------------------------------------- |
| 340 | // clock_write - |
| 341 | //------------------------------------------------- |
| 342 | |
| 343 | WRITE_LINE_MEMBER( ec_1841_keyboard_device::clock_write ) |
| 344 | { |
| 345 | DBG_LOG(1,0,( "%s: clock write %d\n", tag(), state)); |
| 346 | } |
| 347 | |
| 348 | |
| 349 | //------------------------------------------------- |
| 350 | // data_write - |
| 351 | //------------------------------------------------- |
| 352 | |
| 353 | WRITE_LINE_MEMBER( ec_1841_keyboard_device::data_write ) |
| 354 | { |
| 355 | DBG_LOG(1,0,( "%s: data write %d\n", tag(), state)); |
| 356 | } |
| 357 | |
| 358 | |
| 359 | //------------------------------------------------- |
| 360 | // bus_w - |
| 361 | //------------------------------------------------- |
| 362 | |
| 363 | WRITE8_MEMBER( ec_1841_keyboard_device::bus_w ) |
| 364 | { |
| 365 | DBG_LOG(2,0,( "%s: bus_w %02x\n", tag(), data)); |
| 366 | |
| 367 | m_bus = data; |
| 368 | } |
| 369 | |
| 370 | |
| 371 | //------------------------------------------------- |
| 372 | // p1_r - |
| 373 | //------------------------------------------------- |
| 374 | |
| 375 | READ8_MEMBER( ec_1841_keyboard_device::p1_r ) |
| 376 | { |
| 377 | /* |
| 378 | |
| 379 | bit description |
| 380 | |
| 381 | 0 -REQ IN |
| 382 | 1 DATA IN |
| 383 | 2 |
| 384 | 3 |
| 385 | 4 |
| 386 | 5 |
| 387 | 6 |
| 388 | 7 |
| 389 | |
| 390 | */ |
| 391 | |
| 392 | UINT8 data = 0; |
| 393 | |
| 394 | data |= clock_signal(); |
| 395 | data |= data_signal() << 1; |
| 396 | |
| 397 | DBG_LOG(1,0,( "%s: p1_r %02x\n", tag(), data)); |
| 398 | |
| 399 | return data; |
| 400 | } |
| 401 | |
| 402 | |
| 403 | //------------------------------------------------- |
| 404 | // p1_w - |
| 405 | //------------------------------------------------- |
| 406 | |
| 407 | WRITE8_MEMBER( ec_1841_keyboard_device::p1_w ) |
| 408 | { |
| 409 | /* |
| 410 | bit description |
| 411 | |
| 412 | 0 |
| 413 | 1 |
| 414 | 2 |
| 415 | 3 |
| 416 | 4 |
| 417 | 5 LED XXX |
| 418 | 6 LED XXX |
| 419 | 7 LED XXX |
| 420 | */ |
| 421 | DBG_LOG(1,0,( "%s: p1_w %02x\n", tag(), data)); |
| 422 | |
| 423 | m_p1 = data; |
| 424 | } |
| 425 | |
| 426 | |
| 427 | //------------------------------------------------- |
| 428 | // p2_w - |
| 429 | //------------------------------------------------- |
| 430 | |
| 431 | WRITE8_MEMBER( ec_1841_keyboard_device::p2_w ) |
| 432 | { |
| 433 | /* |
| 434 | bit description |
| 435 | |
| 436 | 0 -STROBE (to matrix mux) |
| 437 | 1 XXX CLOCK out 1 |
| 438 | 2 XXX DATA out 1 |
| 439 | 3 |
| 440 | 4 |
| 441 | 5 XXX DATA out 2? |
| 442 | 6 XXX CLOCK out 2? |
| 443 | 7 XXX |
| 444 | */ |
| 445 | DBG_LOG(1,0,( "%s: p2_w %02x\n", tag(), data)); |
| 446 | |
| 447 | m_pc_kbdc->data_write_from_kb(BIT(data, 2)); |
| 448 | m_pc_kbdc->clock_write_from_kb(BIT(data, 1)); |
| 449 | |
| 450 | m_p2 = data; |
| 451 | } |
| 452 | |
| 453 | |
| 454 | //------------------------------------------------- |
| 455 | // t1_r - |
| 456 | //------------------------------------------------- |
| 457 | |
| 458 | READ8_MEMBER( ec_1841_keyboard_device::t1_r ) |
| 459 | { |
| 460 | if (BIT(m_p2,0)) { |
| 461 | m_q = 1; |
| 462 | } else { |
| 463 | UINT8 sense = 0xff; |
| 464 | |
| 465 | switch(m_bus & 15) { |
| 466 | case 0: sense &= m_md00->read(); break; |
| 467 | case 1: sense &= m_md01->read(); break; |
| 468 | case 2: sense &= m_md02->read(); break; |
| 469 | case 3: sense &= m_md03->read(); break; |
| 470 | case 4: sense &= m_md04->read(); break; |
| 471 | case 5: sense &= m_md05->read(); break; |
| 472 | case 6: sense &= m_md06->read(); break; |
| 473 | case 7: sense &= m_md07->read(); break; |
| 474 | case 8: sense &= m_md08->read(); break; |
| 475 | case 9: sense &= m_md09->read(); break; |
| 476 | case 10: sense &= m_md10->read(); break; |
| 477 | case 11: sense &= m_md11->read(); break; |
| 478 | case 12: sense &= m_md12->read(); break; |
| 479 | case 13: sense &= m_md13->read(); break; |
| 480 | case 14: sense &= m_md14->read(); break; |
| 481 | case 15: sense &= m_md15->read(); break; |
| 482 | } |
| 483 | m_q = BIT(sense, (m_bus >> 4) & 7); |
| 484 | } |
| 485 | |
| 486 | DBG_LOG(1,0,( "%s: bus %02X t1_r %d\n", tag(), m_bus, m_q)); |
| 487 | |
| 488 | return m_q; |
| 489 | } |
trunk/src/emu/bus/pc_kbd/pc83.c
| r0 | r26018 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:Curt Coder |
| 3 | /********************************************************************** |
| 4 | |
| 5 | IBM 5150 83-key keyboard emulation |
| 6 | |
| 7 | Copyright MESS Team. |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | |
| 10 | *********************************************************************/ |
| 11 | |
| 12 | #include "pc83.h" |
| 13 | |
| 14 | |
| 15 | |
| 16 | //************************************************************************** |
| 17 | // MACROS / CONSTANTS |
| 18 | //************************************************************************** |
| 19 | |
| 20 | #define I8048_TAG "u1" |
| 21 | |
| 22 | |
| 23 | |
| 24 | //************************************************************************** |
| 25 | // DEVICE DEFINITIONS |
| 26 | //************************************************************************** |
| 27 | |
| 28 | const device_type PC_KBD_IBM_PC_83 = &device_creator<ibm_pc_83_keyboard_device>; |
| 29 | |
| 30 | |
| 31 | //------------------------------------------------- |
| 32 | // ROM( ibm_pc_83_keyboard ) |
| 33 | //------------------------------------------------- |
| 34 | |
| 35 | ROM_START( ibm_pc_83_keyboard ) |
| 36 | ROM_REGION( 0x400, I8048_TAG, 0 ) |
| 37 | ROM_LOAD( "8048.u1", 0x000, 0x400, NO_DUMP ) |
| 38 | ROM_END |
| 39 | |
| 40 | |
| 41 | //------------------------------------------------- |
| 42 | // rom_region - device-specific ROM region |
| 43 | //------------------------------------------------- |
| 44 | |
| 45 | const rom_entry *ibm_pc_83_keyboard_device::device_rom_region() const |
| 46 | { |
| 47 | return ROM_NAME( ibm_pc_83_keyboard ); |
| 48 | } |
| 49 | |
| 50 | |
| 51 | //------------------------------------------------- |
| 52 | // ADDRESS_MAP( kb_io ) |
| 53 | //------------------------------------------------- |
| 54 | |
| 55 | static ADDRESS_MAP_START( ibm_pc_83_keyboard_io, AS_IO, 8, ibm_pc_83_keyboard_device ) |
| 56 | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(bus_w) |
| 57 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(p1_r) AM_WRITENOP |
| 58 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w) |
| 59 | AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t1_r) |
| 60 | ADDRESS_MAP_END |
| 61 | |
| 62 | |
| 63 | //------------------------------------------------- |
| 64 | // MACHINE_DRIVER( ibm_pc_83_keyboard ) |
| 65 | //------------------------------------------------- |
| 66 | |
| 67 | static MACHINE_CONFIG_FRAGMENT( ibm_pc_83_keyboard ) |
| 68 | MCFG_CPU_ADD(I8048_TAG, I8048, MCS48_LC_CLOCK(IND_U(47), CAP_P(20))) |
| 69 | MCFG_CPU_IO_MAP(ibm_pc_83_keyboard_io) |
| 70 | MACHINE_CONFIG_END |
| 71 | |
| 72 | |
| 73 | //------------------------------------------------- |
| 74 | // machine_config_additions - device-specific |
| 75 | // machine configurations |
| 76 | //------------------------------------------------- |
| 77 | |
| 78 | machine_config_constructor ibm_pc_83_keyboard_device::device_mconfig_additions() const |
| 79 | { |
| 80 | return MACHINE_CONFIG_NAME( ibm_pc_83_keyboard ); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | //------------------------------------------------- |
| 85 | // INPUT_PORTS( ibm_pc_83_keyboard ) |
| 86 | //------------------------------------------------- |
| 87 | |
| 88 | INPUT_PORTS_START( ibm_pc_83_keyboard ) |
| 89 | PORT_START("DR00") |
| 90 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 91 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 92 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 93 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 94 | |
| 95 | PORT_START("DR01") |
| 96 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 97 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 98 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 99 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 100 | |
| 101 | PORT_START("DR02") |
| 102 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 103 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 104 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 105 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 106 | |
| 107 | PORT_START("DR03") |
| 108 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 109 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 110 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 111 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 112 | |
| 113 | PORT_START("DR04") |
| 114 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 115 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 116 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 117 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 118 | |
| 119 | PORT_START("DR05") |
| 120 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 121 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 122 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 123 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 124 | |
| 125 | PORT_START("DR06") |
| 126 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 127 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 128 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 129 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 130 | |
| 131 | PORT_START("DR07") |
| 132 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 133 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 134 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 135 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 136 | |
| 137 | PORT_START("DR08") |
| 138 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 139 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 140 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 141 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 142 | |
| 143 | PORT_START("DR09") |
| 144 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 145 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 146 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 147 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 148 | |
| 149 | PORT_START("DR10") |
| 150 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 151 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 152 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 153 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 154 | |
| 155 | PORT_START("DR11") |
| 156 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 157 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 158 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 159 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 160 | |
| 161 | PORT_START("DR12") |
| 162 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 163 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 164 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 165 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 166 | |
| 167 | PORT_START("DR13") |
| 168 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 169 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 170 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 171 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 172 | |
| 173 | PORT_START("DR14") |
| 174 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 175 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 176 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 177 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 178 | |
| 179 | PORT_START("DR15") |
| 180 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 181 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 182 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 183 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 184 | |
| 185 | PORT_START("DR16") |
| 186 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 187 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 188 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 189 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 190 | |
| 191 | PORT_START("DR17") |
| 192 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 193 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 194 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 195 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 196 | |
| 197 | PORT_START("DR18") |
| 198 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 199 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 200 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 201 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 202 | |
| 203 | PORT_START("DR19") |
| 204 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 205 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 206 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 207 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 208 | |
| 209 | PORT_START("DR20") |
| 210 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 211 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 212 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 213 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 214 | |
| 215 | PORT_START("DR21") |
| 216 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 217 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 218 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 219 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 220 | |
| 221 | PORT_START("DR22") |
| 222 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 223 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 224 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 225 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 226 | |
| 227 | PORT_START("DR23") |
| 228 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 229 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 230 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 231 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 232 | INPUT_PORTS_END |
| 233 | |
| 234 | |
| 235 | //------------------------------------------------- |
| 236 | // input_ports - device-specific input ports |
| 237 | //------------------------------------------------- |
| 238 | |
| 239 | ioport_constructor ibm_pc_83_keyboard_device::device_input_ports() const |
| 240 | { |
| 241 | return INPUT_PORTS_NAME( ibm_pc_83_keyboard ); |
| 242 | } |
| 243 | |
| 244 | |
| 245 | |
| 246 | //************************************************************************** |
| 247 | // LIVE DEVICE |
| 248 | //************************************************************************** |
| 249 | |
| 250 | //------------------------------------------------- |
| 251 | // ibm_pc_83_keyboard_device - constructor |
| 252 | //------------------------------------------------- |
| 253 | |
| 254 | ibm_pc_83_keyboard_device::ibm_pc_83_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 255 | : device_t(mconfig, PC_KBD_IBM_PC_83, "IBM PC Keyboard", tag, owner, clock, "kb_pc83", __FILE__), |
| 256 | device_pc_kbd_interface(mconfig, *this), |
| 257 | m_maincpu(*this, I8048_TAG), |
| 258 | m_dr00(*this, "DR00"), |
| 259 | m_dr01(*this, "DR01"), |
| 260 | m_dr02(*this, "DR02"), |
| 261 | m_dr03(*this, "DR03"), |
| 262 | m_dr04(*this, "DR04"), |
| 263 | m_dr05(*this, "DR05"), |
| 264 | m_dr06(*this, "DR06"), |
| 265 | m_dr07(*this, "DR07"), |
| 266 | m_dr08(*this, "DR08"), |
| 267 | m_dr09(*this, "DR09"), |
| 268 | m_dr10(*this, "DR10"), |
| 269 | m_dr11(*this, "DR11"), |
| 270 | m_dr12(*this, "DR12"), |
| 271 | m_dr13(*this, "DR13"), |
| 272 | m_dr14(*this, "DR14"), |
| 273 | m_dr15(*this, "DR15"), |
| 274 | m_dr16(*this, "DR16"), |
| 275 | m_dr17(*this, "DR17"), |
| 276 | m_dr18(*this, "DR18"), |
| 277 | m_dr19(*this, "DR19"), |
| 278 | m_dr20(*this, "DR20"), |
| 279 | m_dr21(*this, "DR21"), |
| 280 | m_dr22(*this, "DR22"), |
| 281 | m_dr23(*this, "DR23") |
| 282 | { |
| 283 | } |
| 284 | |
| 285 | |
| 286 | //------------------------------------------------- |
| 287 | // device_start - device-specific startup |
| 288 | //------------------------------------------------- |
| 289 | |
| 290 | void ibm_pc_83_keyboard_device::device_start() |
| 291 | { |
| 292 | // state saving |
| 293 | save_item(NAME(m_cnt)); |
| 294 | } |
| 295 | |
| 296 | |
| 297 | //------------------------------------------------- |
| 298 | // device_reset - device-specific reset |
| 299 | //------------------------------------------------- |
| 300 | |
| 301 | void ibm_pc_83_keyboard_device::device_reset() |
| 302 | { |
| 303 | m_maincpu->reset(); |
| 304 | } |
| 305 | |
| 306 | |
| 307 | //------------------------------------------------- |
| 308 | // bus_w - |
| 309 | //------------------------------------------------- |
| 310 | |
| 311 | WRITE8_MEMBER( ibm_pc_83_keyboard_device::bus_w ) |
| 312 | { |
| 313 | /* |
| 314 | |
| 315 | bit description |
| 316 | |
| 317 | 0 CNT 1 |
| 318 | 1 CNT 2 |
| 319 | 2 CNT 4 |
| 320 | 3 CNT 8 |
| 321 | 4 CNT 16 |
| 322 | 5 CNT 32 |
| 323 | 6 CNT 64 |
| 324 | 7 |
| 325 | |
| 326 | */ |
| 327 | |
| 328 | m_cnt = data & 0x7f; |
| 329 | } |
| 330 | |
| 331 | |
| 332 | //------------------------------------------------- |
| 333 | // p1_r - |
| 334 | //------------------------------------------------- |
| 335 | |
| 336 | READ8_MEMBER( ibm_pc_83_keyboard_device::p1_r ) |
| 337 | { |
| 338 | /* |
| 339 | |
| 340 | bit description |
| 341 | |
| 342 | 0 -REQ IN |
| 343 | 1 DATA IN |
| 344 | 2 |
| 345 | 3 |
| 346 | 4 |
| 347 | 5 |
| 348 | 6 |
| 349 | 7 |
| 350 | |
| 351 | */ |
| 352 | |
| 353 | UINT8 data = 0; |
| 354 | |
| 355 | data |= clock_signal(); |
| 356 | data |= data_signal() << 1; |
| 357 | |
| 358 | return data; |
| 359 | } |
| 360 | |
| 361 | |
| 362 | //------------------------------------------------- |
| 363 | // p2_w - |
| 364 | //------------------------------------------------- |
| 365 | |
| 366 | WRITE8_MEMBER( ibm_pc_83_keyboard_device::p2_w ) |
| 367 | { |
| 368 | /* |
| 369 | |
| 370 | bit description |
| 371 | |
| 372 | 0 -MATRIX STROBE |
| 373 | 1 CLOCK OUT |
| 374 | 2 DATA OUT |
| 375 | 3 |
| 376 | 4 |
| 377 | 5 |
| 378 | 6 |
| 379 | 7 |
| 380 | |
| 381 | */ |
| 382 | |
| 383 | m_pc_kbdc->clock_write_from_kb(BIT(data, 1)); |
| 384 | m_pc_kbdc->data_write_from_kb(BIT(data, 2)); |
| 385 | } |
| 386 | |
| 387 | |
| 388 | //------------------------------------------------- |
| 389 | // t1_r - |
| 390 | //------------------------------------------------- |
| 391 | |
| 392 | READ8_MEMBER( ibm_pc_83_keyboard_device::t1_r ) |
| 393 | { |
| 394 | UINT8 data = 0xff; |
| 395 | |
| 396 | switch (m_cnt >> 2) |
| 397 | { |
| 398 | case 0: data = m_dr00->read(); break; |
| 399 | case 1: data = m_dr01->read(); break; |
| 400 | case 2: data = m_dr02->read(); break; |
| 401 | case 3: data = m_dr03->read(); break; |
| 402 | case 4: data = m_dr04->read(); break; |
| 403 | case 5: data = m_dr05->read(); break; |
| 404 | case 6: data = m_dr06->read(); break; |
| 405 | case 7: data = m_dr07->read(); break; |
| 406 | case 8: data = m_dr08->read(); break; |
| 407 | case 9: data = m_dr09->read(); break; |
| 408 | case 10: data = m_dr10->read(); break; |
| 409 | case 11: data = m_dr11->read(); break; |
| 410 | case 12: data = m_dr12->read(); break; |
| 411 | case 13: data = m_dr13->read(); break; |
| 412 | case 14: data = m_dr14->read(); break; |
| 413 | case 15: data = m_dr15->read(); break; |
| 414 | case 16: data = m_dr16->read(); break; |
| 415 | case 17: data = m_dr17->read(); break; |
| 416 | case 18: data = m_dr18->read(); break; |
| 417 | case 19: data = m_dr19->read(); break; |
| 418 | case 20: data = m_dr20->read(); break; |
| 419 | case 21: data = m_dr21->read(); break; |
| 420 | case 22: data = m_dr22->read(); break; |
| 421 | case 23: data = m_dr23->read(); break; |
| 422 | } |
| 423 | |
| 424 | int sense = m_cnt & 0x03; |
| 425 | |
| 426 | return BIT(data, sense); |
| 427 | } |
trunk/src/emu/bus/pc_kbd/keytro.c
| r0 | r26018 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | TODO: |
| 4 | - Add support for PF01 - PF24 |
| 5 | |
| 6 | Emulation file for Keytronic KB3270/PC keyboard by Wilbert Pol. |
| 7 | |
| 8 | This keyboard supports both the PC/XT and the PC/AT keyboard protocols. The |
| 9 | desired protocol can be selected by a switch on the keyboard. |
| 10 | |
| 11 | Keyboard matrix. |
| 12 | |
| 13 | Z5 = XR 22-00950-001 |
| 14 | Z6 = SN74LS132N |
| 15 | Z7 = XR 22-00950-001 |
| 16 | Z8 = SN74LS374N |
| 17 | Z11 = XR 22-908-03B |
| 18 | |
| 19 | |
| 20 | | Z11 pin 8 |
| 21 | | | Z11 pin 7 |
| 22 | | | | Z11 pin 6 |
| 23 | | | | | Z11 pin 5 |
| 24 | | | | | | Z11 pin 4 |
| 25 | | | | | | | |
| 26 | F1 -------- F2 ------------- F3 ----- F4 ----- F5 ----- F6 -------- J2 pin 2 - Z5 pin 19 |
| 27 | | | | | | | |
| 28 | F7 -------- F8 ------------- LShift - < ------ Z ------ X --------- J2 pin 1 - Z5 pin 18 |
| 29 | | | | | | | |
| 30 | F9 -------- F10 ------------ LCtrl -- LAlt --- Space -- RAlt ------ J1 pin 9 - Z5 pin 17 |
| 31 | | | | | | | |
| 32 | 1 --------- ` -------------- Q ------ TAB ---- A ------ Caps Lock - J1 pin 8 - Z5 pin 16 |
| 33 | | | | | | | |
| 34 | 2 --------- 3 -------------- W ------ E ------ S ------ D --------- J1 pin 7 - Z5 pin 15 |
| 35 | | | | | | | |
| 36 | 5 --------- 4 -------------- T ------ R ------ G ------ F --------- J2 pin 3 - Z7 pin 20 |
| 37 | | | | | | | |
| 38 | N --------- M -------------- B ------ V ------ C ------ , -------------------- Z7 pin 19 |
| 39 | | | | | | | |
| 40 | 6 --------- 7 -------------- Y ------ U ------ H ------ J -------------------- Z7 pin 18 |
| 41 | | | | | | | |
| 42 | 9 --------- 8 -------------- O ------ I ------ L ------ K -------------------- Z7 pin 17 |
| 43 | | | | | | | |
| 44 | Pad 2 ----- Pad 1 ---------- Unused - Unused - Down --- Enter ---------------- Z7 pin 16 |
| 45 | | | | | | | |
| 46 | | / -------------- Rshift - Rshift - Left --- . --------- J9 pin 8 - Z7 pin 15 |
| 47 | | | | | | | |
| 48 | 0 --------- - -------------- P ------ [ ------ ; ------ ' --------- J9 pin 7 - Z7 pin 14 |
| 49 | | | | | | | |
| 50 | Backspace - = -------------- Return - \ ------ Return - ] --------- J9 pin 6 - Z7 pin 13 |
| 51 | | | | | | | |
| 52 | Backspace - PA1/Dup -------- |<-- --- /a\ ---- Pad + -- Pad + ----- J9 pin 5 - Z7 pin 12 |
| 53 | | | | | | | |
| 54 | Esc ------- NumLock -------- Pad 7 -- Pad 8 -- Pad 4 -- Pad 5 ------J9 pin 3 - Z7 pin 2 |
| 55 | | | | | | | |
| 56 | SysReq ---- ScrLk ---------- -->| --- Pad 9 -- Pad - -- Pad 6 ---------------- goes under Z8 between pins 5 and 6 to Z8 pin 15? |
| 57 | | | | | | | |
| 58 | Pad 3 ----- Pad 0 ---------- Pad 0 -- Pad . -- Unused - Up ------------------- Z7 pin 7 |
| 59 | | | | | | | |
| 60 | PrtSc * --- PA2/Field Mark - Right -- /a ----- Center - Unused ---- J9 pin 2 - Z7 pin 3 |
| 61 | | | | | | | |
| 62 | |
| 63 | The 'Return', 'Backspace, 'Pad 0', 'Right Shift', 'Pad +' keys on the keyboard |
| 64 | are attached to two switches. The keys appear twice in the keyboard matrix. |
| 65 | |
| 66 | ***************************************************************************/ |
| 67 | |
| 68 | #include "emu.h" |
| 69 | #include "keytro.h" |
| 70 | #include "cpu/mcs51/mcs51.h" |
| 71 | |
| 72 | |
| 73 | /*************************************************************************** |
| 74 | CONSTANTS |
| 75 | ***************************************************************************/ |
| 76 | |
| 77 | #define LOG 0 |
| 78 | |
| 79 | |
| 80 | /*************************************************************************** |
| 81 | TYPE DEFINITIONS |
| 82 | ***************************************************************************/ |
| 83 | |
| 84 | struct kb_keytr_state |
| 85 | { |
| 86 | device_t *cpu; |
| 87 | |
| 88 | devcb_resolved_write_line out_clock_func; |
| 89 | devcb_resolved_write_line out_data_func; |
| 90 | |
| 91 | /* state of i/o signals */ |
| 92 | int clock_signal; |
| 93 | int data_signal; |
| 94 | |
| 95 | /* internal state */ |
| 96 | UINT8 p1; |
| 97 | UINT8 p1_data; |
| 98 | UINT8 p2; |
| 99 | UINT8 p3; |
| 100 | UINT16 last_write_addr; |
| 101 | }; |
| 102 | |
| 103 | |
| 104 | /***************************************************************************** |
| 105 | INPUT PORTS |
| 106 | *****************************************************************************/ |
| 107 | |
| 108 | static INPUT_PORTS_START( kb_keytronic_common ) |
| 109 | |
| 110 | PORT_START( "kb_keytronic_0f" ) |
| 111 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') /* 06 */ |
| 112 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') /* 05 */ |
| 113 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') /* 14 */ |
| 114 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') /* 13 */ |
| 115 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') /* 22 */ |
| 116 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') /* 21 */ |
| 117 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 (IRMA)") /* 41 */ |
| 118 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6a?") /* 6a */ |
| 119 | |
| 120 | PORT_START( "kb_keytronic_30_0" ) |
| 121 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') /* 31 */ |
| 122 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') /* 32 */ |
| 123 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') /* 30 */ |
| 124 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') /* 2f */ |
| 125 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') /* 2e */ |
| 126 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') /* 33 */ |
| 127 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 128 | |
| 129 | PORT_START( "kb_keytronic_30_1" ) |
| 130 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) /* 58 */ |
| 131 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) /* 59 */ |
| 132 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) /* 5a */ |
| 133 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) /* 5b */ |
| 134 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) /* 5c */ |
| 135 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) /* 5d */ |
| 136 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6b?") /* 6b */ |
| 137 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 (IRMA)") /* 42 */ |
| 138 | |
| 139 | PORT_START( "kb_keytronic_31_0" ) |
| 140 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') /* 07 */ |
| 141 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') /* 08 */ |
| 142 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') /* 15 */ |
| 143 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') /* 16 */ |
| 144 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') /* 23 */ |
| 145 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') /* 24 */ |
| 146 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 147 | |
| 148 | PORT_START( "kb_keytronic_31_1" ) |
| 149 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) /* 37 */ |
| 150 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) /* 5f */ |
| 151 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("LShift") /* 2a */ |
| 152 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("<") /* 70 */ |
| 153 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') /* 2c */ |
| 154 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') /* 2d */ |
| 155 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6c?") /* 6c */ |
| 156 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 (IRMA)") /* 43 */ |
| 157 | |
| 158 | PORT_START( "kb_keytronic_32_0" ) |
| 159 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') /* 0a */ |
| 160 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') /* 09 */ |
| 161 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') /* 18 */ |
| 162 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') /* 17 */ |
| 163 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') /* 26 */ |
| 164 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') /* 25 */ |
| 165 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 166 | |
| 167 | PORT_START( "kb_keytronic_32_1" ) |
| 168 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) /* 57 */ |
| 169 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) /* 1d */ |
| 170 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) /* 71 */ |
| 171 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_NAME("LAlt") /* 38 */ |
| 172 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') /* 39 */ |
| 173 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_NAME("RAlt") /* 38 */ |
| 174 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?69?") /* 69 */ |
| 175 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6 (IRMA)") /* 40 */ |
| 176 | |
| 177 | PORT_START( "kb_keytronic_33_0" ) |
| 178 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("KP 2") /* 50 */ |
| 179 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_END) PORT_NAME("KP 1") /* 4f */ |
| 180 | PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 181 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Down") /* 55 */ |
| 182 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") /* 75 */ |
| 183 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 184 | |
| 185 | PORT_START( "kb_keytronic_33_1" ) |
| 186 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') /* 02 */ |
| 187 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') /* 29 */ |
| 188 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') /* 10 */ |
| 189 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) /* 0f */ |
| 190 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') /* 1e */ |
| 191 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("Caps") /* 3a */ |
| 192 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?68?") /* 68 */ |
| 193 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5 (IRMA)") /* 3f */ |
| 194 | |
| 195 | PORT_START( "kb_keytronic_34_0" ) |
| 196 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 197 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') /* 35 */ |
| 198 | PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) /* 36 */ |
| 199 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left") /* 56 */ |
| 200 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') /* 34 */ |
| 201 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 202 | |
| 203 | PORT_START( "kb_keytronic_34_1" ) |
| 204 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') /* 02 */ |
| 205 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') /* 03 */ |
| 206 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') /* 11 */ |
| 207 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') /* 12 */ |
| 208 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') /* 1f */ |
| 209 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') /* 20 */ |
| 210 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?67?") /* 67 */ |
| 211 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 (IRMA)") /* 3e */ |
| 212 | |
| 213 | PORT_START( "kb_keytronic_35_0" ) |
| 214 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') /* 0b */ |
| 215 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') /* 0c */ |
| 216 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') /* 19 */ |
| 217 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') /* 1a */ |
| 218 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') /* 27 */ |
| 219 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') /* 28 */ |
| 220 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 221 | |
| 222 | PORT_START( "kb_keytronic_35_1" ) |
| 223 | PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 224 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?66?") /* 66 */ |
| 225 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3 (IRMA)") /* 3d */ |
| 226 | |
| 227 | PORT_START( "kb_keytronic_36_0" ) |
| 228 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) /* 0e */ |
| 229 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') /* 0d */ |
| 230 | PORT_BIT( 0x14, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) /* 1c */ |
| 231 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') /* 2b */ |
| 232 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') /* 1b */ |
| 233 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 234 | |
| 235 | PORT_START( "kb_keytronic_36_1" ) |
| 236 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 237 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2 (IRMA)") /* 3c */ |
| 238 | |
| 239 | PORT_START( "kb_keytronic_37_0" ) |
| 240 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PA1") /* 7b */ |
| 241 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("|<--") /* 7e */ |
| 242 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/a\\") /* 7a */ |
| 243 | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("KP +") /* 4e */ |
| 244 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 245 | |
| 246 | PORT_START( "kb_keytronic_37_1" ) |
| 247 | PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 248 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?64?") /* 64 */ |
| 249 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1 (IRMA)") /* 3b */ |
| 250 | |
| 251 | PORT_START( "kb_keytronic_38_0" ) |
| 252 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SysReq") /* 54 */ |
| 253 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) /*PORT_CODE(KEYCODE_SCRLOCK)*/ PORT_NAME("ScrLock") /* 46 */ |
| 254 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-->|") /* 7c */ |
| 255 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("KP 9") /* 49 */ |
| 256 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("KP -") /* 4a */ |
| 257 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("KP 6") /* 4d */ |
| 258 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 259 | |
| 260 | PORT_START( "kb_keytronic_39_0" ) |
| 261 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_NAME("Esc") /* 01 */ |
| 262 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_NAME("NumLock") /* 45 */ |
| 263 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_HOME) PORT_NAME("KP 7") /* 47 */ |
| 264 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_NAME("KP 8") /* 48 */ |
| 265 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("KP 4") /* 4b */ |
| 266 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("KP 5") /* 4c */ |
| 267 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?76?") /* 76 */ |
| 268 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?63?") /* 63 */ |
| 269 | |
| 270 | PORT_START( "kb_keytronic_3a_0" ) |
| 271 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PrtSc *") /* 6f */ |
| 272 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PA2") /* 7f */ |
| 273 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right") /* 7d */ |
| 274 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/a") /* 79 */ |
| 275 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Center") /* 77 */ |
| 276 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 277 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6e?") /* 6e */ |
| 278 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?62?") /* 62 */ |
| 279 | |
| 280 | PORT_START( "kb_keytronic_3b_0" ) |
| 281 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("KP 3") /* 51 */ |
| 282 | PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("KP 0") /* 52 */ |
| 283 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("KP .") /* 53 */ |
| 284 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 285 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Up") /* 78 */ |
| 286 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6d?") /* 6d */ |
| 287 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 (IRMA)") /* 44 */ |
| 288 | |
| 289 | INPUT_PORTS_END |
| 290 | |
| 291 | |
| 292 | static INPUT_PORTS_START( kb_keytronic_pc ) |
| 293 | PORT_INCLUDE( kb_keytronic_common ) |
| 294 | |
| 295 | PORT_START( "kb_keytronic_0b" ) |
| 296 | PORT_DIPNAME( 0x01, 0x01, "Protocol selection" ) |
| 297 | PORT_DIPSETTING( 0x00, "Enhanced XT, AT and PS/2 models" ) |
| 298 | PORT_DIPSETTING( 0x01, "Standard PC and XT" ) |
| 299 | PORT_DIPNAME( 0x02, 0x00, "IRMA/Native scan code set" ) |
| 300 | PORT_DIPSETTING( 0x00, "Native scan code set" ) |
| 301 | PORT_DIPSETTING( 0x02, "IRMA Emulation" ) |
| 302 | PORT_DIPNAME( 0x04, 0x04, "Enhanced 101/Native scan code set" ) |
| 303 | PORT_DIPSETTING( 0x00, "Native scan code set" ) |
| 304 | PORT_DIPSETTING( 0x04, "Enhanced 101 scan code set" ) |
| 305 | PORT_DIPNAME( 0x08, 0x08, "Enable E0" ) |
| 306 | PORT_DIPSETTING( 0x00, "Enable E0" ) |
| 307 | PORT_DIPSETTING( 0x08, "Disable E0" ) |
| 308 | PORT_DIPNAME( 0x10, 0x10, "Code tables" ) |
| 309 | PORT_DIPSETTING( 0x00, "U.S. code tables" ) |
| 310 | PORT_DIPSETTING( 0x10, "International code tables" ) |
| 311 | PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 312 | PORT_DIPNAME( 0x80, 0x80, "Key click" ) |
| 313 | PORT_DIPSETTING( 0x00, "No key click" ) |
| 314 | PORT_DIPSETTING( 0x80, "Key click" ) |
| 315 | INPUT_PORTS_END |
| 316 | |
| 317 | |
| 318 | static INPUT_PORTS_START( kb_keytronic_at ) |
| 319 | |
| 320 | PORT_INCLUDE( kb_keytronic_common ) |
| 321 | |
| 322 | PORT_START( "kb_keytronic_0b" ) |
| 323 | PORT_DIPNAME( 0x01, 0x00, "Protocol selection" ) |
| 324 | PORT_DIPSETTING( 0x00, "Enhanced XT, AT and PS/2 models" ) |
| 325 | PORT_DIPSETTING( 0x01, "Standard PC and XT" ) |
| 326 | PORT_DIPNAME( 0x02, 0x00, "IRMA/Native scan code set" ) |
| 327 | PORT_DIPSETTING( 0x00, "Native scan code set" ) |
| 328 | PORT_DIPSETTING( 0x02, "IRMA Emulation" ) |
| 329 | PORT_DIPNAME( 0x04, 0x04, "Enhanced 101/Native scan code set" ) |
| 330 | PORT_DIPSETTING( 0x00, "Native scan code set" ) |
| 331 | PORT_DIPSETTING( 0x04, "Enhanced 101 scan code set" ) |
| 332 | PORT_DIPNAME( 0x08, 0x00, "Enable E0" ) |
| 333 | PORT_DIPSETTING( 0x00, "Enable E0" ) |
| 334 | PORT_DIPSETTING( 0x08, "Disable E0" ) |
| 335 | PORT_DIPNAME( 0x10, 0x10, "Code tables" ) |
| 336 | PORT_DIPSETTING( 0x00, "U.S. code tables" ) |
| 337 | PORT_DIPSETTING( 0x10, "International code tables" ) |
| 338 | PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 339 | PORT_DIPNAME( 0x80, 0x80, "Key click" ) |
| 340 | PORT_DIPSETTING( 0x00, "No key click" ) |
| 341 | PORT_DIPSETTING( 0x80, "Key click" ) |
| 342 | INPUT_PORTS_END |
| 343 | |
| 344 | |
| 345 | /*************************************************************************** |
| 346 | ROM DEFINITIONS |
| 347 | ***************************************************************************/ |
| 348 | |
| 349 | ROM_START( kb_keytr ) |
| 350 | ROM_REGION(0x2000, "kb_keytr", 0) |
| 351 | ROM_LOAD("14166.bin", 0x0000, 0x2000, CRC(1aea1b53) SHA1(b75b6d4509036406052157bc34159f7039cdc72e)) |
| 352 | ROM_END |
| 353 | |
| 354 | |
| 355 | //************************************************************************** |
| 356 | // GLOBAL VARIABLES |
| 357 | //************************************************************************** |
| 358 | |
| 359 | const device_type PC_KBD_KEYTRONIC_PC3270 = &device_creator<pc_kbd_keytronic_pc3270_device>; |
| 360 | const device_type PC_KBD_KEYTRONIC_PC3270_AT = &device_creator<pc_kbd_keytronic_pc3270_at_device>; |
| 361 | |
| 362 | |
| 363 | /***************************************************************************** |
| 364 | ADDRESS MAPS |
| 365 | *****************************************************************************/ |
| 366 | |
| 367 | static ADDRESS_MAP_START( keytronic_pc3270_program, AS_PROGRAM, 8, pc_kbd_keytronic_pc3270_device ) |
| 368 | AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("kb_keytr", 0) |
| 369 | ADDRESS_MAP_END |
| 370 | |
| 371 | static ADDRESS_MAP_START( keytronic_pc3270_io, AS_IO, 8, pc_kbd_keytronic_pc3270_device ) |
| 372 | AM_RANGE(0x0000, 0xffff) AM_READWRITE(internal_data_read, internal_data_write) |
| 373 | AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READWRITE(p1_read, p1_write) |
| 374 | AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_READWRITE(p2_read, p2_write) |
| 375 | AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_read, p3_write) |
| 376 | ADDRESS_MAP_END |
| 377 | |
| 378 | |
| 379 | /***************************************************************************** |
| 380 | MACHINE CONFIG |
| 381 | *****************************************************************************/ |
| 382 | |
| 383 | MACHINE_CONFIG_FRAGMENT( keytronic_pc3270 ) |
| 384 | MCFG_CPU_ADD("kb_keytr", I8051, 11060250) |
| 385 | MCFG_CPU_PROGRAM_MAP(keytronic_pc3270_program) |
| 386 | MCFG_CPU_IO_MAP(keytronic_pc3270_io) |
| 387 | MACHINE_CONFIG_END |
| 388 | |
| 389 | |
| 390 | /*************************************************************************** |
| 391 | ROM DEFINITIONS |
| 392 | ***************************************************************************/ |
| 393 | |
| 394 | ROM_START( keytronic_pc3270 ) |
| 395 | ROM_REGION(0x2000, "kb_keytr", 0) |
| 396 | ROM_LOAD("14166.bin", 0x0000, 0x2000, CRC(1aea1b53) SHA1(b75b6d4509036406052157bc34159f7039cdc72e)) |
| 397 | ROM_END |
| 398 | |
| 399 | |
| 400 | pc_kbd_keytronic_pc3270_device::pc_kbd_keytronic_pc3270_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 401 | device_t(mconfig, PC_KBD_KEYTRONIC_PC3270, "Keytronic PC3270", tag, owner, clock, "keytronic_pc3270", __FILE__), |
| 402 | device_pc_kbd_interface(mconfig, *this), |
| 403 | m_cpu(*this, "kb_keytr") |
| 404 | { |
| 405 | } |
| 406 | |
| 407 | |
| 408 | //------------------------------------------------- |
| 409 | // device_start - device-specific startup |
| 410 | //------------------------------------------------- |
| 411 | void pc_kbd_keytronic_pc3270_device::device_start() |
| 412 | { |
| 413 | set_pc_kbdc_device(); |
| 414 | |
| 415 | /* setup savestates */ |
| 416 | save_item(NAME(m_p1)); |
| 417 | save_item(NAME(m_p1_data)); |
| 418 | save_item(NAME(m_p2)); |
| 419 | save_item(NAME(m_p3)); |
| 420 | save_item(NAME(m_last_write_addr)); |
| 421 | } |
| 422 | |
| 423 | |
| 424 | //------------------------------------------------- |
| 425 | // device_reset - device-specific reset |
| 426 | //------------------------------------------------- |
| 427 | void pc_kbd_keytronic_pc3270_device::device_reset() |
| 428 | { |
| 429 | /* set default values */ |
| 430 | m_p3 = 0xff; |
| 431 | m_last_write_addr = 0; |
| 432 | } |
| 433 | |
| 434 | |
| 435 | //------------------------------------------------- |
| 436 | // machine_config_additions - device-specific |
| 437 | // machine configurations |
| 438 | //------------------------------------------------- |
| 439 | |
| 440 | machine_config_constructor pc_kbd_keytronic_pc3270_device::device_mconfig_additions() const |
| 441 | { |
| 442 | return MACHINE_CONFIG_NAME( keytronic_pc3270 ); |
| 443 | } |
| 444 | |
| 445 | |
| 446 | ioport_constructor pc_kbd_keytronic_pc3270_device::device_input_ports() const |
| 447 | { |
| 448 | return INPUT_PORTS_NAME( kb_keytronic_pc ); |
| 449 | } |
| 450 | |
| 451 | |
| 452 | ioport_constructor pc_kbd_keytronic_pc3270_at_device::device_input_ports() const |
| 453 | { |
| 454 | return INPUT_PORTS_NAME( kb_keytronic_at ); |
| 455 | } |
| 456 | |
| 457 | |
| 458 | //------------------------------------------------- |
| 459 | // rom_region - device-specific ROM region |
| 460 | //------------------------------------------------- |
| 461 | |
| 462 | const rom_entry *pc_kbd_keytronic_pc3270_device::device_rom_region() const |
| 463 | { |
| 464 | return ROM_NAME( keytronic_pc3270 ); |
| 465 | } |
| 466 | |
| 467 | |
| 468 | WRITE_LINE_MEMBER( pc_kbd_keytronic_pc3270_device::clock_write ) |
| 469 | { |
| 470 | m_cpu->set_input_line(MCS51_INT0_LINE, state ); |
| 471 | } |
| 472 | |
| 473 | |
| 474 | WRITE_LINE_MEMBER( pc_kbd_keytronic_pc3270_device::data_write ) |
| 475 | { |
| 476 | m_cpu->set_input_line(MCS51_T0_LINE, state); |
| 477 | } |
| 478 | |
| 479 | |
| 480 | READ8_MEMBER( pc_kbd_keytronic_pc3270_device::internal_data_read ) |
| 481 | { |
| 482 | if (LOG) |
| 483 | logerror("keytronic_pc3270::internal_data_read(): read from %04x\n", offset); |
| 484 | |
| 485 | if ( m_pc_kbdc ) |
| 486 | { |
| 487 | m_pc_kbdc->data_write_from_kb( BIT(offset, 8) ); |
| 488 | m_pc_kbdc->clock_write_from_kb( BIT(offset, 9) ); |
| 489 | } |
| 490 | |
| 491 | return 0xff; |
| 492 | } |
| 493 | |
| 494 | |
| 495 | WRITE8_MEMBER( pc_kbd_keytronic_pc3270_device::internal_data_write ) |
| 496 | { |
| 497 | if (LOG) |
| 498 | logerror("keytronic_pc3270::internal_data_write(): write to offset %04x\n", offset); |
| 499 | |
| 500 | /* Check for low->high transition on AD8 */ |
| 501 | if ( ! ( m_last_write_addr & 0x0100 ) && ( offset & 0x0100 ) ) |
| 502 | { |
| 503 | switch (m_p1) |
| 504 | { |
| 505 | case 0x0e: |
| 506 | break; |
| 507 | case 0x0f: |
| 508 | m_p1_data = ioport("kb_keytronic_0f")->read(); |
| 509 | break; |
| 510 | case 0x30: |
| 511 | m_p1_data = ioport("kb_keytronic_30_0")->read(); |
| 512 | break; |
| 513 | case 0x31: |
| 514 | m_p1_data = ioport("kb_keytronic_31_0")->read(); |
| 515 | break; |
| 516 | case 0x32: |
| 517 | m_p1_data = ioport("kb_keytronic_32_0")->read(); |
| 518 | break; |
| 519 | case 0x33: |
| 520 | m_p1_data = ioport("kb_keytronic_33_0")->read(); |
| 521 | break; |
| 522 | case 0x34: |
| 523 | m_p1_data = ioport("kb_keytronic_34_0")->read(); |
| 524 | break; |
| 525 | case 0x35: |
| 526 | m_p1_data = ioport("kb_keytronic_35_0")->read(); |
| 527 | break; |
| 528 | case 0x36: |
| 529 | m_p1_data = ioport("kb_keytronic_36_0")->read(); |
| 530 | break; |
| 531 | case 0x37: |
| 532 | m_p1_data = ioport("kb_keytronic_37_0")->read() | (ioport("kb_keytronic_36_0")->read() & 0x01); |
| 533 | break; |
| 534 | case 0x38: |
| 535 | m_p1_data = ioport("kb_keytronic_38_0")->read(); |
| 536 | break; |
| 537 | case 0x39: |
| 538 | m_p1_data = ioport("kb_keytronic_39_0")->read(); |
| 539 | break; |
| 540 | case 0x3a: |
| 541 | m_p1_data = ioport("kb_keytronic_3a_0")->read(); |
| 542 | break; |
| 543 | case 0x3b: |
| 544 | m_p1_data = ioport("kb_keytronic_3b_0")->read(); |
| 545 | break; |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | /* Check for low->high transition on AD9 */ |
| 550 | if ( ! ( m_last_write_addr & 0x0200 ) && ( offset & 0x0200 ) ) |
| 551 | { |
| 552 | switch (m_p1) |
| 553 | { |
| 554 | case 0x0b: |
| 555 | m_p1_data = ioport("kb_keytronic_0b")->read(); |
| 556 | break; |
| 557 | case 0x30: |
| 558 | m_p1_data = ioport("kb_keytronic_30_1")->read(); |
| 559 | break; |
| 560 | case 0x31: |
| 561 | m_p1_data = ioport("kb_keytronic_31_1")->read(); |
| 562 | break; |
| 563 | case 0x32: |
| 564 | m_p1_data = ioport("kb_keytronic_32_1")->read(); |
| 565 | break; |
| 566 | case 0x33: |
| 567 | m_p1_data = ioport("kb_keytronic_33_1")->read(); |
| 568 | break; |
| 569 | case 0x34: |
| 570 | m_p1_data = ioport("kb_keytronic_34_1")->read(); |
| 571 | break; |
| 572 | case 0x35: |
| 573 | m_p1_data = ioport("kb_keytronic_35_1")->read(); |
| 574 | break; |
| 575 | case 0x36: |
| 576 | m_p1_data = ioport("kb_keytronic_36_1")->read(); |
| 577 | break; |
| 578 | case 0x37: |
| 579 | m_p1_data = ioport("kb_keytronic_37_1")->read(); |
| 580 | break; |
| 581 | case 0x38: |
| 582 | m_p1_data = 0xff; |
| 583 | break; |
| 584 | case 0x39: |
| 585 | m_p1_data = 0xff; |
| 586 | break; |
| 587 | case 0x3a: |
| 588 | m_p1_data = 0xff; |
| 589 | break; |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | m_last_write_addr = offset; |
| 594 | } |
| 595 | |
| 596 | |
| 597 | READ8_MEMBER( pc_kbd_keytronic_pc3270_device::p1_read ) |
| 598 | { |
| 599 | return m_p1 & m_p1_data; |
| 600 | } |
| 601 | |
| 602 | |
| 603 | WRITE8_MEMBER( pc_kbd_keytronic_pc3270_device::p1_write ) |
| 604 | { |
| 605 | if (LOG) |
| 606 | logerror("keytronic_pc3270::p1_write(): write %02x\n", data); |
| 607 | |
| 608 | m_p1 = data; |
| 609 | } |
| 610 | |
| 611 | |
| 612 | READ8_MEMBER( pc_kbd_keytronic_pc3270_device::p2_read ) |
| 613 | { |
| 614 | return m_p2; |
| 615 | } |
| 616 | |
| 617 | |
| 618 | WRITE8_MEMBER( pc_kbd_keytronic_pc3270_device::p2_write ) |
| 619 | { |
| 620 | if (LOG) |
| 621 | logerror("keytronic_pc3270::p2_write(): write %02x\n", data); |
| 622 | |
| 623 | m_p2 = data; |
| 624 | } |
| 625 | |
| 626 | |
| 627 | READ8_MEMBER( pc_kbd_keytronic_pc3270_device::p3_read ) |
| 628 | { |
| 629 | UINT8 data = m_p3; |
| 630 | |
| 631 | data &= ~0x14; |
| 632 | |
| 633 | /* -INT0 signal */ |
| 634 | data |= (clock_signal() ? 0x04 : 0x00); |
| 635 | |
| 636 | /* T0 signal */ |
| 637 | data |= (data_signal() ? 0x00 : 0x10); |
| 638 | |
| 639 | return data; |
| 640 | } |
| 641 | |
| 642 | |
| 643 | WRITE8_MEMBER( pc_kbd_keytronic_pc3270_device::p3_write ) |
| 644 | { |
| 645 | if (LOG) |
| 646 | logerror("keytronic_pc3270::p3_write(): write %02x\n", data); |
| 647 | |
| 648 | m_p3 = data; |
| 649 | } |
trunk/src/emu/bus/pc_kbd/msnat.c
| r0 | r26018 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | Microsoft Natural Keybaord emulation |
| 4 | |
| 5 | |
| 6 | TODO: |
| 7 | - Keyboard LEDs |
| 8 | |
| 9 | ***************************************************************************/ |
| 10 | |
| 11 | #include "emu.h" |
| 12 | #include "msnat.h" |
| 13 | #include "cpu/mcs51/mcs51.h" |
| 14 | |
| 15 | |
| 16 | /*************************************************************************** |
| 17 | ONSTANTS |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | #define LOG 0 |
| 21 | |
| 22 | |
| 23 | /***************************************************************************** |
| 24 | INPUT PORTS |
| 25 | *****************************************************************************/ |
| 26 | |
| 27 | static INPUT_PORTS_START( microsoft_natural ) |
| 28 | PORT_START( "P2.0" ) |
| 29 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') // 15 |
| 30 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') // 23 |
| 31 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') // 24 |
| 32 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') // 31 |
| 33 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') // 32 |
| 34 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') // 16 |
| 35 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') // 07 |
| 36 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') // 08 |
| 37 | |
| 38 | PORT_START( "P2.1" ) |
| 39 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') // 0D |
| 40 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') // 1B |
| 41 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') // 2B 2 spots for backslash? |
| 42 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) // E0 4B |
| 43 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // 1C |
| 44 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) // 0E |
| 45 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) // 3F |
| 46 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) // 40 |
| 47 | |
| 48 | PORT_START( "P2.2" ) |
| 49 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') // 0A |
| 50 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') // 18 |
| 51 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') // 1A |
| 52 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') // 26 |
| 53 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') // 34 |
| 54 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') // 0C |
| 55 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) // 41 |
| 56 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) // 42 |
| 57 | |
| 58 | PORT_START( "P2.3" ) |
| 59 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') // 0B |
| 60 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') // 27 |
| 61 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') // 28 |
| 62 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') // 35 |
| 63 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // E0 50 |
| 64 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') // 19 |
| 65 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) // 43 |
| 66 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) // 44 |
| 67 | |
| 68 | PORT_START( "P2.4" ) |
| 69 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // E0 48 |
| 70 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 71 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Unknown 73") // 73 TODO |
| 72 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ 2nd?") // 2B 2 spots for backslash?? |
| 73 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 74 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RWIN) PORT_CHAR(UCHAR_MAMEKEY(RWIN)) // E0 5C |
| 75 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // E0 4D |
| 76 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') // 39 |
| 77 | |
| 78 | PORT_START( "P2.5" ) |
| 79 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // E0 47 |
| 80 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) // 48 |
| 81 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) // 4C |
| 82 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) // 50 |
| 83 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) // 52 |
| 84 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) // E0 4F |
| 85 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) // 57 |
| 86 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) // 58 |
| 87 | |
| 88 | PORT_START( "P2.6" ) |
| 89 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) // E0 52 |
| 90 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) // E0 53 |
| 91 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) // 4D |
| 92 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) // 51 |
| 93 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) // 53 |
| 94 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) // 49 |
| 95 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) // 3D |
| 96 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) // 3E |
| 97 | |
| 98 | PORT_START( "P2.7" ) |
| 99 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) // E0 |
| 100 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) // 47 |
| 101 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) // 4B |
| 102 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) // 4E |
| 103 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) // 4F |
| 104 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) // 37 TODO |
| 105 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PRTSCR) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) // E0 2A E0 37 |
| 106 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MENU) PORT_CHAR(UCHAR_MAMEKEY(MENU)) // E0 5D |
| 107 | |
| 108 | PORT_START( "P1.0" ) |
| 109 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LWIN) PORT_CHAR(UCHAR_MAMEKEY(LWIN)) // E0 5B |
| 110 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 111 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INT5 7E") // 7E INT5 |
| 112 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 113 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 114 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 115 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) // 46 |
| 116 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) // E0 1C |
| 117 | |
| 118 | PORT_START( "P1.1" ) |
| 119 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 120 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // 1D |
| 121 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 122 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 123 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) // E0 1D |
| 124 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // 3A |
| 125 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 126 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 127 | |
| 128 | PORT_START( "P1.2" ) |
| 129 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) // E0 49 |
| 130 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') // 03 |
| 131 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') // 11 |
| 132 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') // 1F |
| 133 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') // 2D |
| 134 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) // E0 51 |
| 135 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) // 3B |
| 136 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) // 3C |
| 137 | |
| 138 | PORT_START( "P1.3" ) |
| 139 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 140 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 141 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) // 38 |
| 142 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) // E0 38 |
| 143 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 144 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 145 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) // 4A |
| 146 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) // 45 |
| 147 | |
| 148 | PORT_START( "P1.4" ) |
| 149 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') // 17 |
| 150 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') // 25 |
| 151 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') // 20 |
| 152 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') // 2E |
| 153 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') // 33 |
| 154 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') // 12 |
| 155 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') // 04 |
| 156 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') // 09 |
| 157 | |
| 158 | PORT_START( "P1.5" ) |
| 159 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') // 13 |
| 160 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') // 21 |
| 161 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') // 22 |
| 162 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') // 2F |
| 163 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') // 30 |
| 164 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') // 14 |
| 165 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') // 05 |
| 166 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') // 06 |
| 167 | |
| 168 | PORT_START( "P1.6" ) |
| 169 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') // 02 |
| 170 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') // 10 |
| 171 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') // 1E |
| 172 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INT1 56") // 56 INT1? |
| 173 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') // 2C |
| 174 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) // 0F |
| 175 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) // 01 |
| 176 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') // 29 |
| 177 | |
| 178 | PORT_START( "P1.7" ) |
| 179 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 180 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) // 2A |
| 181 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 182 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 183 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) // 36 |
| 184 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 185 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CANCEL) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) // E1 1D 45 E1 9D C5 |
| 186 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 187 | |
| 188 | INPUT_PORTS_END |
| 189 | |
| 190 | |
| 191 | //************************************************************************** |
| 192 | // GLOBAL VARIABLES |
| 193 | //************************************************************************** |
| 194 | |
| 195 | const device_type PC_KBD_MICROSOFT_NATURAL = &device_creator<pc_kbd_microsoft_natural_device>; |
| 196 | |
| 197 | /***************************************************************************** |
| 198 | ADDRESS MAPS |
| 199 | *****************************************************************************/ |
| 200 | |
| 201 | static ADDRESS_MAP_START( microsoft_natural_io, AS_IO, 8, pc_kbd_microsoft_natural_device ) |
| 202 | AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P0) AM_READWRITE(p0_read, p0_write) |
| 203 | AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_WRITE(p1_write) |
| 204 | AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_WRITE(p2_write) |
| 205 | AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_read, p3_write) |
| 206 | ADDRESS_MAP_END |
| 207 | |
| 208 | |
| 209 | /***************************************************************************** |
| 210 | MACHINE CONFIG |
| 211 | *****************************************************************************/ |
| 212 | |
| 213 | MACHINE_CONFIG_FRAGMENT( microsoft_natural ) |
| 214 | MCFG_CPU_ADD("ms_natrl_cpu", I8051, XTAL_6MHz) |
| 215 | MCFG_CPU_IO_MAP(microsoft_natural_io) |
| 216 | MACHINE_CONFIG_END |
| 217 | |
| 218 | |
| 219 | /*************************************************************************** |
| 220 | ROM DEFINITIONS |
| 221 | ***************************************************************************/ |
| 222 | |
| 223 | ROM_START( microsoft_natural ) |
| 224 | ROM_REGION(0x1000, "ms_natrl_cpu", 0) |
| 225 | ROM_LOAD("natural.bin", 0x0000, 0x1000, CRC(aa8243ab) SHA1(72134882a5c03e785db07cc54dfb7572c0a730d9)) |
| 226 | ROM_END |
| 227 | |
| 228 | |
| 229 | pc_kbd_microsoft_natural_device::pc_kbd_microsoft_natural_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 230 | : device_t(mconfig, PC_KBD_MICROSOFT_NATURAL, "Microsoft Natural Keyboard", tag, owner, clock, "ms_natural", __FILE__) |
| 231 | , device_pc_kbd_interface(mconfig, *this) |
| 232 | , m_cpu(*this, "ms_natrl_cpu") |
| 233 | , m_p2_0(*this, "P2.0") |
| 234 | , m_p2_1(*this, "P2.1") |
| 235 | , m_p2_2(*this, "P2.2") |
| 236 | , m_p2_3(*this, "P2.3") |
| 237 | , m_p2_4(*this, "P2.4") |
| 238 | , m_p2_5(*this, "P2.5") |
| 239 | , m_p2_6(*this, "P2.6") |
| 240 | , m_p2_7(*this, "P2.7") |
| 241 | , m_p1_0(*this, "P1.0") |
| 242 | , m_p1_1(*this, "P1.1") |
| 243 | , m_p1_2(*this, "P1.2") |
| 244 | , m_p1_3(*this, "P1.3") |
| 245 | , m_p1_4(*this, "P1.4") |
| 246 | , m_p1_5(*this, "P1.5") |
| 247 | , m_p1_6(*this, "P1.6") |
| 248 | , m_p1_7(*this, "P1.7") |
| 249 | { |
| 250 | } |
| 251 | |
| 252 | |
| 253 | //------------------------------------------------- |
| 254 | // device_start - device-specific startup |
| 255 | //------------------------------------------------- |
| 256 | void pc_kbd_microsoft_natural_device::device_start() |
| 257 | { |
| 258 | set_pc_kbdc_device(); |
| 259 | |
| 260 | /* setup savestates */ |
| 261 | save_item(NAME(m_p0)); |
| 262 | save_item(NAME(m_p1)); |
| 263 | save_item(NAME(m_p2)); |
| 264 | save_item(NAME(m_p3)); |
| 265 | } |
| 266 | |
| 267 | |
| 268 | //------------------------------------------------- |
| 269 | // device_reset - device-specific reset |
| 270 | //------------------------------------------------- |
| 271 | void pc_kbd_microsoft_natural_device::device_reset() |
| 272 | { |
| 273 | /* set default values */ |
| 274 | } |
| 275 | |
| 276 | |
| 277 | //------------------------------------------------- |
| 278 | // machine_config_additions - device-specific |
| 279 | // machine configurations |
| 280 | //------------------------------------------------- |
| 281 | |
| 282 | machine_config_constructor pc_kbd_microsoft_natural_device::device_mconfig_additions() const |
| 283 | { |
| 284 | return MACHINE_CONFIG_NAME( microsoft_natural ); |
| 285 | } |
| 286 | |
| 287 | |
| 288 | ioport_constructor pc_kbd_microsoft_natural_device::device_input_ports() const |
| 289 | { |
| 290 | return INPUT_PORTS_NAME( microsoft_natural ); |
| 291 | } |
| 292 | |
| 293 | |
| 294 | //------------------------------------------------- |
| 295 | // rom_region - device-specific ROM region |
| 296 | //------------------------------------------------- |
| 297 | |
| 298 | const rom_entry *pc_kbd_microsoft_natural_device::device_rom_region() const |
| 299 | { |
| 300 | return ROM_NAME( microsoft_natural ); |
| 301 | } |
| 302 | |
| 303 | |
| 304 | WRITE_LINE_MEMBER( pc_kbd_microsoft_natural_device::clock_write ) |
| 305 | { |
| 306 | } |
| 307 | |
| 308 | |
| 309 | WRITE_LINE_MEMBER( pc_kbd_microsoft_natural_device::data_write ) |
| 310 | { |
| 311 | } |
| 312 | |
| 313 | |
| 314 | READ8_MEMBER( pc_kbd_microsoft_natural_device::p0_read ) |
| 315 | { |
| 316 | UINT8 data = 0xFF; |
| 317 | |
| 318 | if (LOG) |
| 319 | logerror("%s: P0 read. P1 = %02x, P2 = %02x\n", tag(), m_p1, m_p2 ); |
| 320 | |
| 321 | if ( ! ( m_p2 & 0x01 ) ) |
| 322 | { |
| 323 | data &= m_p2_0->read(); |
| 324 | } |
| 325 | |
| 326 | if ( ! ( m_p2 & 0x02 ) ) |
| 327 | { |
| 328 | data &= m_p2_1->read(); |
| 329 | } |
| 330 | |
| 331 | if ( ! ( m_p2 & 0x04 ) ) |
| 332 | { |
| 333 | data &= m_p2_2->read(); |
| 334 | } |
| 335 | |
| 336 | if ( ! ( m_p2 & 0x08 ) ) |
| 337 | { |
| 338 | data &= m_p2_3->read(); |
| 339 | } |
| 340 | |
| 341 | if ( ! ( m_p2 & 0x10 ) ) |
| 342 | { |
| 343 | data &= m_p2_4->read(); |
| 344 | } |
| 345 | |
| 346 | if ( ! ( m_p2 & 0x20 ) ) |
| 347 | { |
| 348 | data &= m_p2_5->read(); |
| 349 | } |
| 350 | |
| 351 | if ( ! ( m_p2 & 0x40 ) ) |
| 352 | { |
| 353 | data &= m_p2_6->read(); |
| 354 | } |
| 355 | |
| 356 | if ( ! ( m_p2 & 0x80 ) ) |
| 357 | { |
| 358 | data &= m_p2_7->read(); |
| 359 | } |
| 360 | |
| 361 | if ( ! ( m_p1 & 0x01 ) ) |
| 362 | { |
| 363 | data &= m_p1_0->read(); |
| 364 | } |
| 365 | |
| 366 | if ( ! ( m_p1 & 0x02 ) ) |
| 367 | { |
| 368 | data &= m_p1_1->read(); |
| 369 | } |
| 370 | |
| 371 | if ( ! ( m_p1 & 0x04 ) ) |
| 372 | { |
| 373 | data &= m_p1_2->read(); |
| 374 | } |
| 375 | |
| 376 | if ( ! ( m_p1 & 0x08 ) ) |
| 377 | { |
| 378 | data &= m_p1_3->read(); |
| 379 | } |
| 380 | |
| 381 | if ( ! ( m_p1 & 0x10 ) ) |
| 382 | { |
| 383 | data &= m_p1_4->read(); |
| 384 | } |
| 385 | |
| 386 | if ( ! ( m_p1 & 0x20 ) ) |
| 387 | { |
| 388 | data &= m_p1_5->read(); |
| 389 | } |
| 390 | |
| 391 | if ( ! ( m_p1 & 0x40 ) ) |
| 392 | { |
| 393 | data &= m_p1_6->read(); |
| 394 | } |
| 395 | |
| 396 | if ( ! ( m_p1 & 0x80 ) ) |
| 397 | { |
| 398 | data &= m_p1_7->read(); |
| 399 | } |
| 400 | |
| 401 | return data; |
| 402 | } |
| 403 | |
| 404 | |
| 405 | WRITE8_MEMBER( pc_kbd_microsoft_natural_device::p0_write ) |
| 406 | { |
| 407 | m_p0 = data; |
| 408 | } |
| 409 | |
| 410 | |
| 411 | WRITE8_MEMBER( pc_kbd_microsoft_natural_device::p1_write ) |
| 412 | { |
| 413 | m_p1 = data; |
| 414 | } |
| 415 | |
| 416 | |
| 417 | WRITE8_MEMBER( pc_kbd_microsoft_natural_device::p2_write ) |
| 418 | { |
| 419 | m_p2 = data; |
| 420 | } |
| 421 | |
| 422 | |
| 423 | READ8_MEMBER( pc_kbd_microsoft_natural_device::p3_read ) |
| 424 | { |
| 425 | UINT8 data = m_p3 & ~0x21; |
| 426 | |
| 427 | // (Incoming) Clock signal is tied to the T1/P3.5 pin |
| 428 | data |= (clock_signal() ? 0x20 : 0x00); |
| 429 | |
| 430 | // (Incoming) Data signal is tied to the RXD/P3.0 pin |
| 431 | data |= ( data_signal() ? 0x01 : 0x00 ); |
| 432 | |
| 433 | return data; |
| 434 | } |
| 435 | |
| 436 | |
| 437 | WRITE8_MEMBER( pc_kbd_microsoft_natural_device::p3_write ) |
| 438 | { |
| 439 | if ( m_pc_kbdc ) |
| 440 | { |
| 441 | // (Outgoing) data signal is tied to the WR/P3.6 pin |
| 442 | m_pc_kbdc->data_write_from_kb( BIT(data, 6) ); |
| 443 | |
| 444 | // (Outgoing) clock signal is tied to the T0/P3.4 pin |
| 445 | m_pc_kbdc->clock_write_from_kb( BIT(data, 4) ); |
| 446 | } |
| 447 | |
| 448 | m_p3 = data; |
| 449 | } |
trunk/src/emu/bus/pc_kbd/pc_kbdc.c
| r0 | r26018 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | PC Keyboard connector interface |
| 4 | |
| 5 | The following basic program can be useful for identifying scancodes: |
| 6 | 10 sc%=0:sp%=0 |
| 7 | 20 sc%=inp(96) |
| 8 | 30 if sc%<>sp% then print hex$(sc%):sp%=sc% |
| 9 | 40 goto 20 |
| 10 | |
| 11 | ***************************************************************************/ |
| 12 | |
| 13 | |
| 14 | #include "emu.h" |
| 15 | #include "emuopts.h" |
| 16 | #include "pc_kbdc.h" |
| 17 | |
| 18 | |
| 19 | //************************************************************************** |
| 20 | // GLOBAL VARIABLES |
| 21 | //************************************************************************** |
| 22 | |
| 23 | const device_type PC_KBDC_SLOT = &device_creator<pc_kbdc_slot_device>; |
| 24 | |
| 25 | //************************************************************************** |
| 26 | // LIVE DEVICE |
| 27 | //************************************************************************** |
| 28 | |
| 29 | //------------------------------------------------- |
| 30 | // pc_kbdc_slot_device - constructor |
| 31 | //------------------------------------------------- |
| 32 | pc_kbdc_slot_device::pc_kbdc_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 33 | device_t(mconfig, PC_KBDC_SLOT, "PC_KBDC_SLOT", tag, owner, clock, "pc_kbdc_slot", __FILE__), |
| 34 | device_slot_interface(mconfig, *this) |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | |
| 39 | void pc_kbdc_slot_device::static_set_pc_kbdc_slot(device_t &device, device_t *kbdc_device) |
| 40 | { |
| 41 | pc_kbdc_slot_device &pc_kbdc = dynamic_cast<pc_kbdc_slot_device &>(device); |
| 42 | pc_kbdc.m_kbdc_device = kbdc_device; |
| 43 | } |
| 44 | |
| 45 | //------------------------------------------------- |
| 46 | // device_start - device-specific startup |
| 47 | //------------------------------------------------- |
| 48 | |
| 49 | void pc_kbdc_slot_device::device_start() |
| 50 | { |
| 51 | device_pc_kbd_interface *pc_kbd = dynamic_cast<device_pc_kbd_interface *>(get_card_device()); |
| 52 | |
| 53 | if (pc_kbd) |
| 54 | { |
| 55 | device_pc_kbd_interface::static_set_pc_kbdc( *pc_kbd, m_kbdc_device ); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | |
| 60 | //************************************************************************** |
| 61 | // GLOBAL VARIABLES |
| 62 | //************************************************************************** |
| 63 | |
| 64 | const device_type PC_KBDC = &device_creator<pc_kbdc_device>; |
| 65 | |
| 66 | |
| 67 | //------------------------------------------------- |
| 68 | // pc_kbdc_device - constructor |
| 69 | //------------------------------------------------- |
| 70 | pc_kbdc_device::pc_kbdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 71 | device_t(mconfig, PC_KBDC, "PC_KBDC", tag, owner, clock, "pc_kbdc", __FILE__), |
| 72 | m_clock_state(-1), |
| 73 | m_data_state(-1), |
| 74 | m_kb_clock_state(1), |
| 75 | m_kb_data_state(1), |
| 76 | m_keyboard( NULL ) |
| 77 | { |
| 78 | } |
| 79 | |
| 80 | |
| 81 | //------------------------------------------------- |
| 82 | // device_config_complete - perform any |
| 83 | // operations now that the configuration is |
| 84 | // complete |
| 85 | //------------------------------------------------- |
| 86 | void pc_kbdc_device::device_config_complete() |
| 87 | { |
| 88 | // inherit a copy of the static data |
| 89 | const pc_kbdc_interface *intf = reinterpret_cast<const pc_kbdc_interface *>(static_config()); |
| 90 | if (intf != NULL) |
| 91 | { |
| 92 | *static_cast<pc_kbdc_interface *>(this) = *intf; |
| 93 | } |
| 94 | |
| 95 | // or initialize to defaults if none provided |
| 96 | else |
| 97 | { |
| 98 | memset(&m_out_clock_cb, 0, sizeof(m_out_clock_cb)); |
| 99 | memset(&m_out_data_cb, 0, sizeof(m_out_data_cb)); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | |
| 104 | void pc_kbdc_device::set_keyboard( device_pc_kbd_interface *keyboard ) |
| 105 | { |
| 106 | m_keyboard = keyboard; |
| 107 | } |
| 108 | |
| 109 | |
| 110 | //------------------------------------------------- |
| 111 | // device_start - device-specific startup |
| 112 | //------------------------------------------------- |
| 113 | void pc_kbdc_device::device_start() |
| 114 | { |
| 115 | // resolve callbacks |
| 116 | m_out_clock_func.resolve(m_out_clock_cb, *this); |
| 117 | m_out_data_func.resolve(m_out_data_cb, *this); |
| 118 | } |
| 119 | |
| 120 | |
| 121 | //------------------------------------------------- |
| 122 | // device_reset - device-specific reset |
| 123 | //------------------------------------------------- |
| 124 | void pc_kbdc_device::device_reset() |
| 125 | { |
| 126 | m_clock_state = -1; /* initial state of calculated clock line */ |
| 127 | m_data_state = -1; /* initial state of calculated data line */ |
| 128 | |
| 129 | // Initially assume both keyboard and mainboard have released their data and clock lines |
| 130 | m_mb_clock_state = 1; |
| 131 | m_mb_data_state = 1; |
| 132 | m_kb_clock_state = 1; |
| 133 | m_kb_data_state = 1; |
| 134 | } |
| 135 | |
| 136 | |
| 137 | void pc_kbdc_device::update_clock_state() |
| 138 | { |
| 139 | int new_clock_state = m_mb_clock_state & m_kb_clock_state; |
| 140 | |
| 141 | if ( new_clock_state != m_clock_state ) |
| 142 | { |
| 143 | // We first set our state to prevent possible endless loops |
| 144 | m_clock_state = new_clock_state; |
| 145 | |
| 146 | // Send state to keyboard interface logic on mainboard |
| 147 | m_out_clock_func( m_clock_state ); |
| 148 | |
| 149 | // Send state to keyboard |
| 150 | if ( m_keyboard ) |
| 151 | { |
| 152 | m_keyboard->clock_write( m_clock_state ); |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | |
| 158 | void pc_kbdc_device::update_data_state() |
| 159 | { |
| 160 | int new_data_state = m_mb_data_state & m_kb_data_state; |
| 161 | |
| 162 | if ( new_data_state != m_data_state ) |
| 163 | { |
| 164 | // We first set our state to prevent possible endless loops |
| 165 | m_data_state = new_data_state; |
| 166 | |
| 167 | // Send state to keyboard interface logic on mainboard |
| 168 | m_out_data_func( m_data_state ); |
| 169 | |
| 170 | // Send state to keyboard |
| 171 | if ( m_keyboard ) |
| 172 | { |
| 173 | m_keyboard->data_write( m_data_state ); |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | |
| 179 | WRITE_LINE_MEMBER( pc_kbdc_device::clock_write_from_mb ) |
| 180 | { |
| 181 | m_mb_clock_state = state; |
| 182 | update_clock_state(); |
| 183 | } |
| 184 | |
| 185 | |
| 186 | WRITE_LINE_MEMBER( pc_kbdc_device::data_write_from_mb ) |
| 187 | { |
| 188 | m_mb_data_state = state; |
| 189 | update_data_state(); |
| 190 | } |
| 191 | |
| 192 | |
| 193 | WRITE_LINE_MEMBER( pc_kbdc_device::clock_write_from_kb ) |
| 194 | { |
| 195 | m_kb_clock_state = state; |
| 196 | update_clock_state(); |
| 197 | } |
| 198 | |
| 199 | |
| 200 | WRITE_LINE_MEMBER( pc_kbdc_device::data_write_from_kb ) |
| 201 | { |
| 202 | m_kb_data_state = state; |
| 203 | update_data_state(); |
| 204 | } |
| 205 | |
| 206 | |
| 207 | //************************************************************************** |
| 208 | // DEVICE PC KBD INTERFACE |
| 209 | //************************************************************************** |
| 210 | |
| 211 | //------------------------------------------------- |
| 212 | // device_pc_kbd_interface - constructor |
| 213 | //------------------------------------------------- |
| 214 | |
| 215 | device_pc_kbd_interface::device_pc_kbd_interface(const machine_config &mconfig, device_t &device) |
| 216 | : device_slot_card_interface(mconfig, device), |
| 217 | m_pc_kbdc(NULL), |
| 218 | m_pc_kbdc_tag(NULL) |
| 219 | { |
| 220 | } |
| 221 | |
| 222 | |
| 223 | //------------------------------------------------- |
| 224 | // ~device_pc_kbd_interface - destructor |
| 225 | //------------------------------------------------- |
| 226 | |
| 227 | device_pc_kbd_interface::~device_pc_kbd_interface() |
| 228 | { |
| 229 | } |
| 230 | |
| 231 | |
| 232 | WRITE_LINE_MEMBER( device_pc_kbd_interface::clock_write ) |
| 233 | { |
| 234 | } |
| 235 | |
| 236 | |
| 237 | WRITE_LINE_MEMBER( device_pc_kbd_interface::data_write ) |
| 238 | { |
| 239 | } |
| 240 | |
| 241 | |
| 242 | void device_pc_kbd_interface::static_set_pc_kbdc(device_t &device, device_t *kbdc_device) |
| 243 | { |
| 244 | device_pc_kbd_interface &pc_kbd = dynamic_cast<device_pc_kbd_interface &>(device); |
| 245 | pc_kbd.m_pc_kbdc = dynamic_cast<pc_kbdc_device *>(kbdc_device); |
| 246 | } |
| 247 | |
| 248 | |
| 249 | void device_pc_kbd_interface::set_pc_kbdc_device() |
| 250 | { |
| 251 | if ( m_pc_kbdc ) |
| 252 | { |
| 253 | m_pc_kbdc->set_keyboard( this ); |
| 254 | } |
| 255 | } |
trunk/src/emu/bus/pc_kbd/pcxt83.c
| r0 | r26018 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:Curt Coder |
| 3 | /********************************************************************** |
| 4 | |
| 5 | IBM Model F PC/XT 83-key keyboard emulation |
| 6 | |
| 7 | Copyright MESS Team. |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | |
| 10 | *********************************************************************/ |
| 11 | |
| 12 | /* |
| 13 | |
| 14 | Part No Layout |
| 15 | ------------------- |
| 16 | 1501100 US |
| 17 | 1501102 Germany |
| 18 | 1501105 UK |
| 19 | |
| 20 | */ |
| 21 | |
| 22 | #include "pcxt83.h" |
| 23 | |
| 24 | |
| 25 | |
| 26 | //************************************************************************** |
| 27 | // MACROS / CONSTANTS |
| 28 | //************************************************************************** |
| 29 | |
| 30 | #define I8048_TAG "i8048" |
| 31 | |
| 32 | |
| 33 | |
| 34 | //************************************************************************** |
| 35 | // DEVICE DEFINITIONS |
| 36 | //************************************************************************** |
| 37 | |
| 38 | const device_type PC_KBD_IBM_PC_XT_83 = &device_creator<ibm_pc_xt_83_keyboard_device>; |
| 39 | |
| 40 | |
| 41 | //------------------------------------------------- |
| 42 | // ROM( ibm_pc_xt_83_keyboard ) |
| 43 | //------------------------------------------------- |
| 44 | |
| 45 | ROM_START( ibm_pc_xt_83_keyboard ) |
| 46 | ROM_REGION( 0x400, I8048_TAG, 0 ) |
| 47 | /* |
| 48 | Keyboard Part No. 1501105 |
| 49 | |
| 50 | MOI 74 01 |
| 51 | PN 4584751 |
| 52 | GX 344231 |
| 53 | |
| 54 | i 4429745 |
| 55 | ZO P 379297 |
| 56 | 8143 P |
| 57 | (C) INTEL 76 |
| 58 | */ |
| 59 | ROM_LOAD( "4584751.m1", 0x000, 0x400, CRC(c59aa9d1) SHA1(4f5b2a075c68f6493310ec1e2a24271ceea330df) ) |
| 60 | ROM_END |
| 61 | |
| 62 | |
| 63 | //------------------------------------------------- |
| 64 | // rom_region - device-specific ROM region |
| 65 | //------------------------------------------------- |
| 66 | |
| 67 | const rom_entry *ibm_pc_xt_83_keyboard_device::device_rom_region() const |
| 68 | { |
| 69 | return ROM_NAME( ibm_pc_xt_83_keyboard ); |
| 70 | } |
| 71 | |
| 72 | |
| 73 | //------------------------------------------------- |
| 74 | // ADDRESS_MAP( kb_io ) |
| 75 | //------------------------------------------------- |
| 76 | |
| 77 | static ADDRESS_MAP_START( ibm_pc_xt_83_keyboard_io, AS_IO, 8, ibm_pc_xt_83_keyboard_device ) |
| 78 | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE(bus_r, bus_w) |
| 79 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(p1_w) |
| 80 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w) |
| 81 | AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r) |
| 82 | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) |
| 83 | ADDRESS_MAP_END |
| 84 | |
| 85 | |
| 86 | //------------------------------------------------- |
| 87 | // MACHINE_DRIVER( ibm_pc_xt_83_keyboard ) |
| 88 | //------------------------------------------------- |
| 89 | |
| 90 | static MACHINE_CONFIG_FRAGMENT( ibm_pc_xt_83_keyboard ) |
| 91 | MCFG_CPU_ADD(I8048_TAG, I8048, MCS48_LC_CLOCK(IND_U(47), CAP_P(20.7))) |
| 92 | MCFG_CPU_IO_MAP(ibm_pc_xt_83_keyboard_io) |
| 93 | MACHINE_CONFIG_END |
| 94 | |
| 95 | |
| 96 | //------------------------------------------------- |
| 97 | // machine_config_additions - device-specific |
| 98 | // machine configurations |
| 99 | //------------------------------------------------- |
| 100 | |
| 101 | machine_config_constructor ibm_pc_xt_83_keyboard_device::device_mconfig_additions() const |
| 102 | { |
| 103 | return MACHINE_CONFIG_NAME( ibm_pc_xt_83_keyboard ); |
| 104 | } |
| 105 | |
| 106 | |
| 107 | //------------------------------------------------- |
| 108 | // INPUT_PORTS( ibm_pc_xt_83_keyboard ) |
| 109 | //------------------------------------------------- |
| 110 | |
| 111 | INPUT_PORTS_START( ibm_pc_xt_83_keyboard ) |
| 112 | PORT_START("MD00") |
| 113 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 114 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) |
| 115 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 PgDn") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 116 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 117 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 118 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 PgUp") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 119 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 120 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock Break") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) |
| 121 | |
| 122 | PORT_START("MD01") |
| 123 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 124 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 125 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 126 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 127 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 128 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 129 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 130 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) |
| 131 | |
| 132 | PORT_START("MD02") |
| 133 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 134 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad * PrtSc") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) |
| 135 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 136 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') |
| 137 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 138 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 139 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 140 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 141 | |
| 142 | PORT_START("MD03") |
| 143 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 144 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 145 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') |
| 146 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 147 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 148 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 149 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 150 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') |
| 151 | |
| 152 | PORT_START("MD04") |
| 153 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 154 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 155 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') |
| 156 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 157 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 158 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 159 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') |
| 160 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') |
| 161 | |
| 162 | PORT_START("MD05") |
| 163 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 164 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 165 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 166 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 167 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 168 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 169 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') |
| 170 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') |
| 171 | |
| 172 | PORT_START("MD06") |
| 173 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 174 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 175 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 176 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 177 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| 178 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 179 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') |
| 180 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') |
| 181 | |
| 182 | PORT_START("MD07") |
| 183 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 184 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 185 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 186 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 187 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 188 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 189 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 190 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 191 | |
| 192 | PORT_START("MD08") |
| 193 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 194 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 195 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 196 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 197 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 198 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 199 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 200 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') |
| 201 | |
| 202 | PORT_START("MD09") |
| 203 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') |
| 204 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 205 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) |
| 206 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 207 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 208 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) |
| 209 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 210 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 211 | |
| 212 | PORT_START("MD10") |
| 213 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) |
| 214 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) |
| 215 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) |
| 216 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) |
| 217 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 218 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) |
| 219 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 220 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| 221 | |
| 222 | PORT_START("MD11") |
| 223 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 224 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) |
| 225 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) |
| 226 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) |
| 227 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 228 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) |
| 229 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) // 76 "Clear" |
| 230 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 231 | INPUT_PORTS_END |
| 232 | |
| 233 | |
| 234 | //------------------------------------------------- |
| 235 | // input_ports - device-specific input ports |
| 236 | //------------------------------------------------- |
| 237 | |
| 238 | ioport_constructor ibm_pc_xt_83_keyboard_device::device_input_ports() const |
| 239 | { |
| 240 | return INPUT_PORTS_NAME( ibm_pc_xt_83_keyboard ); |
| 241 | } |
| 242 | |
| 243 | |
| 244 | |
| 245 | //************************************************************************** |
| 246 | // LIVE DEVICE |
| 247 | //************************************************************************** |
| 248 | |
| 249 | //------------------------------------------------- |
| 250 | // ibm_pc_xt_83_keyboard_device - constructor |
| 251 | //------------------------------------------------- |
| 252 | |
| 253 | ibm_pc_xt_83_keyboard_device::ibm_pc_xt_83_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 254 | : device_t(mconfig, PC_KBD_IBM_PC_XT_83, "IBM PC/XT Keyboard", tag, owner, clock, "kb_pcxt83", __FILE__), |
| 255 | device_pc_kbd_interface(mconfig, *this), |
| 256 | m_maincpu(*this, I8048_TAG), |
| 257 | m_md00(*this, "MD00"), |
| 258 | m_md01(*this, "MD01"), |
| 259 | m_md02(*this, "MD02"), |
| 260 | m_md03(*this, "MD03"), |
| 261 | m_md04(*this, "MD04"), |
| 262 | m_md05(*this, "MD05"), |
| 263 | m_md06(*this, "MD06"), |
| 264 | m_md07(*this, "MD07"), |
| 265 | m_md08(*this, "MD08"), |
| 266 | m_md09(*this, "MD09"), |
| 267 | m_md10(*this, "MD10"), |
| 268 | m_md11(*this, "MD11"), |
| 269 | m_bus(0xff), |
| 270 | m_p1(0xff), |
| 271 | m_p2(0xff), |
| 272 | m_sense(0), |
| 273 | m_q(1) |
| 274 | { |
| 275 | } |
| 276 | |
| 277 | |
| 278 | //------------------------------------------------- |
| 279 | // device_start - device-specific startup |
| 280 | //------------------------------------------------- |
| 281 | |
| 282 | void ibm_pc_xt_83_keyboard_device::device_start() |
| 283 | { |
| 284 | set_pc_kbdc_device(); |
| 285 | |
| 286 | // state saving |
| 287 | save_item(NAME(m_bus)); |
| 288 | save_item(NAME(m_p1)); |
| 289 | save_item(NAME(m_p2)); |
| 290 | save_item(NAME(m_sense)); |
| 291 | save_item(NAME(m_q)); |
| 292 | } |
| 293 | |
| 294 | |
| 295 | //------------------------------------------------- |
| 296 | // device_reset - device-specific reset |
| 297 | //------------------------------------------------- |
| 298 | |
| 299 | void ibm_pc_xt_83_keyboard_device::device_reset() |
| 300 | { |
| 301 | } |
| 302 | |
| 303 | |
| 304 | //------------------------------------------------- |
| 305 | // clock_write - |
| 306 | //------------------------------------------------- |
| 307 | |
| 308 | WRITE_LINE_MEMBER( ibm_pc_xt_83_keyboard_device::clock_write ) |
| 309 | { |
| 310 | } |
| 311 | |
| 312 | |
| 313 | //------------------------------------------------- |
| 314 | // data_write - |
| 315 | //------------------------------------------------- |
| 316 | |
| 317 | WRITE_LINE_MEMBER( ibm_pc_xt_83_keyboard_device::data_write ) |
| 318 | { |
| 319 | m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); |
| 320 | } |
| 321 | |
| 322 | |
| 323 | //------------------------------------------------- |
| 324 | // bus_r - |
| 325 | //------------------------------------------------- |
| 326 | |
| 327 | READ8_MEMBER( ibm_pc_xt_83_keyboard_device::bus_r ) |
| 328 | { |
| 329 | // HACK this should be handled in mcs48.c |
| 330 | return m_bus; |
| 331 | } |
| 332 | |
| 333 | |
| 334 | //------------------------------------------------- |
| 335 | // bus_w - |
| 336 | //------------------------------------------------- |
| 337 | |
| 338 | WRITE8_MEMBER( ibm_pc_xt_83_keyboard_device::bus_w ) |
| 339 | { |
| 340 | /* |
| 341 | |
| 342 | bit description |
| 343 | |
| 344 | 0 |
| 345 | 1 |
| 346 | 2 |
| 347 | 3 |
| 348 | 4 |
| 349 | 5 DATAOUT |
| 350 | 6 -REQOUT |
| 351 | 7 Z1 RESET |
| 352 | |
| 353 | */ |
| 354 | |
| 355 | m_pc_kbdc->data_write_from_kb(BIT(data, 5)); |
| 356 | m_pc_kbdc->clock_write_from_kb(BIT(data, 6)); |
| 357 | |
| 358 | if (!BIT(m_bus, 7) && BIT(data, 7)) |
| 359 | { |
| 360 | UINT8 data = 0xff; |
| 361 | |
| 362 | if (BIT(m_p1, 0)) data &= m_md00->read(); |
| 363 | if (BIT(m_p1, 1)) data &= m_md01->read(); |
| 364 | if (BIT(m_p1, 2)) data &= m_md02->read(); |
| 365 | if (BIT(m_p1, 3)) data &= m_md03->read(); |
| 366 | if (BIT(m_p1, 4)) data &= m_md04->read(); |
| 367 | if (BIT(m_p1, 5)) data &= m_md05->read(); |
| 368 | if (BIT(m_p1, 6)) data &= m_md06->read(); |
| 369 | if (BIT(m_p1, 7)) data &= m_md07->read(); |
| 370 | if (BIT(m_p2, 4)) data &= m_md08->read(); |
| 371 | if (BIT(m_p2, 5)) data &= m_md09->read(); |
| 372 | if (BIT(m_p2, 6)) data &= m_md10->read(); |
| 373 | if (BIT(m_p2, 7)) data &= m_md11->read(); |
| 374 | |
| 375 | m_q = BIT(data, m_sense); |
| 376 | } |
| 377 | |
| 378 | m_bus = data; |
| 379 | } |
| 380 | |
| 381 | |
| 382 | //------------------------------------------------- |
| 383 | // p1_w - |
| 384 | //------------------------------------------------- |
| 385 | |
| 386 | WRITE8_MEMBER( ibm_pc_xt_83_keyboard_device::p1_w ) |
| 387 | { |
| 388 | /* |
| 389 | |
| 390 | bit description |
| 391 | |
| 392 | 0 MD00 |
| 393 | 1 MD01 |
| 394 | 2 MD02 |
| 395 | 3 MD03 |
| 396 | 4 MD04 |
| 397 | 5 MD05 |
| 398 | 6 MD06 |
| 399 | 7 MD07 |
| 400 | |
| 401 | */ |
| 402 | |
| 403 | m_p1 = data; |
| 404 | } |
| 405 | |
| 406 | |
| 407 | //------------------------------------------------- |
| 408 | // p2_w - |
| 409 | //------------------------------------------------- |
| 410 | |
| 411 | WRITE8_MEMBER( ibm_pc_xt_83_keyboard_device::p2_w ) |
| 412 | { |
| 413 | /* |
| 414 | |
| 415 | bit description |
| 416 | |
| 417 | 0 SELECT 2 |
| 418 | 1 SELECT 1 |
| 419 | 2 SELECT 0 |
| 420 | 3 SA CLOSED |
| 421 | 4 MD08 |
| 422 | 5 MD09 |
| 423 | 6 MD10 |
| 424 | 7 MD11 |
| 425 | |
| 426 | */ |
| 427 | |
| 428 | if (!BIT(m_p2, 3) && BIT(data, 3)) |
| 429 | { |
| 430 | m_sense = data & 0x07; |
| 431 | } |
| 432 | |
| 433 | m_p2 = data; |
| 434 | } |
| 435 | |
| 436 | |
| 437 | //------------------------------------------------- |
| 438 | // t0_r - |
| 439 | //------------------------------------------------- |
| 440 | |
| 441 | READ8_MEMBER( ibm_pc_xt_83_keyboard_device::t0_r ) |
| 442 | { |
| 443 | return clock_signal(); |
| 444 | } |
| 445 | |
| 446 | |
| 447 | //------------------------------------------------- |
| 448 | // t1_r - |
| 449 | //------------------------------------------------- |
| 450 | |
| 451 | READ8_MEMBER( ibm_pc_xt_83_keyboard_device::t1_r ) |
| 452 | { |
| 453 | return BIT(m_p2, 3) && m_q; |
| 454 | } |
trunk/src/mess/machine/kb_keytro.c
| r26017 | r26018 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | TODO: |
| 4 | | - Add support for PF01 - PF24 |
| 5 | | |
| 6 | | Emulation file for Keytronic KB3270/PC keyboard by Wilbert Pol. |
| 7 | | |
| 8 | | This keyboard supports both the PC/XT and the PC/AT keyboard protocols. The |
| 9 | | desired protocol can be selected by a switch on the keyboard. |
| 10 | | |
| 11 | | Keyboard matrix. |
| 12 | | |
| 13 | | Z5 = XR 22-00950-001 |
| 14 | | Z6 = SN74LS132N |
| 15 | | Z7 = XR 22-00950-001 |
| 16 | | Z8 = SN74LS374N |
| 17 | | Z11 = XR 22-908-03B |
| 18 | | |
| 19 | | |
| 20 | | | Z11 pin 8 |
| 21 | | | | Z11 pin 7 |
| 22 | | | | | Z11 pin 6 |
| 23 | | | | | | Z11 pin 5 |
| 24 | | | | | | | Z11 pin 4 |
| 25 | | | | | | | | |
| 26 | | F1 -------- F2 ------------- F3 ----- F4 ----- F5 ----- F6 -------- J2 pin 2 - Z5 pin 19 |
| 27 | | | | | | | | |
| 28 | | F7 -------- F8 ------------- LShift - < ------ Z ------ X --------- J2 pin 1 - Z5 pin 18 |
| 29 | | | | | | | | |
| 30 | | F9 -------- F10 ------------ LCtrl -- LAlt --- Space -- RAlt ------ J1 pin 9 - Z5 pin 17 |
| 31 | | | | | | | | |
| 32 | | 1 --------- ` -------------- Q ------ TAB ---- A ------ Caps Lock - J1 pin 8 - Z5 pin 16 |
| 33 | | | | | | | | |
| 34 | | 2 --------- 3 -------------- W ------ E ------ S ------ D --------- J1 pin 7 - Z5 pin 15 |
| 35 | | | | | | | | |
| 36 | | 5 --------- 4 -------------- T ------ R ------ G ------ F --------- J2 pin 3 - Z7 pin 20 |
| 37 | | | | | | | | |
| 38 | | N --------- M -------------- B ------ V ------ C ------ , -------------------- Z7 pin 19 |
| 39 | | | | | | | | |
| 40 | | 6 --------- 7 -------------- Y ------ U ------ H ------ J -------------------- Z7 pin 18 |
| 41 | | | | | | | | |
| 42 | | 9 --------- 8 -------------- O ------ I ------ L ------ K -------------------- Z7 pin 17 |
| 43 | | | | | | | | |
| 44 | | Pad 2 ----- Pad 1 ---------- Unused - Unused - Down --- Enter ---------------- Z7 pin 16 |
| 45 | | | | | | | | |
| 46 | | | / -------------- Rshift - Rshift - Left --- . --------- J9 pin 8 - Z7 pin 15 |
| 47 | | | | | | | | |
| 48 | | 0 --------- - -------------- P ------ [ ------ ; ------ ' --------- J9 pin 7 - Z7 pin 14 |
| 49 | | | | | | | | |
| 50 | | Backspace - = -------------- Return - \ ------ Return - ] --------- J9 pin 6 - Z7 pin 13 |
| 51 | | | | | | | | |
| 52 | | Backspace - PA1/Dup -------- |<-- --- /a\ ---- Pad + -- Pad + ----- J9 pin 5 - Z7 pin 12 |
| 53 | | | | | | | | |
| 54 | | Esc ------- NumLock -------- Pad 7 -- Pad 8 -- Pad 4 -- Pad 5 ------J9 pin 3 - Z7 pin 2 |
| 55 | | | | | | | | |
| 56 | | SysReq ---- ScrLk ---------- -->| --- Pad 9 -- Pad - -- Pad 6 ---------------- goes under Z8 between pins 5 and 6 to Z8 pin 15? |
| 57 | | | | | | | | |
| 58 | | Pad 3 ----- Pad 0 ---------- Pad 0 -- Pad . -- Unused - Up ------------------- Z7 pin 7 |
| 59 | | | | | | | | |
| 60 | | PrtSc * --- PA2/Field Mark - Right -- /a ----- Center - Unused ---- J9 pin 2 - Z7 pin 3 |
| 61 | | | | | | | | |
| 62 | | |
| 63 | | The 'Return', 'Backspace, 'Pad 0', 'Right Shift', 'Pad +' keys on the keyboard |
| 64 | | are attached to two switches. The keys appear twice in the keyboard matrix. |
| 65 | | |
| 66 | | ***************************************************************************/ |
| 67 | | |
| 68 | | #include "emu.h" |
| 69 | | #include "kb_keytro.h" |
| 70 | | #include "cpu/mcs51/mcs51.h" |
| 71 | | |
| 72 | | |
| 73 | | /*************************************************************************** |
| 74 | | CONSTANTS |
| 75 | | ***************************************************************************/ |
| 76 | | |
| 77 | | #define LOG 0 |
| 78 | | |
| 79 | | |
| 80 | | /*************************************************************************** |
| 81 | | TYPE DEFINITIONS |
| 82 | | ***************************************************************************/ |
| 83 | | |
| 84 | | struct kb_keytr_state |
| 85 | | { |
| 86 | | device_t *cpu; |
| 87 | | |
| 88 | | devcb_resolved_write_line out_clock_func; |
| 89 | | devcb_resolved_write_line out_data_func; |
| 90 | | |
| 91 | | /* state of i/o signals */ |
| 92 | | int clock_signal; |
| 93 | | int data_signal; |
| 94 | | |
| 95 | | /* internal state */ |
| 96 | | UINT8 p1; |
| 97 | | UINT8 p1_data; |
| 98 | | UINT8 p2; |
| 99 | | UINT8 p3; |
| 100 | | UINT16 last_write_addr; |
| 101 | | }; |
| 102 | | |
| 103 | | |
| 104 | | /***************************************************************************** |
| 105 | | INPUT PORTS |
| 106 | | *****************************************************************************/ |
| 107 | | |
| 108 | | static INPUT_PORTS_START( kb_keytronic_common ) |
| 109 | | |
| 110 | | PORT_START( "kb_keytronic_0f" ) |
| 111 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') /* 06 */ |
| 112 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') /* 05 */ |
| 113 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') /* 14 */ |
| 114 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') /* 13 */ |
| 115 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') /* 22 */ |
| 116 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') /* 21 */ |
| 117 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 (IRMA)") /* 41 */ |
| 118 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6a?") /* 6a */ |
| 119 | | |
| 120 | | PORT_START( "kb_keytronic_30_0" ) |
| 121 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') /* 31 */ |
| 122 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') /* 32 */ |
| 123 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') /* 30 */ |
| 124 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') /* 2f */ |
| 125 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') /* 2e */ |
| 126 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') /* 33 */ |
| 127 | | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 128 | | |
| 129 | | PORT_START( "kb_keytronic_30_1" ) |
| 130 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) /* 58 */ |
| 131 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) /* 59 */ |
| 132 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) /* 5a */ |
| 133 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) /* 5b */ |
| 134 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) /* 5c */ |
| 135 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) /* 5d */ |
| 136 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6b?") /* 6b */ |
| 137 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 (IRMA)") /* 42 */ |
| 138 | | |
| 139 | | PORT_START( "kb_keytronic_31_0" ) |
| 140 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') /* 07 */ |
| 141 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') /* 08 */ |
| 142 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') /* 15 */ |
| 143 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') /* 16 */ |
| 144 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') /* 23 */ |
| 145 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') /* 24 */ |
| 146 | | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 147 | | |
| 148 | | PORT_START( "kb_keytronic_31_1" ) |
| 149 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) /* 37 */ |
| 150 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) /* 5f */ |
| 151 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("LShift") /* 2a */ |
| 152 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("<") /* 70 */ |
| 153 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') /* 2c */ |
| 154 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') /* 2d */ |
| 155 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6c?") /* 6c */ |
| 156 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 (IRMA)") /* 43 */ |
| 157 | | |
| 158 | | PORT_START( "kb_keytronic_32_0" ) |
| 159 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') /* 0a */ |
| 160 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') /* 09 */ |
| 161 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') /* 18 */ |
| 162 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') /* 17 */ |
| 163 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') /* 26 */ |
| 164 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') /* 25 */ |
| 165 | | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 166 | | |
| 167 | | PORT_START( "kb_keytronic_32_1" ) |
| 168 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) /* 57 */ |
| 169 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) /* 1d */ |
| 170 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) /* 71 */ |
| 171 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_NAME("LAlt") /* 38 */ |
| 172 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') /* 39 */ |
| 173 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_NAME("RAlt") /* 38 */ |
| 174 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?69?") /* 69 */ |
| 175 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6 (IRMA)") /* 40 */ |
| 176 | | |
| 177 | | PORT_START( "kb_keytronic_33_0" ) |
| 178 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("KP 2") /* 50 */ |
| 179 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_END) PORT_NAME("KP 1") /* 4f */ |
| 180 | | PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 181 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Down") /* 55 */ |
| 182 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") /* 75 */ |
| 183 | | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 184 | | |
| 185 | | PORT_START( "kb_keytronic_33_1" ) |
| 186 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') /* 02 */ |
| 187 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') /* 29 */ |
| 188 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') /* 10 */ |
| 189 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) /* 0f */ |
| 190 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') /* 1e */ |
| 191 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("Caps") /* 3a */ |
| 192 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?68?") /* 68 */ |
| 193 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5 (IRMA)") /* 3f */ |
| 194 | | |
| 195 | | PORT_START( "kb_keytronic_34_0" ) |
| 196 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 197 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') /* 35 */ |
| 198 | | PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) /* 36 */ |
| 199 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left") /* 56 */ |
| 200 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') /* 34 */ |
| 201 | | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 202 | | |
| 203 | | PORT_START( "kb_keytronic_34_1" ) |
| 204 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') /* 02 */ |
| 205 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') /* 03 */ |
| 206 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') /* 11 */ |
| 207 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') /* 12 */ |
| 208 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') /* 1f */ |
| 209 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') /* 20 */ |
| 210 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?67?") /* 67 */ |
| 211 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 (IRMA)") /* 3e */ |
| 212 | | |
| 213 | | PORT_START( "kb_keytronic_35_0" ) |
| 214 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') /* 0b */ |
| 215 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') /* 0c */ |
| 216 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') /* 19 */ |
| 217 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') /* 1a */ |
| 218 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') /* 27 */ |
| 219 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') /* 28 */ |
| 220 | | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 221 | | |
| 222 | | PORT_START( "kb_keytronic_35_1" ) |
| 223 | | PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 224 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?66?") /* 66 */ |
| 225 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3 (IRMA)") /* 3d */ |
| 226 | | |
| 227 | | PORT_START( "kb_keytronic_36_0" ) |
| 228 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) /* 0e */ |
| 229 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') /* 0d */ |
| 230 | | PORT_BIT( 0x14, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) /* 1c */ |
| 231 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') /* 2b */ |
| 232 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') /* 1b */ |
| 233 | | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 234 | | |
| 235 | | PORT_START( "kb_keytronic_36_1" ) |
| 236 | | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 237 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2 (IRMA)") /* 3c */ |
| 238 | | |
| 239 | | PORT_START( "kb_keytronic_37_0" ) |
| 240 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PA1") /* 7b */ |
| 241 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("|<--") /* 7e */ |
| 242 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/a\\") /* 7a */ |
| 243 | | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("KP +") /* 4e */ |
| 244 | | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 245 | | |
| 246 | | PORT_START( "kb_keytronic_37_1" ) |
| 247 | | PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 248 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?64?") /* 64 */ |
| 249 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1 (IRMA)") /* 3b */ |
| 250 | | |
| 251 | | PORT_START( "kb_keytronic_38_0" ) |
| 252 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SysReq") /* 54 */ |
| 253 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) /*PORT_CODE(KEYCODE_SCRLOCK)*/ PORT_NAME("ScrLock") /* 46 */ |
| 254 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-->|") /* 7c */ |
| 255 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("KP 9") /* 49 */ |
| 256 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("KP -") /* 4a */ |
| 257 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("KP 6") /* 4d */ |
| 258 | | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 259 | | |
| 260 | | PORT_START( "kb_keytronic_39_0" ) |
| 261 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_NAME("Esc") /* 01 */ |
| 262 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_NAME("NumLock") /* 45 */ |
| 263 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_HOME) PORT_NAME("KP 7") /* 47 */ |
| 264 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_NAME("KP 8") /* 48 */ |
| 265 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("KP 4") /* 4b */ |
| 266 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("KP 5") /* 4c */ |
| 267 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?76?") /* 76 */ |
| 268 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?63?") /* 63 */ |
| 269 | | |
| 270 | | PORT_START( "kb_keytronic_3a_0" ) |
| 271 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PrtSc *") /* 6f */ |
| 272 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PA2") /* 7f */ |
| 273 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right") /* 7d */ |
| 274 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/a") /* 79 */ |
| 275 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Center") /* 77 */ |
| 276 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 277 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6e?") /* 6e */ |
| 278 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?62?") /* 62 */ |
| 279 | | |
| 280 | | PORT_START( "kb_keytronic_3b_0" ) |
| 281 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("KP 3") /* 51 */ |
| 282 | | PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("KP 0") /* 52 */ |
| 283 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("KP .") /* 53 */ |
| 284 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 285 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Up") /* 78 */ |
| 286 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6d?") /* 6d */ |
| 287 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 (IRMA)") /* 44 */ |
| 288 | | |
| 289 | | INPUT_PORTS_END |
| 290 | | |
| 291 | | |
| 292 | | static INPUT_PORTS_START( kb_keytronic_pc ) |
| 293 | | PORT_INCLUDE( kb_keytronic_common ) |
| 294 | | |
| 295 | | PORT_START( "kb_keytronic_0b" ) |
| 296 | | PORT_DIPNAME( 0x01, 0x01, "Protocol selection" ) |
| 297 | | PORT_DIPSETTING( 0x00, "Enhanced XT, AT and PS/2 models" ) |
| 298 | | PORT_DIPSETTING( 0x01, "Standard PC and XT" ) |
| 299 | | PORT_DIPNAME( 0x02, 0x00, "IRMA/Native scan code set" ) |
| 300 | | PORT_DIPSETTING( 0x00, "Native scan code set" ) |
| 301 | | PORT_DIPSETTING( 0x02, "IRMA Emulation" ) |
| 302 | | PORT_DIPNAME( 0x04, 0x04, "Enhanced 101/Native scan code set" ) |
| 303 | | PORT_DIPSETTING( 0x00, "Native scan code set" ) |
| 304 | | PORT_DIPSETTING( 0x04, "Enhanced 101 scan code set" ) |
| 305 | | PORT_DIPNAME( 0x08, 0x08, "Enable E0" ) |
| 306 | | PORT_DIPSETTING( 0x00, "Enable E0" ) |
| 307 | | PORT_DIPSETTING( 0x08, "Disable E0" ) |
| 308 | | PORT_DIPNAME( 0x10, 0x10, "Code tables" ) |
| 309 | | PORT_DIPSETTING( 0x00, "U.S. code tables" ) |
| 310 | | PORT_DIPSETTING( 0x10, "International code tables" ) |
| 311 | | PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 312 | | PORT_DIPNAME( 0x80, 0x80, "Key click" ) |
| 313 | | PORT_DIPSETTING( 0x00, "No key click" ) |
| 314 | | PORT_DIPSETTING( 0x80, "Key click" ) |
| 315 | | INPUT_PORTS_END |
| 316 | | |
| 317 | | |
| 318 | | static INPUT_PORTS_START( kb_keytronic_at ) |
| 319 | | |
| 320 | | PORT_INCLUDE( kb_keytronic_common ) |
| 321 | | |
| 322 | | PORT_START( "kb_keytronic_0b" ) |
| 323 | | PORT_DIPNAME( 0x01, 0x00, "Protocol selection" ) |
| 324 | | PORT_DIPSETTING( 0x00, "Enhanced XT, AT and PS/2 models" ) |
| 325 | | PORT_DIPSETTING( 0x01, "Standard PC and XT" ) |
| 326 | | PORT_DIPNAME( 0x02, 0x00, "IRMA/Native scan code set" ) |
| 327 | | PORT_DIPSETTING( 0x00, "Native scan code set" ) |
| 328 | | PORT_DIPSETTING( 0x02, "IRMA Emulation" ) |
| 329 | | PORT_DIPNAME( 0x04, 0x04, "Enhanced 101/Native scan code set" ) |
| 330 | | PORT_DIPSETTING( 0x00, "Native scan code set" ) |
| 331 | | PORT_DIPSETTING( 0x04, "Enhanced 101 scan code set" ) |
| 332 | | PORT_DIPNAME( 0x08, 0x00, "Enable E0" ) |
| 333 | | PORT_DIPSETTING( 0x00, "Enable E0" ) |
| 334 | | PORT_DIPSETTING( 0x08, "Disable E0" ) |
| 335 | | PORT_DIPNAME( 0x10, 0x10, "Code tables" ) |
| 336 | | PORT_DIPSETTING( 0x00, "U.S. code tables" ) |
| 337 | | PORT_DIPSETTING( 0x10, "International code tables" ) |
| 338 | | PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 339 | | PORT_DIPNAME( 0x80, 0x80, "Key click" ) |
| 340 | | PORT_DIPSETTING( 0x00, "No key click" ) |
| 341 | | PORT_DIPSETTING( 0x80, "Key click" ) |
| 342 | | INPUT_PORTS_END |
| 343 | | |
| 344 | | |
| 345 | | /*************************************************************************** |
| 346 | | ROM DEFINITIONS |
| 347 | | ***************************************************************************/ |
| 348 | | |
| 349 | | ROM_START( kb_keytr ) |
| 350 | | ROM_REGION(0x2000, "kb_keytr", 0) |
| 351 | | ROM_LOAD("14166.bin", 0x0000, 0x2000, CRC(1aea1b53) SHA1(b75b6d4509036406052157bc34159f7039cdc72e)) |
| 352 | | ROM_END |
| 353 | | |
| 354 | | |
| 355 | | //************************************************************************** |
| 356 | | // GLOBAL VARIABLES |
| 357 | | //************************************************************************** |
| 358 | | |
| 359 | | const device_type PC_KBD_KEYTRONIC_PC3270 = &device_creator<pc_kbd_keytronic_pc3270_device>; |
| 360 | | const device_type PC_KBD_KEYTRONIC_PC3270_AT = &device_creator<pc_kbd_keytronic_pc3270_at_device>; |
| 361 | | |
| 362 | | |
| 363 | | /***************************************************************************** |
| 364 | | ADDRESS MAPS |
| 365 | | *****************************************************************************/ |
| 366 | | |
| 367 | | static ADDRESS_MAP_START( keytronic_pc3270_program, AS_PROGRAM, 8, pc_kbd_keytronic_pc3270_device ) |
| 368 | | AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("kb_keytr", 0) |
| 369 | | ADDRESS_MAP_END |
| 370 | | |
| 371 | | static ADDRESS_MAP_START( keytronic_pc3270_io, AS_IO, 8, pc_kbd_keytronic_pc3270_device ) |
| 372 | | AM_RANGE(0x0000, 0xffff) AM_READWRITE(internal_data_read, internal_data_write) |
| 373 | | AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READWRITE(p1_read, p1_write) |
| 374 | | AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_READWRITE(p2_read, p2_write) |
| 375 | | AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_read, p3_write) |
| 376 | | ADDRESS_MAP_END |
| 377 | | |
| 378 | | |
| 379 | | /***************************************************************************** |
| 380 | | MACHINE CONFIG |
| 381 | | *****************************************************************************/ |
| 382 | | |
| 383 | | MACHINE_CONFIG_FRAGMENT( keytronic_pc3270 ) |
| 384 | | MCFG_CPU_ADD("kb_keytr", I8051, 11060250) |
| 385 | | MCFG_CPU_PROGRAM_MAP(keytronic_pc3270_program) |
| 386 | | MCFG_CPU_IO_MAP(keytronic_pc3270_io) |
| 387 | | MACHINE_CONFIG_END |
| 388 | | |
| 389 | | |
| 390 | | /*************************************************************************** |
| 391 | | ROM DEFINITIONS |
| 392 | | ***************************************************************************/ |
| 393 | | |
| 394 | | ROM_START( keytronic_pc3270 ) |
| 395 | | ROM_REGION(0x2000, "kb_keytr", 0) |
| 396 | | ROM_LOAD("14166.bin", 0x0000, 0x2000, CRC(1aea1b53) SHA1(b75b6d4509036406052157bc34159f7039cdc72e)) |
| 397 | | ROM_END |
| 398 | | |
| 399 | | |
| 400 | | pc_kbd_keytronic_pc3270_device::pc_kbd_keytronic_pc3270_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 401 | | device_t(mconfig, PC_KBD_KEYTRONIC_PC3270, "Keytronic PC3270", tag, owner, clock, "keytronic_pc3270", __FILE__), |
| 402 | | device_pc_kbd_interface(mconfig, *this), |
| 403 | | m_cpu(*this, "kb_keytr") |
| 404 | | { |
| 405 | | } |
| 406 | | |
| 407 | | |
| 408 | | //------------------------------------------------- |
| 409 | | // device_start - device-specific startup |
| 410 | | //------------------------------------------------- |
| 411 | | void pc_kbd_keytronic_pc3270_device::device_start() |
| 412 | | { |
| 413 | | set_pc_kbdc_device(); |
| 414 | | |
| 415 | | /* setup savestates */ |
| 416 | | save_item(NAME(m_p1)); |
| 417 | | save_item(NAME(m_p1_data)); |
| 418 | | save_item(NAME(m_p2)); |
| 419 | | save_item(NAME(m_p3)); |
| 420 | | save_item(NAME(m_last_write_addr)); |
| 421 | | } |
| 422 | | |
| 423 | | |
| 424 | | //------------------------------------------------- |
| 425 | | // device_reset - device-specific reset |
| 426 | | //------------------------------------------------- |
| 427 | | void pc_kbd_keytronic_pc3270_device::device_reset() |
| 428 | | { |
| 429 | | /* set default values */ |
| 430 | | m_p3 = 0xff; |
| 431 | | m_last_write_addr = 0; |
| 432 | | } |
| 433 | | |
| 434 | | |
| 435 | | //------------------------------------------------- |
| 436 | | // machine_config_additions - device-specific |
| 437 | | // machine configurations |
| 438 | | //------------------------------------------------- |
| 439 | | |
| 440 | | machine_config_constructor pc_kbd_keytronic_pc3270_device::device_mconfig_additions() const |
| 441 | | { |
| 442 | | return MACHINE_CONFIG_NAME( keytronic_pc3270 ); |
| 443 | | } |
| 444 | | |
| 445 | | |
| 446 | | ioport_constructor pc_kbd_keytronic_pc3270_device::device_input_ports() const |
| 447 | | { |
| 448 | | return INPUT_PORTS_NAME( kb_keytronic_pc ); |
| 449 | | } |
| 450 | | |
| 451 | | |
| 452 | | ioport_constructor pc_kbd_keytronic_pc3270_at_device::device_input_ports() const |
| 453 | | { |
| 454 | | return INPUT_PORTS_NAME( kb_keytronic_at ); |
| 455 | | } |
| 456 | | |
| 457 | | |
| 458 | | //------------------------------------------------- |
| 459 | | // rom_region - device-specific ROM region |
| 460 | | //------------------------------------------------- |
| 461 | | |
| 462 | | const rom_entry *pc_kbd_keytronic_pc3270_device::device_rom_region() const |
| 463 | | { |
| 464 | | return ROM_NAME( keytronic_pc3270 ); |
| 465 | | } |
| 466 | | |
| 467 | | |
| 468 | | WRITE_LINE_MEMBER( pc_kbd_keytronic_pc3270_device::clock_write ) |
| 469 | | { |
| 470 | | m_cpu->set_input_line(MCS51_INT0_LINE, state ); |
| 471 | | } |
| 472 | | |
| 473 | | |
| 474 | | WRITE_LINE_MEMBER( pc_kbd_keytronic_pc3270_device::data_write ) |
| 475 | | { |
| 476 | | m_cpu->set_input_line(MCS51_T0_LINE, state); |
| 477 | | } |
| 478 | | |
| 479 | | |
| 480 | | READ8_MEMBER( pc_kbd_keytronic_pc3270_device::internal_data_read ) |
| 481 | | { |
| 482 | | if (LOG) |
| 483 | | logerror("keytronic_pc3270::internal_data_read(): read from %04x\n", offset); |
| 484 | | |
| 485 | | if ( m_pc_kbdc ) |
| 486 | | { |
| 487 | | m_pc_kbdc->data_write_from_kb( BIT(offset, 8) ); |
| 488 | | m_pc_kbdc->clock_write_from_kb( BIT(offset, 9) ); |
| 489 | | } |
| 490 | | |
| 491 | | return 0xff; |
| 492 | | } |
| 493 | | |
| 494 | | |
| 495 | | WRITE8_MEMBER( pc_kbd_keytronic_pc3270_device::internal_data_write ) |
| 496 | | { |
| 497 | | if (LOG) |
| 498 | | logerror("keytronic_pc3270::internal_data_write(): write to offset %04x\n", offset); |
| 499 | | |
| 500 | | /* Check for low->high transition on AD8 */ |
| 501 | | if ( ! ( m_last_write_addr & 0x0100 ) && ( offset & 0x0100 ) ) |
| 502 | | { |
| 503 | | switch (m_p1) |
| 504 | | { |
| 505 | | case 0x0e: |
| 506 | | break; |
| 507 | | case 0x0f: |
| 508 | | m_p1_data = ioport("kb_keytronic_0f")->read(); |
| 509 | | break; |
| 510 | | case 0x30: |
| 511 | | m_p1_data = ioport("kb_keytronic_30_0")->read(); |
| 512 | | break; |
| 513 | | case 0x31: |
| 514 | | m_p1_data = ioport("kb_keytronic_31_0")->read(); |
| 515 | | break; |
| 516 | | case 0x32: |
| 517 | | m_p1_data = ioport("kb_keytronic_32_0")->read(); |
| 518 | | break; |
| 519 | | case 0x33: |
| 520 | | m_p1_data = ioport("kb_keytronic_33_0")->read(); |
| 521 | | break; |
| 522 | | case 0x34: |
| 523 | | m_p1_data = ioport("kb_keytronic_34_0")->read(); |
| 524 | | break; |
| 525 | | case 0x35: |
| 526 | | m_p1_data = ioport("kb_keytronic_35_0")->read(); |
| 527 | | break; |
| 528 | | case 0x36: |
| 529 | | m_p1_data = ioport("kb_keytronic_36_0")->read(); |
| 530 | | break; |
| 531 | | case 0x37: |
| 532 | | m_p1_data = ioport("kb_keytronic_37_0")->read() | (ioport("kb_keytronic_36_0")->read() & 0x01); |
| 533 | | break; |
| 534 | | case 0x38: |
| 535 | | m_p1_data = ioport("kb_keytronic_38_0")->read(); |
| 536 | | break; |
| 537 | | case 0x39: |
| 538 | | m_p1_data = ioport("kb_keytronic_39_0")->read(); |
| 539 | | break; |
| 540 | | case 0x3a: |
| 541 | | m_p1_data = ioport("kb_keytronic_3a_0")->read(); |
| 542 | | break; |
| 543 | | case 0x3b: |
| 544 | | m_p1_data = ioport("kb_keytronic_3b_0")->read(); |
| 545 | | break; |
| 546 | | } |
| 547 | | } |
| 548 | | |
| 549 | | /* Check for low->high transition on AD9 */ |
| 550 | | if ( ! ( m_last_write_addr & 0x0200 ) && ( offset & 0x0200 ) ) |
| 551 | | { |
| 552 | | switch (m_p1) |
| 553 | | { |
| 554 | | case 0x0b: |
| 555 | | m_p1_data = ioport("kb_keytronic_0b")->read(); |
| 556 | | break; |
| 557 | | case 0x30: |
| 558 | | m_p1_data = ioport("kb_keytronic_30_1")->read(); |
| 559 | | break; |
| 560 | | case 0x31: |
| 561 | | m_p1_data = ioport("kb_keytronic_31_1")->read(); |
| 562 | | break; |
| 563 | | case 0x32: |
| 564 | | m_p1_data = ioport("kb_keytronic_32_1")->read(); |
| 565 | | break; |
| 566 | | case 0x33: |
| 567 | | m_p1_data = ioport("kb_keytronic_33_1")->read(); |
| 568 | | break; |
| 569 | | case 0x34: |
| 570 | | m_p1_data = ioport("kb_keytronic_34_1")->read(); |
| 571 | | break; |
| 572 | | case 0x35: |
| 573 | | m_p1_data = ioport("kb_keytronic_35_1")->read(); |
| 574 | | break; |
| 575 | | case 0x36: |
| 576 | | m_p1_data = ioport("kb_keytronic_36_1")->read(); |
| 577 | | break; |
| 578 | | case 0x37: |
| 579 | | m_p1_data = ioport("kb_keytronic_37_1")->read(); |
| 580 | | break; |
| 581 | | case 0x38: |
| 582 | | m_p1_data = 0xff; |
| 583 | | break; |
| 584 | | case 0x39: |
| 585 | | m_p1_data = 0xff; |
| 586 | | break; |
| 587 | | case 0x3a: |
| 588 | | m_p1_data = 0xff; |
| 589 | | break; |
| 590 | | } |
| 591 | | } |
| 592 | | |
| 593 | | m_last_write_addr = offset; |
| 594 | | } |
| 595 | | |
| 596 | | |
| 597 | | READ8_MEMBER( pc_kbd_keytronic_pc3270_device::p1_read ) |
| 598 | | { |
| 599 | | return m_p1 & m_p1_data; |
| 600 | | } |
| 601 | | |
| 602 | | |
| 603 | | WRITE8_MEMBER( pc_kbd_keytronic_pc3270_device::p1_write ) |
| 604 | | { |
| 605 | | if (LOG) |
| 606 | | logerror("keytronic_pc3270::p1_write(): write %02x\n", data); |
| 607 | | |
| 608 | | m_p1 = data; |
| 609 | | } |
| 610 | | |
| 611 | | |
| 612 | | READ8_MEMBER( pc_kbd_keytronic_pc3270_device::p2_read ) |
| 613 | | { |
| 614 | | return m_p2; |
| 615 | | } |
| 616 | | |
| 617 | | |
| 618 | | WRITE8_MEMBER( pc_kbd_keytronic_pc3270_device::p2_write ) |
| 619 | | { |
| 620 | | if (LOG) |
| 621 | | logerror("keytronic_pc3270::p2_write(): write %02x\n", data); |
| 622 | | |
| 623 | | m_p2 = data; |
| 624 | | } |
| 625 | | |
| 626 | | |
| 627 | | READ8_MEMBER( pc_kbd_keytronic_pc3270_device::p3_read ) |
| 628 | | { |
| 629 | | UINT8 data = m_p3; |
| 630 | | |
| 631 | | data &= ~0x14; |
| 632 | | |
| 633 | | /* -INT0 signal */ |
| 634 | | data |= (clock_signal() ? 0x04 : 0x00); |
| 635 | | |
| 636 | | /* T0 signal */ |
| 637 | | data |= (data_signal() ? 0x00 : 0x10); |
| 638 | | |
| 639 | | return data; |
| 640 | | } |
| 641 | | |
| 642 | | |
| 643 | | WRITE8_MEMBER( pc_kbd_keytronic_pc3270_device::p3_write ) |
| 644 | | { |
| 645 | | if (LOG) |
| 646 | | logerror("keytronic_pc3270::p3_write(): write %02x\n", data); |
| 647 | | |
| 648 | | m_p3 = data; |
| 649 | | } |
trunk/src/mess/machine/kb_msnat.c
| r26017 | r26018 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | Microsoft Natural Keybaord emulation |
| 4 | | |
| 5 | | |
| 6 | | TODO: |
| 7 | | - Keyboard LEDs |
| 8 | | |
| 9 | | ***************************************************************************/ |
| 10 | | |
| 11 | | #include "emu.h" |
| 12 | | #include "machine/kb_msnat.h" |
| 13 | | #include "cpu/mcs51/mcs51.h" |
| 14 | | |
| 15 | | |
| 16 | | /*************************************************************************** |
| 17 | | ONSTANTS |
| 18 | | ***************************************************************************/ |
| 19 | | |
| 20 | | #define LOG 0 |
| 21 | | |
| 22 | | |
| 23 | | /***************************************************************************** |
| 24 | | INPUT PORTS |
| 25 | | *****************************************************************************/ |
| 26 | | |
| 27 | | static INPUT_PORTS_START( microsoft_natural ) |
| 28 | | PORT_START( "P2.0" ) |
| 29 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') // 15 |
| 30 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') // 23 |
| 31 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') // 24 |
| 32 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') // 31 |
| 33 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') // 32 |
| 34 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') // 16 |
| 35 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') // 07 |
| 36 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') // 08 |
| 37 | | |
| 38 | | PORT_START( "P2.1" ) |
| 39 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') // 0D |
| 40 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') // 1B |
| 41 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') // 2B 2 spots for backslash? |
| 42 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) // E0 4B |
| 43 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // 1C |
| 44 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) // 0E |
| 45 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) // 3F |
| 46 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) // 40 |
| 47 | | |
| 48 | | PORT_START( "P2.2" ) |
| 49 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') // 0A |
| 50 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') // 18 |
| 51 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') // 1A |
| 52 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') // 26 |
| 53 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') // 34 |
| 54 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') // 0C |
| 55 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) // 41 |
| 56 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) // 42 |
| 57 | | |
| 58 | | PORT_START( "P2.3" ) |
| 59 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') // 0B |
| 60 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') // 27 |
| 61 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') // 28 |
| 62 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') // 35 |
| 63 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // E0 50 |
| 64 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') // 19 |
| 65 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) // 43 |
| 66 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) // 44 |
| 67 | | |
| 68 | | PORT_START( "P2.4" ) |
| 69 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // E0 48 |
| 70 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 71 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Unknown 73") // 73 TODO |
| 72 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ 2nd?") // 2B 2 spots for backslash?? |
| 73 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 74 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RWIN) PORT_CHAR(UCHAR_MAMEKEY(RWIN)) // E0 5C |
| 75 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // E0 4D |
| 76 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') // 39 |
| 77 | | |
| 78 | | PORT_START( "P2.5" ) |
| 79 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // E0 47 |
| 80 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) // 48 |
| 81 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) // 4C |
| 82 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) // 50 |
| 83 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) // 52 |
| 84 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) // E0 4F |
| 85 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) // 57 |
| 86 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) // 58 |
| 87 | | |
| 88 | | PORT_START( "P2.6" ) |
| 89 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) // E0 52 |
| 90 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) // E0 53 |
| 91 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) // 4D |
| 92 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) // 51 |
| 93 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) // 53 |
| 94 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) // 49 |
| 95 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) // 3D |
| 96 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) // 3E |
| 97 | | |
| 98 | | PORT_START( "P2.7" ) |
| 99 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) // E0 |
| 100 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) // 47 |
| 101 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) // 4B |
| 102 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) // 4E |
| 103 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) // 4F |
| 104 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) // 37 TODO |
| 105 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PRTSCR) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) // E0 2A E0 37 |
| 106 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MENU) PORT_CHAR(UCHAR_MAMEKEY(MENU)) // E0 5D |
| 107 | | |
| 108 | | PORT_START( "P1.0" ) |
| 109 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LWIN) PORT_CHAR(UCHAR_MAMEKEY(LWIN)) // E0 5B |
| 110 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 111 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INT5 7E") // 7E INT5 |
| 112 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 113 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 114 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 115 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) // 46 |
| 116 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) // E0 1C |
| 117 | | |
| 118 | | PORT_START( "P1.1" ) |
| 119 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 120 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // 1D |
| 121 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 122 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 123 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) // E0 1D |
| 124 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // 3A |
| 125 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 126 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 127 | | |
| 128 | | PORT_START( "P1.2" ) |
| 129 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) // E0 49 |
| 130 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') // 03 |
| 131 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') // 11 |
| 132 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') // 1F |
| 133 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') // 2D |
| 134 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) // E0 51 |
| 135 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) // 3B |
| 136 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) // 3C |
| 137 | | |
| 138 | | PORT_START( "P1.3" ) |
| 139 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 140 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 141 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) // 38 |
| 142 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) // E0 38 |
| 143 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 144 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 145 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) // 4A |
| 146 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) // 45 |
| 147 | | |
| 148 | | PORT_START( "P1.4" ) |
| 149 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') // 17 |
| 150 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') // 25 |
| 151 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') // 20 |
| 152 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') // 2E |
| 153 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') // 33 |
| 154 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') // 12 |
| 155 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') // 04 |
| 156 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') // 09 |
| 157 | | |
| 158 | | PORT_START( "P1.5" ) |
| 159 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') // 13 |
| 160 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') // 21 |
| 161 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') // 22 |
| 162 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') // 2F |
| 163 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') // 30 |
| 164 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') // 14 |
| 165 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') // 05 |
| 166 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') // 06 |
| 167 | | |
| 168 | | PORT_START( "P1.6" ) |
| 169 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') // 02 |
| 170 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') // 10 |
| 171 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') // 1E |
| 172 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INT1 56") // 56 INT1? |
| 173 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') // 2C |
| 174 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) // 0F |
| 175 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) // 01 |
| 176 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') // 29 |
| 177 | | |
| 178 | | PORT_START( "P1.7" ) |
| 179 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 180 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) // 2A |
| 181 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 182 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 183 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) // 36 |
| 184 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 185 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CANCEL) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) // E1 1D 45 E1 9D C5 |
| 186 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // FF |
| 187 | | |
| 188 | | INPUT_PORTS_END |
| 189 | | |
| 190 | | |
| 191 | | //************************************************************************** |
| 192 | | // GLOBAL VARIABLES |
| 193 | | //************************************************************************** |
| 194 | | |
| 195 | | const device_type PC_KBD_MICROSOFT_NATURAL = &device_creator<pc_kbd_microsoft_natural_device>; |
| 196 | | |
| 197 | | /***************************************************************************** |
| 198 | | ADDRESS MAPS |
| 199 | | *****************************************************************************/ |
| 200 | | |
| 201 | | static ADDRESS_MAP_START( microsoft_natural_io, AS_IO, 8, pc_kbd_microsoft_natural_device ) |
| 202 | | AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P0) AM_READWRITE(p0_read, p0_write) |
| 203 | | AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_WRITE(p1_write) |
| 204 | | AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_WRITE(p2_write) |
| 205 | | AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_read, p3_write) |
| 206 | | ADDRESS_MAP_END |
| 207 | | |
| 208 | | |
| 209 | | /***************************************************************************** |
| 210 | | MACHINE CONFIG |
| 211 | | *****************************************************************************/ |
| 212 | | |
| 213 | | MACHINE_CONFIG_FRAGMENT( microsoft_natural ) |
| 214 | | MCFG_CPU_ADD("ms_natrl_cpu", I8051, XTAL_6MHz) |
| 215 | | MCFG_CPU_IO_MAP(microsoft_natural_io) |
| 216 | | MACHINE_CONFIG_END |
| 217 | | |
| 218 | | |
| 219 | | /*************************************************************************** |
| 220 | | ROM DEFINITIONS |
| 221 | | ***************************************************************************/ |
| 222 | | |
| 223 | | ROM_START( microsoft_natural ) |
| 224 | | ROM_REGION(0x1000, "ms_natrl_cpu", 0) |
| 225 | | ROM_LOAD("natural.bin", 0x0000, 0x1000, CRC(aa8243ab) SHA1(72134882a5c03e785db07cc54dfb7572c0a730d9)) |
| 226 | | ROM_END |
| 227 | | |
| 228 | | |
| 229 | | pc_kbd_microsoft_natural_device::pc_kbd_microsoft_natural_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 230 | | : device_t(mconfig, PC_KBD_MICROSOFT_NATURAL, "Microsoft Natural Keyboard", tag, owner, clock, "ms_natural", __FILE__) |
| 231 | | , device_pc_kbd_interface(mconfig, *this) |
| 232 | | , m_cpu(*this, "ms_natrl_cpu") |
| 233 | | , m_p2_0(*this, "P2.0") |
| 234 | | , m_p2_1(*this, "P2.1") |
| 235 | | , m_p2_2(*this, "P2.2") |
| 236 | | , m_p2_3(*this, "P2.3") |
| 237 | | , m_p2_4(*this, "P2.4") |
| 238 | | , m_p2_5(*this, "P2.5") |
| 239 | | , m_p2_6(*this, "P2.6") |
| 240 | | , m_p2_7(*this, "P2.7") |
| 241 | | , m_p1_0(*this, "P1.0") |
| 242 | | , m_p1_1(*this, "P1.1") |
| 243 | | , m_p1_2(*this, "P1.2") |
| 244 | | , m_p1_3(*this, "P1.3") |
| 245 | | , m_p1_4(*this, "P1.4") |
| 246 | | , m_p1_5(*this, "P1.5") |
| 247 | | , m_p1_6(*this, "P1.6") |
| 248 | | , m_p1_7(*this, "P1.7") |
| 249 | | { |
| 250 | | } |
| 251 | | |
| 252 | | |
| 253 | | //------------------------------------------------- |
| 254 | | // device_start - device-specific startup |
| 255 | | //------------------------------------------------- |
| 256 | | void pc_kbd_microsoft_natural_device::device_start() |
| 257 | | { |
| 258 | | set_pc_kbdc_device(); |
| 259 | | |
| 260 | | /* setup savestates */ |
| 261 | | save_item(NAME(m_p0)); |
| 262 | | save_item(NAME(m_p1)); |
| 263 | | save_item(NAME(m_p2)); |
| 264 | | save_item(NAME(m_p3)); |
| 265 | | } |
| 266 | | |
| 267 | | |
| 268 | | //------------------------------------------------- |
| 269 | | // device_reset - device-specific reset |
| 270 | | //------------------------------------------------- |
| 271 | | void pc_kbd_microsoft_natural_device::device_reset() |
| 272 | | { |
| 273 | | /* set default values */ |
| 274 | | } |
| 275 | | |
| 276 | | |
| 277 | | //------------------------------------------------- |
| 278 | | // machine_config_additions - device-specific |
| 279 | | // machine configurations |
| 280 | | //------------------------------------------------- |
| 281 | | |
| 282 | | machine_config_constructor pc_kbd_microsoft_natural_device::device_mconfig_additions() const |
| 283 | | { |
| 284 | | return MACHINE_CONFIG_NAME( microsoft_natural ); |
| 285 | | } |
| 286 | | |
| 287 | | |
| 288 | | ioport_constructor pc_kbd_microsoft_natural_device::device_input_ports() const |
| 289 | | { |
| 290 | | return INPUT_PORTS_NAME( microsoft_natural ); |
| 291 | | } |
| 292 | | |
| 293 | | |
| 294 | | //------------------------------------------------- |
| 295 | | // rom_region - device-specific ROM region |
| 296 | | //------------------------------------------------- |
| 297 | | |
| 298 | | const rom_entry *pc_kbd_microsoft_natural_device::device_rom_region() const |
| 299 | | { |
| 300 | | return ROM_NAME( microsoft_natural ); |
| 301 | | } |
| 302 | | |
| 303 | | |
| 304 | | WRITE_LINE_MEMBER( pc_kbd_microsoft_natural_device::clock_write ) |
| 305 | | { |
| 306 | | } |
| 307 | | |
| 308 | | |
| 309 | | WRITE_LINE_MEMBER( pc_kbd_microsoft_natural_device::data_write ) |
| 310 | | { |
| 311 | | } |
| 312 | | |
| 313 | | |
| 314 | | READ8_MEMBER( pc_kbd_microsoft_natural_device::p0_read ) |
| 315 | | { |
| 316 | | UINT8 data = 0xFF; |
| 317 | | |
| 318 | | if (LOG) |
| 319 | | logerror("%s: P0 read. P1 = %02x, P2 = %02x\n", tag(), m_p1, m_p2 ); |
| 320 | | |
| 321 | | if ( ! ( m_p2 & 0x01 ) ) |
| 322 | | { |
| 323 | | data &= m_p2_0->read(); |
| 324 | | } |
| 325 | | |
| 326 | | if ( ! ( m_p2 & 0x02 ) ) |
| 327 | | { |
| 328 | | data &= m_p2_1->read(); |
| 329 | | } |
| 330 | | |
| 331 | | if ( ! ( m_p2 & 0x04 ) ) |
| 332 | | { |
| 333 | | data &= m_p2_2->read(); |
| 334 | | } |
| 335 | | |
| 336 | | if ( ! ( m_p2 & 0x08 ) ) |
| 337 | | { |
| 338 | | data &= m_p2_3->read(); |
| 339 | | } |
| 340 | | |
| 341 | | if ( ! ( m_p2 & 0x10 ) ) |
| 342 | | { |
| 343 | | data &= m_p2_4->read(); |
| 344 | | } |
| 345 | | |
| 346 | | if ( ! ( m_p2 & 0x20 ) ) |
| 347 | | { |
| 348 | | data &= m_p2_5->read(); |
| 349 | | } |
| 350 | | |
| 351 | | if ( ! ( m_p2 & 0x40 ) ) |
| 352 | | { |
| 353 | | data &= m_p2_6->read(); |
| 354 | | } |
| 355 | | |
| 356 | | if ( ! ( m_p2 & 0x80 ) ) |
| 357 | | { |
| 358 | | data &= m_p2_7->read(); |
| 359 | | } |
| 360 | | |
| 361 | | if ( ! ( m_p1 & 0x01 ) ) |
| 362 | | { |
| 363 | | data &= m_p1_0->read(); |
| 364 | | } |
| 365 | | |
| 366 | | if ( ! ( m_p1 & 0x02 ) ) |
| 367 | | { |
| 368 | | data &= m_p1_1->read(); |
| 369 | | } |
| 370 | | |
| 371 | | if ( ! ( m_p1 & 0x04 ) ) |
| 372 | | { |
| 373 | | data &= m_p1_2->read(); |
| 374 | | } |
| 375 | | |
| 376 | | if ( ! ( m_p1 & 0x08 ) ) |
| 377 | | { |
| 378 | | data &= m_p1_3->read(); |
| 379 | | } |
| 380 | | |
| 381 | | if ( ! ( m_p1 & 0x10 ) ) |
| 382 | | { |
| 383 | | data &= m_p1_4->read(); |
| 384 | | } |
| 385 | | |
| 386 | | if ( ! ( m_p1 & 0x20 ) ) |
| 387 | | { |
| 388 | | data &= m_p1_5->read(); |
| 389 | | } |
| 390 | | |
| 391 | | if ( ! ( m_p1 & 0x40 ) ) |
| 392 | | { |
| 393 | | data &= m_p1_6->read(); |
| 394 | | } |
| 395 | | |
| 396 | | if ( ! ( m_p1 & 0x80 ) ) |
| 397 | | { |
| 398 | | data &= m_p1_7->read(); |
| 399 | | } |
| 400 | | |
| 401 | | return data; |
| 402 | | } |
| 403 | | |
| 404 | | |
| 405 | | WRITE8_MEMBER( pc_kbd_microsoft_natural_device::p0_write ) |
| 406 | | { |
| 407 | | m_p0 = data; |
| 408 | | } |
| 409 | | |
| 410 | | |
| 411 | | WRITE8_MEMBER( pc_kbd_microsoft_natural_device::p1_write ) |
| 412 | | { |
| 413 | | m_p1 = data; |
| 414 | | } |
| 415 | | |
| 416 | | |
| 417 | | WRITE8_MEMBER( pc_kbd_microsoft_natural_device::p2_write ) |
| 418 | | { |
| 419 | | m_p2 = data; |
| 420 | | } |
| 421 | | |
| 422 | | |
| 423 | | READ8_MEMBER( pc_kbd_microsoft_natural_device::p3_read ) |
| 424 | | { |
| 425 | | UINT8 data = m_p3 & ~0x21; |
| 426 | | |
| 427 | | // (Incoming) Clock signal is tied to the T1/P3.5 pin |
| 428 | | data |= (clock_signal() ? 0x20 : 0x00); |
| 429 | | |
| 430 | | // (Incoming) Data signal is tied to the RXD/P3.0 pin |
| 431 | | data |= ( data_signal() ? 0x01 : 0x00 ); |
| 432 | | |
| 433 | | return data; |
| 434 | | } |
| 435 | | |
| 436 | | |
| 437 | | WRITE8_MEMBER( pc_kbd_microsoft_natural_device::p3_write ) |
| 438 | | { |
| 439 | | if ( m_pc_kbdc ) |
| 440 | | { |
| 441 | | // (Outgoing) data signal is tied to the WR/P3.6 pin |
| 442 | | m_pc_kbdc->data_write_from_kb( BIT(data, 6) ); |
| 443 | | |
| 444 | | // (Outgoing) clock signal is tied to the T0/P3.4 pin |
| 445 | | m_pc_kbdc->clock_write_from_kb( BIT(data, 4) ); |
| 446 | | } |
| 447 | | |
| 448 | | m_p3 = data; |
| 449 | | } |
trunk/src/mess/machine/kb_pcxt83.c
| r26017 | r26018 | |
| 1 | | // license:BSD-3-Clause |
| 2 | | // copyright-holders:Curt Coder |
| 3 | | /********************************************************************** |
| 4 | | |
| 5 | | IBM Model F PC/XT 83-key keyboard emulation |
| 6 | | |
| 7 | | Copyright MESS Team. |
| 8 | | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | | |
| 10 | | *********************************************************************/ |
| 11 | | |
| 12 | | /* |
| 13 | | |
| 14 | | Part No Layout |
| 15 | | ------------------- |
| 16 | | 1501100 US |
| 17 | | 1501102 Germany |
| 18 | | 1501105 UK |
| 19 | | |
| 20 | | */ |
| 21 | | |
| 22 | | #include "kb_pcxt83.h" |
| 23 | | |
| 24 | | |
| 25 | | |
| 26 | | //************************************************************************** |
| 27 | | // MACROS / CONSTANTS |
| 28 | | //************************************************************************** |
| 29 | | |
| 30 | | #define I8048_TAG "i8048" |
| 31 | | |
| 32 | | |
| 33 | | |
| 34 | | //************************************************************************** |
| 35 | | // DEVICE DEFINITIONS |
| 36 | | //************************************************************************** |
| 37 | | |
| 38 | | const device_type PC_KBD_IBM_PC_XT_83 = &device_creator<ibm_pc_xt_83_keyboard_device>; |
| 39 | | |
| 40 | | |
| 41 | | //------------------------------------------------- |
| 42 | | // ROM( ibm_pc_xt_83_keyboard ) |
| 43 | | //------------------------------------------------- |
| 44 | | |
| 45 | | ROM_START( ibm_pc_xt_83_keyboard ) |
| 46 | | ROM_REGION( 0x400, I8048_TAG, 0 ) |
| 47 | | /* |
| 48 | | Keyboard Part No. 1501105 |
| 49 | | |
| 50 | | MOI 74 01 |
| 51 | | PN 4584751 |
| 52 | | GX 344231 |
| 53 | | |
| 54 | | i 4429745 |
| 55 | | ZO P 379297 |
| 56 | | 8143 P |
| 57 | | (C) INTEL 76 |
| 58 | | */ |
| 59 | | ROM_LOAD( "4584751.m1", 0x000, 0x400, CRC(c59aa9d1) SHA1(4f5b2a075c68f6493310ec1e2a24271ceea330df) ) |
| 60 | | ROM_END |
| 61 | | |
| 62 | | |
| 63 | | //------------------------------------------------- |
| 64 | | // rom_region - device-specific ROM region |
| 65 | | //------------------------------------------------- |
| 66 | | |
| 67 | | const rom_entry *ibm_pc_xt_83_keyboard_device::device_rom_region() const |
| 68 | | { |
| 69 | | return ROM_NAME( ibm_pc_xt_83_keyboard ); |
| 70 | | } |
| 71 | | |
| 72 | | |
| 73 | | //------------------------------------------------- |
| 74 | | // ADDRESS_MAP( kb_io ) |
| 75 | | //------------------------------------------------- |
| 76 | | |
| 77 | | static ADDRESS_MAP_START( ibm_pc_xt_83_keyboard_io, AS_IO, 8, ibm_pc_xt_83_keyboard_device ) |
| 78 | | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE(bus_r, bus_w) |
| 79 | | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(p1_w) |
| 80 | | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w) |
| 81 | | AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r) |
| 82 | | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) |
| 83 | | ADDRESS_MAP_END |
| 84 | | |
| 85 | | |
| 86 | | //------------------------------------------------- |
| 87 | | // MACHINE_DRIVER( ibm_pc_xt_83_keyboard ) |
| 88 | | //------------------------------------------------- |
| 89 | | |
| 90 | | static MACHINE_CONFIG_FRAGMENT( ibm_pc_xt_83_keyboard ) |
| 91 | | MCFG_CPU_ADD(I8048_TAG, I8048, MCS48_LC_CLOCK(IND_U(47), CAP_P(20.7))) |
| 92 | | MCFG_CPU_IO_MAP(ibm_pc_xt_83_keyboard_io) |
| 93 | | MACHINE_CONFIG_END |
| 94 | | |
| 95 | | |
| 96 | | //------------------------------------------------- |
| 97 | | // machine_config_additions - device-specific |
| 98 | | // machine configurations |
| 99 | | //------------------------------------------------- |
| 100 | | |
| 101 | | machine_config_constructor ibm_pc_xt_83_keyboard_device::device_mconfig_additions() const |
| 102 | | { |
| 103 | | return MACHINE_CONFIG_NAME( ibm_pc_xt_83_keyboard ); |
| 104 | | } |
| 105 | | |
| 106 | | |
| 107 | | //------------------------------------------------- |
| 108 | | // INPUT_PORTS( ibm_pc_xt_83_keyboard ) |
| 109 | | //------------------------------------------------- |
| 110 | | |
| 111 | | INPUT_PORTS_START( ibm_pc_xt_83_keyboard ) |
| 112 | | PORT_START("MD00") |
| 113 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 114 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) |
| 115 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 PgDn") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 116 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 117 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 118 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 PgUp") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 119 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 120 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock Break") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) |
| 121 | | |
| 122 | | PORT_START("MD01") |
| 123 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 124 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 125 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 126 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 127 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 128 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 129 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 130 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) |
| 131 | | |
| 132 | | PORT_START("MD02") |
| 133 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 134 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad * PrtSc") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) |
| 135 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 136 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') |
| 137 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 138 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 139 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 140 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 141 | | |
| 142 | | PORT_START("MD03") |
| 143 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 144 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 145 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') |
| 146 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 147 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 148 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 149 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 150 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') |
| 151 | | |
| 152 | | PORT_START("MD04") |
| 153 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 154 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 155 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') |
| 156 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 157 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 158 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 159 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') |
| 160 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') |
| 161 | | |
| 162 | | PORT_START("MD05") |
| 163 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 164 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 165 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 166 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 167 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 168 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 169 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') |
| 170 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') |
| 171 | | |
| 172 | | PORT_START("MD06") |
| 173 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 174 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 175 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 176 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 177 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| 178 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 179 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') |
| 180 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') |
| 181 | | |
| 182 | | PORT_START("MD07") |
| 183 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 184 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 185 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 186 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 187 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 188 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 189 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 190 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 191 | | |
| 192 | | PORT_START("MD08") |
| 193 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 194 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 195 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 196 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 197 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 198 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 199 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 200 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') |
| 201 | | |
| 202 | | PORT_START("MD09") |
| 203 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') |
| 204 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 205 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) |
| 206 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 207 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 208 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) |
| 209 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 210 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 211 | | |
| 212 | | PORT_START("MD10") |
| 213 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) |
| 214 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) |
| 215 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) |
| 216 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) |
| 217 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 218 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) |
| 219 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 220 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| 221 | | |
| 222 | | PORT_START("MD11") |
| 223 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 224 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) |
| 225 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) |
| 226 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) |
| 227 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 228 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) |
| 229 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) // 76 "Clear" |
| 230 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 231 | | INPUT_PORTS_END |
| 232 | | |
| 233 | | |
| 234 | | //------------------------------------------------- |
| 235 | | // input_ports - device-specific input ports |
| 236 | | //------------------------------------------------- |
| 237 | | |
| 238 | | ioport_constructor ibm_pc_xt_83_keyboard_device::device_input_ports() const |
| 239 | | { |
| 240 | | return INPUT_PORTS_NAME( ibm_pc_xt_83_keyboard ); |
| 241 | | } |
| 242 | | |
| 243 | | |
| 244 | | |
| 245 | | //************************************************************************** |
| 246 | | // LIVE DEVICE |
| 247 | | //************************************************************************** |
| 248 | | |
| 249 | | //------------------------------------------------- |
| 250 | | // ibm_pc_xt_83_keyboard_device - constructor |
| 251 | | //------------------------------------------------- |
| 252 | | |
| 253 | | ibm_pc_xt_83_keyboard_device::ibm_pc_xt_83_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 254 | | : device_t(mconfig, PC_KBD_IBM_PC_XT_83, "IBM PC/XT Keyboard", tag, owner, clock, "kb_pcxt83", __FILE__), |
| 255 | | device_pc_kbd_interface(mconfig, *this), |
| 256 | | m_maincpu(*this, I8048_TAG), |
| 257 | | m_md00(*this, "MD00"), |
| 258 | | m_md01(*this, "MD01"), |
| 259 | | m_md02(*this, "MD02"), |
| 260 | | m_md03(*this, "MD03"), |
| 261 | | m_md04(*this, "MD04"), |
| 262 | | m_md05(*this, "MD05"), |
| 263 | | m_md06(*this, "MD06"), |
| 264 | | m_md07(*this, "MD07"), |
| 265 | | m_md08(*this, "MD08"), |
| 266 | | m_md09(*this, "MD09"), |
| 267 | | m_md10(*this, "MD10"), |
| 268 | | m_md11(*this, "MD11"), |
| 269 | | m_bus(0xff), |
| 270 | | m_p1(0xff), |
| 271 | | m_p2(0xff), |
| 272 | | m_sense(0), |
| 273 | | m_q(1) |
| 274 | | { |
| 275 | | } |
| 276 | | |
| 277 | | |
| 278 | | //------------------------------------------------- |
| 279 | | // device_start - device-specific startup |
| 280 | | //------------------------------------------------- |
| 281 | | |
| 282 | | void ibm_pc_xt_83_keyboard_device::device_start() |
| 283 | | { |
| 284 | | set_pc_kbdc_device(); |
| 285 | | |
| 286 | | // state saving |
| 287 | | save_item(NAME(m_bus)); |
| 288 | | save_item(NAME(m_p1)); |
| 289 | | save_item(NAME(m_p2)); |
| 290 | | save_item(NAME(m_sense)); |
| 291 | | save_item(NAME(m_q)); |
| 292 | | } |
| 293 | | |
| 294 | | |
| 295 | | //------------------------------------------------- |
| 296 | | // device_reset - device-specific reset |
| 297 | | //------------------------------------------------- |
| 298 | | |
| 299 | | void ibm_pc_xt_83_keyboard_device::device_reset() |
| 300 | | { |
| 301 | | } |
| 302 | | |
| 303 | | |
| 304 | | //------------------------------------------------- |
| 305 | | // clock_write - |
| 306 | | //------------------------------------------------- |
| 307 | | |
| 308 | | WRITE_LINE_MEMBER( ibm_pc_xt_83_keyboard_device::clock_write ) |
| 309 | | { |
| 310 | | } |
| 311 | | |
| 312 | | |
| 313 | | //------------------------------------------------- |
| 314 | | // data_write - |
| 315 | | //------------------------------------------------- |
| 316 | | |
| 317 | | WRITE_LINE_MEMBER( ibm_pc_xt_83_keyboard_device::data_write ) |
| 318 | | { |
| 319 | | m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); |
| 320 | | } |
| 321 | | |
| 322 | | |
| 323 | | //------------------------------------------------- |
| 324 | | // bus_r - |
| 325 | | //------------------------------------------------- |
| 326 | | |
| 327 | | READ8_MEMBER( ibm_pc_xt_83_keyboard_device::bus_r ) |
| 328 | | { |
| 329 | | // HACK this should be handled in mcs48.c |
| 330 | | return m_bus; |
| 331 | | } |
| 332 | | |
| 333 | | |
| 334 | | //------------------------------------------------- |
| 335 | | // bus_w - |
| 336 | | //------------------------------------------------- |
| 337 | | |
| 338 | | WRITE8_MEMBER( ibm_pc_xt_83_keyboard_device::bus_w ) |
| 339 | | { |
| 340 | | /* |
| 341 | | |
| 342 | | bit description |
| 343 | | |
| 344 | | 0 |
| 345 | | 1 |
| 346 | | 2 |
| 347 | | 3 |
| 348 | | 4 |
| 349 | | 5 DATAOUT |
| 350 | | 6 -REQOUT |
| 351 | | 7 Z1 RESET |
| 352 | | |
| 353 | | */ |
| 354 | | |
| 355 | | m_pc_kbdc->data_write_from_kb(BIT(data, 5)); |
| 356 | | m_pc_kbdc->clock_write_from_kb(BIT(data, 6)); |
| 357 | | |
| 358 | | if (!BIT(m_bus, 7) && BIT(data, 7)) |
| 359 | | { |
| 360 | | UINT8 data = 0xff; |
| 361 | | |
| 362 | | if (BIT(m_p1, 0)) data &= m_md00->read(); |
| 363 | | if (BIT(m_p1, 1)) data &= m_md01->read(); |
| 364 | | if (BIT(m_p1, 2)) data &= m_md02->read(); |
| 365 | | if (BIT(m_p1, 3)) data &= m_md03->read(); |
| 366 | | if (BIT(m_p1, 4)) data &= m_md04->read(); |
| 367 | | if (BIT(m_p1, 5)) data &= m_md05->read(); |
| 368 | | if (BIT(m_p1, 6)) data &= m_md06->read(); |
| 369 | | if (BIT(m_p1, 7)) data &= m_md07->read(); |
| 370 | | if (BIT(m_p2, 4)) data &= m_md08->read(); |
| 371 | | if (BIT(m_p2, 5)) data &= m_md09->read(); |
| 372 | | if (BIT(m_p2, 6)) data &= m_md10->read(); |
| 373 | | if (BIT(m_p2, 7)) data &= m_md11->read(); |
| 374 | | |
| 375 | | m_q = BIT(data, m_sense); |
| 376 | | } |
| 377 | | |
| 378 | | m_bus = data; |
| 379 | | } |
| 380 | | |
| 381 | | |
| 382 | | //------------------------------------------------- |
| 383 | | // p1_w - |
| 384 | | //------------------------------------------------- |
| 385 | | |
| 386 | | WRITE8_MEMBER( ibm_pc_xt_83_keyboard_device::p1_w ) |
| 387 | | { |
| 388 | | /* |
| 389 | | |
| 390 | | bit description |
| 391 | | |
| 392 | | 0 MD00 |
| 393 | | 1 MD01 |
| 394 | | 2 MD02 |
| 395 | | 3 MD03 |
| 396 | | 4 MD04 |
| 397 | | 5 MD05 |
| 398 | | 6 MD06 |
| 399 | | 7 MD07 |
| 400 | | |
| 401 | | */ |
| 402 | | |
| 403 | | m_p1 = data; |
| 404 | | } |
| 405 | | |
| 406 | | |
| 407 | | //------------------------------------------------- |
| 408 | | // p2_w - |
| 409 | | //------------------------------------------------- |
| 410 | | |
| 411 | | WRITE8_MEMBER( ibm_pc_xt_83_keyboard_device::p2_w ) |
| 412 | | { |
| 413 | | /* |
| 414 | | |
| 415 | | bit description |
| 416 | | |
| 417 | | 0 SELECT 2 |
| 418 | | 1 SELECT 1 |
| 419 | | 2 SELECT 0 |
| 420 | | 3 SA CLOSED |
| 421 | | 4 MD08 |
| 422 | | 5 MD09 |
| 423 | | 6 MD10 |
| 424 | | 7 MD11 |
| 425 | | |
| 426 | | */ |
| 427 | | |
| 428 | | if (!BIT(m_p2, 3) && BIT(data, 3)) |
| 429 | | { |
| 430 | | m_sense = data & 0x07; |
| 431 | | } |
| 432 | | |
| 433 | | m_p2 = data; |
| 434 | | } |
| 435 | | |
| 436 | | |
| 437 | | //------------------------------------------------- |
| 438 | | // t0_r - |
| 439 | | //------------------------------------------------- |
| 440 | | |
| 441 | | READ8_MEMBER( ibm_pc_xt_83_keyboard_device::t0_r ) |
| 442 | | { |
| 443 | | return clock_signal(); |
| 444 | | } |
| 445 | | |
| 446 | | |
| 447 | | //------------------------------------------------- |
| 448 | | // t1_r - |
| 449 | | //------------------------------------------------- |
| 450 | | |
| 451 | | READ8_MEMBER( ibm_pc_xt_83_keyboard_device::t1_r ) |
| 452 | | { |
| 453 | | return BIT(m_p2, 3) && m_q; |
| 454 | | } |
trunk/src/mess/machine/pc_kbdc.c
| r26017 | r26018 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | PC Keyboard connector interface |
| 4 | | |
| 5 | | The following basic program can be useful for identifying scancodes: |
| 6 | | 10 sc%=0:sp%=0 |
| 7 | | 20 sc%=inp(96) |
| 8 | | 30 if sc%<>sp% then print hex$(sc%):sp%=sc% |
| 9 | | 40 goto 20 |
| 10 | | |
| 11 | | ***************************************************************************/ |
| 12 | | |
| 13 | | |
| 14 | | #include "emu.h" |
| 15 | | #include "emuopts.h" |
| 16 | | #include "machine/pc_kbdc.h" |
| 17 | | |
| 18 | | |
| 19 | | //************************************************************************** |
| 20 | | // GLOBAL VARIABLES |
| 21 | | //************************************************************************** |
| 22 | | |
| 23 | | const device_type PC_KBDC_SLOT = &device_creator<pc_kbdc_slot_device>; |
| 24 | | |
| 25 | | //************************************************************************** |
| 26 | | // LIVE DEVICE |
| 27 | | //************************************************************************** |
| 28 | | |
| 29 | | //------------------------------------------------- |
| 30 | | // pc_kbdc_slot_device - constructor |
| 31 | | //------------------------------------------------- |
| 32 | | pc_kbdc_slot_device::pc_kbdc_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 33 | | device_t(mconfig, PC_KBDC_SLOT, "PC_KBDC_SLOT", tag, owner, clock, "pc_kbdc_slot", __FILE__), |
| 34 | | device_slot_interface(mconfig, *this) |
| 35 | | { |
| 36 | | } |
| 37 | | |
| 38 | | |
| 39 | | void pc_kbdc_slot_device::static_set_pc_kbdc_slot(device_t &device, device_t *kbdc_device) |
| 40 | | { |
| 41 | | pc_kbdc_slot_device &pc_kbdc = dynamic_cast<pc_kbdc_slot_device &>(device); |
| 42 | | pc_kbdc.m_kbdc_device = kbdc_device; |
| 43 | | } |
| 44 | | |
| 45 | | //------------------------------------------------- |
| 46 | | // device_start - device-specific startup |
| 47 | | //------------------------------------------------- |
| 48 | | |
| 49 | | void pc_kbdc_slot_device::device_start() |
| 50 | | { |
| 51 | | device_pc_kbd_interface *pc_kbd = dynamic_cast<device_pc_kbd_interface *>(get_card_device()); |
| 52 | | |
| 53 | | if (pc_kbd) |
| 54 | | { |
| 55 | | device_pc_kbd_interface::static_set_pc_kbdc( *pc_kbd, m_kbdc_device ); |
| 56 | | } |
| 57 | | } |
| 58 | | |
| 59 | | |
| 60 | | //************************************************************************** |
| 61 | | // GLOBAL VARIABLES |
| 62 | | //************************************************************************** |
| 63 | | |
| 64 | | const device_type PC_KBDC = &device_creator<pc_kbdc_device>; |
| 65 | | |
| 66 | | |
| 67 | | //------------------------------------------------- |
| 68 | | // pc_kbdc_device - constructor |
| 69 | | //------------------------------------------------- |
| 70 | | pc_kbdc_device::pc_kbdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 71 | | device_t(mconfig, PC_KBDC, "PC_KBDC", tag, owner, clock, "pc_kbdc", __FILE__), |
| 72 | | m_clock_state(-1), |
| 73 | | m_data_state(-1), |
| 74 | | m_kb_clock_state(1), |
| 75 | | m_kb_data_state(1), |
| 76 | | m_keyboard( NULL ) |
| 77 | | { |
| 78 | | } |
| 79 | | |
| 80 | | |
| 81 | | //------------------------------------------------- |
| 82 | | // device_config_complete - perform any |
| 83 | | // operations now that the configuration is |
| 84 | | // complete |
| 85 | | //------------------------------------------------- |
| 86 | | void pc_kbdc_device::device_config_complete() |
| 87 | | { |
| 88 | | // inherit a copy of the static data |
| 89 | | const pc_kbdc_interface *intf = reinterpret_cast<const pc_kbdc_interface *>(static_config()); |
| 90 | | if (intf != NULL) |
| 91 | | { |
| 92 | | *static_cast<pc_kbdc_interface *>(this) = *intf; |
| 93 | | } |
| 94 | | |
| 95 | | // or initialize to defaults if none provided |
| 96 | | else |
| 97 | | { |
| 98 | | memset(&m_out_clock_cb, 0, sizeof(m_out_clock_cb)); |
| 99 | | memset(&m_out_data_cb, 0, sizeof(m_out_data_cb)); |
| 100 | | } |
| 101 | | } |
| 102 | | |
| 103 | | |
| 104 | | void pc_kbdc_device::set_keyboard( device_pc_kbd_interface *keyboard ) |
| 105 | | { |
| 106 | | m_keyboard = keyboard; |
| 107 | | } |
| 108 | | |
| 109 | | |
| 110 | | //------------------------------------------------- |
| 111 | | // device_start - device-specific startup |
| 112 | | //------------------------------------------------- |
| 113 | | void pc_kbdc_device::device_start() |
| 114 | | { |
| 115 | | // resolve callbacks |
| 116 | | m_out_clock_func.resolve(m_out_clock_cb, *this); |
| 117 | | m_out_data_func.resolve(m_out_data_cb, *this); |
| 118 | | } |
| 119 | | |
| 120 | | |
| 121 | | //------------------------------------------------- |
| 122 | | // device_reset - device-specific reset |
| 123 | | //------------------------------------------------- |
| 124 | | void pc_kbdc_device::device_reset() |
| 125 | | { |
| 126 | | m_clock_state = -1; /* initial state of calculated clock line */ |
| 127 | | m_data_state = -1; /* initial state of calculated data line */ |
| 128 | | |
| 129 | | // Initially assume both keyboard and mainboard have released their data and clock lines |
| 130 | | m_mb_clock_state = 1; |
| 131 | | m_mb_data_state = 1; |
| 132 | | m_kb_clock_state = 1; |
| 133 | | m_kb_data_state = 1; |
| 134 | | } |
| 135 | | |
| 136 | | |
| 137 | | void pc_kbdc_device::update_clock_state() |
| 138 | | { |
| 139 | | int new_clock_state = m_mb_clock_state & m_kb_clock_state; |
| 140 | | |
| 141 | | if ( new_clock_state != m_clock_state ) |
| 142 | | { |
| 143 | | // We first set our state to prevent possible endless loops |
| 144 | | m_clock_state = new_clock_state; |
| 145 | | |
| 146 | | // Send state to keyboard interface logic on mainboard |
| 147 | | m_out_clock_func( m_clock_state ); |
| 148 | | |
| 149 | | // Send state to keyboard |
| 150 | | if ( m_keyboard ) |
| 151 | | { |
| 152 | | m_keyboard->clock_write( m_clock_state ); |
| 153 | | } |
| 154 | | } |
| 155 | | } |
| 156 | | |
| 157 | | |
| 158 | | void pc_kbdc_device::update_data_state() |
| 159 | | { |
| 160 | | int new_data_state = m_mb_data_state & m_kb_data_state; |
| 161 | | |
| 162 | | if ( new_data_state != m_data_state ) |
| 163 | | { |
| 164 | | // We first set our state to prevent possible endless loops |
| 165 | | m_data_state = new_data_state; |
| 166 | | |
| 167 | | // Send state to keyboard interface logic on mainboard |
| 168 | | m_out_data_func( m_data_state ); |
| 169 | | |
| 170 | | // Send state to keyboard |
| 171 | | if ( m_keyboard ) |
| 172 | | { |
| 173 | | m_keyboard->data_write( m_data_state ); |
| 174 | | } |
| 175 | | } |
| 176 | | } |
| 177 | | |
| 178 | | |
| 179 | | WRITE_LINE_MEMBER( pc_kbdc_device::clock_write_from_mb ) |
| 180 | | { |
| 181 | | m_mb_clock_state = state; |
| 182 | | update_clock_state(); |
| 183 | | } |
| 184 | | |
| 185 | | |
| 186 | | WRITE_LINE_MEMBER( pc_kbdc_device::data_write_from_mb ) |
| 187 | | { |
| 188 | | m_mb_data_state = state; |
| 189 | | update_data_state(); |
| 190 | | } |
| 191 | | |
| 192 | | |
| 193 | | WRITE_LINE_MEMBER( pc_kbdc_device::clock_write_from_kb ) |
| 194 | | { |
| 195 | | m_kb_clock_state = state; |
| 196 | | update_clock_state(); |
| 197 | | } |
| 198 | | |
| 199 | | |
| 200 | | WRITE_LINE_MEMBER( pc_kbdc_device::data_write_from_kb ) |
| 201 | | { |
| 202 | | m_kb_data_state = state; |
| 203 | | update_data_state(); |
| 204 | | } |
| 205 | | |
| 206 | | |
| 207 | | //************************************************************************** |
| 208 | | // DEVICE PC KBD INTERFACE |
| 209 | | //************************************************************************** |
| 210 | | |
| 211 | | //------------------------------------------------- |
| 212 | | // device_pc_kbd_interface - constructor |
| 213 | | //------------------------------------------------- |
| 214 | | |
| 215 | | device_pc_kbd_interface::device_pc_kbd_interface(const machine_config &mconfig, device_t &device) |
| 216 | | : device_slot_card_interface(mconfig, device), |
| 217 | | m_pc_kbdc(NULL), |
| 218 | | m_pc_kbdc_tag(NULL) |
| 219 | | { |
| 220 | | } |
| 221 | | |
| 222 | | |
| 223 | | //------------------------------------------------- |
| 224 | | // ~device_pc_kbd_interface - destructor |
| 225 | | //------------------------------------------------- |
| 226 | | |
| 227 | | device_pc_kbd_interface::~device_pc_kbd_interface() |
| 228 | | { |
| 229 | | } |
| 230 | | |
| 231 | | |
| 232 | | WRITE_LINE_MEMBER( device_pc_kbd_interface::clock_write ) |
| 233 | | { |
| 234 | | } |
| 235 | | |
| 236 | | |
| 237 | | WRITE_LINE_MEMBER( device_pc_kbd_interface::data_write ) |
| 238 | | { |
| 239 | | } |
| 240 | | |
| 241 | | |
| 242 | | void device_pc_kbd_interface::static_set_pc_kbdc(device_t &device, device_t *kbdc_device) |
| 243 | | { |
| 244 | | device_pc_kbd_interface &pc_kbd = dynamic_cast<device_pc_kbd_interface &>(device); |
| 245 | | pc_kbd.m_pc_kbdc = dynamic_cast<pc_kbdc_device *>(kbdc_device); |
| 246 | | } |
| 247 | | |
| 248 | | |
| 249 | | void device_pc_kbd_interface::set_pc_kbdc_device() |
| 250 | | { |
| 251 | | if ( m_pc_kbdc ) |
| 252 | | { |
| 253 | | m_pc_kbdc->set_keyboard( this ); |
| 254 | | } |
| 255 | | } |
trunk/src/mess/machine/kb_ec1841.c
| r26017 | r26018 | |
| 1 | | /********************************************************************** |
| 2 | | |
| 3 | | EC-1841 92-key keyboard emulation |
| 4 | | |
| 5 | | Sends 9 non-standard scan codes (54..5C) and reassigns 3 standard |
| 6 | | ones (2A, 36, 3A). EC-1841 BIOS converts scan codes into Cyrillic |
| 7 | | by default; 'Lat' key (mapped to F11) switches it to Latin mode. |
| 8 | | 'Rus' (F12) switches back. |
| 9 | | |
| 10 | | Copyright MESS Team. |
| 11 | | Visit http://mamedev.org for licensing and usage restrictions. |
| 12 | | |
| 13 | | *********************************************************************/ |
| 14 | | |
| 15 | | #include "kb_ec1841.h" |
| 16 | | |
| 17 | | #define VERBOSE_DBG 0 /* general debug messages */ |
| 18 | | |
| 19 | | #define DBG_LOG(N,M,A) \ |
| 20 | | do { \ |
| 21 | | if(VERBOSE_DBG>=N) \ |
| 22 | | { \ |
| 23 | | logerror("%11.6f at %s: ",machine().time().as_double(),machine().describe_context()); \ |
| 24 | | logerror A; \ |
| 25 | | } \ |
| 26 | | } while (0) |
| 27 | | |
| 28 | | |
| 29 | | |
| 30 | | //************************************************************************** |
| 31 | | // MACROS / CONSTANTS |
| 32 | | //************************************************************************** |
| 33 | | |
| 34 | | #define I8048_TAG "i8048" |
| 35 | | |
| 36 | | |
| 37 | | |
| 38 | | //************************************************************************** |
| 39 | | // DEVICE DEFINITIONS |
| 40 | | //************************************************************************** |
| 41 | | |
| 42 | | const device_type PC_KBD_EC_1841 = &device_creator<ec_1841_keyboard_device>; |
| 43 | | |
| 44 | | |
| 45 | | //------------------------------------------------- |
| 46 | | // ROM( ec_1841_keyboard ) |
| 47 | | //------------------------------------------------- |
| 48 | | |
| 49 | | ROM_START( ec_1841_keyboard ) |
| 50 | | ROM_REGION( 0x400, I8048_TAG, 0 ) |
| 51 | | // XXX add P/N etc |
| 52 | | ROM_LOAD( "1816be48.bin", 0x000, 0x400, CRC(e9abfe44) SHA1(1db430c72c2d007ea0b8ae2514ff15c96baba308) ) |
| 53 | | ROM_END |
| 54 | | |
| 55 | | |
| 56 | | //------------------------------------------------- |
| 57 | | // rom_region - device-specific ROM region |
| 58 | | //------------------------------------------------- |
| 59 | | |
| 60 | | const rom_entry *ec_1841_keyboard_device::device_rom_region() const |
| 61 | | { |
| 62 | | return ROM_NAME( ec_1841_keyboard ); |
| 63 | | } |
| 64 | | |
| 65 | | |
| 66 | | //------------------------------------------------- |
| 67 | | // ADDRESS_MAP( kb_io ) |
| 68 | | //------------------------------------------------- |
| 69 | | |
| 70 | | static ADDRESS_MAP_START( ec_1841_keyboard_io, AS_IO, 8, ec_1841_keyboard_device ) |
| 71 | | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(bus_w) |
| 72 | | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w) |
| 73 | | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w) |
| 74 | | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) |
| 75 | | ADDRESS_MAP_END |
| 76 | | |
| 77 | | |
| 78 | | //------------------------------------------------- |
| 79 | | // MACHINE_DRIVER( ec_1841_keyboard ) |
| 80 | | //------------------------------------------------- |
| 81 | | |
| 82 | | static MACHINE_CONFIG_FRAGMENT( ec_1841_keyboard ) |
| 83 | | // XXX check |
| 84 | | MCFG_CPU_ADD(I8048_TAG, I8048, MCS48_LC_CLOCK(IND_U(47), CAP_P(20.7))) |
| 85 | | MCFG_CPU_IO_MAP(ec_1841_keyboard_io) |
| 86 | | MACHINE_CONFIG_END |
| 87 | | |
| 88 | | |
| 89 | | //------------------------------------------------- |
| 90 | | // machine_config_additions - device-specific |
| 91 | | // machine configurations |
| 92 | | //------------------------------------------------- |
| 93 | | |
| 94 | | machine_config_constructor ec_1841_keyboard_device::device_mconfig_additions() const |
| 95 | | { |
| 96 | | return MACHINE_CONFIG_NAME( ec_1841_keyboard ); |
| 97 | | } |
| 98 | | |
| 99 | | |
| 100 | | //------------------------------------------------- |
| 101 | | // INPUT_PORTS( ec_1841_keyboard ) |
| 102 | | //------------------------------------------------- |
| 103 | | |
| 104 | | INPUT_PORTS_START( ec_1841_keyboard ) |
| 105 | | PORT_START("MD00") |
| 106 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 107 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) |
| 108 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 109 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 110 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?59?") // 0x59 = Inf |
| 111 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 112 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 113 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 114 | | |
| 115 | | PORT_START("MD01") |
| 116 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 117 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 118 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 119 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 120 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 121 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 122 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 123 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 124 | | |
| 125 | | PORT_START("MD02") |
| 126 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 127 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 128 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 129 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 130 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) // 0x5a = R/L (R) |
| 131 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 132 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 133 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 134 | | |
| 135 | | PORT_START("MD03") |
| 136 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') |
| 137 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 138 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 139 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 140 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) // 0x5b = Rus |
| 141 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 PgUp") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 142 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 143 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 144 | | |
| 145 | | PORT_START("MD04") |
| 146 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 147 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 148 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 149 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 150 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 151 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 152 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 153 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 154 | | |
| 155 | | PORT_START("MD05") |
| 156 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 157 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 158 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 159 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 160 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| 161 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 162 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 163 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 164 | | |
| 165 | | PORT_START("MD06") |
| 166 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 167 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 168 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 169 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 170 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) |
| 171 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 172 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 173 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 174 | | |
| 175 | | PORT_START("MD07") |
| 176 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') |
| 177 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| 178 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 179 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') |
| 180 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) |
| 181 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 182 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 183 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 184 | | |
| 185 | | PORT_START("MD08") |
| 186 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') |
| 187 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 188 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 189 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?2a?") |
| 190 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) |
| 191 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 192 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 193 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 194 | | |
| 195 | | PORT_START("MD09") |
| 196 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') |
| 197 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 198 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 199 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?5c?") // 0x5c = YO |
| 200 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) |
| 201 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 PgDn") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 202 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 203 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 204 | | |
| 205 | | PORT_START("MD10") |
| 206 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') |
| 207 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 208 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 209 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 210 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) |
| 211 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 212 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 213 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 214 | | |
| 215 | | PORT_START("MD11") |
| 216 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') |
| 217 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?36?") |
| 218 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') |
| 219 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 220 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) |
| 221 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 222 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 223 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 224 | | |
| 225 | | PORT_START("MD12") |
| 226 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') |
| 227 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?3a?") |
| 228 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') |
| 229 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 0x55 |
| 230 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) |
| 231 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) |
| 232 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 233 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 234 | | |
| 235 | | PORT_START("MD13") |
| 236 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') |
| 237 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 238 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 239 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // 0x56 |
| 240 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) |
| 241 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 242 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 243 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 244 | | |
| 245 | | PORT_START("MD14") |
| 246 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') |
| 247 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PRTSCR) |
| 248 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) |
| 249 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) // 0x57 = Lat |
| 250 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) |
| 251 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 252 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 253 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 254 | | |
| 255 | | PORT_START("MD15") |
| 256 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 257 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) |
| 258 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 0x54 |
| 259 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) // 0x58 = R/L (L) |
| 260 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock Break") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) |
| 261 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 262 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 263 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 264 | | INPUT_PORTS_END |
| 265 | | |
| 266 | | |
| 267 | | //------------------------------------------------- |
| 268 | | // input_ports - device-specific input ports |
| 269 | | //------------------------------------------------- |
| 270 | | |
| 271 | | ioport_constructor ec_1841_keyboard_device::device_input_ports() const |
| 272 | | { |
| 273 | | return INPUT_PORTS_NAME( ec_1841_keyboard ); |
| 274 | | } |
| 275 | | |
| 276 | | |
| 277 | | |
| 278 | | //************************************************************************** |
| 279 | | // LIVE DEVICE |
| 280 | | //************************************************************************** |
| 281 | | |
| 282 | | //------------------------------------------------- |
| 283 | | // ec_1841_keyboard_device - constructor |
| 284 | | //------------------------------------------------- |
| 285 | | |
| 286 | | ec_1841_keyboard_device::ec_1841_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 287 | | : device_t(mconfig, PC_KBD_EC_1841, "EC-1841 Keyboard", tag, owner, clock, "kb_ec1841", __FILE__), |
| 288 | | device_pc_kbd_interface(mconfig, *this), |
| 289 | | m_maincpu(*this, I8048_TAG), |
| 290 | | m_md00(*this, "MD00"), |
| 291 | | m_md01(*this, "MD01"), |
| 292 | | m_md02(*this, "MD02"), |
| 293 | | m_md03(*this, "MD03"), |
| 294 | | m_md04(*this, "MD04"), |
| 295 | | m_md05(*this, "MD05"), |
| 296 | | m_md06(*this, "MD06"), |
| 297 | | m_md07(*this, "MD07"), |
| 298 | | m_md08(*this, "MD08"), |
| 299 | | m_md09(*this, "MD09"), |
| 300 | | m_md10(*this, "MD10"), |
| 301 | | m_md11(*this, "MD11"), |
| 302 | | m_md12(*this, "MD12"), |
| 303 | | m_md13(*this, "MD13"), |
| 304 | | m_md14(*this, "MD14"), |
| 305 | | m_md15(*this, "MD15"), |
| 306 | | m_bus(0xff), |
| 307 | | m_p1(0xff), |
| 308 | | m_p2(0xff), |
| 309 | | m_q(1) |
| 310 | | { |
| 311 | | } |
| 312 | | |
| 313 | | |
| 314 | | //------------------------------------------------- |
| 315 | | // device_start - device-specific startup |
| 316 | | //------------------------------------------------- |
| 317 | | |
| 318 | | void ec_1841_keyboard_device::device_start() |
| 319 | | { |
| 320 | | set_pc_kbdc_device(); |
| 321 | | |
| 322 | | // state saving |
| 323 | | save_item(NAME(m_bus)); |
| 324 | | save_item(NAME(m_p1)); |
| 325 | | save_item(NAME(m_p2)); |
| 326 | | save_item(NAME(m_q)); |
| 327 | | } |
| 328 | | |
| 329 | | |
| 330 | | //------------------------------------------------- |
| 331 | | // device_reset - device-specific reset |
| 332 | | //------------------------------------------------- |
| 333 | | |
| 334 | | void ec_1841_keyboard_device::device_reset() |
| 335 | | { |
| 336 | | } |
| 337 | | |
| 338 | | |
| 339 | | //------------------------------------------------- |
| 340 | | // clock_write - |
| 341 | | //------------------------------------------------- |
| 342 | | |
| 343 | | WRITE_LINE_MEMBER( ec_1841_keyboard_device::clock_write ) |
| 344 | | { |
| 345 | | DBG_LOG(1,0,( "%s: clock write %d\n", tag(), state)); |
| 346 | | } |
| 347 | | |
| 348 | | |
| 349 | | //------------------------------------------------- |
| 350 | | // data_write - |
| 351 | | //------------------------------------------------- |
| 352 | | |
| 353 | | WRITE_LINE_MEMBER( ec_1841_keyboard_device::data_write ) |
| 354 | | { |
| 355 | | DBG_LOG(1,0,( "%s: data write %d\n", tag(), state)); |
| 356 | | } |
| 357 | | |
| 358 | | |
| 359 | | //------------------------------------------------- |
| 360 | | // bus_w - |
| 361 | | //------------------------------------------------- |
| 362 | | |
| 363 | | WRITE8_MEMBER( ec_1841_keyboard_device::bus_w ) |
| 364 | | { |
| 365 | | DBG_LOG(2,0,( "%s: bus_w %02x\n", tag(), data)); |
| 366 | | |
| 367 | | m_bus = data; |
| 368 | | } |
| 369 | | |
| 370 | | |
| 371 | | //------------------------------------------------- |
| 372 | | // p1_r - |
| 373 | | //------------------------------------------------- |
| 374 | | |
| 375 | | READ8_MEMBER( ec_1841_keyboard_device::p1_r ) |
| 376 | | { |
| 377 | | /* |
| 378 | | |
| 379 | | bit description |
| 380 | | |
| 381 | | 0 -REQ IN |
| 382 | | 1 DATA IN |
| 383 | | 2 |
| 384 | | 3 |
| 385 | | 4 |
| 386 | | 5 |
| 387 | | 6 |
| 388 | | 7 |
| 389 | | |
| 390 | | */ |
| 391 | | |
| 392 | | UINT8 data = 0; |
| 393 | | |
| 394 | | data |= clock_signal(); |
| 395 | | data |= data_signal() << 1; |
| 396 | | |
| 397 | | DBG_LOG(1,0,( "%s: p1_r %02x\n", tag(), data)); |
| 398 | | |
| 399 | | return data; |
| 400 | | } |
| 401 | | |
| 402 | | |
| 403 | | //------------------------------------------------- |
| 404 | | // p1_w - |
| 405 | | //------------------------------------------------- |
| 406 | | |
| 407 | | WRITE8_MEMBER( ec_1841_keyboard_device::p1_w ) |
| 408 | | { |
| 409 | | /* |
| 410 | | bit description |
| 411 | | |
| 412 | | 0 |
| 413 | | 1 |
| 414 | | 2 |
| 415 | | 3 |
| 416 | | 4 |
| 417 | | 5 LED XXX |
| 418 | | 6 LED XXX |
| 419 | | 7 LED XXX |
| 420 | | */ |
| 421 | | DBG_LOG(1,0,( "%s: p1_w %02x\n", tag(), data)); |
| 422 | | |
| 423 | | m_p1 = data; |
| 424 | | } |
| 425 | | |
| 426 | | |
| 427 | | //------------------------------------------------- |
| 428 | | // p2_w - |
| 429 | | //------------------------------------------------- |
| 430 | | |
| 431 | | WRITE8_MEMBER( ec_1841_keyboard_device::p2_w ) |
| 432 | | { |
| 433 | | /* |
| 434 | | bit description |
| 435 | | |
| 436 | | 0 -STROBE (to matrix mux) |
| 437 | | 1 XXX CLOCK out 1 |
| 438 | | 2 XXX DATA out 1 |
| 439 | | 3 |
| 440 | | 4 |
| 441 | | 5 XXX DATA out 2? |
| 442 | | 6 XXX CLOCK out 2? |
| 443 | | 7 XXX |
| 444 | | */ |
| 445 | | DBG_LOG(1,0,( "%s: p2_w %02x\n", tag(), data)); |
| 446 | | |
| 447 | | m_pc_kbdc->data_write_from_kb(BIT(data, 2)); |
| 448 | | m_pc_kbdc->clock_write_from_kb(BIT(data, 1)); |
| 449 | | |
| 450 | | m_p2 = data; |
| 451 | | } |
| 452 | | |
| 453 | | |
| 454 | | //------------------------------------------------- |
| 455 | | // t1_r - |
| 456 | | //------------------------------------------------- |
| 457 | | |
| 458 | | READ8_MEMBER( ec_1841_keyboard_device::t1_r ) |
| 459 | | { |
| 460 | | if (BIT(m_p2,0)) { |
| 461 | | m_q = 1; |
| 462 | | } else { |
| 463 | | UINT8 sense = 0xff; |
| 464 | | |
| 465 | | switch(m_bus & 15) { |
| 466 | | case 0: sense &= m_md00->read(); break; |
| 467 | | case 1: sense &= m_md01->read(); break; |
| 468 | | case 2: sense &= m_md02->read(); break; |
| 469 | | case 3: sense &= m_md03->read(); break; |
| 470 | | case 4: sense &= m_md04->read(); break; |
| 471 | | case 5: sense &= m_md05->read(); break; |
| 472 | | case 6: sense &= m_md06->read(); break; |
| 473 | | case 7: sense &= m_md07->read(); break; |
| 474 | | case 8: sense &= m_md08->read(); break; |
| 475 | | case 9: sense &= m_md09->read(); break; |
| 476 | | case 10: sense &= m_md10->read(); break; |
| 477 | | case 11: sense &= m_md11->read(); break; |
| 478 | | case 12: sense &= m_md12->read(); break; |
| 479 | | case 13: sense &= m_md13->read(); break; |
| 480 | | case 14: sense &= m_md14->read(); break; |
| 481 | | case 15: sense &= m_md15->read(); break; |
| 482 | | } |
| 483 | | m_q = BIT(sense, (m_bus >> 4) & 7); |
| 484 | | } |
| 485 | | |
| 486 | | DBG_LOG(1,0,( "%s: bus %02X t1_r %d\n", tag(), m_bus, m_q)); |
| 487 | | |
| 488 | | return m_q; |
| 489 | | } |
trunk/src/mess/machine/kb_pcat84.c
| r26017 | r26018 | |
| 1 | | // license:BSD-3-Clause |
| 2 | | // copyright-holders:Curt Coder |
| 3 | | /********************************************************************** |
| 4 | | |
| 5 | | IBM Model F PC/AT 84-key / 3270PC 122-key keyboard emulation |
| 6 | | |
| 7 | | Copyright MESS Team. |
| 8 | | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | | |
| 10 | | *********************************************************************/ |
| 11 | | |
| 12 | | /* |
| 13 | | |
| 14 | | TODO: |
| 15 | | |
| 16 | | - cpu LC timing |
| 17 | | - 3270PC keys |
| 18 | | |
| 19 | | */ |
| 20 | | |
| 21 | | /* |
| 22 | | |
| 23 | | Part No Layout |
| 24 | | ------------------- |
| 25 | | 6450225 UK 84-key |
| 26 | | 6110344 UK 122-key |
| 27 | | |
| 28 | | */ |
| 29 | | |
| 30 | | #include "kb_pcat84.h" |
| 31 | | |
| 32 | | |
| 33 | | |
| 34 | | //************************************************************************** |
| 35 | | // MACROS / CONSTANTS |
| 36 | | //************************************************************************** |
| 37 | | |
| 38 | | #define I8048_TAG "m5" |
| 39 | | |
| 40 | | |
| 41 | | |
| 42 | | //************************************************************************** |
| 43 | | // DEVICE DEFINITIONS |
| 44 | | //************************************************************************** |
| 45 | | |
| 46 | | const device_type PC_KBD_IBM_PC_AT_84 = &device_creator<ibm_pc_at_84_keyboard_device>; |
| 47 | | const device_type PC_KBD_IBM_3270PC_122 = &device_creator<ibm_3270pc_122_keyboard_device>; |
| 48 | | |
| 49 | | |
| 50 | | //------------------------------------------------- |
| 51 | | // ROM( ibm_pc_at_84_keyboard ) |
| 52 | | //------------------------------------------------- |
| 53 | | |
| 54 | | ROM_START( ibm_pc_at_84_keyboard ) |
| 55 | | ROM_REGION( 0x400, I8048_TAG, 0 ) |
| 56 | | /* |
| 57 | | Keyboard Part No 6450225 |
| 58 | | |
| 59 | | PH 1503099 |
| 60 | | D 878154 |
| 61 | | 8441 D H |
| 62 | | */ |
| 63 | | ROM_LOAD( "1503099.m5", 0x000, 0x400, CRC(1e921f37) SHA1(5f722bdb3b57f5a532c02a5c3f78f30d785796f2) ) |
| 64 | | ROM_END |
| 65 | | |
| 66 | | |
| 67 | | //------------------------------------------------- |
| 68 | | // rom_region - device-specific ROM region |
| 69 | | //------------------------------------------------- |
| 70 | | |
| 71 | | const rom_entry *ibm_pc_at_84_keyboard_device::device_rom_region() const |
| 72 | | { |
| 73 | | return ROM_NAME( ibm_pc_at_84_keyboard ); |
| 74 | | } |
| 75 | | |
| 76 | | |
| 77 | | //------------------------------------------------- |
| 78 | | // ROM( ibm_3270pc_122_keyboard ) |
| 79 | | //------------------------------------------------- |
| 80 | | |
| 81 | | ROM_START( ibm_3270pc_122_keyboard ) |
| 82 | | ROM_REGION( 0x400, I8048_TAG, 0 ) |
| 83 | | /* |
| 84 | | Keyboard Part No 6110344 |
| 85 | | |
| 86 | | PH 1385001 |
| 87 | | D |
| 88 | | 8512 D H |
| 89 | | */ |
| 90 | | ROM_LOAD( "1385001.m5", 0x000, 0x400, CRC(c19767e9) SHA1(a3701e4617383a4de0fd5e2e86c4b74beaf94a7b) ) |
| 91 | | ROM_END |
| 92 | | |
| 93 | | |
| 94 | | //------------------------------------------------- |
| 95 | | // rom_region - device-specific ROM region |
| 96 | | //------------------------------------------------- |
| 97 | | |
| 98 | | const rom_entry *ibm_3270pc_122_keyboard_device::device_rom_region() const |
| 99 | | { |
| 100 | | return ROM_NAME( ibm_3270pc_122_keyboard ); |
| 101 | | } |
| 102 | | |
| 103 | | |
| 104 | | //------------------------------------------------- |
| 105 | | // ADDRESS_MAP( kb_io ) |
| 106 | | //------------------------------------------------- |
| 107 | | |
| 108 | | static ADDRESS_MAP_START( ibm_pc_at_84_keyboard_io, AS_IO, 8, ibm_pc_at_84_keyboard_device ) |
| 109 | | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READNOP AM_WRITE(bus_w) |
| 110 | | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w) |
| 111 | | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(p2_r, p2_w) |
| 112 | | AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r) |
| 113 | | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) |
| 114 | | ADDRESS_MAP_END |
| 115 | | |
| 116 | | |
| 117 | | //------------------------------------------------- |
| 118 | | // MACHINE_DRIVER( ibm_pc_at_84_keyboard ) |
| 119 | | //------------------------------------------------- |
| 120 | | |
| 121 | | static MACHINE_CONFIG_FRAGMENT( ibm_pc_at_84_keyboard ) |
| 122 | | MCFG_CPU_ADD(I8048_TAG, I8048, 5364000) |
| 123 | | MCFG_CPU_IO_MAP(ibm_pc_at_84_keyboard_io) |
| 124 | | MACHINE_CONFIG_END |
| 125 | | |
| 126 | | |
| 127 | | //------------------------------------------------- |
| 128 | | // machine_config_additions - device-specific |
| 129 | | // machine configurations |
| 130 | | //------------------------------------------------- |
| 131 | | |
| 132 | | machine_config_constructor ibm_pc_at_84_keyboard_device::device_mconfig_additions() const |
| 133 | | { |
| 134 | | return MACHINE_CONFIG_NAME( ibm_pc_at_84_keyboard ); |
| 135 | | } |
| 136 | | |
| 137 | | |
| 138 | | //------------------------------------------------- |
| 139 | | // INPUT_PORTS( ibm_pc_at_84_keyboard ) |
| 140 | | //------------------------------------------------- |
| 141 | | |
| 142 | | INPUT_PORTS_START( ibm_pc_at_84_keyboard ) |
| 143 | | PORT_START("DR00") |
| 144 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) |
| 145 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) |
| 146 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) |
| 147 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) |
| 148 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 149 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| 150 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 151 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 152 | | |
| 153 | | PORT_START("DR01") |
| 154 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) |
| 155 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) |
| 156 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) |
| 157 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) |
| 158 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) |
| 159 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 160 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 161 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 162 | | |
| 163 | | PORT_START("DR02") |
| 164 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) |
| 165 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 166 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 167 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) |
| 168 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 169 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 170 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 171 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 172 | | |
| 173 | | PORT_START("DR03") |
| 174 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 175 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 176 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 177 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 178 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 179 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') |
| 180 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 181 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 182 | | |
| 183 | | PORT_START("DR04") |
| 184 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 185 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 186 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 187 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 188 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 189 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 190 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 191 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 192 | | |
| 193 | | PORT_START("DR05") |
| 194 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 195 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 196 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 197 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 198 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 199 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 200 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 201 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 202 | | |
| 203 | | PORT_START("DR06") |
| 204 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 205 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 206 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 207 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 208 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 209 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') |
| 210 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 211 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 212 | | |
| 213 | | PORT_START("DR07") |
| 214 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 215 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 216 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 217 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| 218 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') |
| 219 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') |
| 220 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 221 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 222 | | |
| 223 | | PORT_START("DR08") |
| 224 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 225 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 226 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 227 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 228 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') |
| 229 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') |
| 230 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 231 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 232 | | |
| 233 | | PORT_START("DR09") |
| 234 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 235 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 236 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 237 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') |
| 238 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 239 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') |
| 240 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 241 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 242 | | |
| 243 | | PORT_START("DR10") |
| 244 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) |
| 245 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') |
| 246 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 247 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 248 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') |
| 249 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 250 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 251 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 252 | | |
| 253 | | PORT_START("DR11") |
| 254 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 255 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 256 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 257 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') |
| 258 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 259 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 260 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 261 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 262 | | |
| 263 | | PORT_START("DR12") |
| 264 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 265 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 266 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 267 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 268 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 269 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 270 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 271 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 272 | | |
| 273 | | PORT_START("DR13") |
| 274 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 275 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 276 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 277 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 278 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 279 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 280 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 281 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 282 | | |
| 283 | | PORT_START("DR14") |
| 284 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 285 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 286 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 287 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 288 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 289 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 290 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 291 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) |
| 292 | | |
| 293 | | PORT_START("DR15") |
| 294 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 295 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) |
| 296 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 PgDn") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 297 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 298 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad * PrtSc") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) |
| 299 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 PgUp") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 300 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock Break") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) |
| 301 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Sys Req") |
| 302 | | INPUT_PORTS_END |
| 303 | | |
| 304 | | |
| 305 | | //------------------------------------------------- |
| 306 | | // input_ports - device-specific input ports |
| 307 | | //------------------------------------------------- |
| 308 | | |
| 309 | | ioport_constructor ibm_pc_at_84_keyboard_device::device_input_ports() const |
| 310 | | { |
| 311 | | return INPUT_PORTS_NAME( ibm_pc_at_84_keyboard ); |
| 312 | | } |
| 313 | | |
| 314 | | |
| 315 | | //------------------------------------------------- |
| 316 | | // INPUT_PORTS( ibm_3270pc_122_keyboard ) |
| 317 | | //------------------------------------------------- |
| 318 | | |
| 319 | | INPUT_PORTS_START( ibm_3270pc_122_keyboard ) |
| 320 | | PORT_INCLUDE(ibm_pc_at_84_keyboard) |
| 321 | | |
| 322 | | PORT_START("KBDIDA") |
| 323 | | PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW ) |
| 324 | | PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW ) |
| 325 | | PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW ) |
| 326 | | PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW ) |
| 327 | | PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW ) |
| 328 | | PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW ) |
| 329 | | |
| 330 | | PORT_START("KBDIDB") |
| 331 | | PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW ) |
| 332 | | PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW ) |
| 333 | | PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW ) |
| 334 | | PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW ) |
| 335 | | PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW ) |
| 336 | | PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW ) |
| 337 | | INPUT_PORTS_END |
| 338 | | |
| 339 | | |
| 340 | | //------------------------------------------------- |
| 341 | | // input_ports - device-specific input ports |
| 342 | | //------------------------------------------------- |
| 343 | | |
| 344 | | ioport_constructor ibm_3270pc_122_keyboard_device::device_input_ports() const |
| 345 | | { |
| 346 | | return INPUT_PORTS_NAME( ibm_3270pc_122_keyboard ); |
| 347 | | } |
| 348 | | |
| 349 | | |
| 350 | | |
| 351 | | //************************************************************************** |
| 352 | | // LIVE DEVICE |
| 353 | | //************************************************************************** |
| 354 | | |
| 355 | | //------------------------------------------------- |
| 356 | | // ibm_pc_at_84_keyboard_device - constructor |
| 357 | | //------------------------------------------------- |
| 358 | | |
| 359 | | ibm_pc_at_84_keyboard_device::ibm_pc_at_84_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 360 | | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 361 | | device_pc_kbd_interface(mconfig, *this), |
| 362 | | m_maincpu(*this, I8048_TAG), |
| 363 | | m_dr00(*this, "DR00"), |
| 364 | | m_dr01(*this, "DR01"), |
| 365 | | m_dr02(*this, "DR02"), |
| 366 | | m_dr03(*this, "DR03"), |
| 367 | | m_dr04(*this, "DR04"), |
| 368 | | m_dr05(*this, "DR05"), |
| 369 | | m_dr06(*this, "DR06"), |
| 370 | | m_dr07(*this, "DR07"), |
| 371 | | m_dr08(*this, "DR08"), |
| 372 | | m_dr09(*this, "DR09"), |
| 373 | | m_dr10(*this, "DR10"), |
| 374 | | m_dr11(*this, "DR11"), |
| 375 | | m_dr12(*this, "DR12"), |
| 376 | | m_dr13(*this, "DR13"), |
| 377 | | m_dr14(*this, "DR14"), |
| 378 | | m_dr15(*this, "DR15"), |
| 379 | | m_kbdida(*this, "KBDIDA"), |
| 380 | | m_kbdidb(*this, "KBDIDB"), |
| 381 | | m_db(0), |
| 382 | | m_cnt(0), |
| 383 | | m_sense(0), |
| 384 | | m_t1(1) |
| 385 | | { |
| 386 | | } |
| 387 | | |
| 388 | | ibm_pc_at_84_keyboard_device::ibm_pc_at_84_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 389 | | : device_t(mconfig, PC_KBD_IBM_PC_AT_84, "IBM PC/AT Keyboard", tag, owner, clock, "kb_pcat84", __FILE__), |
| 390 | | device_pc_kbd_interface(mconfig, *this), |
| 391 | | m_maincpu(*this, I8048_TAG), |
| 392 | | m_dr00(*this, "DR00"), |
| 393 | | m_dr01(*this, "DR01"), |
| 394 | | m_dr02(*this, "DR02"), |
| 395 | | m_dr03(*this, "DR03"), |
| 396 | | m_dr04(*this, "DR04"), |
| 397 | | m_dr05(*this, "DR05"), |
| 398 | | m_dr06(*this, "DR06"), |
| 399 | | m_dr07(*this, "DR07"), |
| 400 | | m_dr08(*this, "DR08"), |
| 401 | | m_dr09(*this, "DR09"), |
| 402 | | m_dr10(*this, "DR10"), |
| 403 | | m_dr11(*this, "DR11"), |
| 404 | | m_dr12(*this, "DR12"), |
| 405 | | m_dr13(*this, "DR13"), |
| 406 | | m_dr14(*this, "DR14"), |
| 407 | | m_dr15(*this, "DR15"), |
| 408 | | m_kbdida(*this, "KBDIDA"), |
| 409 | | m_kbdidb(*this, "KBDIDB"), |
| 410 | | m_db(0), |
| 411 | | m_cnt(0), |
| 412 | | m_sense(0), |
| 413 | | m_t1(1) |
| 414 | | { |
| 415 | | } |
| 416 | | |
| 417 | | ibm_3270pc_122_keyboard_device::ibm_3270pc_122_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 418 | | : ibm_pc_at_84_keyboard_device(mconfig, PC_KBD_IBM_3270PC_122, "IBM 3270PC Keyboard", tag, owner, clock, "kb_3270pc", __FILE__) { } |
| 419 | | |
| 420 | | |
| 421 | | //------------------------------------------------- |
| 422 | | // device_start - device-specific startup |
| 423 | | //------------------------------------------------- |
| 424 | | |
| 425 | | void ibm_pc_at_84_keyboard_device::device_start() |
| 426 | | { |
| 427 | | set_pc_kbdc_device(); |
| 428 | | |
| 429 | | // state saving |
| 430 | | save_item(NAME(m_db)); |
| 431 | | save_item(NAME(m_cnt)); |
| 432 | | save_item(NAME(m_sense)); |
| 433 | | save_item(NAME(m_t1)); |
| 434 | | } |
| 435 | | |
| 436 | | |
| 437 | | //------------------------------------------------- |
| 438 | | // device_reset - device-specific reset |
| 439 | | //------------------------------------------------- |
| 440 | | |
| 441 | | void ibm_pc_at_84_keyboard_device::device_reset() |
| 442 | | { |
| 443 | | m_maincpu->reset(); |
| 444 | | } |
| 445 | | |
| 446 | | |
| 447 | | //------------------------------------------------- |
| 448 | | // bus_w - |
| 449 | | //------------------------------------------------- |
| 450 | | |
| 451 | | WRITE8_MEMBER( ibm_pc_at_84_keyboard_device::bus_w ) |
| 452 | | { |
| 453 | | /* |
| 454 | | |
| 455 | | bit description |
| 456 | | |
| 457 | | 0 SENSE 0 |
| 458 | | 1 SENSE 1 |
| 459 | | 2 SENSE 2 |
| 460 | | 3 CNT 0 |
| 461 | | 4 CNT 1 |
| 462 | | 5 CNT 2 |
| 463 | | 6 CNT 3 |
| 464 | | 7 CNT G |
| 465 | | |
| 466 | | */ |
| 467 | | |
| 468 | | m_db = data; |
| 469 | | |
| 470 | | if (!BIT(data, 7)) |
| 471 | | { |
| 472 | | m_cnt = (data >> 3) & 0x0f; |
| 473 | | } |
| 474 | | } |
| 475 | | |
| 476 | | |
| 477 | | //------------------------------------------------- |
| 478 | | // p1_r - |
| 479 | | //------------------------------------------------- |
| 480 | | |
| 481 | | READ8_MEMBER( ibm_pc_at_84_keyboard_device::p1_r ) |
| 482 | | { |
| 483 | | /* |
| 484 | | |
| 485 | | bit description |
| 486 | | |
| 487 | | 0 |
| 488 | | 1 |
| 489 | | 2 KBDID A1 |
| 490 | | 3 KBDID A2 |
| 491 | | 4 KBDID A3 |
| 492 | | 5 KBDID A4 |
| 493 | | 6 KBDID A5 |
| 494 | | 7 KBDID A6 |
| 495 | | |
| 496 | | */ |
| 497 | | |
| 498 | | UINT8 data = 0; |
| 499 | | |
| 500 | | data |= m_kbdida->read() << 2; |
| 501 | | |
| 502 | | return data; |
| 503 | | } |
| 504 | | |
| 505 | | |
| 506 | | //------------------------------------------------- |
| 507 | | // p1_w - |
| 508 | | //------------------------------------------------- |
| 509 | | |
| 510 | | WRITE8_MEMBER( ibm_pc_at_84_keyboard_device::p1_w ) |
| 511 | | { |
| 512 | | /* |
| 513 | | |
| 514 | | bit description |
| 515 | | |
| 516 | | 0 SENSE G |
| 517 | | 1 T1 |
| 518 | | 2 |
| 519 | | 3 |
| 520 | | 4 |
| 521 | | 5 |
| 522 | | 6 |
| 523 | | 7 |
| 524 | | |
| 525 | | */ |
| 526 | | |
| 527 | | if (!BIT(data, 0)) |
| 528 | | { |
| 529 | | m_sense = m_db & 0x07; |
| 530 | | } |
| 531 | | |
| 532 | | m_t1 = BIT(data, 1); |
| 533 | | } |
| 534 | | |
| 535 | | |
| 536 | | //------------------------------------------------- |
| 537 | | // p2_r - |
| 538 | | //------------------------------------------------- |
| 539 | | |
| 540 | | READ8_MEMBER( ibm_pc_at_84_keyboard_device::p2_r ) |
| 541 | | { |
| 542 | | /* |
| 543 | | |
| 544 | | bit description |
| 545 | | |
| 546 | | 0 KBDID B1 |
| 547 | | 1 KBDID B2 |
| 548 | | 2 KBDID B3 |
| 549 | | 3 KBDID B4 |
| 550 | | 4 KBDID B5 |
| 551 | | 5 KBDID B6 |
| 552 | | 6 |
| 553 | | 7 |
| 554 | | |
| 555 | | */ |
| 556 | | |
| 557 | | UINT8 data = 0xc0; |
| 558 | | |
| 559 | | data |= m_kbdidb->read(); |
| 560 | | |
| 561 | | return data; |
| 562 | | } |
| 563 | | |
| 564 | | |
| 565 | | //------------------------------------------------- |
| 566 | | // p2_w - |
| 567 | | //------------------------------------------------- |
| 568 | | |
| 569 | | WRITE8_MEMBER( ibm_pc_at_84_keyboard_device::p2_w ) |
| 570 | | { |
| 571 | | /* |
| 572 | | |
| 573 | | bit description |
| 574 | | |
| 575 | | 0 SCROLL LED |
| 576 | | 1 NUM LED |
| 577 | | 2 CAPS LED |
| 578 | | 3 |
| 579 | | 4 |
| 580 | | 5 |
| 581 | | 6 CLOCK |
| 582 | | 7 DATA |
| 583 | | |
| 584 | | */ |
| 585 | | |
| 586 | | output_set_led_value(LED_SCROLL, BIT(data, 0)); |
| 587 | | output_set_led_value(LED_NUM, BIT(data, 1)); |
| 588 | | output_set_led_value(LED_CAPS, BIT(data, 2)); |
| 589 | | |
| 590 | | m_pc_kbdc->data_write_from_kb(!BIT(data, 7)); |
| 591 | | m_pc_kbdc->clock_write_from_kb(!BIT(data, 6)); |
| 592 | | } |
| 593 | | |
| 594 | | |
| 595 | | //------------------------------------------------- |
| 596 | | // t0_r - |
| 597 | | //------------------------------------------------- |
| 598 | | |
| 599 | | READ8_MEMBER( ibm_pc_at_84_keyboard_device::t0_r ) |
| 600 | | { |
| 601 | | return !data_signal(); |
| 602 | | } |
| 603 | | |
| 604 | | |
| 605 | | //------------------------------------------------- |
| 606 | | // t1_r - |
| 607 | | //------------------------------------------------- |
| 608 | | |
| 609 | | READ8_MEMBER( ibm_pc_at_84_keyboard_device::t1_r ) |
| 610 | | { |
| 611 | | return key_depressed(); |
| 612 | | } |
| 613 | | |
| 614 | | |
| 615 | | //------------------------------------------------- |
| 616 | | // key_depressed - |
| 617 | | //------------------------------------------------- |
| 618 | | |
| 619 | | int ibm_pc_at_84_keyboard_device::key_depressed() |
| 620 | | { |
| 621 | | UINT8 data = 0xff; |
| 622 | | |
| 623 | | switch (m_cnt) |
| 624 | | { |
| 625 | | case 0: data = m_dr00->read(); break; |
| 626 | | case 1: data = m_dr01->read(); break; |
| 627 | | case 2: data = m_dr02->read(); break; |
| 628 | | case 3: data = m_dr03->read(); break; |
| 629 | | case 4: data = m_dr04->read(); break; |
| 630 | | case 5: data = m_dr05->read(); break; |
| 631 | | case 6: data = m_dr06->read(); break; |
| 632 | | case 7: data = m_dr07->read(); break; |
| 633 | | case 8: data = m_dr08->read(); break; |
| 634 | | case 9: data = m_dr09->read(); break; |
| 635 | | case 10: data = m_dr10->read(); break; |
| 636 | | case 11: data = m_dr11->read(); break; |
| 637 | | case 12: data = m_dr12->read(); break; |
| 638 | | case 13: data = m_dr13->read(); break; |
| 639 | | case 14: data = m_dr14->read(); break; |
| 640 | | case 15: data = m_dr15->read(); break; |
| 641 | | } |
| 642 | | |
| 643 | | return m_t1 && BIT(data, m_sense); |
| 644 | | } |
trunk/src/mess/machine/kb_pc83.c
| r26017 | r26018 | |
| 1 | | // license:BSD-3-Clause |
| 2 | | // copyright-holders:Curt Coder |
| 3 | | /********************************************************************** |
| 4 | | |
| 5 | | IBM 5150 83-key keyboard emulation |
| 6 | | |
| 7 | | Copyright MESS Team. |
| 8 | | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | | |
| 10 | | *********************************************************************/ |
| 11 | | |
| 12 | | #include "kb_pc83.h" |
| 13 | | |
| 14 | | |
| 15 | | |
| 16 | | //************************************************************************** |
| 17 | | // MACROS / CONSTANTS |
| 18 | | //************************************************************************** |
| 19 | | |
| 20 | | #define I8048_TAG "u1" |
| 21 | | |
| 22 | | |
| 23 | | |
| 24 | | //************************************************************************** |
| 25 | | // DEVICE DEFINITIONS |
| 26 | | //************************************************************************** |
| 27 | | |
| 28 | | const device_type PC_KBD_IBM_PC_83 = &device_creator<ibm_pc_83_keyboard_device>; |
| 29 | | |
| 30 | | |
| 31 | | //------------------------------------------------- |
| 32 | | // ROM( ibm_pc_83_keyboard ) |
| 33 | | //------------------------------------------------- |
| 34 | | |
| 35 | | ROM_START( ibm_pc_83_keyboard ) |
| 36 | | ROM_REGION( 0x400, I8048_TAG, 0 ) |
| 37 | | ROM_LOAD( "8048.u1", 0x000, 0x400, NO_DUMP ) |
| 38 | | ROM_END |
| 39 | | |
| 40 | | |
| 41 | | //------------------------------------------------- |
| 42 | | // rom_region - device-specific ROM region |
| 43 | | //------------------------------------------------- |
| 44 | | |
| 45 | | const rom_entry *ibm_pc_83_keyboard_device::device_rom_region() const |
| 46 | | { |
| 47 | | return ROM_NAME( ibm_pc_83_keyboard ); |
| 48 | | } |
| 49 | | |
| 50 | | |
| 51 | | //------------------------------------------------- |
| 52 | | // ADDRESS_MAP( kb_io ) |
| 53 | | //------------------------------------------------- |
| 54 | | |
| 55 | | static ADDRESS_MAP_START( ibm_pc_83_keyboard_io, AS_IO, 8, ibm_pc_83_keyboard_device ) |
| 56 | | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(bus_w) |
| 57 | | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(p1_r) AM_WRITENOP |
| 58 | | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w) |
| 59 | | AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t1_r) |
| 60 | | ADDRESS_MAP_END |
| 61 | | |
| 62 | | |
| 63 | | //------------------------------------------------- |
| 64 | | // MACHINE_DRIVER( ibm_pc_83_keyboard ) |
| 65 | | //------------------------------------------------- |
| 66 | | |
| 67 | | static MACHINE_CONFIG_FRAGMENT( ibm_pc_83_keyboard ) |
| 68 | | MCFG_CPU_ADD(I8048_TAG, I8048, MCS48_LC_CLOCK(IND_U(47), CAP_P(20))) |
| 69 | | MCFG_CPU_IO_MAP(ibm_pc_83_keyboard_io) |
| 70 | | MACHINE_CONFIG_END |
| 71 | | |
| 72 | | |
| 73 | | //------------------------------------------------- |
| 74 | | // machine_config_additions - device-specific |
| 75 | | // machine configurations |
| 76 | | //------------------------------------------------- |
| 77 | | |
| 78 | | machine_config_constructor ibm_pc_83_keyboard_device::device_mconfig_additions() const |
| 79 | | { |
| 80 | | return MACHINE_CONFIG_NAME( ibm_pc_83_keyboard ); |
| 81 | | } |
| 82 | | |
| 83 | | |
| 84 | | //------------------------------------------------- |
| 85 | | // INPUT_PORTS( ibm_pc_83_keyboard ) |
| 86 | | //------------------------------------------------- |
| 87 | | |
| 88 | | INPUT_PORTS_START( ibm_pc_83_keyboard ) |
| 89 | | PORT_START("DR00") |
| 90 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 91 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 92 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 93 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 94 | | |
| 95 | | PORT_START("DR01") |
| 96 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 97 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 98 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 99 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 100 | | |
| 101 | | PORT_START("DR02") |
| 102 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 103 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 104 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 105 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 106 | | |
| 107 | | PORT_START("DR03") |
| 108 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 109 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 110 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 111 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 112 | | |
| 113 | | PORT_START("DR04") |
| 114 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 115 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 116 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 117 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 118 | | |
| 119 | | PORT_START("DR05") |
| 120 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 121 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 122 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 123 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 124 | | |
| 125 | | PORT_START("DR06") |
| 126 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 127 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 128 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 129 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 130 | | |
| 131 | | PORT_START("DR07") |
| 132 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 133 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 134 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 135 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 136 | | |
| 137 | | PORT_START("DR08") |
| 138 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 139 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 140 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 141 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 142 | | |
| 143 | | PORT_START("DR09") |
| 144 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 145 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 146 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 147 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 148 | | |
| 149 | | PORT_START("DR10") |
| 150 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 151 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 152 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 153 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 154 | | |
| 155 | | PORT_START("DR11") |
| 156 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 157 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 158 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 159 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 160 | | |
| 161 | | PORT_START("DR12") |
| 162 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 163 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 164 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 165 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 166 | | |
| 167 | | PORT_START("DR13") |
| 168 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 169 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 170 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 171 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 172 | | |
| 173 | | PORT_START("DR14") |
| 174 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 175 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 176 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 177 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 178 | | |
| 179 | | PORT_START("DR15") |
| 180 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 181 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 182 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 183 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 184 | | |
| 185 | | PORT_START("DR16") |
| 186 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 187 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 188 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 189 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 190 | | |
| 191 | | PORT_START("DR17") |
| 192 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 193 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 194 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 195 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 196 | | |
| 197 | | PORT_START("DR18") |
| 198 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 199 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 200 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 201 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 202 | | |
| 203 | | PORT_START("DR19") |
| 204 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 205 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 206 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 207 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 208 | | |
| 209 | | PORT_START("DR20") |
| 210 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 211 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 212 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 213 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 214 | | |
| 215 | | PORT_START("DR21") |
| 216 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 217 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 218 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 219 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 220 | | |
| 221 | | PORT_START("DR22") |
| 222 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 223 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 224 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 225 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 226 | | |
| 227 | | PORT_START("DR23") |
| 228 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 229 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 230 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 231 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 232 | | INPUT_PORTS_END |
| 233 | | |
| 234 | | |
| 235 | | //------------------------------------------------- |
| 236 | | // input_ports - device-specific input ports |
| 237 | | //------------------------------------------------- |
| 238 | | |
| 239 | | ioport_constructor ibm_pc_83_keyboard_device::device_input_ports() const |
| 240 | | { |
| 241 | | return INPUT_PORTS_NAME( ibm_pc_83_keyboard ); |
| 242 | | } |
| 243 | | |
| 244 | | |
| 245 | | |
| 246 | | //************************************************************************** |
| 247 | | // LIVE DEVICE |
| 248 | | //************************************************************************** |
| 249 | | |
| 250 | | //------------------------------------------------- |
| 251 | | // ibm_pc_83_keyboard_device - constructor |
| 252 | | //------------------------------------------------- |
| 253 | | |
| 254 | | ibm_pc_83_keyboard_device::ibm_pc_83_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 255 | | : device_t(mconfig, PC_KBD_IBM_PC_83, "IBM PC Keyboard", tag, owner, clock, "kb_pc83", __FILE__), |
| 256 | | device_pc_kbd_interface(mconfig, *this), |
| 257 | | m_maincpu(*this, I8048_TAG), |
| 258 | | m_dr00(*this, "DR00"), |
| 259 | | m_dr01(*this, "DR01"), |
| 260 | | m_dr02(*this, "DR02"), |
| 261 | | m_dr03(*this, "DR03"), |
| 262 | | m_dr04(*this, "DR04"), |
| 263 | | m_dr05(*this, "DR05"), |
| 264 | | m_dr06(*this, "DR06"), |
| 265 | | m_dr07(*this, "DR07"), |
| 266 | | m_dr08(*this, "DR08"), |
| 267 | | m_dr09(*this, "DR09"), |
| 268 | | m_dr10(*this, "DR10"), |
| 269 | | m_dr11(*this, "DR11"), |
| 270 | | m_dr12(*this, "DR12"), |
| 271 | | m_dr13(*this, "DR13"), |
| 272 | | m_dr14(*this, "DR14"), |
| 273 | | m_dr15(*this, "DR15"), |
| 274 | | m_dr16(*this, "DR16"), |
| 275 | | m_dr17(*this, "DR17"), |
| 276 | | m_dr18(*this, "DR18"), |
| 277 | | m_dr19(*this, "DR19"), |
| 278 | | m_dr20(*this, "DR20"), |
| 279 | | m_dr21(*this, "DR21"), |
| 280 | | m_dr22(*this, "DR22"), |
| 281 | | m_dr23(*this, "DR23") |
| 282 | | { |
| 283 | | } |
| 284 | | |
| 285 | | |
| 286 | | //------------------------------------------------- |
| 287 | | // device_start - device-specific startup |
| 288 | | //------------------------------------------------- |
| 289 | | |
| 290 | | void ibm_pc_83_keyboard_device::device_start() |
| 291 | | { |
| 292 | | // state saving |
| 293 | | save_item(NAME(m_cnt)); |
| 294 | | } |
| 295 | | |
| 296 | | |
| 297 | | //------------------------------------------------- |
| 298 | | // device_reset - device-specific reset |
| 299 | | //------------------------------------------------- |
| 300 | | |
| 301 | | void ibm_pc_83_keyboard_device::device_reset() |
| 302 | | { |
| 303 | | m_maincpu->reset(); |
| 304 | | } |
| 305 | | |
| 306 | | |
| 307 | | //------------------------------------------------- |
| 308 | | // bus_w - |
| 309 | | //------------------------------------------------- |
| 310 | | |
| 311 | | WRITE8_MEMBER( ibm_pc_83_keyboard_device::bus_w ) |
| 312 | | { |
| 313 | | /* |
| 314 | | |
| 315 | | bit description |
| 316 | | |
| 317 | | 0 CNT 1 |
| 318 | | 1 CNT 2 |
| 319 | | 2 CNT 4 |
| 320 | | 3 CNT 8 |
| 321 | | 4 CNT 16 |
| 322 | | 5 CNT 32 |
| 323 | | 6 CNT 64 |
| 324 | | 7 |
| 325 | | |
| 326 | | */ |
| 327 | | |
| 328 | | m_cnt = data & 0x7f; |
| 329 | | } |
| 330 | | |
| 331 | | |
| 332 | | //------------------------------------------------- |
| 333 | | // p1_r - |
| 334 | | //------------------------------------------------- |
| 335 | | |
| 336 | | READ8_MEMBER( ibm_pc_83_keyboard_device::p1_r ) |
| 337 | | { |
| 338 | | /* |
| 339 | | |
| 340 | | bit description |
| 341 | | |
| 342 | | 0 -REQ IN |
| 343 | | 1 DATA IN |
| 344 | | 2 |
| 345 | | 3 |
| 346 | | 4 |
| 347 | | 5 |
| 348 | | 6 |
| 349 | | 7 |
| 350 | | |
| 351 | | */ |
| 352 | | |
| 353 | | UINT8 data = 0; |
| 354 | | |
| 355 | | data |= clock_signal(); |
| 356 | | data |= data_signal() << 1; |
| 357 | | |
| 358 | | return data; |
| 359 | | } |
| 360 | | |
| 361 | | |
| 362 | | //------------------------------------------------- |
| 363 | | // p2_w - |
| 364 | | //------------------------------------------------- |
| 365 | | |
| 366 | | WRITE8_MEMBER( ibm_pc_83_keyboard_device::p2_w ) |
| 367 | | { |
| 368 | | /* |
| 369 | | |
| 370 | | bit description |
| 371 | | |
| 372 | | 0 -MATRIX STROBE |
| 373 | | 1 CLOCK OUT |
| 374 | | 2 DATA OUT |
| 375 | | 3 |
| 376 | | 4 |
| 377 | | 5 |
| 378 | | 6 |
| 379 | | 7 |
| 380 | | |
| 381 | | */ |
| 382 | | |
| 383 | | m_pc_kbdc->clock_write_from_kb(BIT(data, 1)); |
| 384 | | m_pc_kbdc->data_write_from_kb(BIT(data, 2)); |
| 385 | | } |
| 386 | | |
| 387 | | |
| 388 | | //------------------------------------------------- |
| 389 | | // t1_r - |
| 390 | | //------------------------------------------------- |
| 391 | | |
| 392 | | READ8_MEMBER( ibm_pc_83_keyboard_device::t1_r ) |
| 393 | | { |
| 394 | | UINT8 data = 0xff; |
| 395 | | |
| 396 | | switch (m_cnt >> 2) |
| 397 | | { |
| 398 | | case 0: data = m_dr00->read(); break; |
| 399 | | case 1: data = m_dr01->read(); break; |
| 400 | | case 2: data = m_dr02->read(); break; |
| 401 | | case 3: data = m_dr03->read(); break; |
| 402 | | case 4: data = m_dr04->read(); break; |
| 403 | | case 5: data = m_dr05->read(); break; |
| 404 | | case 6: data = m_dr06->read(); break; |
| 405 | | case 7: data = m_dr07->read(); break; |
| 406 | | case 8: data = m_dr08->read(); break; |
| 407 | | case 9: data = m_dr09->read(); break; |
| 408 | | case 10: data = m_dr10->read(); break; |
| 409 | | case 11: data = m_dr11->read(); break; |
| 410 | | case 12: data = m_dr12->read(); break; |
| 411 | | case 13: data = m_dr13->read(); break; |
| 412 | | case 14: data = m_dr14->read(); break; |
| 413 | | case 15: data = m_dr15->read(); break; |
| 414 | | case 16: data = m_dr16->read(); break; |
| 415 | | case 17: data = m_dr17->read(); break; |
| 416 | | case 18: data = m_dr18->read(); break; |
| 417 | | case 19: data = m_dr19->read(); break; |
| 418 | | case 20: data = m_dr20->read(); break; |
| 419 | | case 21: data = m_dr21->read(); break; |
| 420 | | case 22: data = m_dr22->read(); break; |
| 421 | | case 23: data = m_dr23->read(); break; |
| 422 | | } |
| 423 | | |
| 424 | | int sense = m_cnt & 0x03; |
| 425 | | |
| 426 | | return BIT(data, sense); |
| 427 | | } |