trunk/src/mess/drivers/ticalc1x.c
| r0 | r241974 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:hap |
| 3 | /*************************************************************************** |
| 4 | |
| 5 | Texas Instruments TMS1xxx/0970/0980 handheld calculators |
| 6 | |
| 7 | Texas Instruments WIZ-A-TRON |
| 8 | * TMC0907NL DP0907BS (die labeled 0970F-07B) |
| 9 | |
| 10 | Other handhelds assumed to be on similar hardware: |
| 11 | - Math Magic |
| 12 | - Little Professor |
| 13 | |
| 14 | |
| 15 | TODO: |
| 16 | - the rom goes in an infinite loop very soon, cpu missing emulation? |
| 17 | |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | #include "emu.h" |
| 21 | #include "cpu/tms0980/tms0980.h" |
| 22 | |
| 23 | // master clock is cpu internal, the value below is an approximation |
| 24 | #define MASTER_CLOCK (250000) |
| 25 | |
| 26 | |
| 27 | class ticalc1x_state : public driver_device |
| 28 | { |
| 29 | public: |
| 30 | ticalc1x_state(const machine_config &mconfig, device_type type, const char *tag) |
| 31 | : driver_device(mconfig, type, tag), |
| 32 | m_maincpu(*this, "maincpu"), |
| 33 | m_button_matrix(*this, "IN") |
| 34 | { } |
| 35 | |
| 36 | required_device<cpu_device> m_maincpu; |
| 37 | required_ioport_array<4> m_button_matrix; |
| 38 | |
| 39 | UINT16 m_r; |
| 40 | UINT16 m_o; |
| 41 | |
| 42 | DECLARE_READ8_MEMBER(read_k); |
| 43 | DECLARE_WRITE16_MEMBER(write_o); |
| 44 | DECLARE_WRITE16_MEMBER(write_r); |
| 45 | |
| 46 | virtual void machine_start(); |
| 47 | }; |
| 48 | |
| 49 | |
| 50 | /*************************************************************************** |
| 51 | |
| 52 | I/O |
| 53 | |
| 54 | ***************************************************************************/ |
| 55 | |
| 56 | READ8_MEMBER(ticalc1x_state::read_k) |
| 57 | { |
| 58 | UINT8 k = 0; |
| 59 | |
| 60 | // read selected button rows |
| 61 | for (int i = 0; i < 4; i++) |
| 62 | if (m_o & (1 << (i + 1))) |
| 63 | k |= m_button_matrix[i]->read(); |
| 64 | |
| 65 | return k; |
| 66 | } |
| 67 | |
| 68 | WRITE16_MEMBER(ticalc1x_state::write_r) |
| 69 | { |
| 70 | // R..: select digit |
| 71 | m_r = data; |
| 72 | } |
| 73 | |
| 74 | WRITE16_MEMBER(ticalc1x_state::write_o) |
| 75 | { |
| 76 | // O0-O6: digit segments A-G |
| 77 | // O1-O4: input mux |
| 78 | m_o = data; |
| 79 | } |
| 80 | |
| 81 | |
| 82 | |
| 83 | /*************************************************************************** |
| 84 | |
| 85 | Inputs |
| 86 | |
| 87 | ***************************************************************************/ |
| 88 | |
| 89 | static INPUT_PORTS_START( wizatron ) |
| 90 | PORT_START("IN.0") |
| 91 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) |
| 92 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) |
| 93 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) |
| 94 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) |
| 95 | |
| 96 | PORT_START("IN.1") |
| 97 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 98 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 99 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 100 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 101 | |
| 102 | PORT_START("IN.2") |
| 103 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 104 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 105 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 106 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 107 | |
| 108 | PORT_START("IN.3") |
| 109 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 110 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 111 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 112 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 113 | INPUT_PORTS_END |
| 114 | |
| 115 | |
| 116 | |
| 117 | /*************************************************************************** |
| 118 | |
| 119 | Machine Config |
| 120 | |
| 121 | ***************************************************************************/ |
| 122 | |
| 123 | void ticalc1x_state::machine_start() |
| 124 | { |
| 125 | m_r = 0; |
| 126 | m_o = 0; |
| 127 | |
| 128 | save_item(NAME(m_r)); |
| 129 | save_item(NAME(m_o)); |
| 130 | } |
| 131 | |
| 132 | |
| 133 | static const UINT16 wizatron_output_pla[0x20] = |
| 134 | { |
| 135 | // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, +, -, X, /, r |
| 136 | 0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, |
| 137 | 0x7f, 0x7b, 0x26, 0x02, 0x35, 0x4a, 0x05, 0x00, |
| 138 | 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, |
| 139 | 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00 |
| 140 | }; |
| 141 | |
| 142 | |
| 143 | static MACHINE_CONFIG_START( wizatron, ticalc1x_state ) |
| 144 | |
| 145 | /* basic machine hardware */ |
| 146 | MCFG_CPU_ADD("maincpu", TMS0970, MASTER_CLOCK) |
| 147 | MCFG_TMS1XXX_OUTPUT_PLA(wizatron_output_pla) |
| 148 | MCFG_TMS1XXX_READ_K(READ8(ticalc1x_state, read_k)) |
| 149 | MCFG_TMS1XXX_WRITE_O(WRITE16(ticalc1x_state, write_o)) |
| 150 | MCFG_TMS1XXX_WRITE_R(WRITE16(ticalc1x_state, write_r)) |
| 151 | |
| 152 | /* no video! */ |
| 153 | |
| 154 | /* no sound! */ |
| 155 | MACHINE_CONFIG_END |
| 156 | |
| 157 | |
| 158 | |
| 159 | /*************************************************************************** |
| 160 | |
| 161 | Game driver(s) |
| 162 | |
| 163 | ***************************************************************************/ |
| 164 | |
| 165 | ROM_START( wizatron ) |
| 166 | ROM_REGION( 0x0400, "maincpu", 0 ) |
| 167 | ROM_LOAD( "dp0907bs", 0x0000, 0x0400, CRC(5a6af094) SHA1(b1f27e1f13f4db3b052dd50fb08dbf9c4d8db26e) ) |
| 168 | ROM_END |
| 169 | |
| 170 | |
| 171 | CONS( 1977, wizatron, 0, 0, wizatron, wizatron, driver_device, 0, "Texas Instruments", "Wiz-A-Tron", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) |
trunk/src/mess/drivers/wizatron.c
| r241973 | r241974 | |
| 1 | | // license:BSD-3-Clause |
| 2 | | // copyright-holders:hap |
| 3 | | /*************************************************************************** |
| 4 | | |
| 5 | | Texas Instruments WIZ-A-TRON |
| 6 | | * TMC0907NL DP0907BS (die labeled 0970F-07B) |
| 7 | | |
| 8 | | Other handhelds assumed to be on similar hardware: |
| 9 | | - Math Magic |
| 10 | | - Little Professor |
| 11 | | |
| 12 | | |
| 13 | | TODO: |
| 14 | | - the rom goes in an infinite loop very soon, cpu missing emulation? |
| 15 | | |
| 16 | | ***************************************************************************/ |
| 17 | | |
| 18 | | #include "emu.h" |
| 19 | | #include "cpu/tms0980/tms0980.h" |
| 20 | | |
| 21 | | // master clock is cpu internal, the value below is an approximation |
| 22 | | #define MASTER_CLOCK (250000) |
| 23 | | |
| 24 | | |
| 25 | | class wizatron_state : public driver_device |
| 26 | | { |
| 27 | | public: |
| 28 | | wizatron_state(const machine_config &mconfig, device_type type, const char *tag) |
| 29 | | : driver_device(mconfig, type, tag), |
| 30 | | m_maincpu(*this, "maincpu"), |
| 31 | | m_button_matrix(*this, "IN") |
| 32 | | { } |
| 33 | | |
| 34 | | required_device<cpu_device> m_maincpu; |
| 35 | | required_ioport_array<4> m_button_matrix; |
| 36 | | |
| 37 | | UINT16 m_r; |
| 38 | | UINT16 m_o; |
| 39 | | |
| 40 | | DECLARE_READ8_MEMBER(read_k); |
| 41 | | DECLARE_WRITE16_MEMBER(write_o); |
| 42 | | DECLARE_WRITE16_MEMBER(write_r); |
| 43 | | |
| 44 | | virtual void machine_start(); |
| 45 | | }; |
| 46 | | |
| 47 | | |
| 48 | | /*************************************************************************** |
| 49 | | |
| 50 | | I/O |
| 51 | | |
| 52 | | ***************************************************************************/ |
| 53 | | |
| 54 | | READ8_MEMBER(wizatron_state::read_k) |
| 55 | | { |
| 56 | | UINT8 k = 0; |
| 57 | | |
| 58 | | // read selected button rows |
| 59 | | for (int i = 0; i < 4; i++) |
| 60 | | if (m_o & (1 << (i + 1))) |
| 61 | | k |= m_button_matrix[i]->read(); |
| 62 | | |
| 63 | | return k; |
| 64 | | } |
| 65 | | |
| 66 | | WRITE16_MEMBER(wizatron_state::write_r) |
| 67 | | { |
| 68 | | // R..: select digit |
| 69 | | m_r = data; |
| 70 | | } |
| 71 | | |
| 72 | | WRITE16_MEMBER(wizatron_state::write_o) |
| 73 | | { |
| 74 | | // O0-O6: digit segments A-G |
| 75 | | // O1-O4: input mux |
| 76 | | m_o = data; |
| 77 | | } |
| 78 | | |
| 79 | | |
| 80 | | |
| 81 | | /*************************************************************************** |
| 82 | | |
| 83 | | Inputs |
| 84 | | |
| 85 | | ***************************************************************************/ |
| 86 | | |
| 87 | | static INPUT_PORTS_START( wizatron ) |
| 88 | | PORT_START("IN.0") |
| 89 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) |
| 90 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) |
| 91 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) |
| 92 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) |
| 93 | | |
| 94 | | PORT_START("IN.1") |
| 95 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 96 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 97 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 98 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 99 | | |
| 100 | | PORT_START("IN.2") |
| 101 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 102 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 103 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 104 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 105 | | |
| 106 | | PORT_START("IN.3") |
| 107 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 108 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 109 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 110 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) |
| 111 | | INPUT_PORTS_END |
| 112 | | |
| 113 | | |
| 114 | | |
| 115 | | /*************************************************************************** |
| 116 | | |
| 117 | | Machine Config |
| 118 | | |
| 119 | | ***************************************************************************/ |
| 120 | | |
| 121 | | void wizatron_state::machine_start() |
| 122 | | { |
| 123 | | m_r = 0; |
| 124 | | m_o = 0; |
| 125 | | |
| 126 | | save_item(NAME(m_r)); |
| 127 | | save_item(NAME(m_o)); |
| 128 | | } |
| 129 | | |
| 130 | | |
| 131 | | static const UINT16 wizatron_output_pla[0x20] = |
| 132 | | { |
| 133 | | // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, +, -, X, /, r |
| 134 | | 0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, |
| 135 | | 0x7f, 0x7b, 0x26, 0x02, 0x35, 0x4a, 0x05, 0x00, |
| 136 | | 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, |
| 137 | | 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00 |
| 138 | | }; |
| 139 | | |
| 140 | | |
| 141 | | static MACHINE_CONFIG_START( wizatron, wizatron_state ) |
| 142 | | |
| 143 | | /* basic machine hardware */ |
| 144 | | MCFG_CPU_ADD("maincpu", TMS0970, MASTER_CLOCK) |
| 145 | | MCFG_TMS1XXX_OUTPUT_PLA(wizatron_output_pla) |
| 146 | | MCFG_TMS1XXX_READ_K(READ8(wizatron_state, read_k)) |
| 147 | | MCFG_TMS1XXX_WRITE_O(WRITE16(wizatron_state, write_o)) |
| 148 | | MCFG_TMS1XXX_WRITE_R(WRITE16(wizatron_state, write_r)) |
| 149 | | |
| 150 | | /* no video! */ |
| 151 | | |
| 152 | | /* no sound! */ |
| 153 | | MACHINE_CONFIG_END |
| 154 | | |
| 155 | | |
| 156 | | |
| 157 | | /*************************************************************************** |
| 158 | | |
| 159 | | Game driver(s) |
| 160 | | |
| 161 | | ***************************************************************************/ |
| 162 | | |
| 163 | | ROM_START( wizatron ) |
| 164 | | ROM_REGION( 0x0400, "maincpu", 0 ) |
| 165 | | ROM_LOAD( "dp0907bs", 0x0000, 0x0400, CRC(5a6af094) SHA1(b1f27e1f13f4db3b052dd50fb08dbf9c4d8db26e) ) |
| 166 | | ROM_END |
| 167 | | |
| 168 | | |
| 169 | | CONS( 1977, wizatron, 0, 0, wizatron, wizatron, driver_device, 0, "Texas Instruments", "Wiz-A-Tron", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) |