diff options
author | 2021-12-06 19:05:24 -0900 | |
---|---|---|
committer | 2021-12-06 23:05:24 -0500 | |
commit | 59867a349a4f0b2143941d27d1b6e562028cda7e (patch) | |
tree | 84829756f4c640052d48473acf44b45ceac472fb | |
parent | 013e4315285337702389fb70ad7b2bf2f56fe25a (diff) |
bus/nes_ctrl: Updated Arkanoid paddles. (#8935)
- Added daisy chain expansion port to Famicom paddle for Arkanoid II's versus mode.
- Also expanded range of paddle value reads to ensure full range of motion within all games' play fields.
-rw-r--r-- | hash/nes.xml | 2 | ||||
-rw-r--r-- | src/devices/bus/nes_ctrl/arkpaddle.cpp | 79 | ||||
-rw-r--r-- | src/devices/bus/nes_ctrl/arkpaddle.h | 28 |
3 files changed, 71 insertions, 38 deletions
diff --git a/hash/nes.xml b/hash/nes.xml index 1c1386d6c84..15150fad1da 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -1946,6 +1946,7 @@ license:CC0 <feature name="slot" value="discrete_74x161" /> <feature name="pcb" value="TAITO-74*161/161/32" /> <feature name="mirroring" value="pcb_controlled" /> + <feature name="peripheral" value="vaus" /> <dataarea name="prg" size="65536"> <rom name="0.prg" size="65536" crc="6267fbd1" sha1="4094905bbb6aabad2db67d6641504a43682a4757" offset="00000" /> </dataarea> @@ -37845,6 +37846,7 @@ license:CC0 <feature name="slot" value="txrom" /> <feature name="pcb" value="HVC-TL1ROM" /> <feature name="mmc3_type" value="MMC3A" /> + <feature name="peripheral" value="vaus" /> <dataarea name="prg" size="131072"> <rom name="dtf-h9-0 prg" size="131072" crc="ecfd3c69" sha1="a9e3d812ed897fda80de5a1672f8ed4aa19d3da3" offset="00000" /> </dataarea> diff --git a/src/devices/bus/nes_ctrl/arkpaddle.cpp b/src/devices/bus/nes_ctrl/arkpaddle.cpp index 8cd2cfea3c4..e322d10eeed 100644 --- a/src/devices/bus/nes_ctrl/arkpaddle.cpp +++ b/src/devices/bus/nes_ctrl/arkpaddle.cpp @@ -5,6 +5,19 @@ Nintendo Family Computer & Entertainment System - Arkanoid Paddle input device + TODO: Investigate the differences between the 3 paddles released with + Arkanoid (US), Arkanoid (JP), Arkanoid II (JP). It's not clear if and + how they differ and so for the moment we only emulate the NES and + daisy-chainable Famicom paddles. + + Known differences: NES and Ark2 paddles have screws to adjust range + of returned values, Ark2 paddle has an extra expansion port. + + Claimed differences: NES and Ark1 paddles have 9-bit latch (and don't + return the MSB) while Ark2 has an 8-bit latch, Ark2 paddle ADC responds + to writes to $4016.b1 not b0 (the post-Ark2 paddle games, Arkanoid 2 + and Chase HQ, both dutifully strobe both bits one at a time). + **********************************************************************/ #include "emu.h" @@ -20,7 +33,7 @@ DEFINE_DEVICE_TYPE(NES_ARKPADDLE_FC, nes_vausfc_device, "nes_vausfc", "FC Arkano static INPUT_PORTS_START( arkanoid_paddle ) PORT_START("PADDLE") - PORT_BIT( 0xff, 0x7f, IPT_PADDLE) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_CENTERDELTA(0) PORT_MINMAX(0x62,0xf2) + 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 PORT_START("BUTTON") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Paddle button") INPUT_PORTS_END @@ -35,6 +48,23 @@ ioport_constructor nes_vaus_device::device_input_ports() const return INPUT_PORTS_NAME( arkanoid_paddle ); } +static void vausfc_daisy(device_slot_interface &device) +{ + device.option_add("vaus", NES_ARKPADDLE_FC); +} + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void nes_vausfc_device::device_add_mconfig(machine_config &config) +{ + // expansion port to allow daisy chaining + NES_CONTROL_PORT(config, m_daisychain, vausfc_daisy, nullptr); + if (m_port != nullptr) + m_daisychain->set_screen_tag(m_port->m_screen); +} //************************************************************************** @@ -45,22 +75,24 @@ ioport_constructor nes_vaus_device::device_input_ports() const // nes_vaus_device - constructor //------------------------------------------------- -nes_vaus_device::nes_vaus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) +nes_vaus_device::nes_vaus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, type, tag, owner, clock) , device_nes_control_port_interface(mconfig, *this) , m_paddle(*this, "PADDLE") , m_button(*this, "BUTTON") - , m_start_conv(0), m_latch(0) + , m_start_conv(0) + , m_latch(0) { } -nes_vaus_device::nes_vaus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +nes_vaus_device::nes_vaus_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_vaus_device(mconfig, NES_ARKPADDLE, tag, owner, clock) { } -nes_vausfc_device::nes_vausfc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +nes_vausfc_device::nes_vausfc_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_vaus_device(mconfig, NES_ARKPADDLE_FC, tag, owner, clock) + , m_daisychain(*this, "subexp") { } @@ -77,39 +109,28 @@ void nes_vaus_device::device_start() //------------------------------------------------- -// device_reset -//------------------------------------------------- - -void nes_vaus_device::device_reset() -{ - m_latch = 0; - m_start_conv = 0; -} - - -//------------------------------------------------- // read //------------------------------------------------- -uint8_t nes_vaus_device::read_bit34() +u8 nes_vaus_device::read_bit34() { - uint8_t ret = (m_button->read() << 3); + u8 ret = m_button->read() << 3; ret |= (m_latch & 0x80) >> 3; m_latch <<= 1; - m_latch &= 0xff; return ret; } -uint8_t nes_vausfc_device::read_exp(offs_t offset) +u8 nes_vausfc_device::read_exp(offs_t offset) { - uint8_t ret; + u8 ret; if (offset == 0) //$4016 ret = m_button->read() << 1; else //$4017 { ret = (m_latch & 0x80) >> 6; m_latch <<= 1; - m_latch &= 0xff; + ret |= m_daisychain->read_exp(0) << 2; + ret |= m_daisychain->read_exp(1) << 3; } return ret; } @@ -118,12 +139,16 @@ uint8_t nes_vausfc_device::read_exp(offs_t offset) // write //------------------------------------------------- -void nes_vaus_device::write(uint8_t data) +void nes_vaus_device::write(u8 data) { - int old = m_start_conv; - - if (data == 0 && old == 1) - m_latch = (uint8_t) (m_paddle->read() ^ 0xff); + if (data == 0 && m_start_conv == 1) + m_latch = ~m_paddle->read(); m_start_conv = data; } + +void nes_vausfc_device::write(u8 data) +{ + m_daisychain->write(data); + nes_vaus_device::write(data); +} diff --git a/src/devices/bus/nes_ctrl/arkpaddle.h b/src/devices/bus/nes_ctrl/arkpaddle.h index cdd6255792b..be4786dddfc 100644 --- a/src/devices/bus/nes_ctrl/arkpaddle.h +++ b/src/devices/bus/nes_ctrl/arkpaddle.h @@ -25,39 +25,45 @@ class nes_vaus_device : public device_t, public device_nes_control_port_interfac { public: // construction/destruction - nes_vaus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_vaus_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // optional information overrides virtual ioport_constructor device_input_ports() const override; protected: - nes_vaus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + nes_vaus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); // 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; required_ioport m_paddle; required_ioport m_button; - uint8_t m_start_conv; - uint32_t m_latch; + u8 m_start_conv; + u8 m_latch; }; -// ======================> nes_vaus_device +// ======================> nes_vausfc_device class nes_vausfc_device : public nes_vaus_device { public: // construction/destruction - nes_vausfc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_vausfc_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - virtual uint8_t read_bit34() override { return 0; } - virtual uint8_t read_exp(offs_t offset) override; + // device-level overrides + virtual void device_add_mconfig(machine_config &config) override; + + virtual u8 read_bit34() override { return 0; } + virtual u8 read_exp(offs_t offset) override; + virtual void write(u8 data) override; + +private: + required_device<nes_control_port_device> m_daisychain; }; |