trunk/src/mess/drivers/hh_hmcs40.c
r245324 | r245325 | |
105 | 105 | DECLARE_WRITE16_MEMBER(alnattck_grid_w); |
106 | 106 | DECLARE_READ16_MEMBER(alnattck_input_r); |
107 | 107 | |
| 108 | DECLARE_WRITE8_MEMBER(packmon_plate_w); |
| 109 | DECLARE_WRITE16_MEMBER(packmon_grid_w); |
| 110 | DECLARE_READ16_MEMBER(packmon_input_r); |
| 111 | |
| 112 | DECLARE_WRITE8_MEMBER(zackman_plate_w); |
| 113 | DECLARE_WRITE16_MEMBER(zackman_grid_w); |
| 114 | void zackman_update_int0(); |
| 115 | DECLARE_INPUT_CHANGED_MEMBER(zackman_input_changed); |
| 116 | |
108 | 117 | void cdkong_display(); |
109 | 118 | DECLARE_WRITE8_MEMBER(cdkong_plate_w); |
110 | 119 | DECLARE_WRITE16_MEMBER(cdkong_grid_w); |
r245324 | r245325 | |
428 | 437 | |
429 | 438 | ***************************************************************************/ |
430 | 439 | |
| 440 | WRITE8_MEMBER(hh_hmcs40_state::packmon_plate_w) |
| 441 | { |
| 442 | // R0x-R3x, D0-D3: vfd matrix plate |
| 443 | int shift = offset * 4; |
| 444 | m_plate = (m_plate & ~(0xf << shift)) | (data << shift); |
| 445 | |
| 446 | // update display |
| 447 | UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); |
| 448 | UINT32 plate = BITSWAP24(m_plate,23,22,21,20,0,1,2,3,4,5,6,19,18,17,16,15,14,13,12,11,10,9,8,7); |
| 449 | |
| 450 | display_matrix(20, 10, plate, grid); |
| 451 | } |
| 452 | |
| 453 | WRITE16_MEMBER(hh_hmcs40_state::packmon_grid_w) |
| 454 | { |
| 455 | // D4: speaker out |
| 456 | m_speaker->level_w(data >> 4 & 1); |
| 457 | |
| 458 | // D11-D15: input mux |
| 459 | m_inp_mux = data >> 11 & 0x1f; |
| 460 | |
| 461 | // D6-D15: vfd matrix grid |
| 462 | m_grid = data >> 6 & 0x3ff; |
| 463 | |
| 464 | // D0-D3: plate 9-12 (update display there) |
| 465 | packmon_plate_w(space, 4, data & 0xf); |
| 466 | |
| 467 | // 12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,13,14,15,16,17,18,19 |
| 468 | // 23,22,21,20,19,18,17,16,15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 |
| 469 | // 23,22,21,20, 0, 1, 2, 3, 4, 5, 6,19,18,17,16,15,14,13,12,11,10, 9, 8, 7 |
| 470 | |
| 471 | } |
| 472 | |
| 473 | READ16_MEMBER(hh_hmcs40_state::packmon_input_r) |
| 474 | { |
| 475 | // D5: multiplexed inputs |
| 476 | return read_inputs(5); |
| 477 | } |
| 478 | |
| 479 | |
431 | 480 | static INPUT_PORTS_START( packmon ) |
| 481 | PORT_START("IN.0") // D11 line D5 |
| 482 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START ) |
| 483 | |
| 484 | PORT_START("IN.1") // D12 line D5 |
| 485 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) |
| 486 | |
| 487 | PORT_START("IN.2") // D13 line D5 |
| 488 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) |
| 489 | |
| 490 | PORT_START("IN.3") // D14 line D5 |
| 491 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) |
| 492 | |
| 493 | PORT_START("IN.4") // D15 line D5 |
| 494 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) |
432 | 495 | INPUT_PORTS_END |
433 | 496 | |
434 | 497 | |
r245324 | r245325 | |
436 | 499 | |
437 | 500 | /* basic machine hardware */ |
438 | 501 | MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - RC osc. |
| 502 | MCFG_HMCS40_WRITE_R_CB(0, WRITE8(hh_hmcs40_state, packmon_plate_w)) |
| 503 | MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, packmon_plate_w)) |
| 504 | MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, packmon_plate_w)) |
| 505 | MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, packmon_plate_w)) |
| 506 | MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, packmon_grid_w)) |
| 507 | MCFG_HMCS40_READ_D_CB(READ16(hh_hmcs40_state, packmon_input_r)) |
439 | 508 | |
440 | | // MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) |
| 509 | MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) |
441 | 510 | MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) |
442 | 511 | |
443 | 512 | /* no video! */ |
r245324 | r245325 | |
462 | 531 | |
463 | 532 | ***************************************************************************/ |
464 | 533 | |
| 534 | WRITE8_MEMBER(hh_hmcs40_state::zackman_plate_w) |
| 535 | { |
| 536 | // R0x-R6x,D0,D1: vfd matrix plate |
| 537 | int shift = offset * 4; |
| 538 | m_plate = (m_plate & ~(0xf << shift)) | (data << shift); |
| 539 | |
| 540 | // 13,12,nc,14,15,16,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,17,18,19,20,21,22,23,24,25,26,27,28 |
| 541 | // 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 |
| 542 | // 31,30,27, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,24,25,26,29,28,23,22,21,20,19,18,17,16,15,14,13,12 |
| 543 | |
| 544 | // update display |
| 545 | UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); |
| 546 | UINT32 plate = BITSWAP32(m_plate,31,30,27,0,1,2,3,4,5,6,7,8,9,10,11,24,25,26,29,28,23,22,21,20,19,18,17,16,15,14,13,12); |
| 547 | |
| 548 | display_matrix(29, 8, plate, grid); |
| 549 | } |
| 550 | |
| 551 | WRITE16_MEMBER(hh_hmcs40_state::zackman_grid_w) |
| 552 | { |
| 553 | // D2: speaker out |
| 554 | m_speaker->level_w(data >> 2 & 1); |
| 555 | |
| 556 | // D11-D14: input mux |
| 557 | UINT8 inp_mux = data >> 11 & 0xf; |
| 558 | if (inp_mux != m_inp_mux) |
| 559 | { |
| 560 | m_inp_mux = inp_mux; |
| 561 | zackman_update_int0(); |
| 562 | } |
| 563 | |
| 564 | // D8-D15: vfd matrix grid |
| 565 | m_grid = data >> 8 & 0xff; |
| 566 | |
| 567 | // D0,D1: plate 12,13 (update display there) |
| 568 | zackman_plate_w(space, 7, data & 3); |
| 569 | } |
| 570 | |
| 571 | void hh_hmcs40_state::zackman_update_int0() |
| 572 | { |
| 573 | // INT0 on multiplexed inputs |
| 574 | set_interrupt(0, read_inputs(4)); |
| 575 | } |
| 576 | |
| 577 | |
| 578 | INPUT_CHANGED_MEMBER(hh_hmcs40_state::zackman_input_changed) |
| 579 | { |
| 580 | zackman_update_int0(); |
| 581 | } |
| 582 | |
465 | 583 | static INPUT_PORTS_START( zackman ) |
| 584 | PORT_START("IN.0") // D11 INT0 |
| 585 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, zackman_input_changed, NULL) |
| 586 | |
| 587 | PORT_START("IN.1") // D12 INT0 |
| 588 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, zackman_input_changed, NULL) |
| 589 | |
| 590 | PORT_START("IN.2") // D13 INT0 |
| 591 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, zackman_input_changed, NULL) |
| 592 | |
| 593 | PORT_START("IN.3") // D14 INT0 |
| 594 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, zackman_input_changed, NULL) |
| 595 | |
| 596 | PORT_START("IN.4") // INT1 |
| 597 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) |
466 | 598 | INPUT_PORTS_END |
467 | 599 | |
468 | 600 | |
r245324 | r245325 | |
470 | 602 | |
471 | 603 | /* basic machine hardware */ |
472 | 604 | MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - RC osc. |
| 605 | MCFG_HMCS40_WRITE_R_CB(0, WRITE8(hh_hmcs40_state, zackman_plate_w)) |
| 606 | MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, zackman_plate_w)) |
| 607 | MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, zackman_plate_w)) |
| 608 | MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, zackman_plate_w)) |
| 609 | MCFG_HMCS40_WRITE_R_CB(4, WRITE8(hh_hmcs40_state, zackman_plate_w)) |
| 610 | MCFG_HMCS40_WRITE_R_CB(5, WRITE8(hh_hmcs40_state, zackman_plate_w)) |
| 611 | MCFG_HMCS40_WRITE_R_CB(6, WRITE8(hh_hmcs40_state, zackman_plate_w)) |
| 612 | MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, zackman_grid_w)) |
473 | 613 | |
474 | | // MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) |
| 614 | MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) |
475 | 615 | MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) |
476 | 616 | |
477 | 617 | /* no video! */ |
r245324 | r245325 | |
536 | 676 | PORT_CONFSETTING( 0x00, "1" ) |
537 | 677 | PORT_CONFSETTING( 0x20, "2" ) |
538 | 678 | |
539 | | PORT_START("IN.1") // D5 D8 |
| 679 | PORT_START("IN.1") // D8 line D5 |
540 | 680 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) |
541 | 681 | |
542 | | PORT_START("IN.2") // D5 D9 |
| 682 | PORT_START("IN.2") // D9 line D5 |
543 | 683 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) |
544 | 684 | |
545 | | PORT_START("IN.3") // D5 D10 |
| 685 | PORT_START("IN.3") // D10 line D5 |
546 | 686 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) |
547 | 687 | |
548 | | PORT_START("IN.4") // D5 D11 |
| 688 | PORT_START("IN.4") // D11 line D5 |
549 | 689 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) |
550 | 690 | |
551 | | PORT_START("IN.5") // D5 D12 |
| 691 | PORT_START("IN.5") // D12 line D5 |
552 | 692 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Move") |
553 | 693 | |
554 | | PORT_START("IN.6") // D5 D13 |
| 694 | PORT_START("IN.6") // D13 line D5 |
555 | 695 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Fire") |
556 | 696 | INPUT_PORTS_END |
557 | 697 | |