trunk/src/mame/drivers/mw18w.c
| r26551 | r26552 | |
| 4 | 4 | |
| 5 | 5 | Midway's 18 Wheeler, game number 653 |
| 6 | 6 | |
| 7 | | driver todo: |
| 7 | TODO: |
| 8 | - needs extensive interactive artwork |
| 8 | 9 | - discrete sound |
| 9 | | - hook up lamps (and sensors) |
| 10 | | - lots of external artwork |
| 10 | - identify lamps |
| 11 | 11 | |
| 12 | 12 | To diagnose game, turn on service mode and: |
| 13 | 13 | - test RAM/ROM, leds, lamps: reset with shifter in neutral |
| r26551 | r26552 | |
| 28 | 28 | public: |
| 29 | 29 | mw18w_state(const machine_config &mconfig, device_type type, const char *tag) |
| 30 | 30 | : driver_device(mconfig, type, tag), |
| 31 | | m_maincpu(*this, "maincpu") { } |
| 31 | m_maincpu(*this, "maincpu"), |
| 32 | m_lamp_timer(*this, "lamp_timer") |
| 33 | { } |
| 32 | 34 | |
| 33 | 35 | required_device<cpu_device> m_maincpu; |
| 36 | required_device<timer_device> m_lamp_timer; |
| 37 | |
| 38 | int m_lamps_on[5][8]; |
| 34 | 39 | |
| 35 | 40 | DECLARE_WRITE8_MEMBER(mw18w_sound0_w); |
| 36 | 41 | DECLARE_WRITE8_MEMBER(mw18w_sound1_w); |
| r26551 | r26552 | |
| 38 | 43 | DECLARE_WRITE8_MEMBER(mw18w_led_display_w); |
| 39 | 44 | DECLARE_WRITE8_MEMBER(mw18w_irq0_clear_w); |
| 40 | 45 | DECLARE_CUSTOM_INPUT_MEMBER(mw18w_sensors_r); |
| 46 | TIMER_DEVICE_CALLBACK_MEMBER(mw18w_update_lamps); |
| 47 | |
| 48 | virtual void machine_start(); |
| 41 | 49 | }; |
| 42 | 50 | |
| 43 | 51 | |
| r26551 | r26552 | |
| 50 | 58 | WRITE8_MEMBER(mw18w_state::mw18w_sound0_w) |
| 51 | 59 | { |
| 52 | 60 | // sound write (airhorn, brake, crash) plus motor speed for backdrop, and coin counter |
| 53 | | coin_counter_w(machine(), 0, data&1); |
| 61 | coin_counter_w(machine(), 0, data & 1); |
| 54 | 62 | } |
| 55 | 63 | |
| 56 | 64 | WRITE8_MEMBER(mw18w_state::mw18w_sound1_w) |
| r26551 | r26552 | |
| 61 | 69 | |
| 62 | 70 | WRITE8_MEMBER(mw18w_state::mw18w_lamps_w) |
| 63 | 71 | { |
| 64 | | ; |
| 72 | // d0-3, d7: selected rows |
| 73 | int rows = (data & 0xf) | ( data >> 3 & 0x10); |
| 74 | |
| 75 | // d4-d6: column |
| 76 | int col = data >> 4 & 7; |
| 77 | |
| 78 | // refresh lamp status |
| 79 | for (int i = 0; i < 5; i++) |
| 80 | if (rows >> i & 1) m_lamps_on[i][col] = 100; |
| 65 | 81 | } |
| 66 | 82 | |
| 67 | 83 | WRITE8_MEMBER(mw18w_state::mw18w_led_display_w) |
| r26551 | r26552 | |
| 72 | 88 | |
| 73 | 89 | // d4-7: 7442 (BCD to decimal) -> pick digit panel |
| 74 | 90 | if ((data&0xf0)>0x90) return; |
| 75 | | output_set_digit_value(data>>4, ls48_map[data&0xf]); |
| 91 | output_set_digit_value(data >> 4, ls48_map[data & 0xf]); |
| 76 | 92 | } |
| 77 | 93 | |
| 78 | 94 | WRITE8_MEMBER(mw18w_state::mw18w_irq0_clear_w) |
| r26551 | r26552 | |
| 131 | 147 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 132 | 148 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 133 | 149 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 134 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // left/right sw. |
| 150 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // left/right sw. |
| 135 | 151 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 136 | 152 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 137 | | PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw18w_state,mw18w_sensors_r, NULL) |
| 153 | PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw18w_state, mw18w_sensors_r, NULL) |
| 138 | 154 | |
| 139 | 155 | PORT_START("IN1") |
| 140 | | PORT_BIT( 0x1f, 0x00, IPT_PEDAL ) PORT_REMAP_TABLE(mw18w_controller_table + 0x20) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) // accelerate |
| 156 | PORT_BIT( 0x1f, 0x00, IPT_PEDAL ) PORT_REMAP_TABLE(mw18w_controller_table + 0x20) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_NAME("Gas Pedal") |
| 141 | 157 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Shifter 1st Gear") |
| 142 | 158 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Shifter 3rd Gear") |
| 143 | 159 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Shifter 2nd Gear") |
| 144 | 160 | |
| 145 | 161 | PORT_START("IN2") |
| 146 | | PORT_BIT( 0x3f, 0x1f, IPT_PADDLE ) PORT_REMAP_TABLE(mw18w_controller_table) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) // steering wheel |
| 147 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) // brake |
| 162 | PORT_BIT( 0x3f, 0x1f, IPT_PADDLE ) PORT_REMAP_TABLE(mw18w_controller_table) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_NAME("Steering Wheel") |
| 163 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Brake Pedal") |
| 148 | 164 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Shifter Reverse") |
| 149 | 165 | |
| 150 | 166 | PORT_START("DSW") |
| r26551 | r26552 | |
| 181 | 197 | PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_LOW, "SW:8" ) |
| 182 | 198 | |
| 183 | 199 | PORT_START("IN4") |
| 184 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) // n/c |
| 185 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // n/c |
| 186 | 200 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) |
| 187 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) // for both coin chutes |
| 188 | | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 201 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) // for both coin chutes |
| 202 | PORT_BIT( 0xf3, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 189 | 203 | INPUT_PORTS_END |
| 190 | 204 | |
| 191 | 205 | |
| r26551 | r26552 | |
| 196 | 210 | |
| 197 | 211 | ***************************************************************************/ |
| 198 | 212 | |
| 213 | TIMER_DEVICE_CALLBACK_MEMBER(mw18w_state::mw18w_update_lamps) |
| 214 | { |
| 215 | // arbitrary timer to update and output lamp matrix |
| 216 | for (int row = 0; row < 5; row++) |
| 217 | for (int col = 0; col < 8; col++) |
| 218 | { |
| 219 | if (m_lamps_on[row][col]) m_lamps_on[row][col]--; |
| 220 | output_set_lamp_value(row * 10 + col, m_lamps_on[row][col] != 0); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | void mw18w_state::machine_start() |
| 225 | { |
| 226 | // init lamp matrix |
| 227 | for (int row = 0; row < 5; row++) |
| 228 | for (int col = 0; col < 8; col++) |
| 229 | m_lamps_on[row][col] = 0; |
| 230 | |
| 231 | save_item(NAME(m_lamps_on)); |
| 232 | } |
| 233 | |
| 199 | 234 | static MACHINE_CONFIG_START( mw18w, mw18w_state ) |
| 200 | 235 | |
| 201 | 236 | /* basic machine hardware */ |
| r26551 | r26552 | |
| 204 | 239 | MCFG_CPU_PROGRAM_MAP(mw18w_map) |
| 205 | 240 | MCFG_CPU_IO_MAP(mw18w_portmap) |
| 206 | 241 | |
| 242 | MCFG_TIMER_DRIVER_ADD_PERIODIC("lamp_timer", mw18w_state, mw18w_update_lamps, attotime::from_hz(500)) // capacitors, frequency is a simple guess (/100) |
| 243 | |
| 207 | 244 | /* no video! */ |
| 208 | 245 | |
| 209 | 246 | /* sound hardware */ |