trunk/src/mess/machine/kb_pcat84.c
| r23890 | r23891 | |
| 288 | 288 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 289 | 289 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 290 | 290 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 291 | |
| 292 | PORT_START("SW1") |
| 293 | PORT_DIPUNUSED_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:1" ) |
| 294 | PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" ) |
| 295 | PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW1:3" ) |
| 296 | PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW1:4" ) |
| 297 | PORT_DIPUNUSED_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW1:5" ) |
| 298 | PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW1:6" ) |
| 299 | PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW1:7" ) |
| 300 | PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" ) |
| 301 | |
| 302 | PORT_START("SW2") |
| 303 | PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW ) |
| 304 | PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW ) |
| 305 | PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW ) |
| 306 | PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW ) |
| 291 | 307 | INPUT_PORTS_END |
| 292 | 308 | |
| 293 | 309 | |
| r23890 | r23891 | |
| 349 | 365 | m_dr13(*this, "DR13"), |
| 350 | 366 | m_dr14(*this, "DR14"), |
| 351 | 367 | m_dr15(*this, "DR15"), |
| 368 | m_sw1(*this, "SW1"), |
| 369 | m_sw2(*this, "SW2"), |
| 352 | 370 | m_db(0), |
| 353 | 371 | m_cnt(0), |
| 354 | | m_sense(0) |
| 372 | m_sense(0), |
| 373 | m_t1(1) |
| 355 | 374 | { |
| 356 | 375 | } |
| 357 | 376 | |
| r23890 | r23891 | |
| 375 | 394 | m_dr13(*this, "DR13"), |
| 376 | 395 | m_dr14(*this, "DR14"), |
| 377 | 396 | m_dr15(*this, "DR15"), |
| 397 | m_sw1(*this, "SW1"), |
| 398 | m_sw2(*this, "SW2"), |
| 378 | 399 | m_db(0), |
| 379 | 400 | m_cnt(0), |
| 380 | | m_sense(0) |
| 401 | m_sense(0), |
| 402 | m_t1(1) |
| 381 | 403 | { |
| 382 | 404 | } |
| 383 | 405 | |
| r23890 | r23891 | |
| 391 | 413 | |
| 392 | 414 | void ibm_pc_at_84_keyboard_device::device_start() |
| 393 | 415 | { |
| 416 | set_pc_kbdc_device(); |
| 417 | |
| 394 | 418 | // state saving |
| 395 | 419 | save_item(NAME(m_db)); |
| 396 | 420 | save_item(NAME(m_cnt)); |
| 397 | 421 | save_item(NAME(m_sense)); |
| 422 | save_item(NAME(m_t1)); |
| 398 | 423 | } |
| 399 | 424 | |
| 400 | 425 | |
| r23890 | r23891 | |
| 431 | 456 | |
| 432 | 457 | m_db = data; |
| 433 | 458 | |
| 434 | | if (BIT(data, 7)) |
| 459 | if (!BIT(data, 7)) |
| 435 | 460 | { |
| 436 | 461 | m_cnt = (data >> 3) & 0x0f; |
| 437 | 462 | } |
| r23890 | r23891 | |
| 459 | 484 | |
| 460 | 485 | */ |
| 461 | 486 | |
| 462 | | UINT8 data = 0xfc; |
| 487 | UINT8 data = 0x01; |
| 463 | 488 | |
| 489 | m_t1 = 1; |
| 490 | data |= key_depressed() << 1; |
| 491 | |
| 492 | data |= m_sw1->read() << 2; |
| 493 | |
| 464 | 494 | return data; |
| 465 | 495 | } |
| 466 | 496 | |
| r23890 | r23891 | |
| 486 | 516 | |
| 487 | 517 | */ |
| 488 | 518 | |
| 489 | | if (BIT(data, 0)) |
| 519 | if (!BIT(data, 0)) |
| 490 | 520 | { |
| 491 | 521 | m_sense = m_db & 0x07; |
| 492 | 522 | } |
| 523 | |
| 524 | m_t1 = BIT(data, 1); |
| 493 | 525 | } |
| 494 | 526 | |
| 495 | 527 | |
| r23890 | r23891 | |
| 514 | 546 | |
| 515 | 547 | */ |
| 516 | 548 | |
| 517 | | return 0xff; |
| 549 | UINT8 data = 0xc0; |
| 550 | |
| 551 | data |= m_sw2->read() & 0x0f; |
| 552 | data |= (m_sw1->read() >> 2) & 0x30; |
| 553 | |
| 554 | return data; |
| 518 | 555 | } |
| 519 | 556 | |
| 520 | 557 | |
| r23890 | r23891 | |
| 539 | 576 | |
| 540 | 577 | */ |
| 541 | 578 | |
| 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)); |
| 579 | output_set_led_value(LED_SCROLL, BIT(data, 0)); |
| 580 | output_set_led_value(LED_NUM, BIT(data, 1)); |
| 581 | output_set_led_value(LED_CAPS, BIT(data, 2)); |
| 545 | 582 | |
| 546 | 583 | m_pc_kbdc->clock_write_from_kb(!BIT(data, 6)); |
| 547 | 584 | m_pc_kbdc->data_write_from_kb(!BIT(data, 7)); |
| r23890 | r23891 | |
| 564 | 601 | |
| 565 | 602 | READ8_MEMBER( ibm_pc_at_84_keyboard_device::t1_r ) |
| 566 | 603 | { |
| 604 | return key_depressed(); |
| 605 | } |
| 606 | |
| 607 | |
| 608 | //------------------------------------------------- |
| 609 | // key_depressed - |
| 610 | //------------------------------------------------- |
| 611 | |
| 612 | int ibm_pc_at_84_keyboard_device::key_depressed() |
| 613 | { |
| 567 | 614 | UINT8 data = 0xff; |
| 568 | 615 | |
| 569 | 616 | switch (m_cnt) |
| r23890 | r23891 | |
| 586 | 633 | case 15: data = m_dr15->read(); break; |
| 587 | 634 | } |
| 588 | 635 | |
| 589 | | return BIT(data, m_sense); |
| 636 | return m_t1 && BIT(data, m_sense); |
| 590 | 637 | } |
trunk/src/mess/machine/kb_pcxt83.c
| r23890 | r23891 | |
| 259 | 259 | //------------------------------------------------- |
| 260 | 260 | |
| 261 | 261 | ibm_pc_xt_83_keyboard_device::ibm_pc_xt_83_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 262 | | : device_t(mconfig, PC_KBD_IBM_PC_XT_83, "IBM 1501100 Keyboard", tag, owner, clock, "kb_pcxt83", __FILE__), |
| 262 | : device_t(mconfig, PC_KBD_IBM_PC_XT_83, "IBM PC/XT Keyboard", tag, owner, clock, "kb_pcxt83", __FILE__), |
| 263 | 263 | device_pc_kbd_interface(mconfig, *this), |
| 264 | 264 | m_maincpu(*this, I8048_TAG), |
| 265 | 265 | m_p10(*this, "P10"), |
| r23890 | r23891 | |
| 288 | 288 | |
| 289 | 289 | void ibm_pc_xt_83_keyboard_device::device_start() |
| 290 | 290 | { |
| 291 | set_pc_kbdc_device(); |
| 292 | |
| 291 | 293 | // state saving |
| 292 | 294 | save_item(NAME(m_p1)); |
| 293 | 295 | save_item(NAME(m_p2)); |