Previous 199869 Revisions Next

r26552 Sunday 8th December, 2013 at 21:15:07 UTC by hap
added 18w lamp outputs
[src/mame/drivers]mw18w.c mwsub.c

trunk/src/mame/drivers/mwsub.c
r26551r26552
55  Midway's Submarine, game number 760
66
77TODO:
8- needs extensive artwork
8- needs extensive interactive artwork
99- discrete sound
1010- identify sensors
1111
r26551r26552
107107WRITE8_MEMBER(submar_state::submar_led_w)
108108{
109109   // 7447 (BCD to LED segment)
110   const UINT8 led_map[16] =
110   const UINT8 ls47_map[16] =
111111      { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0x00 };
112112
113113   // 2 digits per write. port 4: time, port 5: score
114   output_set_digit_value((offset << 1 & 2) | 0, led_map[data >> 4]);
115   output_set_digit_value((offset << 1 & 2) | 1, led_map[data & 0x0f]);
114   output_set_digit_value((offset << 1 & 2) | 0, ls47_map[data >> 4]);
115   output_set_digit_value((offset << 1 & 2) | 1, ls47_map[data & 0x0f]);
116116}
117117
118118WRITE8_MEMBER(submar_state::submar_irq_clear_w)
trunk/src/mame/drivers/mw18w.c
r26551r26552
44
55  Midway's 18 Wheeler, game number 653
66
7driver todo:
7TODO:
8- needs extensive interactive artwork
89- discrete sound
9- hook up lamps (and sensors)
10- lots of external artwork
10- identify lamps
1111
1212To diagnose game, turn on service mode and:
1313- test RAM/ROM, leds, lamps:    reset with shifter in neutral
r26551r26552
2828public:
2929   mw18w_state(const machine_config &mconfig, device_type type, const char *tag)
3030      : driver_device(mconfig, type, tag),
31      m_maincpu(*this, "maincpu") { }
31      m_maincpu(*this, "maincpu"),
32      m_lamp_timer(*this, "lamp_timer")
33   { }
3234
3335   required_device<cpu_device> m_maincpu;
36   required_device<timer_device> m_lamp_timer;
37   
38   int m_lamps_on[5][8];
3439
3540   DECLARE_WRITE8_MEMBER(mw18w_sound0_w);
3641   DECLARE_WRITE8_MEMBER(mw18w_sound1_w);
r26551r26552
3843   DECLARE_WRITE8_MEMBER(mw18w_led_display_w);
3944   DECLARE_WRITE8_MEMBER(mw18w_irq0_clear_w);
4045   DECLARE_CUSTOM_INPUT_MEMBER(mw18w_sensors_r);
46   TIMER_DEVICE_CALLBACK_MEMBER(mw18w_update_lamps);
47
48   virtual void machine_start();
4149};
4250
4351
r26551r26552
5058WRITE8_MEMBER(mw18w_state::mw18w_sound0_w)
5159{
5260   // 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);
5462}
5563
5664WRITE8_MEMBER(mw18w_state::mw18w_sound1_w)
r26551r26552
6169
6270WRITE8_MEMBER(mw18w_state::mw18w_lamps_w)
6371{
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;
6581}
6682
6783WRITE8_MEMBER(mw18w_state::mw18w_led_display_w)
r26551r26552
7288
7389   // d4-7: 7442 (BCD to decimal) -> pick digit panel
7490   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]);
7692}
7793
7894WRITE8_MEMBER(mw18w_state::mw18w_irq0_clear_w)
r26551r26552
131147   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
132148   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
133149   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.
135151   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
136152   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)
138154
139155   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")
141157   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Shifter 1st Gear")
142158   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Shifter 3rd Gear")
143159   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Shifter 2nd Gear")
144160
145161   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")
148164   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Shifter Reverse")
149165
150166   PORT_START("DSW")
r26551r26552
181197   PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_LOW, "SW:8" )
182198
183199   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
186200   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 )
189203INPUT_PORTS_END
190204
191205
r26551r26552
196210
197211***************************************************************************/
198212
213TIMER_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
224void 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
199234static MACHINE_CONFIG_START( mw18w, mw18w_state )
200235
201236   /* basic machine hardware */
r26551r26552
204239   MCFG_CPU_PROGRAM_MAP(mw18w_map)
205240   MCFG_CPU_IO_MAP(mw18w_portmap)
206241
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
207244   /* no video! */
208245
209246   /* sound hardware */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team