trunk/src/mame/drivers/mw18w.c
| r26541 | r26542 | |
| 1 | 1 | // license:BSD-3-Clause |
| 2 | 2 | // copyright-holders:hap |
| 3 | | /* Midway's 18 Wheeler hardware, game number 653 |
| 3 | /*************************************************************************** |
| 4 | 4 | |
| 5 | Midway's 18 Wheeler, game number 653 |
| 6 | |
| 5 | 7 | driver todo: |
| 6 | 8 | - discrete sound |
| 7 | 9 | - hook up lamps (and sensors) |
| r26541 | r26542 | |
| 13 | 15 | - test accelerator: reset with shifter in 1st gear |
| 14 | 16 | - test steering wheel: reset with shifter in 2nd gear |
| 15 | 17 | |
| 16 | | */ |
| 18 | ***************************************************************************/ |
| 17 | 19 | |
| 18 | 20 | #include "emu.h" |
| 19 | 21 | #include "cpu/z80/z80.h" |
| r26541 | r26542 | |
| 39 | 41 | }; |
| 40 | 42 | |
| 41 | 43 | |
| 44 | /*************************************************************************** |
| 45 | |
| 46 | I/O, Memorymap |
| 47 | |
| 48 | ***************************************************************************/ |
| 49 | |
| 42 | 50 | WRITE8_MEMBER(mw18w_state::mw18w_sound0_w) |
| 43 | 51 | { |
| 44 | 52 | // sound write (airhorn, brake, crash) plus motor speed for backdrop, and coin counter |
| r26541 | r26542 | |
| 98 | 106 | ADDRESS_MAP_END |
| 99 | 107 | |
| 100 | 108 | |
| 109 | |
| 110 | /*************************************************************************** |
| 111 | |
| 112 | Inputs |
| 113 | |
| 114 | ***************************************************************************/ |
| 115 | |
| 101 | 116 | static const ioport_value mw18w_controller_table[] = |
| 102 | 117 | { |
| 103 | 118 | // same encoder as sspeedr |
| r26541 | r26542 | |
| 138 | 153 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) |
| 139 | 154 | PORT_DIPSETTING( 0x03, DEF_STR( 2C_3C ) ) |
| 140 | 155 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) |
| 141 | | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SW:5,6") |
| 142 | | PORT_DIPSETTING( 0x00, "60 seconds" ) |
| 143 | | PORT_DIPSETTING( 0x10, "70 seconds" ) |
| 144 | | PORT_DIPSETTING( 0x20, "80 seconds" ) |
| 145 | | PORT_DIPSETTING( 0x30, "90 seconds" ) |
| 146 | | |
| 147 | 156 | PORT_DIPNAME( 0x0c, 0x00, "Extended Time" ) PORT_DIPLOCATION("SW:3,4") |
| 148 | 157 | PORT_DIPSETTING( 0x00, "20 seconds at 4000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x00) // @ 60 seconds |
| 149 | 158 | PORT_DIPSETTING( 0x04, "30 seconds at 8000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x00) |
| r26541 | r26542 | |
| 161 | 170 | PORT_DIPSETTING( 0x04, "30 seconds at 15000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x30) |
| 162 | 171 | PORT_DIPSETTING( 0x08, "20 seconds at 15000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x30) |
| 163 | 172 | PORT_DIPSETTING( 0x0c, "30 seconds at 20000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x30) |
| 164 | | |
| 173 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SW:5,6") |
| 174 | PORT_DIPSETTING( 0x00, "60 seconds" ) |
| 175 | PORT_DIPSETTING( 0x10, "70 seconds" ) |
| 176 | PORT_DIPSETTING( 0x20, "80 seconds" ) |
| 177 | PORT_DIPSETTING( 0x30, "90 seconds" ) |
| 165 | 178 | PORT_DIPNAME( 0x40, 0x40, "I/O Test" ) PORT_DIPLOCATION("SW:7") |
| 166 | 179 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 167 | 180 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r26541 | r26542 | |
| 176 | 189 | INPUT_PORTS_END |
| 177 | 190 | |
| 178 | 191 | |
| 192 | |
| 193 | /*************************************************************************** |
| 194 | |
| 195 | Machine Config |
| 196 | |
| 197 | ***************************************************************************/ |
| 198 | |
| 179 | 199 | static MACHINE_CONFIG_START( mw18w, mw18w_state ) |
| 180 | 200 | |
| 181 | 201 | /* basic machine hardware */ |
| r26541 | r26542 | |
| 191 | 211 | MACHINE_CONFIG_END |
| 192 | 212 | |
| 193 | 213 | |
| 214 | |
| 215 | /*************************************************************************** |
| 216 | |
| 217 | Game drivers |
| 218 | |
| 219 | ***************************************************************************/ |
| 220 | |
| 194 | 221 | ROM_START( 18w ) |
| 195 | 222 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 196 | 223 | ROM_LOAD( "18w_b1.rom1", 0x0000, 0x0800, CRC(200c5beb) SHA1(994d67a89f18df9716c5dd4dd60f6e7eeb880f1b) ) |
trunk/src/mame/drivers/mwsub.c
| r26541 | r26542 | |
| 1 | 1 | // license:BSD-3-Clause |
| 2 | 2 | // copyright-holders:hap |
| 3 | | /* Midway's Submarine hardware, game number 760 |
| 3 | /*************************************************************************** |
| 4 | 4 | |
| 5 | Midway's Submarine, game number 760 |
| 5 | 6 | |
| 6 | | */ |
| 7 | TODO: |
| 8 | - needs extensive artwork |
| 9 | - discrete sound |
| 10 | - identify sensors |
| 7 | 11 | |
| 12 | ***************************************************************************/ |
| 13 | |
| 8 | 14 | #include "emu.h" |
| 9 | 15 | #include "cpu/z80/z80.h" |
| 10 | 16 | |
| r26541 | r26542 | |
| 20 | 26 | { } |
| 21 | 27 | |
| 22 | 28 | required_device<cpu_device> m_maincpu; |
| 29 | |
| 30 | DECLARE_READ8_MEMBER(submar_sensor0_r); |
| 31 | DECLARE_READ8_MEMBER(submar_sensor1_r); |
| 32 | DECLARE_WRITE8_MEMBER(submar_motor_w); |
| 33 | DECLARE_WRITE8_MEMBER(submar_lamp_w); |
| 34 | DECLARE_WRITE8_MEMBER(submar_solenoid_w); |
| 35 | DECLARE_WRITE8_MEMBER(submar_sound_w); |
| 36 | DECLARE_WRITE8_MEMBER(submar_led_w); |
| 37 | DECLARE_WRITE8_MEMBER(submar_irq_clear_w); |
| 23 | 38 | }; |
| 24 | 39 | |
| 25 | 40 | |
| 41 | /*************************************************************************** |
| 26 | 42 | |
| 43 | I/O, Memorymap |
| 27 | 44 | |
| 45 | ***************************************************************************/ |
| 28 | 46 | |
| 47 | READ8_MEMBER(submar_state::submar_sensor0_r) |
| 48 | { |
| 49 | // ? |
| 50 | return 0; |
| 51 | } |
| 29 | 52 | |
| 53 | READ8_MEMBER(submar_state::submar_sensor1_r) |
| 54 | { |
| 55 | // ? |
| 56 | return (ioport("IN1")->read() & 0x70) | 0x8f; |
| 57 | } |
| 58 | |
| 59 | WRITE8_MEMBER(submar_state::submar_motor_w) |
| 60 | { |
| 61 | // d0: torpedo follow |
| 62 | // d1: ship movement |
| 63 | // d2: n/c |
| 64 | // d3: torpedo timing |
| 65 | // d4: torpedo timing |
| 66 | // d5: target shipsink |
| 67 | // d6: stir water |
| 68 | // d7: n/c |
| 69 | for (int i = 0; i < 8; i++) |
| 70 | output_set_indexed_value("motor", i, data >> i & 1); |
| 71 | } |
| 72 | |
| 73 | WRITE8_MEMBER(submar_state::submar_lamp_w) |
| 74 | { |
| 75 | // d0: torpedo |
| 76 | // d1: target ship on water |
| 77 | // d2: target ship under water |
| 78 | // d3: explosion |
| 79 | // d4: game over |
| 80 | // d5: extended play |
| 81 | // d6: front ship hit |
| 82 | // d7: scenery |
| 83 | for (int i = 0; i < 8; i++) |
| 84 | output_set_lamp_value(i, data >> i & 1); |
| 85 | } |
| 86 | |
| 87 | WRITE8_MEMBER(submar_state::submar_solenoid_w) |
| 88 | { |
| 89 | // d0-d4: ship1-5 |
| 90 | // d5-d7: n/c |
| 91 | for (int i = 0; i < 8; i++) |
| 92 | output_set_indexed_value("solenoid", i, data >> i & 1); |
| 93 | } |
| 94 | |
| 95 | WRITE8_MEMBER(submar_state::submar_sound_w) |
| 96 | { |
| 97 | // d0: torpedo |
| 98 | // d1: summer |
| 99 | // d2: ship hit |
| 100 | // d3: target ship hit |
| 101 | // d4: sonar circuit |
| 102 | // d5: sonar circuit |
| 103 | // d6: n/c |
| 104 | // d7: n/c |
| 105 | } |
| 106 | |
| 107 | WRITE8_MEMBER(submar_state::submar_led_w) |
| 108 | { |
| 109 | // 7447 (BCD to LED segment) |
| 110 | const UINT8 led_map[16] = |
| 111 | { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0x00 }; |
| 112 | |
| 113 | // 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]); |
| 116 | } |
| 117 | |
| 118 | WRITE8_MEMBER(submar_state::submar_irq_clear_w) |
| 119 | { |
| 120 | m_maincpu->set_input_line(0, CLEAR_LINE); |
| 121 | } |
| 122 | |
| 123 | |
| 30 | 124 | static ADDRESS_MAP_START( submar_map, AS_PROGRAM, 8, submar_state ) |
| 125 | ADDRESS_MAP_GLOBAL_MASK(0x7fff) |
| 31 | 126 | AM_RANGE(0x0000, 0x1fff) AM_ROM |
| 32 | 127 | AM_RANGE(0x2000, 0x207f) AM_RAM |
| 33 | 128 | ADDRESS_MAP_END |
| 34 | 129 | |
| 35 | 130 | static ADDRESS_MAP_START( submar_portmap, AS_IO, 8, submar_state ) |
| 36 | | ADDRESS_MAP_UNMAP_HIGH |
| 37 | 131 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 132 | AM_RANGE(0x00, 0x00) AM_READWRITE(submar_sensor0_r, submar_motor_w) |
| 133 | AM_RANGE(0x01, 0x01) AM_READWRITE(submar_sensor1_r, submar_lamp_w) |
| 134 | AM_RANGE(0x02, 0x02) AM_WRITE(submar_solenoid_w) |
| 135 | AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW") AM_WRITE(submar_sound_w) |
| 136 | AM_RANGE(0x04, 0x05) AM_WRITE(submar_led_w) |
| 137 | AM_RANGE(0x06, 0x06) AM_WRITE(watchdog_reset_w) |
| 138 | AM_RANGE(0x07, 0x07) AM_WRITE(submar_irq_clear_w) |
| 38 | 139 | ADDRESS_MAP_END |
| 39 | 140 | |
| 40 | 141 | |
| 41 | 142 | |
| 143 | /*************************************************************************** |
| 144 | |
| 145 | Inputs |
| 146 | |
| 147 | ***************************************************************************/ |
| 148 | |
| 42 | 149 | static INPUT_PORTS_START( submar ) |
| 43 | | PORT_START("IN0") |
| 44 | | PORT_DIPNAME( 0x01, 0x01, "01" ) |
| 45 | | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 46 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 47 | | PORT_DIPNAME( 0x02, 0x02, "02" ) |
| 150 | PORT_START("IN1") |
| 151 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 152 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 153 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT ) |
| 154 | |
| 155 | PORT_START("DSW") |
| 156 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW:1") |
| 157 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) ) |
| 158 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) |
| 159 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW:2") |
| 48 | 160 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 49 | 161 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 50 | | PORT_DIPNAME( 0x04, 0x04, "04" ) |
| 51 | | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 52 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 53 | | PORT_DIPNAME( 0x08, 0x08, "08" ) |
| 54 | | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 55 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 56 | | PORT_DIPNAME( 0x10, 0x10, "10" ) |
| 57 | | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 58 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 59 | | PORT_DIPNAME( 0x20, 0x20, "20" ) |
| 60 | | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 61 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 62 | | PORT_DIPNAME( 0x40, 0x40, "40" ) |
| 63 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 64 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 65 | | PORT_DIPNAME( 0x80, 0x80, "80" ) |
| 66 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 67 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 68 | | |
| 69 | | PORT_START("IN1") |
| 70 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 71 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 72 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 73 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 74 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 75 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 76 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 77 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 162 | PORT_DIPNAME( 0x0c, 0x00, "Extended Time" ) PORT_DIPLOCATION("SW:3,4") |
| 163 | PORT_DIPSETTING( 0x00, "15 seconds at 1000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x00) // @ 60 seconds |
| 164 | PORT_DIPSETTING( 0x04, "15 seconds at 2000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x00) |
| 165 | PORT_DIPSETTING( 0x08, "30 seconds at 2000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x00) |
| 166 | PORT_DIPSETTING( 0x0c, "30 seconds at 3000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x00) |
| 167 | PORT_DIPSETTING( 0x00, "15 seconds at 2000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x10) // @ 70 seconds |
| 168 | PORT_DIPSETTING( 0x04, "15 seconds at 3000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x10) |
| 169 | PORT_DIPSETTING( 0x08, "30 seconds at 3000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x10) |
| 170 | PORT_DIPSETTING( 0x0c, "30 seconds at 4000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x10) |
| 171 | PORT_DIPSETTING( 0x00, "15 seconds at 3000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x20) // @ 80 seconds |
| 172 | PORT_DIPSETTING( 0x04, "15 seconds at 4000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x20) |
| 173 | PORT_DIPSETTING( 0x08, "30 seconds at 4000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x20) |
| 174 | PORT_DIPSETTING( 0x0c, "30 seconds at 5000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x20) |
| 175 | PORT_DIPSETTING( 0x00, "15 seconds at 4000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x30) // @ 90 seconds |
| 176 | PORT_DIPSETTING( 0x04, "15 seconds at 5000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x30) |
| 177 | PORT_DIPSETTING( 0x08, "30 seconds at 5000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x30) |
| 178 | PORT_DIPSETTING( 0x0c, "30 seconds at 6000" ) PORT_CONDITION("DSW", 0x30, EQUALS, 0x30) |
| 179 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SW:5,6") |
| 180 | PORT_DIPSETTING( 0x00, "60 seconds" ) |
| 181 | PORT_DIPSETTING( 0x10, "70 seconds" ) |
| 182 | PORT_DIPSETTING( 0x20, "80 seconds" ) |
| 183 | PORT_DIPSETTING( 0x30, "90 seconds" ) |
| 184 | PORT_DIPNAME( 0x40, 0x00, "Alignment Mode" ) PORT_DIPLOCATION("SW:7") |
| 185 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 186 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 187 | PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_HIGH, "SW:8" ) |
| 78 | 188 | INPUT_PORTS_END |
| 79 | 189 | |
| 80 | 190 | |
| 81 | 191 | |
| 192 | /*************************************************************************** |
| 82 | 193 | |
| 194 | Machine Config |
| 195 | |
| 196 | ***************************************************************************/ |
| 197 | |
| 83 | 198 | static MACHINE_CONFIG_START( submar, submar_state ) |
| 84 | 199 | |
| 85 | 200 | /* basic machine hardware */ |
| 86 | 201 | MCFG_CPU_ADD("maincpu", Z80, XTAL_19_968MHz/8) |
| 87 | | MCFG_CPU_PERIODIC_INT_DRIVER(submar_state, irq0_line_hold, 960.516) // 555 IC - where is irqack? |
| 202 | MCFG_CPU_PERIODIC_INT_DRIVER(submar_state, irq0_line_assert, 124.675) // 555 IC |
| 88 | 203 | MCFG_CPU_PROGRAM_MAP(submar_map) |
| 89 | 204 | MCFG_CPU_IO_MAP(submar_portmap) |
| 90 | 205 | |
| r26541 | r26542 | |
| 95 | 210 | MACHINE_CONFIG_END |
| 96 | 211 | |
| 97 | 212 | |
| 213 | |
| 214 | /*************************************************************************** |
| 215 | |
| 216 | Game drivers |
| 217 | |
| 218 | ***************************************************************************/ |
| 219 | |
| 98 | 220 | ROM_START( submar ) |
| 99 | 221 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 100 | 222 | ROM_LOAD( "sub.a1", 0x0000, 0x0800, CRC(bcef5db4) SHA1(8ae5099672fbdb7bcdc617e1f8cbc5435fbb738a) ) |
| r26541 | r26542 | |
| 102 | 224 | ROM_END |
| 103 | 225 | |
| 104 | 226 | |
| 105 | | |
| 106 | 227 | GAMEL( 1979, submar, 0, submar, submar, driver_device, 0, ROT0, "Midway", "Submarine (Midway)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_MECHANICAL, layout_submar ) |