trunk/src/mess/machine/kb_pcat84.c
| r0 | r23890 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | IBM Model F PC/AT 84-key / 3270PC 122-key keyboard emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | *********************************************************************/ |
| 9 | |
| 10 | /* |
| 11 | |
| 12 | Part No Layout |
| 13 | ------------------- |
| 14 | 6450225 UK 84-key |
| 15 | 6110344 UK 122-key |
| 16 | |
| 17 | */ |
| 18 | |
| 19 | #include "kb_pcat84.h" |
| 20 | |
| 21 | |
| 22 | |
| 23 | //************************************************************************** |
| 24 | // MACROS / CONSTANTS |
| 25 | //************************************************************************** |
| 26 | |
| 27 | #define I8048_TAG "i8048" |
| 28 | |
| 29 | |
| 30 | |
| 31 | //************************************************************************** |
| 32 | // DEVICE DEFINITIONS |
| 33 | //************************************************************************** |
| 34 | |
| 35 | const device_type PC_KBD_IBM_PC_AT_84 = &device_creator<ibm_pc_at_84_keyboard_device>; |
| 36 | const device_type PC_KBD_IBM_3270PC_122 = &device_creator<ibm_3270pc_122_keyboard_device>; |
| 37 | |
| 38 | |
| 39 | //------------------------------------------------- |
| 40 | // ROM( ibm_pc_at_84_keyboard ) |
| 41 | //------------------------------------------------- |
| 42 | |
| 43 | ROM_START( ibm_pc_at_84_keyboard ) |
| 44 | ROM_REGION( 0x400, I8048_TAG, 0 ) |
| 45 | /* |
| 46 | Keyboard Part No 6450225 |
| 47 | |
| 48 | PH 1503099 |
| 49 | D 878154 |
| 50 | 8441 D H |
| 51 | */ |
| 52 | ROM_LOAD( "1503099.bin", 0x000, 0x400, CRC(1e921f37) SHA1(5f722bdb3b57f5a532c02a5c3f78f30d785796f2) ) |
| 53 | ROM_END |
| 54 | |
| 55 | |
| 56 | //------------------------------------------------- |
| 57 | // rom_region - device-specific ROM region |
| 58 | //------------------------------------------------- |
| 59 | |
| 60 | const rom_entry *ibm_pc_at_84_keyboard_device::device_rom_region() const |
| 61 | { |
| 62 | return ROM_NAME( ibm_pc_at_84_keyboard ); |
| 63 | } |
| 64 | |
| 65 | |
| 66 | //------------------------------------------------- |
| 67 | // ROM( ibm_3270pc_122_keyboard ) |
| 68 | //------------------------------------------------- |
| 69 | |
| 70 | ROM_START( ibm_3270pc_122_keyboard ) |
| 71 | ROM_REGION( 0x400, I8048_TAG, 0 ) |
| 72 | /* |
| 73 | Keyboard Part No 6110344 |
| 74 | |
| 75 | PH 1385001 |
| 76 | D |
| 77 | 8512 D H |
| 78 | */ |
| 79 | ROM_LOAD( "1385001.bin", 0x000, 0x400, CRC(c19767e9) SHA1(a3701e4617383a4de0fd5e2e86c4b74beaf94a7b) ) |
| 80 | ROM_END |
| 81 | |
| 82 | |
| 83 | //------------------------------------------------- |
| 84 | // rom_region - device-specific ROM region |
| 85 | //------------------------------------------------- |
| 86 | |
| 87 | const rom_entry *ibm_3270pc_122_keyboard_device::device_rom_region() const |
| 88 | { |
| 89 | return ROM_NAME( ibm_3270pc_122_keyboard ); |
| 90 | } |
| 91 | |
| 92 | |
| 93 | //------------------------------------------------- |
| 94 | // ADDRESS_MAP( kb_io ) |
| 95 | //------------------------------------------------- |
| 96 | |
| 97 | static ADDRESS_MAP_START( ibm_pc_at_84_keyboard_io, AS_IO, 8, ibm_pc_at_84_keyboard_device ) |
| 98 | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READNOP AM_WRITE(bus_w) |
| 99 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w) |
| 100 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(p2_r, p2_w) |
| 101 | AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r) |
| 102 | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) |
| 103 | ADDRESS_MAP_END |
| 104 | |
| 105 | |
| 106 | //------------------------------------------------- |
| 107 | // MACHINE_DRIVER( ibm_pc_at_84_keyboard ) |
| 108 | //------------------------------------------------- |
| 109 | |
| 110 | static MACHINE_CONFIG_FRAGMENT( ibm_pc_at_84_keyboard ) |
| 111 | MCFG_CPU_ADD(I8048_TAG, I8048, 5364000) |
| 112 | MCFG_CPU_IO_MAP(ibm_pc_at_84_keyboard_io) |
| 113 | MACHINE_CONFIG_END |
| 114 | |
| 115 | |
| 116 | //------------------------------------------------- |
| 117 | // machine_config_additions - device-specific |
| 118 | // machine configurations |
| 119 | //------------------------------------------------- |
| 120 | |
| 121 | machine_config_constructor ibm_pc_at_84_keyboard_device::device_mconfig_additions() const |
| 122 | { |
| 123 | return MACHINE_CONFIG_NAME( ibm_pc_at_84_keyboard ); |
| 124 | } |
| 125 | |
| 126 | |
| 127 | //------------------------------------------------- |
| 128 | // INPUT_PORTS( ibm_pc_at_84_keyboard ) |
| 129 | //------------------------------------------------- |
| 130 | |
| 131 | INPUT_PORTS_START( ibm_pc_at_84_keyboard ) |
| 132 | PORT_START("DR00") |
| 133 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 134 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 135 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 136 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 137 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 138 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 139 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 140 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 141 | |
| 142 | PORT_START("DR01") |
| 143 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 144 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 145 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 146 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 147 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 148 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 149 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 150 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 151 | |
| 152 | PORT_START("DR02") |
| 153 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 154 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 155 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 156 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 157 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 158 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 159 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 160 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 161 | |
| 162 | PORT_START("DR03") |
| 163 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 164 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 165 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 166 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 167 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 168 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 169 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 170 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 171 | |
| 172 | PORT_START("DR04") |
| 173 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 174 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 175 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 176 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 177 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 178 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 179 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 180 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 181 | |
| 182 | PORT_START("DR05") |
| 183 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 184 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 185 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 186 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 187 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 188 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 189 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 190 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 191 | |
| 192 | PORT_START("DR06") |
| 193 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 194 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 195 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 196 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 197 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 198 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 199 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 200 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 201 | |
| 202 | PORT_START("DR07") |
| 203 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 204 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 205 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 206 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 207 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 208 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 209 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 210 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 211 | |
| 212 | PORT_START("DR08") |
| 213 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 214 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 215 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 216 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 217 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 218 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 219 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 220 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 221 | |
| 222 | PORT_START("DR09") |
| 223 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 224 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 225 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 226 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 227 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 228 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 229 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 230 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 231 | |
| 232 | PORT_START("DR10") |
| 233 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 234 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 235 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 236 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 237 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 238 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 239 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 240 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 241 | |
| 242 | PORT_START("DR11") |
| 243 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 244 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 245 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 246 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 247 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 248 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 249 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 250 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 251 | |
| 252 | PORT_START("DR12") |
| 253 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 254 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 255 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 256 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 257 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 258 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 259 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 260 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 261 | |
| 262 | PORT_START("DR13") |
| 263 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 264 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 265 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 266 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 267 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 268 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 269 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 270 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 271 | |
| 272 | PORT_START("DR14") |
| 273 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 274 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 275 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 276 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 277 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 278 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 279 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 280 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 281 | |
| 282 | PORT_START("DR15") |
| 283 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 284 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 285 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 286 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 287 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 288 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 289 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 290 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 291 | INPUT_PORTS_END |
| 292 | |
| 293 | |
| 294 | //------------------------------------------------- |
| 295 | // input_ports - device-specific input ports |
| 296 | //------------------------------------------------- |
| 297 | |
| 298 | ioport_constructor ibm_pc_at_84_keyboard_device::device_input_ports() const |
| 299 | { |
| 300 | return INPUT_PORTS_NAME( ibm_pc_at_84_keyboard ); |
| 301 | } |
| 302 | |
| 303 | |
| 304 | //------------------------------------------------- |
| 305 | // INPUT_PORTS( ibm_3270pc_122_keyboard ) |
| 306 | //------------------------------------------------- |
| 307 | |
| 308 | INPUT_PORTS_START( ibm_3270pc_122_keyboard ) |
| 309 | PORT_INCLUDE(ibm_pc_at_84_keyboard) |
| 310 | INPUT_PORTS_END |
| 311 | |
| 312 | |
| 313 | //------------------------------------------------- |
| 314 | // input_ports - device-specific input ports |
| 315 | //------------------------------------------------- |
| 316 | |
| 317 | ioport_constructor ibm_3270pc_122_keyboard_device::device_input_ports() const |
| 318 | { |
| 319 | return INPUT_PORTS_NAME( ibm_3270pc_122_keyboard ); |
| 320 | } |
| 321 | |
| 322 | |
| 323 | |
| 324 | //************************************************************************** |
| 325 | // LIVE DEVICE |
| 326 | //************************************************************************** |
| 327 | |
| 328 | //------------------------------------------------- |
| 329 | // ibm_pc_at_84_keyboard_device - constructor |
| 330 | //------------------------------------------------- |
| 331 | |
| 332 | 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) |
| 333 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 334 | device_pc_kbd_interface(mconfig, *this), |
| 335 | m_maincpu(*this, I8048_TAG), |
| 336 | m_dr00(*this, "DR00"), |
| 337 | m_dr01(*this, "DR01"), |
| 338 | m_dr02(*this, "DR02"), |
| 339 | m_dr03(*this, "DR03"), |
| 340 | m_dr04(*this, "DR04"), |
| 341 | m_dr05(*this, "DR05"), |
| 342 | m_dr06(*this, "DR06"), |
| 343 | m_dr07(*this, "DR07"), |
| 344 | m_dr08(*this, "DR08"), |
| 345 | m_dr09(*this, "DR09"), |
| 346 | m_dr10(*this, "DR10"), |
| 347 | m_dr11(*this, "DR11"), |
| 348 | m_dr12(*this, "DR12"), |
| 349 | m_dr13(*this, "DR13"), |
| 350 | m_dr14(*this, "DR14"), |
| 351 | m_dr15(*this, "DR15"), |
| 352 | m_db(0), |
| 353 | m_cnt(0), |
| 354 | m_sense(0) |
| 355 | { |
| 356 | } |
| 357 | |
| 358 | ibm_pc_at_84_keyboard_device::ibm_pc_at_84_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 359 | : device_t(mconfig, PC_KBD_IBM_PC_AT_84, "IBM PC/AT Keyboard", tag, owner, clock, "kb_pcat84", __FILE__), |
| 360 | device_pc_kbd_interface(mconfig, *this), |
| 361 | m_maincpu(*this, I8048_TAG), |
| 362 | m_dr00(*this, "DR00"), |
| 363 | m_dr01(*this, "DR01"), |
| 364 | m_dr02(*this, "DR02"), |
| 365 | m_dr03(*this, "DR03"), |
| 366 | m_dr04(*this, "DR04"), |
| 367 | m_dr05(*this, "DR05"), |
| 368 | m_dr06(*this, "DR06"), |
| 369 | m_dr07(*this, "DR07"), |
| 370 | m_dr08(*this, "DR08"), |
| 371 | m_dr09(*this, "DR09"), |
| 372 | m_dr10(*this, "DR10"), |
| 373 | m_dr11(*this, "DR11"), |
| 374 | m_dr12(*this, "DR12"), |
| 375 | m_dr13(*this, "DR13"), |
| 376 | m_dr14(*this, "DR14"), |
| 377 | m_dr15(*this, "DR15"), |
| 378 | m_db(0), |
| 379 | m_cnt(0), |
| 380 | m_sense(0) |
| 381 | { |
| 382 | } |
| 383 | |
| 384 | ibm_3270pc_122_keyboard_device::ibm_3270pc_122_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 385 | : ibm_pc_at_84_keyboard_device(mconfig, PC_KBD_IBM_3270PC_122, "IBM 3270PC Keyboard", tag, owner, clock, "kb_3270pc", __FILE__) { } |
| 386 | |
| 387 | |
| 388 | //------------------------------------------------- |
| 389 | // device_start - device-specific startup |
| 390 | //------------------------------------------------- |
| 391 | |
| 392 | void ibm_pc_at_84_keyboard_device::device_start() |
| 393 | { |
| 394 | // state saving |
| 395 | save_item(NAME(m_db)); |
| 396 | save_item(NAME(m_cnt)); |
| 397 | save_item(NAME(m_sense)); |
| 398 | } |
| 399 | |
| 400 | |
| 401 | //------------------------------------------------- |
| 402 | // device_reset - device-specific reset |
| 403 | //------------------------------------------------- |
| 404 | |
| 405 | void ibm_pc_at_84_keyboard_device::device_reset() |
| 406 | { |
| 407 | m_maincpu->reset(); |
| 408 | } |
| 409 | |
| 410 | |
| 411 | //------------------------------------------------- |
| 412 | // bus_w - |
| 413 | //------------------------------------------------- |
| 414 | |
| 415 | WRITE8_MEMBER( ibm_pc_at_84_keyboard_device::bus_w ) |
| 416 | { |
| 417 | /* |
| 418 | |
| 419 | bit description |
| 420 | |
| 421 | 0 SENSE 0 |
| 422 | 1 SENSE 1 |
| 423 | 2 SENSE 2 |
| 424 | 3 CNT 0 |
| 425 | 4 CNT 1 |
| 426 | 5 CNT 2 |
| 427 | 6 CNT 3 |
| 428 | 7 CNT G |
| 429 | |
| 430 | */ |
| 431 | |
| 432 | m_db = data; |
| 433 | |
| 434 | if (BIT(data, 7)) |
| 435 | { |
| 436 | m_cnt = (data >> 3) & 0x0f; |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | |
| 441 | //------------------------------------------------- |
| 442 | // p1_r - |
| 443 | //------------------------------------------------- |
| 444 | |
| 445 | READ8_MEMBER( ibm_pc_at_84_keyboard_device::p1_r ) |
| 446 | { |
| 447 | /* |
| 448 | |
| 449 | bit description |
| 450 | |
| 451 | 0 |
| 452 | 1 OUT |
| 453 | 2 DSW1 |
| 454 | 3 DSW2 |
| 455 | 4 DSW3 |
| 456 | 5 DSW4 |
| 457 | 6 DSW5 |
| 458 | 7 DSW6 |
| 459 | |
| 460 | */ |
| 461 | |
| 462 | UINT8 data = 0xfc; |
| 463 | |
| 464 | return data; |
| 465 | } |
| 466 | |
| 467 | |
| 468 | //------------------------------------------------- |
| 469 | // p1_w - |
| 470 | //------------------------------------------------- |
| 471 | |
| 472 | WRITE8_MEMBER( ibm_pc_at_84_keyboard_device::p1_w ) |
| 473 | { |
| 474 | /* |
| 475 | |
| 476 | bit description |
| 477 | |
| 478 | 0 SENSE G |
| 479 | 1 T1 |
| 480 | 2 |
| 481 | 3 |
| 482 | 4 |
| 483 | 5 |
| 484 | 6 |
| 485 | 7 |
| 486 | |
| 487 | */ |
| 488 | |
| 489 | if (BIT(data, 0)) |
| 490 | { |
| 491 | m_sense = m_db & 0x07; |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | |
| 496 | //------------------------------------------------- |
| 497 | // p2_r - |
| 498 | //------------------------------------------------- |
| 499 | |
| 500 | READ8_MEMBER( ibm_pc_at_84_keyboard_device::p2_r ) |
| 501 | { |
| 502 | /* |
| 503 | |
| 504 | bit description |
| 505 | |
| 506 | 0 JUMPER1 |
| 507 | 1 JUMPER2 |
| 508 | 2 JUMPER3 |
| 509 | 3 JUMPER4 |
| 510 | 4 DSW7 |
| 511 | 5 DSW8 |
| 512 | 6 |
| 513 | 7 |
| 514 | |
| 515 | */ |
| 516 | |
| 517 | return 0xff; |
| 518 | } |
| 519 | |
| 520 | |
| 521 | //------------------------------------------------- |
| 522 | // p2_w - |
| 523 | //------------------------------------------------- |
| 524 | |
| 525 | WRITE8_MEMBER( ibm_pc_at_84_keyboard_device::p2_w ) |
| 526 | { |
| 527 | /* |
| 528 | |
| 529 | bit description |
| 530 | |
| 531 | 0 SCROLL LED |
| 532 | 1 NUM LED |
| 533 | 2 CAPS LED |
| 534 | 3 |
| 535 | 4 |
| 536 | 5 |
| 537 | 6 CLOCK |
| 538 | 7 DATA |
| 539 | |
| 540 | */ |
| 541 | |
| 542 | output_set_led_value(LED_SCROLL, !BIT(data, 0)); |
| 543 | output_set_led_value(LED_NUM, !BIT(data, 1)); |
| 544 | output_set_led_value(LED_CAPS, !BIT(data, 2)); |
| 545 | |
| 546 | m_pc_kbdc->clock_write_from_kb(!BIT(data, 6)); |
| 547 | m_pc_kbdc->data_write_from_kb(!BIT(data, 7)); |
| 548 | } |
| 549 | |
| 550 | |
| 551 | //------------------------------------------------- |
| 552 | // t0_r - |
| 553 | //------------------------------------------------- |
| 554 | |
| 555 | READ8_MEMBER( ibm_pc_at_84_keyboard_device::t0_r ) |
| 556 | { |
| 557 | return !data_signal(); |
| 558 | } |
| 559 | |
| 560 | |
| 561 | //------------------------------------------------- |
| 562 | // t1_r - |
| 563 | //------------------------------------------------- |
| 564 | |
| 565 | READ8_MEMBER( ibm_pc_at_84_keyboard_device::t1_r ) |
| 566 | { |
| 567 | UINT8 data = 0xff; |
| 568 | |
| 569 | switch (m_cnt) |
| 570 | { |
| 571 | case 0: data = m_dr00->read(); break; |
| 572 | case 1: data = m_dr01->read(); break; |
| 573 | case 2: data = m_dr02->read(); break; |
| 574 | case 3: data = m_dr03->read(); break; |
| 575 | case 4: data = m_dr04->read(); break; |
| 576 | case 5: data = m_dr05->read(); break; |
| 577 | case 6: data = m_dr06->read(); break; |
| 578 | case 7: data = m_dr07->read(); break; |
| 579 | case 8: data = m_dr08->read(); break; |
| 580 | case 9: data = m_dr09->read(); break; |
| 581 | case 10: data = m_dr10->read(); break; |
| 582 | case 11: data = m_dr11->read(); break; |
| 583 | case 12: data = m_dr12->read(); break; |
| 584 | case 13: data = m_dr13->read(); break; |
| 585 | case 14: data = m_dr14->read(); break; |
| 586 | case 15: data = m_dr15->read(); break; |
| 587 | } |
| 588 | |
| 589 | return BIT(data, m_sense); |
| 590 | } |