summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/cbus/pc9801_26.cpp
diff options
context:
space:
mode:
author angelosa <salese_corp_ltd@email.it>2018-05-26 16:28:01 +0200
committer angelosa <salese_corp_ltd@email.it>2018-05-26 16:59:53 +0200
commit9dcc4aaa8a4977d6b12efbb849ce73c259b8cb20 (patch)
tree465be11fefea108c203fa1324c2c234a77b473f6 /src/devices/bus/cbus/pc9801_26.cpp
parentd442de9c479e3f11d81bb21bd42bee516bb26606 (diff)
pc9801.cpp: Merge -26 / -86 / -118 joystick port implementations (nw)
Diffstat (limited to 'src/devices/bus/cbus/pc9801_26.cpp')
-rw-r--r--src/devices/bus/cbus/pc9801_26.cpp42
1 files changed, 6 insertions, 36 deletions
diff --git a/src/devices/bus/cbus/pc9801_26.cpp b/src/devices/bus/cbus/pc9801_26.cpp
index d19bf57f522..6c60bcaa969 100644
--- a/src/devices/bus/cbus/pc9801_26.cpp
+++ b/src/devices/bus/cbus/pc9801_26.cpp
@@ -7,8 +7,8 @@
Legacy sound card for PC-98xx family, composed by a single YM2203
TODO:
- - joystick code should be shared between -26, -86 and -118
-
+ - verify sound irq;
+
***************************************************************************/
#include "emu.h"
@@ -27,18 +27,6 @@
// device type definition
DEFINE_DEVICE_TYPE(PC9801_26, pc9801_26_device, "pc9801_26", "pc9801_26")
-
-
-READ8_MEMBER(pc9801_26_device::opn_porta_r)
-{
- if(m_joy_sel & 0x80)
- return ioport(m_joy_sel & 0x40 ? "OPN_PA2" : "OPN_PA1")->read();
-
- return 0xff;
-}
-
-WRITE8_MEMBER(pc9801_26_device::opn_portb_w){ m_joy_sel = data; }
-
WRITE_LINE_MEMBER(pc9801_26_device::pc9801_sound_irq)
{
/* TODO: seems to die very often */
@@ -54,10 +42,10 @@ MACHINE_CONFIG_START(pc9801_26_device::device_add_mconfig)
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider
MCFG_YM2203_IRQ_HANDLER(WRITELINE(*this, pc9801_26_device, pc9801_sound_irq))
- MCFG_AY8910_PORT_A_READ_CB(READ8(*this, pc9801_26_device, opn_porta_r))
+ MCFG_AY8910_PORT_A_READ_CB(READ8(*this, pc9801_snd_device, opn_porta_r))
//MCFG_AY8910_PORT_B_READ_CB(READ8(*this, pc9801_state, opn_portb_r))
//MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(*this, pc9801_state, opn_porta_w))
- MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(*this, pc9801_26_device, opn_portb_w))
+ MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(*this, pc9801_snd_device, opn_portb_w))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
MACHINE_CONFIG_END
@@ -88,25 +76,7 @@ const tiny_rom_entry *pc9801_26_device::device_rom_region() const
//-------------------------------------------------
static INPUT_PORTS_START( pc9801_26 )
- PORT_START("OPN_PA1")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Up")
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Down")
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Left")
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Right")
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1")
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2")
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
-
- PORT_START("OPN_PA2")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Up")
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Down")
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Left")
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Right")
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 1")
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 2")
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_INCLUDE( pc9801_joy_port )
PORT_START("OPN_DSW")
PORT_CONFNAME( 0x01, 0x01, "PC-9801-26: Port Base" )
@@ -128,7 +98,7 @@ ioport_constructor pc9801_26_device::device_input_ports() const
//-------------------------------------------------
pc9801_26_device::pc9801_26_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, PC9801_26, tag, owner, clock),
+ : pc9801_snd_device(mconfig, PC9801_26, tag, owner, clock),
m_bus(*this, DEVICE_SELF_OWNER),
m_opn(*this, "opn")
{