trunk/src/emu/cpu/hd61700/hd61700.h
| r32680 | r32681 | |
| 15 | 15 | // INTERFACE CONFIGURATION MACROS |
| 16 | 16 | //************************************************************************** |
| 17 | 17 | |
| 18 | | #define MCFG_HD61700_CONFIG(_config) \ |
| 19 | | hd61700_cpu_device::static_set_config(*device, _config); |
| 20 | | //************************************************************************** |
| 21 | | // DEFINITIONS |
| 22 | | //************************************************************************** |
| 18 | #define MCFG_HD61700_LCD_CTRL_CB(_devcb) \ |
| 19 | devcb = &hd61700_cpu_device::set_lcd_ctrl_callback(*device, DEVCB_##_devcb); |
| 23 | 20 | |
| 24 | | // class definition |
| 25 | | class hd61700_cpu_device; |
| 21 | #define MCFG_HD61700_LCD_WRITE_CB(_devcb) \ |
| 22 | devcb = &hd61700_cpu_device::set_lcd_write_callback(*device, DEVCB_##_devcb); |
| 26 | 23 | |
| 27 | | // cpu port callbacks types |
| 28 | | typedef void (*hd61700_lcd_control_func)(hd61700_cpu_device &device, UINT8 data); |
| 29 | | typedef UINT8 (*hd61700_lcd_data_r_func)(hd61700_cpu_device &device); |
| 30 | | typedef void (*hd61700_lcd_data_w_func)(hd61700_cpu_device &device, UINT8 data); |
| 31 | | typedef UINT16 (*hd61700_kb_r_func)(hd61700_cpu_device &device); |
| 32 | | typedef void (*hd61700_kb_w_func)(hd61700_cpu_device &device, UINT8 matrix); |
| 33 | | typedef UINT8 (*hd61700_port_r_func)(hd61700_cpu_device &device); |
| 34 | | typedef void (*hd61700_port_w_func)(hd61700_cpu_device &device, UINT8 data); |
| 24 | #define MCFG_HD61700_LCD_READ_CB(_devcb) \ |
| 25 | devcb = &hd61700_cpu_device::set_lcd_read_callback(*device, DEVCB_##_devcb); |
| 35 | 26 | |
| 36 | | // device config |
| 37 | | struct hd61700_config |
| 38 | | { |
| 39 | | hd61700_lcd_control_func m_lcd_control; //lcd control |
| 40 | | hd61700_lcd_data_r_func m_lcd_data_r; //lcd data read |
| 41 | | hd61700_lcd_data_w_func m_lcd_data_w; //lcd data write |
| 42 | | hd61700_kb_r_func m_kb_r; //keyboard matrix read |
| 43 | | hd61700_kb_w_func m_kb_w; //keyboard matrix write |
| 44 | | hd61700_port_r_func m_port_r; //8 bit port read |
| 45 | | hd61700_port_w_func m_port_w; //8 bit port write |
| 46 | | }; |
| 27 | #define MCFG_HD61700_KB_WRITE_CB(_devcb) \ |
| 28 | devcb = &hd61700_cpu_device::set_kb_write_callback(*device, DEVCB_##_devcb); |
| 47 | 29 | |
| 30 | #define MCFG_HD61700_KB_READ_CB(_devcb) \ |
| 31 | devcb = &hd61700_cpu_device::set_kb_read_callback(*device, DEVCB_##_devcb); |
| 48 | 32 | |
| 33 | #define MCFG_HD61700_PORT_WRITE_CB(_devcb) \ |
| 34 | devcb = &hd61700_cpu_device::set_port_write_callback(*device, DEVCB_##_devcb); |
| 35 | |
| 36 | #define MCFG_HD61700_PORT_READ_CB(_devcb) \ |
| 37 | devcb = &hd61700_cpu_device::set_port_read_callback(*device, DEVCB_##_devcb); |
| 38 | |
| 39 | |
| 40 | //************************************************************************** |
| 41 | // DEFINITIONS |
| 42 | //************************************************************************** |
| 43 | |
| 49 | 44 | // registers |
| 50 | 45 | enum |
| 51 | 46 | { |
| r32680 | r32681 | |
| 68 | 63 | |
| 69 | 64 | // ======================> hd61700_cpu_device |
| 70 | 65 | |
| 71 | | class hd61700_cpu_device : public cpu_device, |
| 72 | | public hd61700_config |
| 66 | class hd61700_cpu_device : public cpu_device |
| 73 | 67 | { |
| 74 | 68 | public: |
| 75 | 69 | // construction/destruction |
| 76 | 70 | hd61700_cpu_device(const machine_config &mconfig, const char *_tag, device_t *_owner, UINT32 _clock); |
| 77 | 71 | |
| 78 | | static void static_set_config(device_t &device, const hd61700_config &config); |
| 79 | | |
| 72 | template<class _Object> static devcb_base &set_lcd_ctrl_callback(device_t &device, _Object object) { return downcast<hd61700_cpu_device &>(device).m_lcd_ctrl_cb.set_callback(object); } |
| 73 | template<class _Object> static devcb_base &set_lcd_write_callback(device_t &device, _Object object) { return downcast<hd61700_cpu_device &>(device).m_lcd_write_cb.set_callback(object); } |
| 74 | template<class _Object> static devcb_base &set_lcd_read_callback(device_t &device, _Object object) { return downcast<hd61700_cpu_device &>(device).m_lcd_read_cb.set_callback(object); } |
| 75 | template<class _Object> static devcb_base &set_kb_write_callback(device_t &device, _Object object) { return downcast<hd61700_cpu_device &>(device).m_kb_write_cb.set_callback(object); } |
| 76 | template<class _Object> static devcb_base &set_kb_read_callback(device_t &device, _Object object) { return downcast<hd61700_cpu_device &>(device).m_kb_read_cb.set_callback(object); } |
| 77 | template<class _Object> static devcb_base &set_port_write_callback(device_t &device, _Object object) { return downcast<hd61700_cpu_device &>(device).m_port_write_cb.set_callback(object); } |
| 78 | template<class _Object> static devcb_base &set_port_read_callback(device_t &device, _Object object) { return downcast<hd61700_cpu_device &>(device).m_port_read_cb.set_callback(object); } |
| 79 | |
| 80 | 80 | protected: |
| 81 | 81 | // device-level overrides |
| 82 | 82 | virtual void device_start(); |
| r32680 | r32681 | |
| 148 | 148 | |
| 149 | 149 | address_space *m_program; |
| 150 | 150 | |
| 151 | devcb_write8 m_lcd_ctrl_cb; //lcd control |
| 152 | devcb_read8 m_lcd_read_cb; //lcd data read |
| 153 | devcb_write8 m_lcd_write_cb; //lcd data write |
| 154 | devcb_read16 m_kb_read_cb; //keyboard matrix read |
| 155 | devcb_write8 m_kb_write_cb; //keyboard matrix write |
| 156 | devcb_read8 m_port_read_cb; //8 bit port read |
| 157 | devcb_write8 m_port_write_cb; //8 bit port write |
| 158 | |
| 151 | 159 | // flag definitions |
| 152 | 160 | static const int FLAG_Z = 0x80; |
| 153 | 161 | static const int FLAG_C = 0x40; |
trunk/src/emu/cpu/hd61700/hd61700.c
| r32680 | r32681 | |
| 107 | 107 | m_ppc(0x0000), |
| 108 | 108 | m_curpc(0x0000), |
| 109 | 109 | m_pc(0), |
| 110 | | m_flags(0) |
| 110 | m_flags(0), |
| 111 | m_lcd_ctrl_cb(*this), |
| 112 | m_lcd_read_cb(*this), |
| 113 | m_lcd_write_cb(*this), |
| 114 | m_kb_read_cb(*this), |
| 115 | m_kb_write_cb(*this), |
| 116 | m_port_read_cb(*this), |
| 117 | m_port_write_cb(*this) |
| 111 | 118 | { |
| 112 | 119 | // ... |
| 113 | 120 | } |
| 114 | 121 | |
| 115 | 122 | |
| 116 | 123 | //------------------------------------------------- |
| 117 | | // static_set_config - set the configuration |
| 118 | | // structure |
| 119 | | //------------------------------------------------- |
| 120 | | |
| 121 | | void hd61700_cpu_device::static_set_config(device_t &device, const hd61700_config &config) |
| 122 | | { |
| 123 | | hd61700_cpu_device &conf = downcast<hd61700_cpu_device &>(device); |
| 124 | | static_cast<hd61700_config &>(conf) = config; |
| 125 | | } |
| 126 | | |
| 127 | | //------------------------------------------------- |
| 128 | 124 | // device_start - start up the device |
| 129 | 125 | //------------------------------------------------- |
| 130 | 126 | |
| r32680 | r32681 | |
| 135 | 131 | m_sec_timer = timer_alloc(SEC_TIMER); |
| 136 | 132 | m_sec_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); |
| 137 | 133 | |
| 134 | m_lcd_ctrl_cb.resolve_safe(); |
| 135 | m_lcd_read_cb.resolve_safe(0xff); |
| 136 | m_lcd_write_cb.resolve_safe(); |
| 137 | m_kb_read_cb.resolve_safe(0xff); |
| 138 | m_kb_write_cb.resolve_safe(); |
| 139 | m_port_read_cb.resolve_safe(0xff); |
| 140 | m_port_write_cb.resolve_safe(); |
| 141 | |
| 138 | 142 | // save state |
| 139 | 143 | save_item(NAME(m_ppc)); |
| 140 | 144 | save_item(NAME(m_curpc)); |
| r32680 | r32681 | |
| 464 | 468 | case 0x12: //stl |
| 465 | 469 | { |
| 466 | 470 | UINT8 arg = read_op(); |
| 471 | m_lcd_write_cb((offs_t)0, READ_REG(arg)); |
| 467 | 472 | |
| 468 | | if (m_lcd_data_w) |
| 469 | | (*m_lcd_data_w)(*this, READ_REG(arg)); |
| 470 | | |
| 471 | 473 | check_optional_jr(arg); |
| 472 | 474 | m_icount -= 11; |
| 473 | 475 | } |
| r32680 | r32681 | |
| 476 | 478 | case 0x13: //ldl |
| 477 | 479 | { |
| 478 | 480 | UINT8 arg = read_op(); |
| 479 | | UINT8 res = 0xff; |
| 481 | UINT8 res = m_lcd_read_cb(0); |
| 480 | 482 | |
| 481 | | if (m_lcd_data_r) |
| 482 | | res = (*m_lcd_data_r)(*this); |
| 483 | | |
| 484 | 483 | WRITE_REG(arg, res); |
| 485 | 484 | |
| 486 | 485 | check_optional_jr(arg); |
| r32680 | r32681 | |
| 498 | 497 | } |
| 499 | 498 | else |
| 500 | 499 | { |
| 501 | | if (m_lcd_control) |
| 502 | | (*m_lcd_control)(*this, READ_REG(arg)); |
| 500 | m_lcd_ctrl_cb((offs_t)0, READ_REG(arg)); |
| 503 | 501 | } |
| 504 | 502 | |
| 505 | 503 | check_optional_jr(arg); |
| r32680 | r32681 | |
| 529 | 527 | case 0: //PE |
| 530 | 528 | case 1: //PD |
| 531 | 529 | WRITE_REG8(idx, src); |
| 532 | | if (m_port_w) |
| 533 | | (*m_port_w)(*this, REG_PD & REG_PE); |
| 530 | m_port_write_cb((offs_t)0, REG_PD & REG_PE); |
| 534 | 531 | break; |
| 535 | 532 | case 2: //IB |
| 536 | 533 | REG_IB = (REG_IB & 0x1f) | (src & 0xe0); |
| r32680 | r32681 | |
| 539 | 536 | WRITE_REG8(idx, src); |
| 540 | 537 | break; |
| 541 | 538 | case 4: //IA |
| 542 | | if (m_kb_w) |
| 543 | | (*m_kb_w)(*this, src); |
| 539 | m_kb_write_cb((offs_t)0, src); |
| 544 | 540 | WRITE_REG8(idx, src); |
| 545 | 541 | break; |
| 546 | 542 | case 5: //IE |
| r32680 | r32681 | |
| 673 | 669 | } |
| 674 | 670 | else |
| 675 | 671 | { |
| 676 | | if (m_port_r) |
| 677 | | src = (*m_port_r)(*this); |
| 678 | | |
| 672 | src = m_port_read_cb(0); |
| 679 | 673 | src&=(~REG_PE); |
| 680 | 674 | } |
| 681 | 675 | |
| r32680 | r32681 | |
| 1017 | 1011 | case 0x52: //stl |
| 1018 | 1012 | { |
| 1019 | 1013 | UINT8 arg = read_op(); |
| 1014 | m_lcd_write_cb((offs_t)0, arg); |
| 1020 | 1015 | |
| 1021 | | if (m_lcd_data_w) |
| 1022 | | (*m_lcd_data_w)(*this, arg); |
| 1023 | | |
| 1024 | 1016 | m_icount -= 12; |
| 1025 | 1017 | } |
| 1026 | 1018 | break; |
| r32680 | r32681 | |
| 1036 | 1028 | } |
| 1037 | 1029 | else |
| 1038 | 1030 | { |
| 1039 | | if (m_lcd_control) |
| 1040 | | (*m_lcd_control)(*this, src); |
| 1031 | m_lcd_ctrl_cb((offs_t)0, src); |
| 1041 | 1032 | } |
| 1042 | 1033 | |
| 1043 | 1034 | m_icount -= 3; |
| r32680 | r32681 | |
| 1065 | 1056 | case 0: //PE |
| 1066 | 1057 | case 1: //PD |
| 1067 | 1058 | WRITE_REG8(idx, src); |
| 1068 | | if (m_port_w) |
| 1069 | | (*m_port_w)(*this, REG_PD & REG_PE); |
| 1059 | m_port_write_cb((offs_t)0, REG_PD & REG_PE); |
| 1070 | 1060 | break; |
| 1071 | 1061 | case 2: //IB |
| 1072 | 1062 | REG_IB = (REG_IB & 0x1f) | (src & 0xe0); |
| r32680 | r32681 | |
| 1075 | 1065 | WRITE_REG8(idx, src); |
| 1076 | 1066 | break; |
| 1077 | 1067 | case 4: //IA |
| 1078 | | if (m_kb_w) |
| 1079 | | (*m_kb_w)(*this, src); |
| 1068 | m_kb_write_cb((offs_t)0, src); |
| 1080 | 1069 | WRITE_REG8(idx, src); |
| 1081 | 1070 | break; |
| 1082 | 1071 | case 5: //IE |
| r32680 | r32681 | |
| 1449 | 1438 | { |
| 1450 | 1439 | UINT8 arg = read_op(); |
| 1451 | 1440 | |
| 1452 | | if (m_lcd_data_w) |
| 1453 | | { |
| 1454 | | (*m_lcd_data_w)(*this, READ_REG(arg)); |
| 1455 | | (*m_lcd_data_w)(*this, READ_REG(arg+1)); |
| 1456 | | } |
| 1441 | m_lcd_write_cb((offs_t)0, READ_REG(arg)); |
| 1442 | m_lcd_write_cb((offs_t)0, READ_REG(arg+1)); |
| 1457 | 1443 | |
| 1458 | 1444 | check_optional_jr(arg); |
| 1459 | 1445 | m_icount -= 19; |
| r32680 | r32681 | |
| 1465 | 1451 | UINT8 arg = read_op(); |
| 1466 | 1452 | UINT8 reg0, reg1; |
| 1467 | 1453 | |
| 1468 | | if (m_lcd_data_r) |
| 1469 | | { |
| 1470 | | reg0 = (*m_lcd_data_r)(*this); |
| 1471 | | reg1 = (*m_lcd_data_r)(*this); |
| 1472 | | } |
| 1473 | | else |
| 1474 | | reg0 = reg1 = 0xff; |
| 1454 | reg0 = m_lcd_read_cb(0); |
| 1455 | reg1 = m_lcd_read_cb(0); |
| 1475 | 1456 | |
| 1476 | 1457 | WRITE_REG(arg+0, reg0); |
| 1477 | 1458 | WRITE_REG(arg+1, reg1); |
| r32680 | r32681 | |
| 1633 | 1614 | } |
| 1634 | 1615 | else |
| 1635 | 1616 | { |
| 1636 | | if (m_port_r) |
| 1637 | | { |
| 1638 | | reg0 = (*m_port_r)(*this); |
| 1639 | | reg1 = (*m_port_r)(*this); |
| 1640 | | } |
| 1641 | | else |
| 1642 | | reg0 = reg1 = 0xff; |
| 1617 | reg0 = m_port_read_cb(0); |
| 1618 | reg1 = m_port_read_cb(0); |
| 1643 | 1619 | |
| 1644 | 1620 | reg0&=(~REG_PE); |
| 1645 | 1621 | reg1&=(~REG_PE); |
| r32680 | r32681 | |
| 1663 | 1639 | |
| 1664 | 1640 | if (idx >= 5) |
| 1665 | 1641 | { |
| 1666 | | UINT16 port = 0xff; |
| 1667 | | |
| 1668 | | if (m_kb_r) |
| 1669 | | port = (*m_kb_r)(*this); |
| 1670 | | |
| 1642 | UINT16 port = m_kb_read_cb(0); |
| 1671 | 1643 | src = (REG_KY & 0x0f00) | (port & 0xf0ff); |
| 1672 | 1644 | } |
| 1673 | 1645 | else |
| r32680 | r32681 | |
| 2125 | 2097 | |
| 2126 | 2098 | for (int n=GET_IM3(arg1); n>0; n--) |
| 2127 | 2099 | { |
| 2128 | | if (m_lcd_data_w) |
| 2129 | | (*m_lcd_data_w)(*this, READ_REG(arg)); |
| 2100 | m_lcd_write_cb((offs_t)0, READ_REG(arg)); |
| 2130 | 2101 | |
| 2131 | 2102 | arg++; |
| 2132 | 2103 | m_icount -= 8; |
| r32680 | r32681 | |
| 2144 | 2115 | |
| 2145 | 2116 | for (int n=GET_IM3(arg1); n>0; n--) |
| 2146 | 2117 | { |
| 2147 | | if (m_lcd_data_r) |
| 2148 | | src = (*m_lcd_data_r)(*this); |
| 2149 | | else |
| 2150 | | src = 0xff; |
| 2118 | src = m_lcd_read_cb(0); |
| 2151 | 2119 | |
| 2152 | 2120 | WRITE_REG(arg, src++); |
| 2153 | 2121 | |
| r32680 | r32681 | |
| 2641 | 2609 | m_state |= CPU_SLP; |
| 2642 | 2610 | |
| 2643 | 2611 | m_irq_status = 0; |
| 2644 | | if (m_lcd_control) |
| 2645 | | (*m_lcd_control)(*this, 0); |
| 2646 | | |
| 2647 | | if (m_kb_w) |
| 2648 | | (*m_kb_w)(*this, 0); |
| 2612 | m_lcd_ctrl_cb((offs_t)0, 0); |
| 2613 | m_kb_write_cb((offs_t)0, 0); |
| 2649 | 2614 | m_icount -= 3; |
| 2650 | 2615 | } |
| 2651 | 2616 | break; |
trunk/src/mess/drivers/pb1000.c
| r32680 | r32681 | |
| 59 | 59 | virtual void machine_start(); |
| 60 | 60 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 61 | 61 | DECLARE_WRITE16_MEMBER( gatearray_w ); |
| 62 | | UINT16 pb2000c_kb_r(); |
| 63 | | UINT16 pb1000_kb_r(); |
| 64 | | void kb_matrix_w(UINT8 matrix); |
| 62 | DECLARE_WRITE8_MEMBER( lcd_control ); |
| 63 | DECLARE_READ8_MEMBER( lcd_data_r ); |
| 64 | DECLARE_WRITE8_MEMBER( lcd_data_w ); |
| 65 | DECLARE_READ16_MEMBER( pb1000_kb_r ); |
| 66 | DECLARE_READ16_MEMBER( pb2000c_kb_r ); |
| 67 | DECLARE_WRITE8_MEMBER( kb_matrix_w ); |
| 68 | DECLARE_READ8_MEMBER( pb1000_port_r ); |
| 69 | DECLARE_READ8_MEMBER( pb2000c_port_r ); |
| 70 | DECLARE_WRITE8_MEMBER( port_w ); |
| 65 | 71 | UINT16 read_touchscreen(UINT8 line); |
| 66 | 72 | DECLARE_PALETTE_INIT(pb1000); |
| 67 | 73 | TIMER_CALLBACK_MEMBER(keyboard_timer); |
| r32680 | r32681 | |
| 325 | 331 | membank("bank1")->set_base(m_rom_reg->base()); |
| 326 | 332 | } |
| 327 | 333 | |
| 328 | | static void lcd_control(hd61700_cpu_device &device, UINT8 data) |
| 334 | WRITE8_MEMBER( pb1000_state::lcd_control ) |
| 329 | 335 | { |
| 330 | | pb1000_state *state = device.machine().driver_data<pb1000_state>(); |
| 331 | | |
| 332 | | state->m_hd44352->control_write(data); |
| 336 | m_hd44352->control_write(data); |
| 333 | 337 | } |
| 334 | 338 | |
| 335 | 339 | |
| 336 | | static UINT8 lcd_data_r(hd61700_cpu_device &device) |
| 340 | READ8_MEMBER( pb1000_state::lcd_data_r ) |
| 337 | 341 | { |
| 338 | | pb1000_state *state = device.machine().driver_data<pb1000_state>(); |
| 339 | | |
| 340 | | return state->m_hd44352->data_read(); |
| 342 | return m_hd44352->data_read(); |
| 341 | 343 | } |
| 342 | 344 | |
| 343 | 345 | |
| 344 | | static void lcd_data_w(hd61700_cpu_device &device, UINT8 data) |
| 346 | WRITE8_MEMBER( pb1000_state::lcd_data_w ) |
| 345 | 347 | { |
| 346 | | pb1000_state *state = device.machine().driver_data<pb1000_state>(); |
| 347 | | |
| 348 | | state->m_hd44352->data_write(data); |
| 348 | m_hd44352->data_write(data); |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | |
| r32680 | r32681 | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | |
| 367 | | UINT16 pb1000_state::pb1000_kb_r() |
| 367 | READ16_MEMBER( pb1000_state::pb1000_kb_r ) |
| 368 | 368 | { |
| 369 | 369 | static const char *const bitnames[] = {"NULL", "KO1", "KO2", "KO3", "KO4", "KO5", "KO6", "KO7", "KO8", "KO9", "KO10", "KO11", "KO12", "NULL", "NULL", "NULL"}; |
| 370 | 370 | UINT16 data = 0; |
| r32680 | r32681 | |
| 388 | 388 | return data; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | | UINT16 pb1000_state::pb2000c_kb_r() |
| 391 | READ16_MEMBER( pb1000_state::pb2000c_kb_r ) |
| 392 | 392 | { |
| 393 | 393 | static const char *const bitnames[] = {"NULL", "KO1", "KO2", "KO3", "KO4", "KO5", "KO6", "KO7", "KO8", "KO9", "KO10", "KO11", "KO12", "NULL", "NULL", "NULL"}; |
| 394 | 394 | UINT16 data = 0; |
| r32680 | r32681 | |
| 410 | 410 | return data; |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | | void pb1000_state::kb_matrix_w(UINT8 matrix) |
| 413 | WRITE8_MEMBER( pb1000_state::kb_matrix_w ) |
| 414 | 414 | { |
| 415 | | if (matrix & 0x80) |
| 415 | if (data & 0x80) |
| 416 | 416 | { |
| 417 | | if ((m_kb_matrix & 0x80) != (matrix & 0x80)) |
| 417 | if ((m_kb_matrix & 0x80) != (data & 0x80)) |
| 418 | 418 | m_kb_timer->adjust(attotime::never, 0, attotime::never); |
| 419 | 419 | } |
| 420 | 420 | else |
| 421 | 421 | { |
| 422 | | if ((m_kb_matrix & 0x40) != (matrix & 0x40)) |
| 422 | if ((m_kb_matrix & 0x40) != (data & 0x40)) |
| 423 | 423 | { |
| 424 | | if (matrix & 0x40) |
| 424 | if (data & 0x40) |
| 425 | 425 | m_kb_timer->adjust(attotime::from_hz(32), 0, attotime::from_hz(32)); |
| 426 | 426 | else |
| 427 | 427 | m_kb_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256)); |
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | | m_kb_matrix = matrix; |
| 431 | m_kb_matrix = data; |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | | //------------------------------------------------- |
| 435 | | // HD61700 interface |
| 436 | | //------------------------------------------------- |
| 437 | | |
| 438 | | static void kb_matrix_w_call(hd61700_cpu_device &device, UINT8 matrix) |
| 434 | READ8_MEMBER( pb1000_state::pb1000_port_r ) |
| 439 | 435 | { |
| 440 | | pb1000_state *state = device.machine().driver_data<pb1000_state>(); |
| 441 | | |
| 442 | | state->kb_matrix_w(matrix); |
| 443 | | } |
| 444 | | |
| 445 | | static UINT8 pb1000_port_r(hd61700_cpu_device &device) |
| 446 | | { |
| 447 | 436 | //TODO |
| 448 | 437 | return 0x00; |
| 449 | 438 | } |
| 450 | 439 | |
| 451 | | static UINT8 pb2000c_port_r(hd61700_cpu_device &device) |
| 440 | READ8_MEMBER( pb1000_state::pb2000c_port_r ) |
| 452 | 441 | { |
| 453 | 442 | //TODO |
| 454 | 443 | return 0xfc; |
| 455 | 444 | } |
| 456 | 445 | |
| 457 | | static void port_w(hd61700_cpu_device &device, UINT8 data) |
| 446 | WRITE8_MEMBER( pb1000_state::port_w ) |
| 458 | 447 | { |
| 459 | | pb1000_state *state = device.machine().driver_data<pb1000_state>(); |
| 460 | | state->m_beeper->set_state((BIT(data,7) ^ BIT(data,6))); |
| 448 | m_beeper->set_state((BIT(data,7) ^ BIT(data,6))); |
| 461 | 449 | //printf("%x\n", data); |
| 462 | 450 | } |
| 463 | 451 | |
| 464 | | static UINT16 pb1000_kb_r_call(hd61700_cpu_device &device) |
| 465 | | { |
| 466 | | pb1000_state *state = device.machine().driver_data<pb1000_state>(); |
| 467 | 452 | |
| 468 | | return state->pb1000_kb_r(); |
| 469 | | } |
| 470 | | |
| 471 | | static UINT16 pb2000c_kb_r_call(hd61700_cpu_device &device) |
| 472 | | { |
| 473 | | pb1000_state *state = device.machine().driver_data<pb1000_state>(); |
| 474 | | |
| 475 | | return state->pb2000c_kb_r(); |
| 476 | | } |
| 477 | | |
| 478 | | static const hd61700_config pb1000_config = |
| 479 | | { |
| 480 | | lcd_control, //lcd control |
| 481 | | lcd_data_r, //lcd data read |
| 482 | | lcd_data_w, //lcd data write |
| 483 | | pb1000_kb_r_call, //keyboard matrix read |
| 484 | | kb_matrix_w_call, //keyboard matrix write |
| 485 | | pb1000_port_r, //8 bit port read |
| 486 | | port_w //8 bit port write |
| 487 | | }; |
| 488 | | |
| 489 | | static const hd61700_config pb2000c_config = |
| 490 | | { |
| 491 | | lcd_control, //lcd control |
| 492 | | lcd_data_r, //lcd data read |
| 493 | | lcd_data_w, //lcd data write |
| 494 | | pb2000c_kb_r_call, //keyboard matrix read |
| 495 | | kb_matrix_w_call, //keyboard matrix write |
| 496 | | pb2000c_port_r, //8 bit port read |
| 497 | | port_w //8 bit port write |
| 498 | | }; |
| 499 | | |
| 500 | 453 | TIMER_CALLBACK_MEMBER(pb1000_state::keyboard_timer) |
| 501 | 454 | { |
| 502 | 455 | m_maincpu->set_input_line(HD61700_KEY_INT, ASSERT_LINE); |
| r32680 | r32681 | |
| 522 | 475 | /* basic machine hardware */ |
| 523 | 476 | MCFG_CPU_ADD("maincpu", HD61700, 910000) |
| 524 | 477 | MCFG_CPU_PROGRAM_MAP(pb1000_mem) |
| 525 | | MCFG_HD61700_CONFIG(pb1000_config) |
| 478 | MCFG_HD61700_LCD_CTRL_CB(WRITE8(pb1000_state, lcd_control)) |
| 479 | MCFG_HD61700_LCD_READ_CB(READ8(pb1000_state, lcd_data_r)) |
| 480 | MCFG_HD61700_LCD_WRITE_CB(WRITE8(pb1000_state, lcd_data_w)) |
| 481 | MCFG_HD61700_KB_READ_CB(READ16(pb1000_state, pb1000_kb_r)) |
| 482 | MCFG_HD61700_KB_WRITE_CB(WRITE8(pb1000_state, kb_matrix_w)) |
| 483 | MCFG_HD61700_PORT_READ_CB(READ8(pb1000_state, pb1000_port_r)) |
| 484 | MCFG_HD61700_PORT_WRITE_CB(WRITE8(pb1000_state, port_w)) |
| 526 | 485 | |
| 527 | 486 | /* video hardware */ |
| 528 | 487 | MCFG_SCREEN_ADD("screen", LCD) |
| r32680 | r32681 | |
| 554 | 513 | /* basic machine hardware */ |
| 555 | 514 | MCFG_CPU_MODIFY("maincpu") |
| 556 | 515 | MCFG_CPU_PROGRAM_MAP(pb2000c_mem) |
| 557 | | MCFG_HD61700_CONFIG(pb2000c_config) |
| 516 | MCFG_HD61700_KB_READ_CB(READ16(pb1000_state, pb2000c_kb_r)) |
| 517 | MCFG_HD61700_PORT_READ_CB(READ8(pb1000_state, pb2000c_port_r)) |
| 558 | 518 | |
| 559 | 519 | MCFG_GENERIC_CARTSLOT_ADD("cardslot1", generic_plain_slot, "pb2000c_card") |
| 560 | 520 | MCFG_GENERIC_CARTSLOT_ADD("cardslot2", generic_plain_slot, "pb2000c_card") |