trunk/src/mess/drivers/unk3403.c
| r0 | r242618 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:hap |
| 3 | /*************************************************************************** |
| 4 | |
| 5 | TMS1100NLL MP3403 DBS 7836 SINGAPORE some game board with 7-segs. |
| 6 | |
| 7 | What old electronic game is this? |
| 8 | |
| 9 | some clues: |
| 10 | - it's from 1978 |
| 11 | - Merlin is MP3404, Amaze-A-Tron is MP3405, this one is MP3403 |
| 12 | - it plays some short jingles (you need to be lucky with button mashing), |
| 13 | jingles feel like maybe a horse racing game |
| 14 | |
| 15 | ***************************************************************************/ |
| 16 | |
| 17 | #include "emu.h" |
| 18 | #include "cpu/tms0980/tms0980.h" |
| 19 | #include "sound/speaker.h" |
| 20 | |
| 21 | // master clock is unknown, the value below is an approximation |
| 22 | #define MASTER_CLOCK (350000) |
| 23 | |
| 24 | |
| 25 | class unk3403_state : public driver_device |
| 26 | { |
| 27 | public: |
| 28 | unk3403_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 | m_speaker(*this, "speaker") |
| 33 | { } |
| 34 | |
| 35 | required_device<cpu_device> m_maincpu; |
| 36 | required_ioport_array<4> m_button_matrix; |
| 37 | required_device<speaker_sound_device> m_speaker; |
| 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 | void leds_update(); |
| 47 | |
| 48 | virtual void machine_start(); |
| 49 | }; |
| 50 | |
| 51 | |
| 52 | |
| 53 | /*************************************************************************** |
| 54 | |
| 55 | I/O |
| 56 | |
| 57 | ***************************************************************************/ |
| 58 | |
| 59 | void unk3403_state::leds_update() |
| 60 | { |
| 61 | // show debug clues |
| 62 | static UINT8 leds[0x10] = { 0 }; |
| 63 | char msg[0x100] = { 0 }; |
| 64 | char dig[0x100] = { 0 }; |
| 65 | sprintf(msg, "i, R, O[R]"); |
| 66 | |
| 67 | for (int i = 0; i < 16; i++) |
| 68 | { |
| 69 | if (m_r >> i & 1) |
| 70 | { |
| 71 | leds[i]=m_o; |
| 72 | } |
| 73 | sprintf(dig, "\n %X %c %02X",i, (m_r >> i & 1) ? 'X' : '_', leds[i]); |
| 74 | strcat(msg, dig); |
| 75 | } |
| 76 | |
| 77 | popmessage("%s", msg); |
| 78 | } |
| 79 | |
| 80 | READ8_MEMBER(unk3403_state::read_k) |
| 81 | { |
| 82 | UINT8 k = 0; |
| 83 | |
| 84 | // read selected button rows |
| 85 | for (int i = 0; i < 4; i++) |
| 86 | { |
| 87 | if (m_r >> (i + 4) & 1) |
| 88 | k |= m_button_matrix[i]->read(); |
| 89 | } |
| 90 | |
| 91 | return k; |
| 92 | } |
| 93 | |
| 94 | WRITE16_MEMBER(unk3403_state::write_r) |
| 95 | { |
| 96 | // R4-R7: input mux |
| 97 | // R10: maybe a switch or other button row? |
| 98 | // R9: speaker out |
| 99 | m_speaker->level_w(data >> 9 & 1); |
| 100 | |
| 101 | // others: ? |
| 102 | m_r = data; |
| 103 | leds_update(); |
| 104 | } |
| 105 | |
| 106 | WRITE16_MEMBER(unk3403_state::write_o) |
| 107 | { |
| 108 | // ? |
| 109 | m_o = data; |
| 110 | leds_update(); |
| 111 | } |
| 112 | |
| 113 | |
| 114 | |
| 115 | /*************************************************************************** |
| 116 | |
| 117 | Inputs |
| 118 | |
| 119 | ***************************************************************************/ |
| 120 | |
| 121 | static INPUT_PORTS_START( unk3403 ) |
| 122 | PORT_START("IN.0") // R4 |
| 123 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) |
| 124 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) |
| 125 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) |
| 126 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) |
| 127 | |
| 128 | PORT_START("IN.1") // R5 |
| 129 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) |
| 130 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) |
| 131 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) |
| 132 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) |
| 133 | |
| 134 | PORT_START("IN.2") // R6 |
| 135 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) |
| 136 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) |
| 137 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) |
| 138 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) // reset/newgame? |
| 139 | |
| 140 | PORT_START("IN.3") // R7 |
| 141 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) |
| 142 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) |
| 143 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) |
| 144 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) |
| 145 | INPUT_PORTS_END |
| 146 | |
| 147 | |
| 148 | |
| 149 | /*************************************************************************** |
| 150 | |
| 151 | Machine Config |
| 152 | |
| 153 | ***************************************************************************/ |
| 154 | |
| 155 | void unk3403_state::machine_start() |
| 156 | { |
| 157 | m_r = 0; |
| 158 | m_o = 0; |
| 159 | |
| 160 | save_item(NAME(m_r)); |
| 161 | save_item(NAME(m_o)); |
| 162 | } |
| 163 | |
| 164 | |
| 165 | static const UINT16 unk3403_output_pla[0x20] = |
| 166 | { |
| 167 | /* O output PLA configuration currently unknown */ |
| 168 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 169 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 170 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
| 171 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f |
| 172 | }; |
| 173 | |
| 174 | |
| 175 | static MACHINE_CONFIG_START( unk3403, unk3403_state ) |
| 176 | |
| 177 | /* basic machine hardware */ |
| 178 | MCFG_CPU_ADD("maincpu", TMS1100, MASTER_CLOCK) |
| 179 | MCFG_TMS1XXX_OUTPUT_PLA(unk3403_output_pla) |
| 180 | MCFG_TMS1XXX_READ_K_CB(READ8(unk3403_state, read_k)) |
| 181 | MCFG_TMS1XXX_WRITE_O_CB(WRITE16(unk3403_state, write_o)) |
| 182 | MCFG_TMS1XXX_WRITE_R_CB(WRITE16(unk3403_state, write_r)) |
| 183 | |
| 184 | /* no video! */ |
| 185 | |
| 186 | /* sound hardware */ |
| 187 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 188 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
| 189 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 190 | MACHINE_CONFIG_END |
| 191 | |
| 192 | |
| 193 | |
| 194 | /*************************************************************************** |
| 195 | |
| 196 | Game driver(s) |
| 197 | |
| 198 | ***************************************************************************/ |
| 199 | |
| 200 | ROM_START( unk3403 ) |
| 201 | ROM_REGION( 0x0800, "maincpu", 0 ) |
| 202 | ROM_LOAD( "tms1100nll_mp3403", 0x0000, 0x0800, CRC(9eabaa7d) SHA1(b1f54587ed7f2bbf3a5d49075c807296384c2b06) ) |
| 203 | |
| 204 | ROM_REGION( 867, "maincpu:mpla", 0 ) |
| 205 | ROM_LOAD( "tms1100_default_mpla.pla", 0, 867, BAD_DUMP CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) // not verified |
| 206 | ROM_REGION( 365, "maincpu:opla", 0 ) |
| 207 | ROM_LOAD( "tms1100_xxx_opla.pla", 0, 365, NO_DUMP ) |
| 208 | ROM_END |
| 209 | |
| 210 | |
| 211 | CONS( 1978, unk3403, 0, 0, unk3403, unk3403, driver_device, 0, "<unknown>", "unknown TMS1100 electronic game", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) |