mirror of
https://github.com/holub/mame
synced 2025-07-04 09:28:51 +03:00
bus/nes_ctrl: Minor cleanup for Konami Hyper Shot controllers. (#9023)
This commit is contained in:
parent
c76d2b2cb1
commit
d1e6531f50
@ -17565,7 +17565,7 @@ license:CC0
|
||||
<feature name="slot" value="nrom" />
|
||||
<feature name="pcb" value="KONAMI-NROM-128" />
|
||||
<feature name="mirroring" value="vertical" />
|
||||
<feature name="peripheral" value="hypershot" />
|
||||
<feature name="peripheral" value="konami_hypershot" />
|
||||
<dataarea name="prg" size="32768">
|
||||
<rom name="0.prg" size="16384" crc="ff6621ce" sha1="33be02be4ba014b45394c18255f3885c13253690" offset="00000" />
|
||||
<rom size="16384" offset="0x4000" loadflag="reload" />
|
||||
@ -17586,6 +17586,7 @@ license:CC0
|
||||
<feature name="slot" value="discrete_74x139" />
|
||||
<feature name="pcb" value="KONAMI-74*139/74" />
|
||||
<feature name="mirroring" value="vertical" />
|
||||
<feature name="peripheral" value="konami_hypershot" />
|
||||
<dataarea name="prg" size="32768">
|
||||
<rom name="800jx1p" size="32768" crc="db9418e8" sha1="91023417168e05ea9b63696ccca34355fc53011c" offset="00000" />
|
||||
</dataarea>
|
||||
@ -17606,7 +17607,7 @@ license:CC0
|
||||
<feature name="slot" value="nrom" />
|
||||
<feature name="pcb" value="KONAMI-NROM-128" />
|
||||
<feature name="mirroring" value="vertical" />
|
||||
<feature name="peripheral" value="hypershot" />
|
||||
<feature name="peripheral" value="konami_hypershot" />
|
||||
<dataarea name="prg" size="32768">
|
||||
<rom name="806j0p" size="16384" crc="ac98cd70" sha1="191ede32665ddc042126e90e48805846f76fbe7b" offset="00000" />
|
||||
<rom size="16384" offset="0x4000" loadflag="reload" />
|
||||
@ -17628,7 +17629,7 @@ license:CC0
|
||||
<feature name="slot" value="nrom" />
|
||||
<feature name="pcb" value="KONAMI-NROM-128" />
|
||||
<feature name="mirroring" value="vertical" />
|
||||
<feature name="peripheral" value="hypershot" />
|
||||
<feature name="peripheral" value="konami_hypershot" />
|
||||
<dataarea name="prg" size="32768">
|
||||
<rom name="1.1.prg" size="16384" crc="ba5c8a54" sha1="f4fd4f13078c4aa758a5501d8270785c03018aba" offset="00000" />
|
||||
<rom size="16384" offset="0x4000" loadflag="reload" />
|
||||
|
@ -18,12 +18,12 @@ DEFINE_DEVICE_TYPE(NES_KONAMIHS, nes_konamihs_device, "nes_konamihs", "Konami Hy
|
||||
|
||||
static INPUT_PORTS_START( nes_konamihs )
|
||||
PORT_START("P1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("PI Run")
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("PI Jump")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("I Run")
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("I Jump")
|
||||
|
||||
PORT_START("P2")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("PII Run")
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("PII Jump")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("II Run")
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("II Jump")
|
||||
INPUT_PORTS_END
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -43,13 +43,11 @@ ioport_constructor nes_konamihs_device::device_input_ports() const
|
||||
// nes_konamihs_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
nes_konamihs_device::nes_konamihs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, NES_KONAMIHS, tag, owner, clock),
|
||||
device_nes_control_port_interface(mconfig, *this),
|
||||
m_ipt_p1(*this, "P1"),
|
||||
m_ipt_p2(*this, "P2"),
|
||||
m_latch_p1(0),
|
||||
m_latch_p2(0)
|
||||
nes_konamihs_device::nes_konamihs_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, NES_KONAMIHS, tag, owner, clock)
|
||||
, device_nes_control_port_interface(mconfig, *this)
|
||||
, m_ipt(*this, "P%u", 1)
|
||||
, m_latch(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -60,19 +58,7 @@ nes_konamihs_device::nes_konamihs_device(const machine_config &mconfig, const ch
|
||||
|
||||
void nes_konamihs_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_latch_p1));
|
||||
save_item(NAME(m_latch_p2));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void nes_konamihs_device::device_reset()
|
||||
{
|
||||
m_latch_p1 = 0;
|
||||
m_latch_p2 = 0;
|
||||
save_item(NAME(m_latch));
|
||||
}
|
||||
|
||||
|
||||
@ -80,14 +66,13 @@ void nes_konamihs_device::device_reset()
|
||||
// read
|
||||
//-------------------------------------------------
|
||||
|
||||
uint8_t nes_konamihs_device::read_exp(offs_t offset)
|
||||
u8 nes_konamihs_device::read_exp(offs_t offset)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
u8 ret = 0;
|
||||
if (offset == 1) //$4017
|
||||
{
|
||||
ret |= m_latch_p1 << 1;
|
||||
ret |= m_latch_p2 << 3;
|
||||
}
|
||||
for (int i = 0; i < 2; i++)
|
||||
if (BIT(m_latch, i))
|
||||
ret |= m_ipt[i]->read() << (2 * i + 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -95,10 +80,7 @@ uint8_t nes_konamihs_device::read_exp(offs_t offset)
|
||||
// write
|
||||
//-------------------------------------------------
|
||||
|
||||
void nes_konamihs_device::write(uint8_t data)
|
||||
void nes_konamihs_device::write(u8 data)
|
||||
{
|
||||
if ((data & 0x02) == 0)
|
||||
m_latch_p1 = m_ipt_p1->read();
|
||||
if ((data & 0x04) == 0)
|
||||
m_latch_p2 = m_ipt_p2->read();
|
||||
m_latch = ~data >> 1;
|
||||
}
|
||||
|
@ -25,23 +25,22 @@ class nes_konamihs_device : public device_t,
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
nes_konamihs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
nes_konamihs_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_exp(offs_t offset) override;
|
||||
virtual void write(uint8_t data) override;
|
||||
virtual u8 read_exp(offs_t offset) override;
|
||||
virtual void write(u8 data) override;
|
||||
|
||||
required_ioport m_ipt_p1;
|
||||
required_ioport m_ipt_p2;
|
||||
uint32_t m_latch_p1, m_latch_p2;
|
||||
required_ioport_array<2> m_ipt;
|
||||
u8 m_latch;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(NES_KONAMIHS, nes_konamihs_device)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user