-pce.cpp: Converted PC Engine controller ports to slot devices. (#8028)

-ggconnie.cpp: Add notes for IRQ.
This commit is contained in:
cam900 2021-07-13 21:55:25 +09:00 committed by GitHub
parent a857cfcdee
commit 1d7e9c0284
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1258 additions and 281 deletions

View File

@ -4595,3 +4595,21 @@ if (BUSES["THOMSON"]~=null) then
MAME_DIR .. "src/devices/bus/thomson/nanoreseau.h",
}
end
---------------------------------------------------
--
--@src/devices/bus/pce_ctrl/pcectrl.h,BUSES["PCE_CTRL"] = true
---------------------------------------------------
if (BUSES["PCE_CTRL"]~=null) then
files {
MAME_DIR .. "src/devices/bus/pce_ctrl/pcectrl.cpp",
MAME_DIR .. "src/devices/bus/pce_ctrl/pcectrl.h",
MAME_DIR .. "src/devices/bus/pce_ctrl/joypad2.cpp",
MAME_DIR .. "src/devices/bus/pce_ctrl/joypad2.h",
MAME_DIR .. "src/devices/bus/pce_ctrl/joypad6.cpp",
MAME_DIR .. "src/devices/bus/pce_ctrl/joypad6.h",
MAME_DIR .. "src/devices/bus/pce_ctrl/multitap.cpp",
MAME_DIR .. "src/devices/bus/pce_ctrl/multitap.h",
}
end

View File

@ -803,6 +803,7 @@ BUSES["NSCSI"] = true
--BUSES["O2"] = true
--BUSES["ORICEXT"] = true
--BUSES["PCE"] = true
--BUSES["PCE_CTRL"] = true
BUSES["PC_JOY"] = true
BUSES["PC_KBD"] = true
--BUSES["PET"] = true

View File

@ -931,6 +931,7 @@ BUSES["PC_JOY"] = true
BUSES["PC_KBD"] = true
BUSES["PC1512"] = true
BUSES["PCE"] = true
BUSES["PCE_CTRL"] = true
BUSES["PET"] = true
BUSES["PLUS4"] = true
BUSES["POFO"] = true

View File

@ -0,0 +1,242 @@
// license:BSD-3-Clause
// copyright-holders:cam900
/**********************************************************************
NEC PC Engine/TurboGrafx-16 2 button joypad emulation
Based on SMS controller port emulation (devices\bus\sms_ctrl\*.*)
by Fabio Priuli,
PC engine emulation (mame\*\pce.*)
by Charles MacDonald, Wilbert Pol, Angelo Salese
First party models:
NEC PC Engine Pad (PI-PD001)
No autofire, Bundled in PC Engine
NEC Turbo Pad (PI-PD002 and Later models)
Add autofire support, Bundled in PC Engine CoreGrafx and later
models
NEC Turbo Stick (PI-PD4)
Arcade joystick variation of Turbo Pad, with Seperated autofire
buttons.
Turbo Stick for TurboGrafx-16 has slow motion.
Everything else PI-PD001 supports Autofire.
TODO:
- Needs verifications for Part numbers
**********************************************************************/
#include "emu.h"
#include "joypad2.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(PCE_JOYPAD2, pce_joypad2_device, "pce_joypad2", "NEC PC Engine Pad")
DEFINE_DEVICE_TYPE(PCE_JOYPAD2_TURBO, pce_joypad2_turbo_device, "pce_joypad2_turbo", "NEC PC Engine/TurboGrafx-16 2 Button Joypad")
static INPUT_PORTS_START( pce_joypad2 )
// II is left of I on the original pad so we map them in reverse order
PORT_START("BUTTONS")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Button I")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Button II")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("Select")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Run")
PORT_START("DIRECTION")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
INPUT_PORTS_END
static INPUT_PORTS_START( pce_joypad2_turbo )
PORT_INCLUDE( pce_joypad2 )
PORT_START("TURBO")
PORT_CONFNAME( 0x03, 0x00, "Button I Turbo" )
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
PORT_CONFSETTING( 0x02, "Slow" )
PORT_CONFSETTING( 0x03, "Fast" )
PORT_CONFNAME( 0x0c, 0x00, "Button II Turbo" )
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
PORT_CONFSETTING( 0x08, "Slow" )
PORT_CONFSETTING( 0x0c, "Fast" )
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor pce_joypad2_device::device_input_ports() const
{
return INPUT_PORTS_NAME( pce_joypad2 );
}
ioport_constructor pce_joypad2_turbo_device::device_input_ports() const
{
return INPUT_PORTS_NAME( pce_joypad2_turbo );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// pce_joypad2_device - constructor
//-------------------------------------------------
pce_joypad2_device::pce_joypad2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, type, tag, owner, clock),
device_pce_control_port_interface(mconfig, *this),
m_muxer(*this, "mux")
{
}
pce_joypad2_device::pce_joypad2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
pce_joypad2_device(mconfig, PCE_JOYPAD2, tag, owner, clock)
{
}
//-------------------------------------------------
// pce_joypad2_turbo_device - constructor
//-------------------------------------------------
pce_joypad2_turbo_device::pce_joypad2_turbo_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
pce_joypad2_device(mconfig, PCE_JOYPAD2_TURBO, tag, owner, clock),
m_buttons_io(*this, "BUTTONS"),
m_turbo_io(*this, "TURBO")
{
}
//-------------------------------------------------
// device_add_mconfig - device-specific machine
// configuration addiitons
//-------------------------------------------------
void pce_joypad2_device::device_add_mconfig(machine_config &config)
{
LS157(config, m_muxer);
m_muxer->a_in_callback().set_ioport("BUTTONS");
m_muxer->b_in_callback().set_ioport("DIRECTION");
}
void pce_joypad2_turbo_device::device_add_mconfig(machine_config &config)
{
pce_joypad2_device::device_add_mconfig(config);
m_muxer->a_in_callback().set(FUNC(pce_joypad2_turbo_device::buttons_r));
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void pce_joypad2_device::device_start()
{
}
void pce_joypad2_turbo_device::device_start()
{
pce_joypad2_device::device_start();
save_item(NAME(m_counter));
save_item(NAME(m_prev_clr));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void pce_joypad2_turbo_device::device_reset()
{
m_counter = 0;
m_prev_clr = false;
}
//-------------------------------------------------
// peripheral_r - joypad read
//-------------------------------------------------
u8 pce_joypad2_device::peripheral_r()
{
return m_muxer->output_r();
}
//-------------------------------------------------
// sel_w - MUXer select pin write
//-------------------------------------------------
void pce_joypad2_device::sel_w(int state)
{
m_muxer->select_w(state);
}
//-------------------------------------------------
// clr_w - MUXer strobe pin write
//-------------------------------------------------
void pce_joypad2_device::clr_w(int state)
{
m_muxer->strobe_w(state);
}
void pce_joypad2_turbo_device::clr_w(int state)
{
pce_joypad2_device::clr_w(state);
if ((!m_prev_clr) && state) // rising edge, connected to 74xx163 clock pin
m_counter = (m_counter + 1) & 7; // QA, QD pin not connected
m_prev_clr = state;
}
//-------------------------------------------------
// buttons_r - read button with autofire counter
//-------------------------------------------------
u8 pce_joypad2_turbo_device::buttons_r()
{
u8 ret = m_buttons_io->read() & 0xf;
const u8 turbo = m_turbo_io->read() & 0xf;
for (int i = 0; i < 2; i++)
{
const u8 enable_bit = 1 + (i << 1);
const u8 rate_bit = (i << 1);
if (BIT(turbo, enable_bit)) // enable autofire
{
if (BIT(turbo, rate_bit)) // Fast
{
if (BIT(m_counter, 1)) // QB pin from 74xx163
ret |= (1 << i);
}
else // Slow
{
if (BIT(m_counter, 2)) // OC pin from 74xx163
ret |= (1 << i);
}
}
}
return ret;
}

View File

@ -0,0 +1,91 @@
// license:BSD-3-Clause
// copyright-holders:cam900
/**********************************************************************
NEC PC Engine/TurboGrafx-16 2 Button Joypad emulation
**********************************************************************/
#ifndef MAME_BUS_PCE_CTRL_JOYPAD2_H
#define MAME_BUS_PCE_CTRL_JOYPAD2_H
#pragma once
#include "machine/74157.h"
#include "pcectrl.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> pce_joypad2_device
class pce_joypad2_device : public device_t,
public device_pce_control_port_interface
{
public:
// construction/destruction
pce_joypad2_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:
// construction/destruction
pce_joypad2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
// device_pce_control_port_interface overrides
virtual u8 peripheral_r() override;
virtual void sel_w(int state) override;
virtual void clr_w(int state) override;
// devices
required_device<ls157_device> m_muxer;
};
// ======================> pce_joypad2_turbo_device
class pce_joypad2_turbo_device : public pce_joypad2_device
{
public:
// construction/destruction
pce_joypad2_turbo_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:
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
// device_pce_control_port_interface overrides
virtual void clr_w(int state) override;
private:
u8 buttons_r();
// internal states
u8 m_counter = 0; // Turbo rate counter, connected on 74xx163 QB and QC.
bool m_prev_clr = false; // previous CLR pin state
// IO ports
required_ioport m_buttons_io;
required_ioport m_turbo_io;
};
// device type definition
DECLARE_DEVICE_TYPE(PCE_JOYPAD2, pce_joypad2_device)
DECLARE_DEVICE_TYPE(PCE_JOYPAD2_TURBO, pce_joypad2_turbo_device)
#endif // MAME_BUS_PCE_CTRL_JOYPAD2_H

View File

@ -0,0 +1,297 @@
// license:BSD-3-Clause
// copyright-holders:cam900
/**********************************************************************
NEC PC Engine/TurboGrafx-16 6 button joypad emulation
Based on SMS controller port emulation (devices\bus\sms_ctrl\*.*)
by Fabio Priuli,
PC engine emulation (mame\*\pce.*)
by Charles MacDonald, Wilbert Pol, Angelo Salese
There's 2 officially licensed 6 button joypad models:
NEC Avenue Pad 6 (NAPD-1002)
- Supports autofire for Button I, II, Run (slow motion)
NEC Arcade Pad 6 (PCE-TP1)
- Supports autofire for Button I-VI, Bundled in PC Engine Duo-RX
TODO:
- Needs verifications for Part numbers
- Verify DTC114Y function for Slow motion in Avenue Pad 6
**********************************************************************/
#include "emu.h"
#include "joypad6.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(PCE_AVENUE_PAD_6, pce_avenue_pad_6_device, "pce_avenue_pad_6", "NEC Avenue Pad 6")
DEFINE_DEVICE_TYPE(PCE_ARCADE_PAD_6, pce_arcade_pad_6_device, "pce_arcade_pad_6", "NEC Arcade Pad 6")
static INPUT_PORTS_START( pce_joypad6 )
PORT_START("BUTTONS_0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Button I") // Rightmost in bottom row
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Button II")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("Select")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Run")
PORT_START("DIRECTION")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
PORT_START("BUTTONS_1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Button III") // Leftmost in bottom row
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Button IV")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Button V")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Button VI")
PORT_START("JOY_MODE")
PORT_CONFNAME( 0x01, 0x00, "Joypad Mode" ) PORT_CHANGED_MEMBER(DEVICE_SELF, pce_joypad6_base_device, joypad_mode_changed, 0)
PORT_CONFSETTING( 0x00, "2-buttons mode" ) // A at avenue pad 6
PORT_CONFSETTING( 0x01, "6-buttons mode" ) // B at avenue pad 6
INPUT_PORTS_END
static INPUT_PORTS_START( pce_avenue_pad_6 )
PORT_INCLUDE( pce_joypad6 )
PORT_START("TURBO")
PORT_CONFNAME( 0x01, 0x00, "Button I Turbo" )
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
PORT_CONFSETTING( 0x01, DEF_STR( On ) )
PORT_CONFNAME( 0x02, 0x00, "Button II Turbo" )
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
PORT_CONFSETTING( 0x02, DEF_STR( On ) )
PORT_CONFNAME( 0x08, 0x00, "Slow motion" ) // TODO: 74xx163 QB pin is connected with DTC114Y for Slow motion (Run button)
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
PORT_CONFSETTING( 0x08, DEF_STR( On ) )
PORT_BIT( 0xf4, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
static INPUT_PORTS_START( pce_arcade_pad_6 )
PORT_INCLUDE( pce_joypad6 )
PORT_START("TURBO")
PORT_CONFNAME( 0x01, 0x00, "Button I Turbo" )
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
PORT_CONFSETTING( 0x01, DEF_STR( On ) )
PORT_CONFNAME( 0x02, 0x00, "Button II Turbo" )
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
PORT_CONFSETTING( 0x02, DEF_STR( On ) )
PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_CONFNAME( 0x10, 0x00, "Button III Turbo" )
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
PORT_CONFSETTING( 0x10, DEF_STR( On ) )
PORT_CONFNAME( 0x20, 0x00, "Button IV Turbo" )
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
PORT_CONFSETTING( 0x20, DEF_STR( On ) )
PORT_CONFNAME( 0x40, 0x00, "Button V Turbo" )
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
PORT_CONFSETTING( 0x40, DEF_STR( On ) )
PORT_CONFNAME( 0x80, 0x00, "Button VI Turbo" )
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
PORT_CONFSETTING( 0x80, DEF_STR( On ) )
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor pce_avenue_pad_6_device::device_input_ports() const
{
return INPUT_PORTS_NAME( pce_avenue_pad_6 );
}
ioport_constructor pce_arcade_pad_6_device::device_input_ports() const
{
return INPUT_PORTS_NAME( pce_arcade_pad_6 );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// pce_joypad6_base_device - constructor
//-------------------------------------------------
pce_joypad6_base_device::pce_joypad6_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, type, tag, owner, clock),
device_pce_control_port_interface(mconfig, *this),
m_muxer(*this, "mux_%u", 0U),
m_joypad_mode(*this, "JOY_MODE")
{
}
//-------------------------------------------------
// pce_avenue_pad_6_device - constructor
//-------------------------------------------------
pce_avenue_pad_6_device::pce_avenue_pad_6_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) :
pce_joypad6_base_device(mconfig, type, tag, owner, clock),
m_buttons_io(*this, "BUTTONS_%u", 0U),
m_turbo_io(*this, "TURBO")
{
}
pce_avenue_pad_6_device::pce_avenue_pad_6_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
pce_avenue_pad_6_device(mconfig, PCE_AVENUE_PAD_6, tag, owner, clock)
{
}
//-------------------------------------------------
// pce_arcade_pad_6_device - constructor
//-------------------------------------------------
pce_arcade_pad_6_device::pce_arcade_pad_6_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
pce_avenue_pad_6_device(mconfig, PCE_ARCADE_PAD_6, tag, owner, clock)
{
}
//-------------------------------------------------
// device_add_mconfig - device-specific machine
// configuration addiitons
//-------------------------------------------------
void pce_joypad6_base_device::device_add_mconfig(machine_config &config)
{
LS157(config, m_muxer[0]);
m_muxer[0]->a_in_callback().set_ioport("BUTTONS_0");
m_muxer[0]->b_in_callback().set_ioport("DIRECTION");
LS157(config, m_muxer[1]);
m_muxer[1]->a_in_callback().set_ioport("BUTTONS_1");
m_muxer[1]->b_in_callback().set_constant(0x0); //6-button pad header
LS157(config, m_muxer[2]);
m_muxer[2]->a_in_callback().set(m_muxer[0], FUNC(ls157_device::output_r));
m_muxer[2]->b_in_callback().set(m_muxer[1], FUNC(ls157_device::output_r));
}
void pce_avenue_pad_6_device::device_add_mconfig(machine_config &config)
{
pce_joypad6_base_device::device_add_mconfig(config);
m_muxer[0]->a_in_callback().set(FUNC(pce_avenue_pad_6_device::buttons_r<0>));
m_muxer[1]->a_in_callback().set(FUNC(pce_avenue_pad_6_device::buttons_r<1>));
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void pce_joypad6_base_device::device_start()
{
save_item(NAME(m_counter));
save_item(NAME(m_prev_clr));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void pce_joypad6_base_device::device_reset()
{
m_counter = 0;
m_prev_clr = false;
}
//-------------------------------------------------
// peripheral_r - joypad read
//-------------------------------------------------
u8 pce_joypad6_base_device::peripheral_r()
{
return m_muxer[2]->output_r();
}
//-------------------------------------------------
// sel_w - MUXer select pin write
//-------------------------------------------------
void pce_joypad6_base_device::sel_w(int state)
{
m_muxer[0]->select_w(state);
m_muxer[1]->select_w(state);
}
//-------------------------------------------------
// clr_w - MUXer strobe pin write, toggle button
// set and autofire control
//-------------------------------------------------
void pce_joypad6_base_device::clr_w(int state)
{
m_muxer[0]->strobe_w(state);
m_muxer[1]->strobe_w(state);
if ((!m_prev_clr) && state) // rising edge, connected to 74xx163 clock pin
m_counter = (m_counter + 1) & 0x3; // Toggle buttons/autofire, connected to 74xx163; QC, QD pin not used
m_prev_clr = state;
buttonset_update();
}
//-------------------------------------------------
// buttonset_update - toggle buttonsets
//-------------------------------------------------
void pce_joypad6_base_device::buttonset_update()
{
m_muxer[2]->select_w((m_joypad_mode->read() & 1) ? BIT(m_counter, 0) : 0);
}
//-------------------------------------------------
// joypad_mode_changed
//-------------------------------------------------
INPUT_CHANGED_MEMBER(pce_joypad6_base_device::joypad_mode_changed)
{
buttonset_update();
}
//-------------------------------------------------
// buttons_r - read button with autofire counter
//-------------------------------------------------
template<unsigned Buttonset>
u8 pce_avenue_pad_6_device::buttons_r()
{
u8 ret = m_buttons_io[Buttonset]->read() & 0xf;
const u8 turbo = BIT(m_turbo_io->read(), Buttonset << 2, 4);
for (int i = 0; i < 4; i++)
{
if (BIT(turbo, i)) // enable autofire
{
if (BIT(m_counter, 1)) // QB pin from 74xx163
ret |= (1 << i);
}
}
return ret;
}

View File

@ -0,0 +1,105 @@
// license:BSD-3-Clause
// copyright-holders:cam900
/**********************************************************************
NEC PC Engine/TurboGrafx-16 6 Button Joypad emulation
**********************************************************************/
#ifndef MAME_BUS_PCE_CTRL_JOYPAD6_H
#define MAME_BUS_PCE_CTRL_JOYPAD6_H
#pragma once
#include "machine/74157.h"
#include "pcectrl.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> pce_joypad6_base_device
class pce_joypad6_base_device : public device_t,
public device_pce_control_port_interface
{
public:
DECLARE_INPUT_CHANGED_MEMBER(joypad_mode_changed);
protected:
// construction/destruction
pce_joypad6_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
// device_pce_control_port_interface overrides
virtual u8 peripheral_r() override;
virtual void sel_w(int state) override;
virtual void clr_w(int state) override;
// button handlers
void buttonset_update();
// internal states
u8 m_counter = 0; // buttonset select, autofire counter (74xx163 QA-QB pin)
bool m_prev_clr = false; // previous CLR pin state
// devices
required_device_array<ls157_device, 3> m_muxer;
// IO ports
required_ioport m_joypad_mode;
};
// ======================> pce_avenue_pad_6_device
class pce_avenue_pad_6_device : public pce_joypad6_base_device
{
public:
// construction/destruction
pce_avenue_pad_6_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:
// construction/destruction
pce_avenue_pad_6_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
template<unsigned Buttonset> u8 buttons_r();
// IO ports
required_ioport_array<2> m_buttons_io;
required_ioport m_turbo_io;
};
// ======================> pce_arcade_pad_6_device
class pce_arcade_pad_6_device : public pce_avenue_pad_6_device
{
public:
// construction/destruction
pce_arcade_pad_6_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
};
// device type definition
DECLARE_DEVICE_TYPE(PCE_AVENUE_PAD_6, pce_avenue_pad_6_device)
DECLARE_DEVICE_TYPE(PCE_ARCADE_PAD_6, pce_arcade_pad_6_device)
#endif // MAME_BUS_PCE_CTRL_JOYPAD6_H

View File

@ -0,0 +1,123 @@
// license:BSD-3-Clause
// copyright-holders:cam900
/**********************************************************************
NEC PC Engine/TurboGrafx-16 Multi Tap emulation
Based on SMS controller port emulation (devices\bus\sms_ctrl\*.*)
by Fabio Priuli,
PC engine emulation (mame\*\pce.*)
by Charles MacDonald, Wilbert Pol, Angelo Salese
First party model (PI-PD003, and US released TurboTap and DuoTap)
has allowed up to 5 controllers, Third-party Multi Taps are has
allowed up to 2-4 controllers, and also compatible?
**********************************************************************/
#include "emu.h"
#include "multitap.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(PCE_MULTITAP, pce_multitap_device, "pce_multitap", "NEC PC Engine/TurboGrafx-16 Multi Tap")
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// pce_multitap_device - constructor
//-------------------------------------------------
pce_multitap_device::pce_multitap_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, PCE_MULTITAP, tag, owner, clock),
device_pce_control_port_interface(mconfig, *this),
m_subctrl_port(*this, "ctrl%u", 1U),
m_port_sel(0),
m_prev_sel(0)
{
}
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void pce_multitap_device::device_add_mconfig(machine_config &config)
{
for (auto & elem : m_subctrl_port)
PCE_CONTROL_PORT(config, elem, pce_control_port_devices, "joypad2");
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void pce_multitap_device::device_start()
{
save_item(NAME(m_port_sel));
save_item(NAME(m_prev_sel));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void pce_multitap_device::device_reset()
{
m_port_sel = 0;
m_prev_sel = false;
}
//-------------------------------------------------
// peripheral_r - multitap read
//-------------------------------------------------
u8 pce_multitap_device::peripheral_r()
{
u8 data = 0xf;
if (m_port_sel < 5) // up to 5 controller ports
data = m_subctrl_port[m_port_sel]->port_r();
return data;
}
//-------------------------------------------------
// sel_w - SEL pin write, with port select
//-------------------------------------------------
void pce_multitap_device::sel_w(int state)
{
for (auto & elem : m_subctrl_port)
elem->sel_w(state);
// bump counter on a low-to-high transition of SEL bit
if ((!m_prev_sel) && state)
m_port_sel = (m_port_sel + 1) & 7;
m_prev_sel = state;
}
//-------------------------------------------------
// clr_w - CLR pin write, with reset multitap
//-------------------------------------------------
void pce_multitap_device::clr_w(int state)
{
for (auto & elem : m_subctrl_port)
elem->clr_w(state);
// clear counter if Reset bit is set
if (state)
m_port_sel = 0;
}

View File

@ -0,0 +1,57 @@
// license:BSD-3-Clause
// copyright-holders:cam900
/**********************************************************************
NEC PC Engine/TurboGrafx-16 Multi Tap emulation
**********************************************************************/
#ifndef MAME_BUS_PCE_CTRL_MULTITAP_H
#define MAME_BUS_PCE_CTRL_MULTITAP_H
#pragma once
#include "pcectrl.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> pce_multitap_device
class pce_multitap_device : public device_t,
public device_pce_control_port_interface
{
public:
// construction/destruction
pce_multitap_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 void device_start() override;
virtual void device_reset() override;
// device_pce_control_port_interface overrides
virtual u8 peripheral_r() override;
virtual void sel_w(int state) override;
virtual void clr_w(int state) override;
private:
// controller ports
required_device_array<pce_control_port_device, 5> m_subctrl_port;
// internal states
u8 m_port_sel = 0; // select port to read
bool m_prev_sel = false; // previous SEL pin state
};
// device type definition
DECLARE_DEVICE_TYPE(PCE_MULTITAP, pce_multitap_device)
#endif // MAME_BUS_PCE_CTRL_MULTITAP_H

View File

@ -0,0 +1,182 @@
// license:BSD-3-Clause
// copyright-holders:cam900
/**********************************************************************
NEC PC Engine/TurboGrafx-16 controller port emulation
Based on SMS controller port emulation (devices\bus\sms_ctrl\*.*)
by Fabio Priuli,
PC engine emulation (mame\*\pce.*)
by Charles MacDonald, Wilbert Pol, Angelo Salese
Controller port interface layout:
DIN-8 interface for TurboGrafx-16:
/-------------\
//-------------\\
// 2 \\
|| 5 4 ||
|| ||
|| 3 8 1 ||
|| ||
|| 7 6 ||
\\ --- //
\\----/ \----//
\-------------/
Mini DIN-8 interface for others:
/-------------\
//----| |----\\
// |---| \\
|| 6 7 8 ||
|| ||
|| 3 4 5 ||
|| ||
||--| 1 2 |--||
\ | | /
\ |-----------| /
\-------------/
1: +5V
2: O0 (Read bit 0)
3: O1 (Read bit 1)
4: O2 (Read bit 2)
5: O3 (Read bit 3)
6: SEL (Write bit 0)
7: CLR (Write bit 1)
8: GND
**********************************************************************/
#include "emu.h"
#include "screen.h"
#include "pcectrl.h"
// slot devices
#include "joypad2.h"
#include "joypad6.h"
#include "multitap.h"
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
DEFINE_DEVICE_TYPE(PCE_CONTROL_PORT, pce_control_port_device, "pce_control_port", "NEC PC Engine/TurboGrafx-16 controller port")
//**************************************************************************
// CARD INTERFACE
//**************************************************************************
//-------------------------------------------------
// device_pce_control_port_interface - constructor
//-------------------------------------------------
device_pce_control_port_interface::device_pce_control_port_interface(const machine_config &mconfig, device_t &device)
: device_interface(device, "pcectrl")
{
m_port = dynamic_cast<pce_control_port_device *>(device.owner());
}
//-------------------------------------------------
// ~device_pce_control_port_interface - destructor
//-------------------------------------------------
device_pce_control_port_interface::~device_pce_control_port_interface()
{
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// pce_control_port_device - constructor
//-------------------------------------------------
pce_control_port_device::pce_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, PCE_CONTROL_PORT, tag, owner, clock),
device_slot_interface(mconfig, *this),
m_device(nullptr)
{
}
//-------------------------------------------------
// pce_control_port_device - destructor
//-------------------------------------------------
pce_control_port_device::~pce_control_port_device()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void pce_control_port_device::device_start()
{
m_device = dynamic_cast<device_pce_control_port_interface *>(get_card_device());
}
//-------------------------------------------------
// port_r - controller port read
//-------------------------------------------------
u8 pce_control_port_device::port_r()
{
u8 data = 0xf;
if (m_device)
data = m_device->peripheral_r() & 0xf; // 4 bit
return data;
}
//-------------------------------------------------
// sel_w - SEL pin write
//-------------------------------------------------
void pce_control_port_device::sel_w(int state)
{
if (m_device)
m_device->sel_w(state);
}
//-------------------------------------------------
// clr_w - CLR pin write
//-------------------------------------------------
void pce_control_port_device::clr_w(int state)
{
if (m_device)
m_device->clr_w(state);
}
void pce_control_port_devices(device_slot_interface &device)
{
// 2 Button Joypad/Joysticks
device.option_add("joypad2", PCE_JOYPAD2); // bundled pad for White PC Engine
device.option_add("joypad2_turbo", PCE_JOYPAD2_TURBO); // Turbo pad and compatibles
// 6 Button Joypad/Joysticks
device.option_add("avenue_pad_6", PCE_AVENUE_PAD_6);
device.option_add("arcade_pad_6", PCE_ARCADE_PAD_6);
device.option_add("multitap", PCE_MULTITAP);
// 3 Button Joypad/Joysticks (ex: Avenue Pad 3)
// Pachinko Controller (CJPC-101)
// PC Engine Mouse (PI-PD10)
// Memory Base 128 (PI-AD19)
// etc...
}

View File

@ -0,0 +1,81 @@
// license:BSD-3-Clause
// copyright-holders:cam900
/**********************************************************************
NEC PC Engine/TurboGrafx-16 controller port emulation
**********************************************************************/
#ifndef MAME_BUS_PCE_CTRL_PCECTRL_H
#define MAME_BUS_PCE_CTRL_PCECTRL_H
#pragma once
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> pce_control_port_device
class device_pce_control_port_interface;
class pce_control_port_device : public device_t,
public device_slot_interface
{
public:
// construction/destruction
template <typename T>
pce_control_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
: pce_control_port_device(mconfig, tag, owner, 0)
{
option_reset();
opts(*this);
set_default_option(dflt);
set_fixed(false);
}
pce_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual ~pce_control_port_device();
u8 port_r();
void sel_w(int state);
void clr_w(int state);
protected:
// device-level overrides
virtual void device_start() override;
device_pce_control_port_interface *m_device;
};
// ======================> device_pce_control_port_interface
// class representing interface-specific live pce_control_port card
class device_pce_control_port_interface : public device_interface
{
public:
// construction/destruction
virtual ~device_pce_control_port_interface();
virtual u8 peripheral_r() { return 0xf; }
virtual void sel_w(int state) {}
virtual void clr_w(int state) {}
protected:
device_pce_control_port_interface(const machine_config &mconfig, device_t &device);
pce_control_port_device *m_port;
};
// device type definition
DECLARE_DEVICE_TYPE(PCE_CONTROL_PORT, pce_control_port_device)
void pce_control_port_devices(device_slot_interface &device);
#endif // MAME_BUS_PCE_CTRL_PCECTRL_H

View File

@ -331,11 +331,11 @@ void ggconnie_state::ggconnie(machine_config &config)
huc6270_device &huc6270_0(HUC6270(config, "huc6270_0", 0));
huc6270_0.set_vram_size(0x10000);
huc6270_0.irq().set_inputline(m_maincpu, 0);
huc6270_0.irq().set_inputline(m_maincpu, 0); // needs input merger?
huc6270_device &huc6270_1(HUC6270(config, "huc6270_1", 0));
huc6270_1.set_vram_size(0x10000);
huc6270_1.irq().set_inputline(m_maincpu, 0);
huc6270_1.irq().set_inputline(m_maincpu, 0); // needs input merger?
huc6202_device &huc6202(HUC6202(config, "huc6202", 0 ));
huc6202.next_pixel_0_callback().set("huc6270_0", FUNC(huc6270_device::next_pixel));

View File

@ -17,7 +17,7 @@
- sprite precaching
- rewrite the base renderer loop
- Add CD support
- Add 6 button joystick support
- Add expansion port support
- Add 263 line mode
- Sprite DMA should use vdc VRAM functions
- properly implement the pixel clocks instead of the simple scaling we do now
@ -75,171 +75,10 @@ Super System Card:
// hucard pachikun gives you option to select pachinko controller after pressing start, likely because it doesn't have a true header id
static INPUT_PORTS_START( pce )
PORT_START("JOY_P.0")
/* II is left of I on the original pad so we map them in reverse order */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button I") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button II") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P1 Select") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P1 Run") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000)
PORT_START("JOY_P.1")
/* II is left of I on the original pad so we map them in reverse order */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button I") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button II") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P2 Select") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P2 Run") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000)
//PORT_START("JOY_P.1")
// pachinko controller paddle maps here (!?) with this arrangement
//PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_MINMAX(0,0x5f) PORT_SENSITIVITY(15) PORT_KEYDELTA(15) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M)
PORT_START("JOY_P.2")
/* II is left of I on the original pad so we map them in reverse order */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P3 Button I") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P3 Button II") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P3 Select") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P3 Run") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000)
PORT_START("JOY_P.3")
/* II is left of I on the original pad so we map them in reverse order */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P4 Button I") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P4 Button II") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P4 Select") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P4 Run") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000)
PORT_START("JOY_P.4")
/* II is left of I on the original pad so we map them in reverse order */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P5 Button I") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P5 Button II") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P5 Select") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P5 Run") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000)
PORT_START("JOY6B_P.0")
/* II is left of I on the original pad so we map them in reverse order */
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button I") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button II") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P1 Select") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P1 Run") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002)
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Button III") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Button IV") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Button V") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Button VI") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002)
PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header
PORT_START("JOY6B_P.1") /* Player 2 controls */
/* II is left of I on the original pad so we map them in reverse order */
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button I") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button II") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P2 Select") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P2 Run") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008)
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 Button III") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 Button IV") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P2 Button V") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Button VI") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008)
PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header
PORT_START("JOY6B_P.2") /* Player 3 controls */
/* II is left of I on the original pad so we map them in reverse order */
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P3 Button I") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P3 Button II") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P3 Select") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P3 Run") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020)
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P3 Button III") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P3 Button IV") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P3 Button V") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P3 Button VI") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020)
PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header
PORT_START("JOY6B_P.3") /* Player 4 controls */
/* II is left of I on the original pad so we map them in reverse order */
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P4 Button I") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P4 Button II") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P4 Select") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P4 Run") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080)
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P3 Button III") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P3 Button IV") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P3 Button V") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P3 Button VI") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080)
PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header
PORT_START("JOY6B_P.4") /* Player 5 controls */
/* II is left of I on the original pad so we map them in reverse order */
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P5 Button I") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P5 Button II") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P5 Select") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P5 Run") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200)
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P5 Button III") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P5 Button IV") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P5 Button V") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P5 Button VI") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200)
PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header
PORT_START("JOY_TYPE")
PORT_CONFNAME(0x0003,0x0000,"Joystick Type Player 1")
PORT_CONFSETTING( 0x0000,"2-buttons" )
// PORT_CONFSETTING( 0x0001,"3-buttons" )
PORT_CONFSETTING( 0x0002,"6-buttons" )
// PORT_CONFSETTING( 0x0003,"Mouse" )
PORT_CONFNAME(0x000c,0x0000,"Joystick Type Player 2")
PORT_CONFSETTING( 0x0000,"2-buttons" )
// PORT_CONFSETTING( 0x0004,"3-buttons" )
PORT_CONFSETTING( 0x0008,"6-buttons" )
// PORT_CONFSETTING( 0x000c,"Mouse" )
PORT_CONFNAME(0x0030,0x0000,"Joystick Type Player 3")
PORT_CONFSETTING( 0x0000,"2-buttons" )
// PORT_CONFSETTING( 0x0010,"3-buttons" )
PORT_CONFSETTING( 0x0020,"6-buttons" )
// PORT_CONFSETTING( 0x0030,"Mouse" )
PORT_CONFNAME(0x00c0,0x0000,"Joystick Type Player 4")
PORT_CONFSETTING( 0x0000,"2-buttons" )
// PORT_CONFSETTING( 0x0040,"3-buttons" )
PORT_CONFSETTING( 0x0080,"6-buttons" )
// PORT_CONFSETTING( 0x00c0,"Mouse" )
PORT_CONFNAME(0x0300,0x0000,"Joystick Type Player 5")
PORT_CONFSETTING( 0x0000,"2-buttons" )
// PORT_CONFSETTING( 0x0100,"3-buttons" )
PORT_CONFSETTING( 0x0200,"6-buttons" )
// PORT_CONFSETTING( 0x0300,"Mouse" )
PORT_START("A_CARD")
PORT_CONFNAME( 0x01, 0x01, "Arcade Card" )
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
@ -255,10 +94,10 @@ void pce_state::pce_mem(address_map &map)
map(0x110000, 0x1EDFFF).noprw();
map(0x1EE000, 0x1EE7FF).rw(m_cd, FUNC(pce_cd_device::bram_r), FUNC(pce_cd_device::bram_w));
map(0x1EE800, 0x1EFFFF).noprw();
map(0x1F0000, 0x1F1FFF).ram().mirror(0x6000).share("user_ram");
map(0x1F0000, 0x1F1FFF).ram().mirror(0x6000);
map(0x1FE000, 0x1FE3FF).rw("huc6270", FUNC(huc6270_device::read), FUNC(huc6270_device::write));
map(0x1FE400, 0x1FE7FF).rw(m_huc6260, FUNC(huc6260_device::read), FUNC(huc6260_device::write));
map(0x1FF800, 0x1FFBFF).rw(FUNC(pce_state::pce_cd_intf_r), FUNC(pce_state::pce_cd_intf_w));
map(0x1FF800, 0x1FFBFF).rw(FUNC(pce_state::cd_intf_r), FUNC(pce_state::cd_intf_w));
}
void pce_state::pce_io(address_map &map)
@ -274,12 +113,12 @@ void pce_state::sgx_mem(address_map &map)
map(0x110000, 0x1EDFFF).noprw();
map(0x1EE000, 0x1EE7FF).rw(m_cd, FUNC(pce_cd_device::bram_r), FUNC(pce_cd_device::bram_w));
map(0x1EE800, 0x1EFFFF).noprw();
map(0x1F0000, 0x1F7FFF).ram().share("user_ram");
map(0x1F0000, 0x1F7FFF).ram();
map(0x1FE000, 0x1FE007).rw("huc6270_0", FUNC(huc6270_device::read), FUNC(huc6270_device::write)).mirror(0x03E0);
map(0x1FE008, 0x1FE00F).rw("huc6202", FUNC(huc6202_device::read), FUNC(huc6202_device::write)).mirror(0x03E0);
map(0x1FE010, 0x1FE017).rw("huc6270_1", FUNC(huc6270_device::read), FUNC(huc6270_device::write)).mirror(0x03E0);
map(0x1FE400, 0x1FE7FF).rw(m_huc6260, FUNC(huc6260_device::read), FUNC(huc6260_device::write));
map(0x1FF800, 0x1FFBFF).rw(FUNC(pce_state::pce_cd_intf_r), FUNC(pce_state::pce_cd_intf_w));
map(0x1FF800, 0x1FFBFF).rw(FUNC(pce_state::cd_intf_r), FUNC(pce_state::cd_intf_w));
}
@ -291,7 +130,7 @@ void pce_state::sgx_io(address_map &map)
uint32_t pce_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_huc6260->video_update( bitmap, cliprect );
m_huc6260->video_update(bitmap, cliprect);
return 0;
}
@ -312,8 +151,8 @@ void pce_state::pce_common(machine_config &config)
H6280(config, m_maincpu, MAIN_CLOCK/3);
m_maincpu->set_addrmap(AS_PROGRAM, &pce_state::pce_mem);
m_maincpu->set_addrmap(AS_IO, &pce_state::pce_io);
m_maincpu->port_in_cb().set(FUNC(pce_state::mess_pce_joystick_r));
m_maincpu->port_out_cb().set(FUNC(pce_state::mess_pce_joystick_w));
m_maincpu->port_in_cb().set(FUNC(pce_state::controller_r));
m_maincpu->port_out_cb().set(FUNC(pce_state::controller_w));
m_maincpu->add_route(0, "lspeaker", 1.00);
m_maincpu->add_route(1, "rspeaker", 1.00);
@ -338,6 +177,9 @@ void pce_state::pce_common(machine_config &config)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
PCE_CONTROL_PORT(config, m_port_ctrl, pce_control_port_devices, "joypad2");
// TODO: expansion port not emulated
PCE_CD(config, m_cd, 0);
SOFTWARE_LIST(config, "cd_list").set_original("pcecd");
@ -349,6 +191,8 @@ void pce_state::pce(machine_config &config)
pce_common(config);
PCE_CART_SLOT(config, m_cartslot, pce_cart, nullptr, "pce_cart");
SOFTWARE_LIST(config, "cart_list").set_original("pce");
// bundled pad (in white PC engine) has not support autofire
}
@ -357,6 +201,9 @@ void pce_state::tg16(machine_config &config)
pce_common(config);
PCE_CART_SLOT(config, m_cartslot, pce_cart, nullptr, "tg16_cart");
SOFTWARE_LIST(config, "cart_list").set_original("tg16");
// turbo pad bundled
m_port_ctrl->set_default_option("joypad2_turbo");
}
@ -366,8 +213,8 @@ void pce_state::sgx(machine_config &config)
H6280(config, m_maincpu, MAIN_CLOCK/3);
m_maincpu->set_addrmap(AS_PROGRAM, &pce_state::sgx_mem);
m_maincpu->set_addrmap(AS_IO, &pce_state::sgx_io);
m_maincpu->port_in_cb().set(FUNC(pce_state::mess_pce_joystick_r));
m_maincpu->port_out_cb().set(FUNC(pce_state::mess_pce_joystick_w));
m_maincpu->port_in_cb().set(FUNC(pce_state::controller_r));
m_maincpu->port_out_cb().set(FUNC(pce_state::controller_w));
m_maincpu->add_route(0, "lspeaker", 1.00);
m_maincpu->add_route(1, "rspeaker", 1.00);
@ -387,11 +234,11 @@ void pce_state::sgx(machine_config &config)
huc6270_device &huc6270_0(HUC6270(config, "huc6270_0", 0));
huc6270_0.set_vram_size(0x10000);
huc6270_0.irq().set_inputline(m_maincpu, 0);
huc6270_0.irq().set_inputline(m_maincpu, 0); // needs input merger?
huc6270_device &huc6270_1(HUC6270(config, "huc6270_1", 0));
huc6270_1.set_vram_size(0x10000);
huc6270_1.irq().set_inputline(m_maincpu, 0);
huc6270_1.irq().set_inputline(m_maincpu, 0); // needs input merger?
huc6202_device &huc6202(HUC6202(config, "huc6202", 0 ));
huc6202.next_pixel_0_callback().set("huc6270_0", FUNC(huc6270_device::next_pixel));
@ -410,10 +257,14 @@ void pce_state::sgx(machine_config &config)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
// turbo pad bundled
PCE_CONTROL_PORT(config, m_port_ctrl, pce_control_port_devices, "joypad2_turbo");
PCE_CART_SLOT(config, m_cartslot, pce_cart, nullptr, "pce_cart");
SOFTWARE_LIST(config, "cart_list").set_original("sgx");
SOFTWARE_LIST(config, "pce_list").set_compatible("pce");
// TODO: expansion port not emulated
PCE_CD(config, m_cd, 0);
SOFTWARE_LIST(config, "cd_list").set_original("pcecd");
@ -432,6 +283,7 @@ ROM_END
#define rom_tg16 rom_pce
#define rom_sgx rom_pce
CONS( 1987, pce, 0, 0, pce, pce, pce_state, init_mess_pce, "NEC / Hudson Soft", "PC Engine", MACHINE_IMPERFECT_SOUND )
CONS( 1989, tg16, pce, 0, tg16, pce, pce_state, init_tg16, "NEC / Hudson Soft", "TurboGrafx 16", MACHINE_IMPERFECT_SOUND )
CONS( 1989, sgx, pce, 0, sgx, pce, pce_state, init_sgx, "NEC / Hudson Soft", "SuperGrafx", MACHINE_IMPERFECT_SOUND )
CONS( 1987, pce, 0, 0, pce, pce, pce_state, init_pce, "NEC / Hudson Soft", "PC Engine", MACHINE_IMPERFECT_SOUND )
CONS( 1989, tg16, pce, 0, tg16, pce, pce_state, init_tg16, "NEC / Hudson Soft", "TurboGrafx 16", MACHINE_IMPERFECT_SOUND )
CONS( 1989, sgx, pce, 0, sgx, pce, pce_state, init_pce, "NEC / Hudson Soft", "SuperGrafx", MACHINE_IMPERFECT_SOUND )
// TODO: TurboGrafx for PAL region?

View File

@ -14,6 +14,7 @@
#include "cdrom.h"
#include "cpu/h6280/h6280.h"
#include "bus/pce/pce_slot.h"
#include "bus/pce_ctrl/pcectrl.h"
#include "machine/pce_cd.h"
#include "video/huc6260.h"
@ -37,19 +38,15 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_cd_ram(*this, "cd_ram"),
m_user_ram(*this, "user_ram"),
m_huc6260(*this, "huc6260"),
m_cartslot(*this, "cartslot"),
m_cd(*this, "pce_cd"),
m_joy(*this, "JOY_P.%u", 0),
m_joy6b(*this, "JOY6B_P.%u", 0),
m_joy_type(*this, "JOY_TYPE"),
m_port_ctrl(*this, "ctrl"),
m_a_card(*this, "A_CARD")
{ }
void init_sgx();
void init_tg16();
void init_mess_pce();
void init_pce();
void pce_common(machine_config &config);
void pce(machine_config &config);
@ -62,28 +59,22 @@ protected:
private:
required_device<h6280_device> m_maincpu;
required_shared_ptr<uint8_t> m_cd_ram;
required_shared_ptr<uint8_t> m_user_ram;
required_shared_ptr<u8> m_cd_ram;
required_device<huc6260_device> m_huc6260;
required_device<pce_cart_slot_device> m_cartslot;
optional_device<pce_cd_device> m_cd;
required_ioport_array<5> m_joy;
required_ioport_array<5> m_joy6b;
required_ioport m_joy_type;
required_device<pce_control_port_device> m_port_ctrl;
required_ioport m_a_card;
uint8_t m_io_port_options;
uint8_t m_sys3_card;
uint8_t m_acard;
int m_joystick_port_select;
int m_joystick_data_select;
uint8_t m_joy_6b_packet[5];
void mess_pce_joystick_w(uint8_t data);
uint8_t mess_pce_joystick_r();
void pce_cd_intf_w(offs_t offset, uint8_t data);
uint8_t pce_cd_intf_r(offs_t offset);
uint8_t pce_cd_acard_wram_r(offs_t offset);
void pce_cd_acard_wram_w(offs_t offset, uint8_t data);
u8 m_io_port_options;
u8 m_sys3_card;
u8 m_acard;
void controller_w(u8 data);
u8 controller_r();
void cd_intf_w(offs_t offset, u8 data);
u8 cd_intf_r(offs_t offset);
u8 acard_wram_r(offs_t offset);
void acard_wram_w(offs_t offset, u8 data);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void pce_io(address_map &map);
void pce_mem(address_map &map);

View File

@ -79,7 +79,7 @@ CD Interface Register 0x0f - ADPCM fade in/out register
void pce_state::init_mess_pce()
void pce_state::init_pce()
{
m_io_port_options = PCE_JOY_SIG | CONST_SIG;
}
@ -89,11 +89,6 @@ void pce_state::init_tg16()
m_io_port_options = TG_16_JOY_SIG | CONST_SIG;
}
void pce_state::init_sgx()
{
m_io_port_options = PCE_JOY_SIG | CONST_SIG;
}
void pce_state::machine_start()
{
if (m_cd)
@ -103,16 +98,10 @@ void pce_state::machine_start()
// OTOH CD states are saved but not correctly restored!
save_item(NAME(m_io_port_options));
save_item(NAME(m_acard));
save_item(NAME(m_joystick_port_select));
save_item(NAME(m_joystick_data_select));
save_item(NAME(m_joy_6b_packet));
}
void pce_state::machine_reset()
{
for (auto & elem : m_joy_6b_packet)
elem = 0;
/* Note: Arcade Card BIOS contents are the same as System 3, only internal HW differs.
We use a category to select between modes (some games can be run in either S-CD or A-CD modes) */
m_acard = m_a_card->read() & 1;
@ -120,88 +109,35 @@ void pce_state::machine_reset()
if (m_cartslot->get_type() == PCE_CDSYS3J)
{
m_sys3_card = 1;
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x080000, 0x087fff, read8sm_delegate(*this, FUNC(pce_state::pce_cd_acard_wram_r)), write8sm_delegate(*this, FUNC(pce_state::pce_cd_acard_wram_w)));
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x080000, 0x087fff, read8sm_delegate(*this, FUNC(pce_state::acard_wram_r)), write8sm_delegate(*this, FUNC(pce_state::acard_wram_w)));
}
if (m_cartslot->get_type() == PCE_CDSYS3U)
{
m_sys3_card = 3;
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x080000, 0x087fff, read8sm_delegate(*this, FUNC(pce_state::pce_cd_acard_wram_r)), write8sm_delegate(*this, FUNC(pce_state::pce_cd_acard_wram_w)));
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x080000, 0x087fff, read8sm_delegate(*this, FUNC(pce_state::acard_wram_r)), write8sm_delegate(*this, FUNC(pce_state::acard_wram_w)));
}
}
/* todo: how many input ports does the PCE have? */
void pce_state::mess_pce_joystick_w(uint8_t data)
void pce_state::controller_w(u8 data)
{
int joy_i;
uint8_t joy_type = m_joy_type->read();
/* bump counter on a low-to-high transition of bit 1 */
if ((!m_joystick_data_select) && (data & JOY_CLOCK))
{
m_joystick_port_select = (m_joystick_port_select + 1) & 0x07;
}
/* do we want buttons or direction? */
m_joystick_data_select = data & JOY_CLOCK;
/* clear counter if bit 2 is set */
if (data & JOY_RESET)
{
m_joystick_port_select = 0;
for (joy_i = 0; joy_i < 5; joy_i++)
{
if (((joy_type >> (joy_i*2)) & 3) == 2)
m_joy_6b_packet[joy_i] ^= 1;
}
}
m_port_ctrl->sel_w(BIT(data, 0));
m_port_ctrl->clr_w(BIT(data, 1));
}
uint8_t pce_state::mess_pce_joystick_r()
u8 pce_state::controller_r()
{
uint8_t joy_type = m_joy_type->read();
uint8_t ret, data;
if (m_joystick_port_select <= 4)
{
switch ((joy_type >> (m_joystick_port_select*2)) & 3)
{
case 0: //2-buttons pad
data = m_joy[m_joystick_port_select]->read();
break;
case 2: //6-buttons pad
/*
Two packets:
1st packet: directions + I, II, Run, Select
2nd packet: 6 buttons "header" (high 4 bits active low) + III, IV, V, VI
Note that six buttons pad just doesn't work with (almost?) every single 2-button-only games, it's really just an after-thought and it is like this
on real HW.
*/
data = m_joy6b[m_joystick_port_select]->read() >> (m_joy_6b_packet[m_joystick_port_select]*8);
break;
default:
data = 0xff;
break;
}
}
else
data = 0xff;
if (m_joystick_data_select)
data >>= 4;
ret = (data & 0x0f) | m_io_port_options;
u8 ret = (m_port_ctrl->port_r() & 0x0f) | m_io_port_options;
#ifdef UNIFIED_PCE
ret &= ~0x40;
#endif
return (ret);
return ret;
}
void pce_state::pce_cd_intf_w(offs_t offset, uint8_t data)
void pce_state::cd_intf_w(offs_t offset, u8 data)
{
m_cd->update();
@ -213,7 +149,7 @@ void pce_state::pce_cd_intf_w(offs_t offset, uint8_t data)
m_cd->update();
}
uint8_t pce_state::pce_cd_intf_r(offs_t offset)
u8 pce_state::cd_intf_r(offs_t offset)
{
m_cd->update();
@ -237,12 +173,12 @@ uint8_t pce_state::pce_cd_intf_r(offs_t offset)
}
uint8_t pce_state::pce_cd_acard_wram_r(offs_t offset)
u8 pce_state::acard_wram_r(offs_t offset)
{
return pce_cd_intf_r(0x200 | (offset & 0x6000) >> 9);
return cd_intf_r(0x200 | (offset & 0x6000) >> 9);
}
void pce_state::pce_cd_acard_wram_w(offs_t offset, uint8_t data)
void pce_state::acard_wram_w(offs_t offset, u8 data)
{
pce_cd_intf_w(0x200 | (offset & 0x6000) >> 9, data);
cd_intf_w(0x200 | (offset & 0x6000) >> 9, data);
}