bus/nes_ctrl: Updated Partytap controller. (#8943)

* bus/nes_ctrl: Updated Partytap controller.  Project Q now detects the controller and inputs work.
This commit is contained in:
0kmg 2021-12-14 06:30:56 -09:00 committed by GitHub
parent 7eac6c8acc
commit 53f28f0934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 41 deletions

View File

@ -5903,6 +5903,7 @@ license:CC0
<feature name="slot" value="sxrom" />
<feature name="pcb" value="HVC-SGROM" />
<feature name="mmc1_type" value="MMC1B2" />
<feature name="peripheral" value="partytap" />
<dataarea name="prg" size="131072">
<rom name="yzw-kd-0 prg" size="131072" crc="e44001d8" sha1="a7800f88af4d5c8be68dc194acaee60c6e82d3c6" offset="00000" />
</dataarea>
@ -14721,6 +14722,7 @@ license:CC0
<part name="cart" interface="nes_cart">
<feature name="slot" value="sxrom" />
<feature name="pcb" value="HVC-SGROM" />
<feature name="mmc1_type" value="MMC1B3" />
<feature name="peripheral" value="partytap" />
<dataarea name="prg" size="262144">
<rom name="yzw-qp-0 prg" size="262144" crc="1545bd13" sha1="ddebe86096daf3b6dcd714c33a91e912f91da7ce" offset="00000" />
@ -47086,6 +47088,7 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
<part name="cart" interface="nes_cart">
<feature name="slot" value="txrom" />
<feature name="pcb" value="NES-TLROM" />
<feature name="peripheral" value="partytap" />
<dataarea name="prg" size="524288">
<rom name="gorilla man, the (japan).prg" size="524288" crc="9fd718fd" sha1="d477320dc99b294b5d26995f1527eca0233f2f46" offset="00000" status="baddump" />
</dataarea>
@ -49387,7 +49390,8 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
<info name="alt_title" value="プロジェクトQ"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="txrom" />
<feature name="pcb" value="NES-TLROM" />
<feature name="pcb" value="HVC-TNROM" />
<feature name="peripheral" value="partytap" />
<dataarea name="prg" size="262144">
<rom name="project q (japan).prg" size="262144" crc="c1ba8bb9" sha1="390443f9b8a69fee3cff5f234a3e92aae8b48102" offset="00000" status="baddump" />
</dataarea>

View File

@ -2,7 +2,7 @@
// copyright-holders:Fabio Priuli
/**********************************************************************
Nintendo Family Computer Yonezawa / PartyRoom 21 Party Tap Controller
Nintendo Family Computer Yonezawa / Party Room 21 Partytap Controller
**********************************************************************/
@ -13,7 +13,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(NES_PARTYTAP, nes_partytap_device, "nes_partytap", "Yonezawa Party Tap Controller")
DEFINE_DEVICE_TYPE(NES_PARTYTAP, nes_partytap_device, "nes_partytap", "Yonezawa Partytap Controller")
static INPUT_PORTS_START( nes_partytap )
@ -44,12 +44,11 @@ ioport_constructor nes_partytap_device::device_input_ports() const
// nes_partytap_device - constructor
//-------------------------------------------------
nes_partytap_device::nes_partytap_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, NES_PARTYTAP, tag, owner, clock),
device_nes_control_port_interface(mconfig, *this),
m_inputs(*this, "INPUTS"),
m_mode(0),
m_latch(0)
nes_partytap_device::nes_partytap_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, NES_PARTYTAP, tag, owner, clock)
, device_nes_control_port_interface(mconfig, *this)
, m_inputs(*this, "INPUTS")
, m_latch(0)
{
}
@ -61,18 +60,7 @@ nes_partytap_device::nes_partytap_device(const machine_config &mconfig, const ch
void nes_partytap_device::device_start()
{
save_item(NAME(m_latch));
save_item(NAME(m_mode));
}
//-------------------------------------------------
// device_reset
//-------------------------------------------------
void nes_partytap_device::device_reset()
{
m_mode = 0xe0;
m_latch = 0;
save_item(NAME(m_strobe));
}
@ -80,15 +68,16 @@ void nes_partytap_device::device_reset()
// read
//-------------------------------------------------
uint8_t nes_partytap_device::read_exp(offs_t offset)
u8 nes_partytap_device::read_exp(offs_t offset)
{
uint8_t ret = 0;
u8 ret = 0;
if (offset == 1) //$4017
{
if (m_strobe)
m_latch = m_inputs->read();
ret |= m_latch & 0x1c;
m_latch >>= 3;
// append mode bits
m_latch |= m_mode;
m_latch |= 0xa0; // after first two reads, 0x14 will be returned
}
return ret;
}
@ -97,14 +86,8 @@ uint8_t nes_partytap_device::read_exp(offs_t offset)
// write
//-------------------------------------------------
void nes_partytap_device::write(uint8_t data)
void nes_partytap_device::write(u8 data)
{
// inputs are read in two chunks of 3 bits, before the second one is read bit2 is written here
// probably a mechanism for the game to detect which group of inputs is being read
m_mode = BIT(data, 2) ? 0xa0 : 0xe0;
if (data & 0x01)
return;
m_latch = m_inputs->read();
if (write_strobe(data))
m_latch = m_inputs->read();
}

View File

@ -2,7 +2,7 @@
// copyright-holders:Fabio Priuli
/**********************************************************************
Nintendo Family Computer Yonezawa / PartyRoom 21 Party Tap Controller
Nintendo Family Computer Yonezawa / Party Room 21 Partytap Controller
**********************************************************************/
@ -25,23 +25,22 @@ class nes_partytap_device : public device_t,
{
public:
// construction/destruction
nes_partytap_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
nes_partytap_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_inputs;
uint8_t m_mode;
uint32_t m_latch;
u8 m_latch;
};
// device type definition
DECLARE_DEVICE_TYPE(NES_PARTYTAP, nes_partytap_device)