From 11e49d9be6616c080908b8c8a4a90a08614e5c7a Mon Sep 17 00:00:00 2001
From: 0kmg <9137159+0kmg@users.noreply.github.com>
Date: Tue, 14 Dec 2021 06:27:13 -0900
Subject: bus/nes_ctrl: Revised Bandai Hyper Shot to only use exp port calls.
(#8947)
* bus/nes_ctrl: Revised Bandai Hyper Shot to only use exp port calls.
- Also corrected Space Shadow mirroring. Now game properly blanks background every other frame.
- Use %p player specifier for B button.
- Use helper function for writing strobe bit
---
hash/nes.xml | 5 +++--
src/devices/bus/nes_ctrl/zapper.cpp | 25 ++++++++++++++-----------
src/devices/bus/nes_ctrl/zapper.h | 3 +--
3 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/hash/nes.xml b/hash/nes.xml
index 4d6507d2e45..ab6592e424c 100644
--- a/hash/nes.xml
+++ b/hash/nes.xml
@@ -50134,7 +50134,7 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
-
+
@@ -55019,7 +55019,7 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
-
+
2 in 1 Uzi Lightgun
199?
@@ -55027,6 +55027,7 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
+
diff --git a/src/devices/bus/nes_ctrl/zapper.cpp b/src/devices/bus/nes_ctrl/zapper.cpp
index 8a2ef132e12..e19c63fa2d2 100644
--- a/src/devices/bus/nes_ctrl/zapper.cpp
+++ b/src/devices/bus/nes_ctrl/zapper.cpp
@@ -34,7 +34,7 @@ static INPUT_PORTS_START( nes_bandaihs )
PORT_START("JOYPAD")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // has complete joypad inputs except button A
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("B")
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("%p B")
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
@@ -86,7 +86,6 @@ nes_bandaihs_device::nes_bandaihs_device(const machine_config &mconfig, const ch
: nes_zapper_device(mconfig, NES_BANDAIHS, tag, owner, clock)
, m_joypad(*this, "JOYPAD")
, m_latch(0)
- , m_strobe(0)
{
}
@@ -144,17 +143,23 @@ u8 nes_zapper_device::read_exp(offs_t offset)
{
u8 ret = 0;
if (offset == 1) // $4017
- ret |= nes_zapper_device::read_bit34();
+ ret = nes_zapper_device::read_bit34();
return ret;
}
-u8 nes_bandaihs_device::read_bit0()
+u8 nes_bandaihs_device::read_exp(offs_t offset)
{
- if (m_strobe & 1)
- m_latch = m_joypad->read();
+ u8 ret = 0;
- u8 ret = m_latch & 1;
- m_latch = (m_latch >> 1) | 0x80;
+ if (offset == 0) // $4016
+ {
+ if (m_strobe)
+ m_latch = m_joypad->read();
+ ret = (m_latch & 1) << 1;
+ m_latch = (m_latch >> 1) | 0x80;
+ }
+ else // $4017
+ ret = nes_zapper_device::read_exp(offset);
return ret;
}
@@ -167,8 +172,6 @@ u8 nes_bandaihs_device::read_bit0()
// carried on expansion port pin 2, so there's likely nothing more going on.
void nes_bandaihs_device::write(u8 data)
{
- if (m_strobe & 1)
+ if (write_strobe(data))
m_latch = m_joypad->read();
-
- m_strobe = data;
}
diff --git a/src/devices/bus/nes_ctrl/zapper.h b/src/devices/bus/nes_ctrl/zapper.h
index 18db8af7057..943fb920cdd 100644
--- a/src/devices/bus/nes_ctrl/zapper.h
+++ b/src/devices/bus/nes_ctrl/zapper.h
@@ -61,13 +61,12 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual u8 read_bit0() override;
+ virtual u8 read_exp(offs_t offset) override;
virtual void write(u8 data) override;
private:
required_ioport m_joypad;
u8 m_latch;
- u8 m_strobe;
};
--
cgit v1.2.3