diff options
Diffstat (limited to 'src/mame/drivers/vegas.cpp')
-rw-r--r-- | src/mame/drivers/vegas.cpp | 131 |
1 files changed, 102 insertions, 29 deletions
diff --git a/src/mame/drivers/vegas.cpp b/src/mame/drivers/vegas.cpp index b7b59758c58..a3a1aa76859 100644 --- a/src/mame/drivers/vegas.cpp +++ b/src/mame/drivers/vegas.cpp @@ -335,6 +335,7 @@ public: int m_a2d_shift; uint8_t m_vblank_state; uint8_t m_cpuio_data[4]; + uint8_t m_sio_reset_ctrl; uint8_t m_sio_irq_clear; uint8_t m_sio_irq_enable; uint8_t m_sio_irq_state; @@ -343,6 +344,7 @@ public: uint8_t m_cmos_unlocked; uint8_t m_dcs_idma_cs; uint32_t m_i40_data; + uint32_t m_keypad_select; DECLARE_WRITE_LINE_MEMBER(vblank_assert); DECLARE_DRIVER_INIT(gauntleg); @@ -387,6 +389,8 @@ public: DECLARE_READ32_MEMBER(unknown_r); DECLARE_WRITE32_MEMBER(i40_w); DECLARE_CUSTOM_INPUT_MEMBER(i40_r); + DECLARE_CUSTOM_INPUT_MEMBER(keypad_r); + DECLARE_WRITE32_MEMBER(wheel_board_w); std::string sioIRQString(uint8_t data); @@ -423,6 +427,7 @@ void vegas_state::machine_start() /* register for save states */ save_item(NAME(m_vblank_state)); save_item(NAME(m_cpuio_data)); + save_item(NAME(m_sio_reset_ctrl)); save_item(NAME(m_sio_irq_clear)); save_item(NAME(m_sio_irq_enable)); save_item(NAME(m_sio_irq_state)); @@ -430,6 +435,7 @@ void vegas_state::machine_start() save_item(NAME(m_pending_analog_read)); save_item(NAME(m_cmos_unlocked)); save_item(NAME(m_i40_data)); + save_item(NAME(m_keypad_select)); } @@ -447,6 +453,7 @@ void vegas_state::machine_reset() // Clear SIO registers reset_sio(); m_i40_data = 0; + m_keypad_select = 0; } /************************************* @@ -559,15 +566,12 @@ WRITE_LINE_MEMBER(vegas_state::vblank_assert) { if (LOG_SIO) logerror("vblank_assert: state: %d\n", state); - if (!m_vblank_state && state) + // latch on the correct polarity transition + if ((state && !(m_sio_reset_ctrl & 0x10)) || (!state && (m_sio_reset_ctrl & 0x10))) { m_sio_irq_state |= 0x20; update_sio_irqs(); } - else if (m_vblank_state && !state) { - m_sio_irq_state &= ~0x20; - } - m_vblank_state = state; } @@ -591,6 +595,7 @@ WRITE_LINE_MEMBER(vegas_state::ethernet_interrupt) void vegas_state::reset_sio() { + m_sio_reset_ctrl = 0; m_sio_irq_clear = 0; m_sio_irq_enable = 0; m_sio_irq_state = 0; @@ -639,6 +644,7 @@ READ8_MEMBER(vegas_state::sio_r) break; case 5: { + result = 0x00; switch (offset & 0x7) { case 0: // Gun 1 H Low @@ -684,7 +690,7 @@ WRITE8_MEMBER(vegas_state::sio_w) if (LOG_SIO) logerror("sio_w: Reset Control offset: %08x index: %d data: %02X\n", offset, index, data); // Reset Control: Bit 0=>Reset IOASIC, Bit 1=>Reset NSS Connection, Bit 2=>Reset SMC, Bit 3=>Reset VSYNC, Bit 4=>VSYNC Polarity - + m_sio_reset_ctrl = data; /* bit 0x01 is used to reset the IOASIC */ if (!(data & 0x01)) { @@ -728,7 +734,7 @@ WRITE8_MEMBER(vegas_state::sio_w) case 7: // Watchdog m_timekeeper->watchdog_write(space, offset, data); - if (LOG_SIO) + if (0 && LOG_SIO) logerror("sio_w: Watchdog: %08x index: %d data: %02X\n", offset, index, data); //space.device().execute().eat_cycles(100); break; @@ -836,7 +842,7 @@ READ32_MEMBER( vegas_state::analog_port_r ) update_sio_irqs(); } // TODO: Need to look at the proper shift value for sf2049 - return m_pending_analog_read << (m_a2d_shift << 0); + return m_pending_analog_read << (m_a2d_shift << 1); } @@ -873,7 +879,7 @@ READ32_MEMBER( vegas_state::ethernet_r ) result |= m_ethernet->read(space, offset * 2 + 0, mem_mask); if (ACCESSING_BITS_16_31) result |= m_ethernet->read(space, offset * 2 + 1, mem_mask >> 16) << 16; - logerror("ethernet_r: offset %08x = %08x\n", offset, result); + logerror("ethernet_r: offset %08x = %08x & %08x\n", offset, result, mem_mask); return result; } @@ -957,6 +963,39 @@ CUSTOM_INPUT_MEMBER(vegas_state::i40_r) } /************************************* +* Keypad +*************************************/ +WRITE32_MEMBER(vegas_state::wheel_board_w) +{ + logerror("wheel_board_w: data = %08x\n", data); + /* two writes in pairs. bit 11 high, bit 10 flag, flag off first, on second. arg remains the same. */ + bool valid = (data & (1 << 11)); + bool flag = (data & (1 << 10)); + uint8_t op = (data >> 8) & 0x3; + uint8_t arg = data & 0xff; + + if (valid && flag && op == 2) + m_keypad_select = arg; +} + +CUSTOM_INPUT_MEMBER(vegas_state::keypad_r) +{ + int row_sel; + for (row_sel=0; row_sel<4; row_sel++) + { + if (!(m_keypad_select & (1 << row_sel))) + break; + } + if (row_sel <= 3) { + uint32_t bits = ioport((const char *)param)->read(); + bits >>= row_sel * 3; + return bits & 0x7; + } + else + return 0x7; +} + +/************************************* * * Input ports * @@ -1348,25 +1387,33 @@ static INPUT_PORTS_START( sf2049 ) PORT_DIPSETTING( 0x0000, "VGA Res 640x480" ) PORT_MODIFY("SYSTEM") - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 ) // Gear Reverse + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Abort") PORT_PLAYER(1) /* Abort */ + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME(DEF_STR( Reverse )) PORT_PLAYER(1) /* reverse */ PORT_MODIFY("IN1") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) // Gear 1 - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) // Gear 2 - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) // Gear 3 - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) // Gear 4 - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("View 1") PORT_PLAYER(1) /* view 1 */ + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("View 2") PORT_PLAYER(1) /* view 2 */ + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("View 3") PORT_PLAYER(1) /* view 3 */ + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_NAME("Music") PORT_PLAYER(1) /* music */ + PORT_BIT( 0x0070, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, vegas_state, keypad_r, "KEYPAD" ) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("1st Gear") PORT_PLAYER(1) /* 1st gear */ + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("2nd Gear") PORT_PLAYER(1) /* 2nd gear */ + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("3rd Gear") PORT_PLAYER(1) /* 3rd gear */ + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("4th Gear") PORT_PLAYER(1) /* 4th gear */ + + PORT_START("KEYPAD") + PORT_BIT(0x0200, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) /* keypad 1 */ + PORT_BIT(0x0040, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) /* keypad 4 */ + PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) /* keypad 7 */ + PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) /* keypad * */ + PORT_BIT(0x0400, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) /* keypad 2 */ + PORT_BIT(0x0080, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) /* keypad 5 */ + PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) /* keypad 8 */ + PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) /* keypad 0 */ + PORT_BIT(0x0800, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) /* keypad 3 */ + PORT_BIT(0x0100, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) /* keypad 6 */ + PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) /* keypad 9 */ + PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad #") PORT_CODE(KEYCODE_PLUS_PAD) /* keypad + */ PORT_MODIFY("AN.2") /* Accel */ PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(100) @@ -1381,6 +1428,28 @@ static INPUT_PORTS_START( sf2049 ) PORT_BIT(0xff, 0x80, IPT_PADDLE) PORT_MINMAX(0x10, 0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) INPUT_PORTS_END +static INPUT_PORTS_START( sf2049se ) + PORT_INCLUDE(sf2049) + + PORT_MODIFY("DIPS") + PORT_DIPUNUSED( 0x003e, 0x003e ) + PORT_DIPNAME( 0x00c0, 0x00c0, "Test Mode" ) + PORT_DIPSETTING( 0x00c0, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0080, "Disk-based Test" ) + PORT_DIPSETTING( 0x0040, "EPROM-based Test" ) + PORT_DIPSETTING( 0x0000, "Interactive Diagnostics" ) + PORT_DIPNAME( 0x0001, 0x0001, "PM Dump" ) + PORT_DIPSETTING( 0x0001, "Watchdog resets only" ) + PORT_DIPSETTING( 0x0000, "All resets" ) + PORT_DIPUNUSED( 0x1f00, 0x1f00 ) + PORT_DIPNAME( 0xc000, 0x8000, "Resolution" ) + PORT_DIPSETTING( 0xc000, "Standard Res 512x256" ) + PORT_DIPSETTING( 0x8000, "Medium Res 512x384" ) + PORT_DIPSETTING( 0x0000, "VGA Res 640x480" ) + PORT_DIPNAME( 0x2000, 0x2000, "Cabinet Type" ) + PORT_DIPSETTING( 0x2000, "Sit down cabinet" ) + PORT_DIPSETTING( 0x0000, "Upright cabinet" ) +INPUT_PORTS_END static INPUT_PORTS_START( cartfury ) PORT_INCLUDE(vegas_common) @@ -1617,6 +1686,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( nbashowt, vegasban ) MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0) MCFG_DCS2_AUDIO_DRAM_IN_MB(4) + MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0b5d) MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0) MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_MACE) @@ -1647,7 +1717,7 @@ static MACHINE_CONFIG_DERIVED( nbagold, vegasban) MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0) MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_GAUNTDL) - MCFG_MIDWAY_IOASIC_UPPER( 494 /* 494 ??? */) + MCFG_MIDWAY_IOASIC_UPPER( 494 /* 494 109 ??? */) MCFG_MIDWAY_IOASIC_YEAR_OFFS(80) MCFG_MIDWAY_IOASIC_IRQ_CALLBACK(WRITELINE(vegas_state, ioasic_irq)) //MCFG_MIDWAY_IOASIC_AUTO_ACK(1) @@ -1665,6 +1735,7 @@ static MACHINE_CONFIG_DERIVED( sf2049 , denver ) MCFG_MIDWAY_IOASIC_YEAR_OFFS(80) MCFG_MIDWAY_IOASIC_IRQ_CALLBACK(WRITELINE(vegas_state, ioasic_irq)) MCFG_MIDWAY_IOASIC_AUTO_ACK(1) + MCFG_MIDWAY_IOASIC_AUX_OUT_CB(WRITE32(vegas_state, wheel_board_w)) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( sf2049se, denver ) @@ -1677,6 +1748,7 @@ static MACHINE_CONFIG_DERIVED( sf2049se, denver ) MCFG_MIDWAY_IOASIC_YEAR_OFFS(80) MCFG_MIDWAY_IOASIC_IRQ_CALLBACK(WRITELINE(vegas_state, ioasic_irq)) MCFG_MIDWAY_IOASIC_AUTO_ACK(1) + MCFG_MIDWAY_IOASIC_AUX_OUT_CB(WRITE32(vegas_state, wheel_board_w)) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( sf2049te, denver ) @@ -1689,6 +1761,7 @@ static MACHINE_CONFIG_DERIVED( sf2049te, denver ) MCFG_MIDWAY_IOASIC_YEAR_OFFS(80) MCFG_MIDWAY_IOASIC_IRQ_CALLBACK(WRITELINE(vegas_state, ioasic_irq)) MCFG_MIDWAY_IOASIC_AUTO_ACK(1) + MCFG_MIDWAY_IOASIC_AUX_OUT_CB(WRITE32(vegas_state, wheel_board_w)) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( cartfury, vegasv3 ) @@ -1974,7 +2047,7 @@ ROM_END ROM_START( sf2049se ) ROM_REGION32_LE( 0x80000, PCI_ID_NILE":rom", 0 ) - ROM_LOAD( "sf2049se.u27", 0x000000, 0x80000, CRC(da4ecd9c) SHA1(2574ff3d608ebcc59a63cf6dea13ee7650ae8921) ) + ROM_LOAD( "sf2049se.u27", 0x000000, 0x80000, CRC(da4ecd9c) SHA1(2574ff3d608ebcc59a63cf6dea13ee7650ae8921) BAD_DUMP ) ROM_REGION32_LE( 0x100000, PCI_ID_NILE":update", ROMREGION_ERASEFF ) @@ -2111,7 +2184,7 @@ GAME( 2000, nbagold , 0, nbagold, nbashowt, vegas_state, nbanfl, ROT /* Durango + Denver SIO + Voodoo 3 */ GAME( 1998, sf2049, 0, sf2049, sf2049, vegas_state, sf2049, ROT0, "Atari Games", "San Francisco Rush 2049", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -GAME( 1998, sf2049se, sf2049, sf2049se, sf2049, vegas_state, sf2049se, ROT0, "Atari Games", "San Francisco Rush 2049: Special Edition", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +GAME( 1998, sf2049se, sf2049, sf2049se, sf2049se, vegas_state, sf2049se, ROT0, "Atari Games", "San Francisco Rush 2049: Special Edition", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) GAME( 1998, sf2049te, sf2049, sf2049te, sf2049, vegas_state, sf2049te, ROT0, "Atari Games", "San Francisco Rush 2049: Tournament Edition", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE) /* Durango + Vegas SIO + Voodoo 3 */ |