trunk/src/mame/drivers/zac_1.c
| r18057 | r18058 | |
| 14 | 14 | and off independently. Some games come with a NE555 and SN76477 with switchable |
| 15 | 15 | sounds (achieved with 21 switching diodes and 8 data bits). |
| 16 | 16 | |
| 17 | Each game has its own map of inputs and outputs, although fortunately some |
| 18 | of them happen to be fairly common. For example the outhole is always on the |
| 19 | same output line, while the knocker is the same except for 'strapids'. |
| 20 | |
| 17 | 21 | ToDo: |
| 18 | 22 | - Outputs |
| 19 | 23 | - Sound |
| r18057 | r18058 | |
| 23 | 27 | **************************************************************************************/ |
| 24 | 28 | |
| 25 | 29 | |
| 26 | | #include "emu.h" |
| 30 | #include "machine/genpin.h" |
| 27 | 31 | #include "cpu/s2650/s2650.h" |
| 28 | 32 | #include "zac_1.lh" |
| 29 | 33 | |
| r18057 | r18058 | |
| 33 | 37 | zac_1_state(const machine_config &mconfig, device_type type, const char *tag) |
| 34 | 38 | : driver_device(mconfig, type, tag), |
| 35 | 39 | m_maincpu(*this, "maincpu"), |
| 36 | | m_p_ram(*this, "ram") |
| 40 | m_p_ram(*this, "ram"), |
| 41 | m_samples(*this, "samples") |
| 37 | 42 | { } |
| 38 | 43 | |
| 39 | 44 | DECLARE_READ8_MEMBER(ctrl_r); |
| r18057 | r18058 | |
| 46 | 51 | UINT8 m_out_offs; |
| 47 | 52 | required_device<cpu_device> m_maincpu; |
| 48 | 53 | required_shared_ptr<UINT8> m_p_ram; |
| 54 | required_device<samples_device> m_samples; |
| 49 | 55 | protected: |
| 50 | 56 | |
| 51 | 57 | // devices |
| r18057 | r18058 | |
| 91 | 97 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT ) |
| 92 | 98 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Burn Test") |
| 93 | 99 | |
| 100 | // from here there are variations per game |
| 94 | 101 | PORT_START("ROW2") |
| 95 | 102 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Outhole") PORT_CODE(KEYCODE_X) |
| 96 | 103 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("LH Flap") PORT_CODE(KEYCODE_Q) |
| r18057 | r18058 | |
| 181 | 188 | { |
| 182 | 189 | m_t_c = 0; |
| 183 | 190 | // init system if invalid (from pinmame) |
| 184 | | if (m_p_ram[0xf7] == 5 && m_p_ram[0xf8] == 0x0a) |
| 191 | if (m_p_ram[0xf7] == 5 || m_p_ram[0xf8] == 0x0a) |
| 185 | 192 | {} |
| 186 | 193 | else |
| 187 | 194 | { |
| r18057 | r18058 | |
| 205 | 212 | state->m_t_c++; |
| 206 | 213 | } |
| 207 | 214 | |
| 215 | /* scores = 1800-182D; solenoids = 1840-1853; |
| 216 | lamps = 1880-18BF; bookkeeping=18C0-18FF. 4-tone osc=1854-1857. |
| 217 | 182E-183F is a storage area for inputs. */ |
| 208 | 218 | static TIMER_DEVICE_CALLBACK( zac_1_outtimer ) |
| 209 | 219 | { |
| 210 | 220 | static const UINT8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0, 0, 0, 0, 0, 0 }; |
| 211 | 221 | zac_1_state *state = timer.machine().driver_data<zac_1_state>(); |
| 212 | 222 | state->m_out_offs++; |
| 213 | | // displays, solenoids, lamps |
| 214 | 223 | |
| 215 | 224 | if (state->m_out_offs < 0x40) |
| 216 | 225 | { |
| r18057 | r18058 | |
| 218 | 227 | UINT8 digit = state->m_out_offs & 7; |
| 219 | 228 | output_set_digit_value(display * 10 + digit, patterns[state->m_p_ram[state->m_out_offs]&15]); |
| 220 | 229 | } |
| 221 | | // seems scores = 1800-182D; solenoids = 1840-187F; |
| 222 | | // lamps = 1880-18BF; bookkeeping=18C0-18FF. 4-tone osc=1850-1853. |
| 223 | | // 182E-183F is a storage area for inputs. |
| 230 | else |
| 231 | if (state->m_out_offs == 0x4a) // outhole |
| 232 | { |
| 233 | if (BIT(state->m_p_ram[state->m_out_offs], 0)) |
| 234 | state->m_samples->start(0, 5); |
| 235 | } |
| 236 | else |
| 237 | if (state->m_out_offs == 0x4b) // knocker (not strapids) |
| 238 | { |
| 239 | if (BIT(state->m_p_ram[state->m_out_offs], 0)) |
| 240 | state->m_samples->start(0, 6); |
| 241 | } |
| 224 | 242 | } |
| 225 | 243 | |
| 226 | 244 | static MACHINE_CONFIG_START( zac_1, zac_1_state ) |
| r18057 | r18058 | |
| 233 | 251 | |
| 234 | 252 | /* Video */ |
| 235 | 253 | MCFG_DEFAULT_LAYOUT(layout_zac_1) |
| 254 | |
| 255 | /* Sound */ |
| 256 | MCFG_FRAGMENT_ADD( genpin_audio ) |
| 236 | 257 | MACHINE_CONFIG_END |
| 237 | 258 | |
| 238 | 259 | /*************************** LOCOMOTION ********************************/ |