diff options
author | 2021-11-15 05:22:42 -0900 | |
---|---|---|
committer | 2021-11-16 01:22:42 +1100 | |
commit | 83586c6000ffdddcdf30a73754ab051cc6f36e22 (patch) | |
tree | dd1be754b8e254b1585a93a70dec90fb941977a7 | |
parent | 379e3db55e5f1212cafaf634232e1f5daeeef450 (diff) |
bus/nes_ctrl: Updated Power Pad code. Promoted all games to working. (#8827)
* Changed KEYPAD inputs to BUTTON with numbering following the pattern used in Family Trainer.
* Removed device_reset().
* Added proper strobe bit behavior and reading 1s on excess reads.
* Made Running Stadium and Stadium Events games clones of World Class Track Meet, the last released variant of the same game.
-rw-r--r-- | hash/nes.xml | 30 | ||||
-rw-r--r-- | src/devices/bus/nes_ctrl/powerpad.cpp | 110 | ||||
-rw-r--r-- | src/devices/bus/nes_ctrl/powerpad.h | 13 |
3 files changed, 73 insertions, 80 deletions
diff --git a/hash/nes.xml b/hash/nes.xml index 06098219a34..682367fd6eb 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -2174,7 +2174,7 @@ license:CC0 </part> </software> - <software name="athlwrldu" cloneof="athlwrld" supported="partial"> + <software name="athlwrldu" cloneof="athlwrld"> <description>Athletic World (USA)</description> <year>1987</year> <publisher>Bandai</publisher> @@ -2194,7 +2194,7 @@ license:CC0 </part> </software> - <software name="athlwrld" supported="partial"> + <software name="athlwrld"> <description>Athletic World (Euro)</description> <year>1988</year> <publisher>Bandai</publisher> @@ -7886,7 +7886,7 @@ license:CC0 </part> </software> - <software name="dancaero" supported="partial"> + <software name="dancaero"> <description>Dance Aerobics (USA)</description> <year>1989</year> <publisher>Nintendo</publisher> @@ -12209,7 +12209,7 @@ license:CC0 </part> </software> - <software name="train2rs" cloneof="stadevnt"> + <software name="train2rs" cloneof="wctmeet"> <description>Family Trainer 2 - Running Stadium (Japan)</description> <year>1986</year> <publisher>Bandai</publisher> @@ -33944,7 +33944,7 @@ license:CC0 </part> </software> - <software name="eggsplod" supported="partial"> + <software name="eggsplod"> <description>Short Order / Eggsplode! (USA)</description> <year>1989</year> <publisher>Nintendo</publisher> @@ -35644,7 +35644,7 @@ license:CC0 </part> </software> - <software name="stadevntu" cloneof="stadevnt" supported="partial"> + <software name="stadevntu" cloneof="wctmeet"> <description>Stadium Events (USA)</description> <year>1987</year> <publisher>Bandai</publisher> @@ -35664,9 +35664,9 @@ license:CC0 </part> </software> - <software name="stadevnt" supported="partial"> + <software name="stadevnt" cloneof="wctmeet"> <description>Stadium Events (Euro)</description> - <year>1990</year> + <year>1988?</year> <publisher>Bandai</publisher> <info name="serial" value="NES-SD-EEC"/> <info name="release" value="19900223"/> @@ -36731,8 +36731,7 @@ license:CC0 </part> </software> -<!-- This is marked as partially supported due to lack of powerpad emulation! --> - <software name="smbdhwca" cloneof="smbdhwc" supported="partial"> + <software name="smbdhwca" cloneof="smbdhwc"> <description>Super Mario Bros. / Duck Hunt / World Class Track Meet (USA)</description> <year>1990</year> <publisher>Nintendo</publisher> @@ -36751,8 +36750,7 @@ license:CC0 </part> </software> -<!-- This is marked as partially supported due to lack of powerpad emulation! --> - <software name="smbdhwc" supported="partial"> + <software name="smbdhwc"> <description>Super Mario Bros. / Duck Hunt / World Class Track Meet (USA, Rev. A)</description> <year>1990</year> <publisher>Nintendo</publisher> @@ -37348,7 +37346,7 @@ license:CC0 </part> </software> - <software name="steamg" supported="no"> + <software name="steamg"> <description>Super Team Games (USA)</description> <year>1988</year> <publisher>Nintendo</publisher> @@ -37358,7 +37356,7 @@ license:CC0 <feature name="slot" value="cnrom" /> <feature name="pcb" value="NES-CNROM" /> <feature name="mirroring" value="vertical" /> - <feature name="peripheral" value="4p_adapter" /> + <feature name="peripheral" value="powerpad" /> <dataarea name="prg" size="32768"> <rom name="nes-un-0 prg" size="32768" crc="f210e68f" sha1="1f706ae232ffb5f54ff1918b624dcdae4fa27a15" offset="00000" /> </dataarea> @@ -43057,7 +43055,7 @@ license:CC0 </part> </software> - <software name="wctmeeta" cloneof="wctmeet" supported="partial"> + <software name="wctmeeta" cloneof="wctmeet"> <description>World Class Track Meet (USA)</description> <year>1988</year> <publisher>Nintendo</publisher> @@ -43077,7 +43075,7 @@ license:CC0 </part> </software> - <software name="wctmeet" supported="partial"> + <software name="wctmeet"> <description>World Class Track Meet (USA, Rev. A)</description> <year>1988</year> <publisher>Nintendo</publisher> diff --git a/src/devices/bus/nes_ctrl/powerpad.cpp b/src/devices/bus/nes_ctrl/powerpad.cpp index 40a31ba89bc..03932ad8874 100644 --- a/src/devices/bus/nes_ctrl/powerpad.cpp +++ b/src/devices/bus/nes_ctrl/powerpad.cpp @@ -19,43 +19,43 @@ DEFINE_DEVICE_TYPE(NES_POWERPAD, nes_powerpad_device, "nes_powerpad", "Bandai Po static INPUT_PORTS_START( nes_powerpad ) PORT_START("LAYOUT") PORT_CONFNAME( 0x01, 0x00, "Power Pad Button Layout") - PORT_CONFSETTING( 0x00, "Side A" ) - PORT_CONFSETTING( 0x01, "Side B" ) + PORT_CONFSETTING( 0x00, "Side A" ) + PORT_CONFSETTING( 0x01, "Side B" ) // difference between the two sides is that we mirror the key mapping to match the real pad layout! - PORT_START("POWERPAD1") + PORT_START("POWERPAD.0") // side A layout - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Top1") PORT_CODE(KEYCODE_Y) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Mid1") PORT_CODE(KEYCODE_J) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Mid2") PORT_CODE(KEYCODE_H) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Low1") PORT_CODE(KEYCODE_N) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Low2") PORT_CODE(KEYCODE_B) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Mid3") PORT_CODE(KEYCODE_G) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("PowerPad Top2") PORT_CODE(KEYCODE_Y) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("PowerPad Mid4") PORT_CODE(KEYCODE_J) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("PowerPad Mid3") PORT_CODE(KEYCODE_H) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("PowerPad Low2") PORT_CODE(KEYCODE_N) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON11 ) PORT_NAME("PowerPad Low1") PORT_CODE(KEYCODE_B) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("PowerPad Mid2") PORT_CODE(KEYCODE_G) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) // side B layout - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 2") PORT_CODE(KEYCODE_T) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 1") PORT_CODE(KEYCODE_R) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 5") PORT_CODE(KEYCODE_F) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 9") PORT_CODE(KEYCODE_V) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 6") PORT_CODE(KEYCODE_G) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 10") PORT_CODE(KEYCODE_B) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 11") PORT_CODE(KEYCODE_N) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 7") PORT_CODE(KEYCODE_H) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) - - PORT_START("POWERPAD2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("PowerPad 2") PORT_CODE(KEYCODE_T) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("PowerPad 1") PORT_CODE(KEYCODE_R) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("PowerPad 5") PORT_CODE(KEYCODE_F) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("PowerPad 9") PORT_CODE(KEYCODE_V) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("PowerPad 6") PORT_CODE(KEYCODE_G) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("PowerPad 10") PORT_CODE(KEYCODE_B) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON11 ) PORT_NAME("PowerPad 11") PORT_CODE(KEYCODE_N) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("PowerPad 7") PORT_CODE(KEYCODE_H) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + + PORT_START("POWERPAD.1") // side A layout - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Top2") PORT_CODE(KEYCODE_T) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Mid4") PORT_CODE(KEYCODE_F) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) - PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("PowerPad Top1") PORT_CODE(KEYCODE_T) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("PowerPad Mid1") PORT_CODE(KEYCODE_F) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00) // side B layout - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 4") PORT_CODE(KEYCODE_U) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 3") PORT_CODE(KEYCODE_Y) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 12") PORT_CODE(KEYCODE_M) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 8") PORT_CODE(KEYCODE_J) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) - PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("PowerPad 4") PORT_CODE(KEYCODE_U) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("PowerPad 3") PORT_CODE(KEYCODE_Y) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("PowerPad 12") PORT_CODE(KEYCODE_M) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("PowerPad 8") PORT_CODE(KEYCODE_J) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01) INPUT_PORTS_END @@ -78,11 +78,11 @@ ioport_constructor nes_powerpad_device::device_input_ports() const // nes_powerpad_device - constructor //------------------------------------------------- -nes_powerpad_device::nes_powerpad_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, NES_POWERPAD, tag, owner, clock), - device_nes_control_port_interface(mconfig, *this), - m_ipt1(*this, "POWERPAD1"), - m_ipt2(*this, "POWERPAD2") +nes_powerpad_device::nes_powerpad_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, NES_POWERPAD, tag, owner, clock) + , device_nes_control_port_interface(mconfig, *this) + , m_ipt(*this, "POWERPAD.%u", 0) + , m_strobe(0) { } @@ -94,31 +94,26 @@ nes_powerpad_device::nes_powerpad_device(const machine_config &mconfig, const ch void nes_powerpad_device::device_start() { save_item(NAME(m_latch)); + save_item(NAME(m_strobe)); } //------------------------------------------------- -// device_reset +// read //------------------------------------------------- -void nes_powerpad_device::device_reset() +u8 nes_powerpad_device::read_bit34() { - m_latch[0] = 0; - m_latch[1] = 0; -} + u8 ret = 0; + for (int i = 0; i < 2; i++) + { + if (m_strobe) + m_latch[i] = m_ipt[i]->read(); + ret |= (m_latch[i] & 1) << (i + 3); + m_latch[i] = (m_latch[i] >> 1) | 0x80; + } -//------------------------------------------------- -// read -//------------------------------------------------- - -uint8_t nes_powerpad_device::read_bit34() -{ - uint8_t ret = 0; - ret |= (m_latch[0] & 0x01) << 3; - ret |= (m_latch[1] & 0x01) << 4; - m_latch[0] >>= 1; - m_latch[1] >>= 1; return ret; } @@ -126,11 +121,12 @@ uint8_t nes_powerpad_device::read_bit34() // write //------------------------------------------------- -void nes_powerpad_device::write(uint8_t data) +void nes_powerpad_device::write(u8 data) { - if (data & 0x01) - return; + u8 prev_strobe = m_strobe; + m_strobe = data & 1; - m_latch[0] = m_ipt1->read(); - m_latch[1] = m_ipt2->read() | 0xf0; + if (prev_strobe && !m_strobe) + for (int i = 0; i < 2; i++) + m_latch[i] = m_ipt[i]->read(); } diff --git a/src/devices/bus/nes_ctrl/powerpad.h b/src/devices/bus/nes_ctrl/powerpad.h index 1e46f8402dc..e017ed519ca 100644 --- a/src/devices/bus/nes_ctrl/powerpad.h +++ b/src/devices/bus/nes_ctrl/powerpad.h @@ -25,22 +25,21 @@ class nes_powerpad_device : public device_t, { public: // construction/destruction - nes_powerpad_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_powerpad_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); virtual ioport_constructor device_input_ports() const override; protected: // device-level overrides virtual void device_start() override; - virtual void device_reset() override; - virtual uint8_t read_bit34() override; - virtual void write(uint8_t data) override; + virtual u8 read_bit34() override; + virtual void write(u8 data) override; private: - required_ioport m_ipt1; - required_ioport m_ipt2; - uint32_t m_latch[2]; + required_ioport_array<2> m_ipt; + u8 m_latch[2]; + u8 m_strobe; }; |