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 - + Athletic World (USA) 1987 Bandai @@ -2194,7 +2194,7 @@ license:CC0 - + Athletic World (Euro) 1988 Bandai @@ -7886,7 +7886,7 @@ license:CC0 - + Dance Aerobics (USA) 1989 Nintendo @@ -12209,7 +12209,7 @@ license:CC0 - + Family Trainer 2 - Running Stadium (Japan) 1986 Bandai @@ -33944,7 +33944,7 @@ license:CC0 - + Short Order / Eggsplode! (USA) 1989 Nintendo @@ -35644,7 +35644,7 @@ license:CC0 - + Stadium Events (USA) 1987 Bandai @@ -35664,9 +35664,9 @@ license:CC0 - + Stadium Events (Euro) - 1990 + 1988? Bandai @@ -36731,8 +36731,7 @@ license:CC0 - - + Super Mario Bros. / Duck Hunt / World Class Track Meet (USA) 1990 Nintendo @@ -36751,8 +36750,7 @@ license:CC0 - - + Super Mario Bros. / Duck Hunt / World Class Track Meet (USA, Rev. A) 1990 Nintendo @@ -37348,7 +37346,7 @@ license:CC0 - + Super Team Games (USA) 1988 Nintendo @@ -37358,7 +37356,7 @@ license:CC0 - + @@ -43057,7 +43055,7 @@ license:CC0 - + World Class Track Meet (USA) 1988 Nintendo @@ -43077,7 +43075,7 @@ license:CC0 - + World Class Track Meet (USA, Rev. A) 1988 Nintendo 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_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("POWERPAD2") + 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,17 +94,7 @@ nes_powerpad_device::nes_powerpad_device(const machine_config &mconfig, const ch void nes_powerpad_device::device_start() { save_item(NAME(m_latch)); -} - - -//------------------------------------------------- -// device_reset -//------------------------------------------------- - -void nes_powerpad_device::device_reset() -{ - m_latch[0] = 0; - m_latch[1] = 0; + save_item(NAME(m_strobe)); } @@ -112,13 +102,18 @@ void nes_powerpad_device::device_reset() // read //------------------------------------------------- -uint8_t nes_powerpad_device::read_bit34() +u8 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; + 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; + } + 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; };