bus/nes_ctrl: Updated Arkanoid paddle to return 9th bit. (#9514)

This commit is contained in:
0kmg 2022-04-05 08:52:43 -08:00 committed by GitHub
parent 2b12a8c2df
commit ce1c326183
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 26 deletions

View File

@ -6,17 +6,15 @@
Arkanoid Paddle input device Arkanoid Paddle input device
TODO: Investigate the differences between the 3 paddles released with TODO: Investigate the differences between the 3 paddles released with
Arkanoid (US), Arkanoid (JP), Arkanoid II (JP). It's not clear if and Arkanoid (US), Arkanoid (JP), Arkanoid II (JP). At the moment we only
how they differ and so for the moment we only emulate the NES and emulate the US and daisy-chainable Famicom (Ark2) paddles.
daisy-chainable Famicom paddles.
Known differences: NES and Ark2 paddles have screws to adjust range Known differences: NES and Ark2 paddles have screws to adjust range
of returned values, Ark2 paddle has an extra expansion port. of returned values, Ark2 paddle has an extra expansion port.
Claimed differences: NES and Ark1 paddles have 9-bit latch (and don't All paddles return the ones' complement of a 9-bit value from their
return the MSB) while Ark2 has an 8-bit latch, Ark2 paddle ADC responds potentiometers, MSB first. The three commercial releases, Arkanoids
to writes to $4016.b1 not b0 (the post-Ark2 paddle games, Arkanoid 2 and Chase HQ, only read 8-bits, ignoring the LSB.
and Chase HQ, both dutifully strobe both bits one at a time).
**********************************************************************/ **********************************************************************/
@ -33,7 +31,10 @@ DEFINE_DEVICE_TYPE(NES_ARKPADDLE_FC, nes_vausfc_device, "nes_vausfc", "FC Arkano
static INPUT_PORTS_START( arkanoid_paddle ) static INPUT_PORTS_START( arkanoid_paddle )
PORT_START("PADDLE") PORT_START("PADDLE")
PORT_BIT( 0xff, 0x7f, IPT_PADDLE ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_CENTERDELTA(0) PORT_MINMAX(0x4e, 0xf2) // this minmax is from what Arkanoid 2 clamps values to, so an actual paddle's range may be greater // MINMAX range large enough to encompass what Taito games expect, Ark1 will glitch if MIN is too low
// This may be too wide compared with real paddles, even accounting for those with adjustment screws
PORT_BIT( 0x1ff, 0x130, IPT_PADDLE ) PORT_SENSITIVITY(50) PORT_KEYDELTA(35) PORT_CENTERDELTA(0) PORT_MINMAX(0x78, 0x1f8)
PORT_START("BUTTON") PORT_START("BUTTON")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Paddle button") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Paddle button")
INPUT_PORTS_END INPUT_PORTS_END
@ -80,7 +81,6 @@ nes_vaus_device::nes_vaus_device(const machine_config &mconfig, device_type type
, device_nes_control_port_interface(mconfig, *this) , device_nes_control_port_interface(mconfig, *this)
, m_paddle(*this, "PADDLE") , m_paddle(*this, "PADDLE")
, m_button(*this, "BUTTON") , m_button(*this, "BUTTON")
, m_start_conv(0)
, m_latch(0) , m_latch(0)
{ {
} }
@ -104,7 +104,7 @@ nes_vausfc_device::nes_vausfc_device(const machine_config &mconfig, const char *
void nes_vaus_device::device_start() void nes_vaus_device::device_start()
{ {
save_item(NAME(m_latch)); save_item(NAME(m_latch));
save_item(NAME(m_start_conv)); save_item(NAME(m_strobe));
} }
@ -115,7 +115,7 @@ void nes_vaus_device::device_start()
u8 nes_vaus_device::read_bit34() u8 nes_vaus_device::read_bit34()
{ {
u8 ret = m_button->read() << 3; u8 ret = m_button->read() << 3;
ret |= (m_latch & 0x80) >> 3; ret |= (m_latch & 0x100) >> 4;
m_latch <<= 1; m_latch <<= 1;
return ret; return ret;
} }
@ -127,7 +127,7 @@ u8 nes_vausfc_device::read_exp(offs_t offset)
ret = m_button->read() << 1; ret = m_button->read() << 1;
else //$4017 else //$4017
{ {
ret = (m_latch & 0x80) >> 6; ret = (m_latch & 0x100) >> 7;
m_latch <<= 1; m_latch <<= 1;
ret |= m_daisychain->read_exp(0) << 2; ret |= m_daisychain->read_exp(0) << 2;
ret |= m_daisychain->read_exp(1) << 3; ret |= m_daisychain->read_exp(1) << 3;
@ -141,10 +141,8 @@ u8 nes_vausfc_device::read_exp(offs_t offset)
void nes_vaus_device::write(u8 data) void nes_vaus_device::write(u8 data)
{ {
if (data == 0 && m_start_conv == 1) if (write_strobe(data))
m_latch = ~m_paddle->read(); m_latch = ~m_paddle->read();
m_start_conv = data;
} }
void nes_vausfc_device::write(u8 data) void nes_vausfc_device::write(u8 data)

View File

@ -27,22 +27,19 @@ public:
// construction/destruction // construction/destruction
nes_vaus_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); nes_vaus_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// optional information overrides virtual u8 read_bit34() override;
virtual ioport_constructor device_input_ports() const override; virtual void write(u8 data) override;
protected: protected:
nes_vaus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); nes_vaus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// device-level overrides // device-level overrides
virtual void device_start() override; virtual void device_start() override;
virtual ioport_constructor device_input_ports() const override;
virtual u8 read_bit34() override;
virtual void write(u8 data) override;
required_ioport m_paddle; required_ioport m_paddle;
required_ioport m_button; required_ioport m_button;
u8 m_start_conv; u16 m_latch;
u8 m_latch;
}; };
@ -54,14 +51,14 @@ public:
// construction/destruction // construction/destruction
nes_vausfc_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); nes_vausfc_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual u8 read_bit34() override { return 0; } virtual u8 read_bit34() override { return 0; }
virtual u8 read_exp(offs_t offset) override; virtual u8 read_exp(offs_t offset) override;
virtual void write(u8 data) override; virtual void write(u8 data) override;
protected:
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
private: private:
required_device<nes_control_port_device> m_daisychain; required_device<nes_control_port_device> m_daisychain;
}; };