From 38436b340d6c76c0b86ef5b51a09e4c07067febe Mon Sep 17 00:00:00 2001 From: cracyc Date: Mon, 26 Jun 2017 14:16:54 -0500 Subject: pc9801: move cbus to bus and add WIP mpu401 [Carl] --- scripts/src/bus.lua | 20 ++ scripts/target/mame/mess.lua | 9 +- src/devices/bus/cbus/mpu_pc98.cpp | 84 +++++++++ src/devices/bus/cbus/mpu_pc98.h | 42 +++++ src/devices/bus/cbus/pc9801_118.cpp | 225 ++++++++++++++++++++++ src/devices/bus/cbus/pc9801_118.h | 71 +++++++ src/devices/bus/cbus/pc9801_26.cpp | 192 +++++++++++++++++++ src/devices/bus/cbus/pc9801_26.h | 67 +++++++ src/devices/bus/cbus/pc9801_86.cpp | 357 +++++++++++++++++++++++++++++++++++ src/devices/bus/cbus/pc9801_86.h | 80 ++++++++ src/devices/bus/cbus/pc9801_cbus.cpp | 81 ++++++++ src/devices/bus/cbus/pc9801_cbus.h | 74 ++++++++ src/mame/drivers/pc9801.cpp | 17 +- src/mame/machine/pc9801_118.cpp | 225 ---------------------- src/mame/machine/pc9801_118.h | 71 ------- src/mame/machine/pc9801_26.cpp | 192 ------------------- src/mame/machine/pc9801_26.h | 67 ------- src/mame/machine/pc9801_86.cpp | 357 ----------------------------------- src/mame/machine/pc9801_86.h | 80 -------- src/mame/machine/pc9801_cbus.cpp | 81 -------- src/mame/machine/pc9801_cbus.h | 74 -------- 21 files changed, 1304 insertions(+), 1162 deletions(-) create mode 100644 src/devices/bus/cbus/mpu_pc98.cpp create mode 100644 src/devices/bus/cbus/mpu_pc98.h create mode 100644 src/devices/bus/cbus/pc9801_118.cpp create mode 100644 src/devices/bus/cbus/pc9801_118.h create mode 100644 src/devices/bus/cbus/pc9801_26.cpp create mode 100644 src/devices/bus/cbus/pc9801_26.h create mode 100644 src/devices/bus/cbus/pc9801_86.cpp create mode 100644 src/devices/bus/cbus/pc9801_86.h create mode 100644 src/devices/bus/cbus/pc9801_cbus.cpp create mode 100644 src/devices/bus/cbus/pc9801_cbus.h delete mode 100644 src/mame/machine/pc9801_118.cpp delete mode 100644 src/mame/machine/pc9801_118.h delete mode 100644 src/mame/machine/pc9801_26.cpp delete mode 100644 src/mame/machine/pc9801_26.h delete mode 100644 src/mame/machine/pc9801_86.cpp delete mode 100644 src/mame/machine/pc9801_86.h delete mode 100644 src/mame/machine/pc9801_cbus.cpp delete mode 100644 src/mame/machine/pc9801_cbus.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 7ae85734f1e..fcc279fee3d 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -3087,3 +3087,23 @@ if (BUSES["PC1512"]~=null) then MAME_DIR .. "src/devices/bus/pc1512/mouse.h", } end + +--------------------------------------------------- +-- +--@src/devices/bus/cbus/pc9801_cbus.h,BUSES["CBUS"] = true +--------------------------------------------------- + +if (BUSES["CBUS"]~=null) then + files { + MAME_DIR .. "src/devices/bus/cbus/pc9801_26.cpp", + MAME_DIR .. "src/devices/bus/cbus/pc9801_26.h", + MAME_DIR .. "src/devices/bus/cbus/pc9801_86.cpp", + MAME_DIR .. "src/devices/bus/cbus/pc9801_86.h", + MAME_DIR .. "src/devices/bus/cbus/pc9801_118.cpp", + MAME_DIR .. "src/devices/bus/cbus/pc9801_118.h", + MAME_DIR .. "src/devices/bus/cbus/mpu_pc98.cpp", + MAME_DIR .. "src/devices/bus/cbus/mpu_pc98.h", + MAME_DIR .. "src/devices/bus/cbus/pc9801_cbus.cpp", + MAME_DIR .. "src/devices/bus/cbus/pc9801_cbus.h", + } +end diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index cdbd0eea109..55051303c8c 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -636,6 +636,7 @@ BUSES["BW2"] = true BUSES["C64"] = true BUSES["CBM2"] = true BUSES["CBMIEC"] = true +BUSES["CBUS"] = true BUSES["CENTRONICS"] = true BUSES["CGENIE_EXPANSION"] = true BUSES["CGENIE_PARALLEL"] = true @@ -2382,14 +2383,6 @@ files { MAME_DIR .. "src/mame/drivers/pc88va.cpp", MAME_DIR .. "src/mame/drivers/pc100.cpp", MAME_DIR .. "src/mame/drivers/pc9801.cpp", - MAME_DIR .. "src/mame/machine/pc9801_26.cpp", - MAME_DIR .. "src/mame/machine/pc9801_26.h", - MAME_DIR .. "src/mame/machine/pc9801_86.cpp", - MAME_DIR .. "src/mame/machine/pc9801_86.h", - MAME_DIR .. "src/mame/machine/pc9801_118.cpp", - MAME_DIR .. "src/mame/machine/pc9801_118.h", - MAME_DIR .. "src/mame/machine/pc9801_cbus.cpp", - MAME_DIR .. "src/mame/machine/pc9801_cbus.h", MAME_DIR .. "src/mame/machine/pc9801_kbd.cpp", MAME_DIR .. "src/mame/machine/pc9801_kbd.h", MAME_DIR .. "src/mame/machine/pc9801_cd.cpp", diff --git a/src/devices/bus/cbus/mpu_pc98.cpp b/src/devices/bus/cbus/mpu_pc98.cpp new file mode 100644 index 00000000000..0f26fe4ac94 --- /dev/null +++ b/src/devices/bus/cbus/mpu_pc98.cpp @@ -0,0 +1,84 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont,Kevin Horton +/*************************************************************************** + + MPU-401 MIDI device interface + +***************************************************************************/ + +#include "mpu_pc98.h" + +#include "emu.h" +#include "machine/pic8259.h" + +#define MPU_CORE_TAG "mpu401" + + +/* +DIP-SWs +1-2-3-4 + 0xc0d0 + 1 0xc4d0 + 1 0xc8d0 +... +1 0xe0d0 (default) +... +1 1 1 1 0xfcd0 + +5-6-7-8 +1 irq12 + 1 irq6 (default) + 1 irq5 + 1 irq3 +*/ + +WRITE_LINE_MEMBER( mpu_pc98_device::mpu_irq_out ) +{ +} + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(MPU_PC98, mpu_pc98_device, "mpu_pc98", "Roland MPU-401 MIDI Interface (CBUS)") + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_MEMBER( mpu_pc98_device::device_add_mconfig ) + MCFG_MPU401_ADD(MPU_CORE_TAG, WRITELINE(mpu_pc98_device, mpu_irq_out)) +MACHINE_CONFIG_END + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +mpu_pc98_device::mpu_pc98_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, MPU_PC98, tag, owner, clock) + , m_mpu401(*this, MPU_CORE_TAG) +{ +} + +DEVICE_ADDRESS_MAP_START(map, 16, mpu_pc98_device) + AM_RANGE(0, 3) AM_DEVREADWRITE8(MPU_CORE_TAG, mpu401_device, mpu_r, mpu_w, 0xff) +ADDRESS_MAP_END + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mpu_pc98_device::device_start() +{ + address_space &iospace = machine().firstcpu->space(AS_IO); + iospace.install_device(0xe0d0, 0xe0d3, *this, map, 16, 0xffffffffffffffffU >> (64 - iospace.data_width())); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mpu_pc98_device::device_reset() +{ +} diff --git a/src/devices/bus/cbus/mpu_pc98.h b/src/devices/bus/cbus/mpu_pc98.h new file mode 100644 index 00000000000..2131f0e94b5 --- /dev/null +++ b/src/devices/bus/cbus/mpu_pc98.h @@ -0,0 +1,42 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont,Kevin Horton +#ifndef MAME_BUS_CBUS_MPU401_H +#define MAME_BUS_CBUS_MPU401_H + +#pragma once + +#include "bus/cbus/pc9801_cbus.h" +#include "machine/mpu401.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> isa8_mpu401_device + +class mpu_pc98_device : public device_t +{ +public: + // construction/destruction + mpu_pc98_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + DECLARE_ADDRESS_MAP(map, 8); +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + // called back by the MPU401 core to set the IRQ line state + DECLARE_WRITE_LINE_MEMBER(mpu_irq_out); + + required_device m_mpu401; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(MPU_PC98, mpu_pc98_device) + +#endif // MAME_BUS_CBUS_MPU401_H diff --git a/src/devices/bus/cbus/pc9801_118.cpp b/src/devices/bus/cbus/pc9801_118.cpp new file mode 100644 index 00000000000..d28ab186c2c --- /dev/null +++ b/src/devices/bus/cbus/pc9801_118.cpp @@ -0,0 +1,225 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + NEC PC-9801-118 sound card + + YMF288 + some extra ports + + TODO: + - preliminary, presumably needs CS-4231 too + - joystick code should be shared between -26, -86 and -118 + +***************************************************************************/ + +#include "emu.h" +#include "bus/cbus/pc9801_118.h" + +#include "machine/pic8259.h" +#include "sound/2608intf.h" +#include "speaker.h" + + +#define MAIN_CLOCK_X2 XTAL_2_4576MHz + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +DEFINE_DEVICE_TYPE(PC9801_118, pc9801_118_device, "pc9801_118", "pc9801_118") + + +READ8_MEMBER(pc9801_118_device::opn_porta_r) +{ + if(m_joy_sel & 0x80) + return ioport(m_joy_sel & 0x40 ? "OPN3_PA2" : "OPN3_PA1")->read(); + + return 0xff; +} + +WRITE8_MEMBER(pc9801_118_device::opn_portb_w){ m_joy_sel = data; } + +WRITE_LINE_MEMBER(pc9801_118_device::pc9801_sound_irq) +{ + /* TODO: seems to die very often */ + machine().device(":pic8259_slave")->ir4_w(state); +} + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_MEMBER( pc9801_118_device::device_add_mconfig ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("opn3", YM2608, MAIN_CLOCK_X2*4) // actually YMF288, unknown clock / divider, might be X1 x 5 actually + MCFG_YM2608_IRQ_HANDLER(WRITELINE(pc9801_118_device, pc9801_sound_irq)) + MCFG_AY8910_PORT_A_READ_CB(READ8(pc9801_118_device, opn_porta_r)) + //MCFG_AY8910_PORT_B_READ_CB(READ8(pc9801_state, opn_portb_r)) + //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(pc9801_state, opn_porta_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(pc9801_118_device, opn_portb_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( pc9801_118 ) + PORT_START("OPN3_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( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("OPN3_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( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("OPN3_DSW") + PORT_CONFNAME( 0x01, 0x00, "PC-9801-118: Port Base" ) + PORT_CONFSETTING( 0x00, "0x088" ) + PORT_CONFSETTING( 0x01, "0x188" ) +INPUT_PORTS_END + +ioport_constructor pc9801_118_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( pc9801_118 ); +} + +// RAM +ROM_START( pc9801_118 ) + ROM_REGION( 0x100000, "opn3", ROMREGION_ERASE00 ) +ROM_END + +const tiny_rom_entry *pc9801_118_device::device_rom_region() const +{ + return ROM_NAME( pc9801_118 ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pc9801_118_device - constructor +//------------------------------------------------- + +pc9801_118_device::pc9801_118_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, PC9801_118, tag, owner, clock), +// m_maincpu(*this, "^maincpu"), + m_opn3(*this, "opn3") +{ +} + + +//------------------------------------------------- +// device_validity_check - perform validity checks +// on this device +//------------------------------------------------- + +void pc9801_118_device::device_validity_check(validity_checker &valid) const +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc9801_118_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler) +{ + int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; + switch(buswidth) + { + case 8: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0); + break; + case 16: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffff); + break; + case 32: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); + break; + default: + fatalerror("PC-9801-118: Bus width %d not supported\n", buswidth); + } +} + + +void pc9801_118_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pc9801_118_device::device_reset() +{ + uint16_t port_base = (ioport("OPN3_DSW")->read() & 1) << 8; + install_device(port_base + 0x0088, port_base + 0x008f, read8_delegate(FUNC(pc9801_118_device::pc9801_118_r), this), write8_delegate(FUNC(pc9801_118_device::pc9801_118_w), this) ); + install_device(0xa460, 0xa463, read8_delegate(FUNC(pc9801_118_device::pc9801_118_ext_r), this), write8_delegate(FUNC(pc9801_118_device::pc9801_118_ext_w), this) ); + m_ext_reg = 1; // TODO: enabled or disabled? +} + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + + +READ8_MEMBER(pc9801_118_device::pc9801_118_r) +{ + if(((offset & 5) == 0) || m_ext_reg) + return m_opn3->read(space, offset >> 1); + else // odd + { + //printf("PC9801-118: Read to undefined port [%02x]\n",offset+0x188); + return 0xff; + } +} + + +WRITE8_MEMBER(pc9801_118_device::pc9801_118_w) +{ + if(((offset & 5) == 0) || m_ext_reg) + m_opn3->write(space, offset >> 1,data); + //else // odd + // printf("PC9801-118: Write to undefined port [%02x] %02x\n",offset+0x188,data); +} + +READ8_MEMBER( pc9801_118_device::pc9801_118_ext_r ) +{ + if(offset == 0) + { + printf("OPN3 EXT read ID [%02x]\n",offset); + return 0x80 | (m_ext_reg & 1); + } + + printf("OPN3 EXT read unk [%02x]\n",offset); + return 0xff; +} + +WRITE8_MEMBER( pc9801_118_device::pc9801_118_ext_w ) +{ + if(offset == 0) + { + m_ext_reg = data & 1; + /* TODO: apparently writing a 1 doubles the available channels (and presumably enables CS-4231 too) */ + if(data) + printf("PC-9801-118: extended register %02x write\n",data); + return; + } + + printf("OPN3 EXT write unk %02x -> [%02x]\n",data,offset); +} diff --git a/src/devices/bus/cbus/pc9801_118.h b/src/devices/bus/cbus/pc9801_118.h new file mode 100644 index 00000000000..fd71c27c3bb --- /dev/null +++ b/src/devices/bus/cbus/pc9801_118.h @@ -0,0 +1,71 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + NEC PC-9801-118 + +***************************************************************************/ + +#ifndef MAME_BUS_CBUS_PC9801_118_H +#define MAME_BUS_CBUS_PC9801_118_H + +#pragma once + + +#include "machine/pic8259.h" +#include "sound/2608intf.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> pc9801_118_device + +class pc9801_118_device : public device_t +{ +public: + // construction/destruction + pc9801_118_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + DECLARE_READ8_MEMBER(pc9801_118_r); + DECLARE_WRITE8_MEMBER(pc9801_118_w); + DECLARE_READ8_MEMBER(pc9801_118_ext_r); + DECLARE_WRITE8_MEMBER(pc9801_118_ext_w); + +protected: + // device-level overrides + virtual void device_validity_check(validity_checker &valid) const override; + virtual void device_start() override; + virtual void device_reset() override; + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + virtual const tiny_rom_entry *device_rom_region() const override; + void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler); + +private: +// required_device m_maincpu; + required_device m_opn3; + + uint8_t m_joy_sel; + uint8_t m_ext_reg; + + DECLARE_READ8_MEMBER(opn_porta_r); + DECLARE_WRITE8_MEMBER(opn_portb_w); + DECLARE_WRITE_LINE_MEMBER(pc9801_sound_irq); +}; + + +// device type definition +DECLARE_DEVICE_TYPE(PC9801_118, pc9801_118_device) + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif // MAME_BUS_CBUS_PC9801_118_H diff --git a/src/devices/bus/cbus/pc9801_26.cpp b/src/devices/bus/cbus/pc9801_26.cpp new file mode 100644 index 00000000000..7b16eea2d65 --- /dev/null +++ b/src/devices/bus/cbus/pc9801_26.cpp @@ -0,0 +1,192 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + NEC PC-9801-26 sound card + + Legacy sound card for PC-98xx family, composed by a single YM2203 + + TODO: + - joystick code should be shared between -26, -86 and -118 + +***************************************************************************/ + +#include "emu.h" +#include "bus/cbus/pc9801_26.h" + +#include "machine/pic8259.h" +#include "sound/2203intf.h" +#include "speaker.h" + + +#define MAIN_CLOCK_X1 XTAL_1_9968MHz + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// 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 */ + machine().device(":pic8259_slave")->ir4_w(state); +} + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_MEMBER( pc9801_26_device::device_add_mconfig ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider + MCFG_YM2203_IRQ_HANDLER(WRITELINE(pc9801_26_device, pc9801_sound_irq)) + MCFG_AY8910_PORT_A_READ_CB(READ8(pc9801_26_device, opn_porta_r)) + //MCFG_AY8910_PORT_B_READ_CB(READ8(pc9801_state, opn_portb_r)) + //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(pc9801_state, opn_porta_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(pc9801_26_device, opn_portb_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +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_START("OPN_DSW") + PORT_CONFNAME( 0x01, 0x01, "PC-9801-26: Port Base" ) + PORT_CONFSETTING( 0x00, "0x088" ) + PORT_CONFSETTING( 0x01, "0x188" ) +INPUT_PORTS_END + +ioport_constructor pc9801_26_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( pc9801_26 ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pc9801_26_device - constructor +//------------------------------------------------- + +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), +// m_maincpu(*this, "^maincpu"), + m_opn(*this, "opn") +{ +} + + +//------------------------------------------------- +// device_validity_check - perform validity checks +// on this device +//------------------------------------------------- + +void pc9801_26_device::device_validity_check(validity_checker &valid) const +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc9801_26_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler) +{ + int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; + switch(buswidth) + { + case 8: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0); + break; + case 16: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffff); + break; + case 32: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); + break; + default: + fatalerror("PC-9801-26: Bus width %d not supported\n", buswidth); + } +} + + +void pc9801_26_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pc9801_26_device::device_reset() +{ + uint16_t port_base = (ioport("OPN_DSW")->read() & 1) << 8; + install_device(port_base + 0x0088, port_base + 0x008b, read8_delegate(FUNC(pc9801_26_device::pc9801_26_r), this), write8_delegate(FUNC(pc9801_26_device::pc9801_26_w), this) ); +} + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + + +READ8_MEMBER(pc9801_26_device::pc9801_26_r) +{ + if((offset & 1) == 0) + { + return offset & 4 ? 0xff : m_opn->read(space, offset >> 1); + } + else // odd + { + printf("Read to undefined port [%02x]\n",offset+0x188); + return 0xff; + } +} + + +WRITE8_MEMBER(pc9801_26_device::pc9801_26_w) +{ + if((offset & 5) == 0) + m_opn->write(space, offset >> 1, data); + else // odd + printf("PC9801-26: Write to undefined port [%02x] %02x\n",offset+0x188,data); +} diff --git a/src/devices/bus/cbus/pc9801_26.h b/src/devices/bus/cbus/pc9801_26.h new file mode 100644 index 00000000000..a006daf9bac --- /dev/null +++ b/src/devices/bus/cbus/pc9801_26.h @@ -0,0 +1,67 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + +Template for skeleton device + +***************************************************************************/ + +#ifndef MAME_BUS_CBUS_PC9801_26_H +#define MAME_BUS_CBUS_PC9801_26_H + +#pragma once + + +#include "machine/pic8259.h" +#include "sound/2203intf.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> pc9801_26_device + +class pc9801_26_device : public device_t +{ +public: + // construction/destruction + pc9801_26_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + DECLARE_READ8_MEMBER(pc9801_26_r); + DECLARE_WRITE8_MEMBER(pc9801_26_w); + +protected: + // device-level overrides + virtual void device_validity_check(validity_checker &valid) const override; + virtual void device_start() override; + virtual void device_reset() override; + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler); + +private: +// required_device m_maincpu; + required_device m_opn; + + uint8_t m_joy_sel; + + DECLARE_WRITE_LINE_MEMBER(pc9801_sound_irq); + DECLARE_READ8_MEMBER(opn_porta_r); + DECLARE_WRITE8_MEMBER(opn_portb_w); +}; + + +// device type definition +DECLARE_DEVICE_TYPE(PC9801_26, pc9801_26_device) + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif // MAME_BUS_CBUS_PC9801_26_H diff --git a/src/devices/bus/cbus/pc9801_86.cpp b/src/devices/bus/cbus/pc9801_86.cpp new file mode 100644 index 00000000000..547ddb634a6 --- /dev/null +++ b/src/devices/bus/cbus/pc9801_86.cpp @@ -0,0 +1,357 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + NEC PC-9801-86 sound card + + Similar to PC-9801-26, this one has YM2608 instead of YM2203 and an + additional DAC port + + TODO: + - joystick code should be shared between -26, -86 and -118 + - Test all pcm modes + - Make volume work + - Recording + +***************************************************************************/ + +#include "emu.h" +#include "bus/cbus/pc9801_86.h" +#include "sound/volt_reg.h" +#include "speaker.h" + +#define MAIN_CLOCK_X1 XTAL_1_9968MHz +#define QUEUE_SIZE 32768 + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +DEFINE_DEVICE_TYPE(PC9801_86, pc9801_86_device, "pc9801_86", "pc9801_86") + + +READ8_MEMBER(pc9801_86_device::opn_porta_r) +{ + if(m_joy_sel & 0x80) + return ioport(m_joy_sel & 0x40 ? "OPNA_PA2" : "OPNA_PA1")->read(); + + return 0xff; +} + +WRITE8_MEMBER(pc9801_86_device::opn_portb_w){ m_joy_sel = data; } + +WRITE_LINE_MEMBER(pc9801_86_device::sound_irq) +{ + m_fmirq = state ? true : false; + /* TODO: seems to die very often */ + machine().device(":pic8259_slave")->ir4_w(state || (m_pcmirq ? ASSERT_LINE : CLEAR_LINE)); +} + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_MEMBER( pc9801_86_device::device_add_mconfig ) + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("opna", YM2608, MAIN_CLOCK_X1*4) // unknown clock / divider + MCFG_YM2608_IRQ_HANDLER(WRITELINE(pc9801_86_device, sound_irq)) + MCFG_AY8910_PORT_A_READ_CB(READ8(pc9801_86_device, opn_porta_r)) + //MCFG_AY8910_PORT_B_READ_CB(READ8(pc9801_state, opn_portb_r)) + //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(pc9801_state, opn_porta_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(pc9801_86_device, opn_portb_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.00) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.00) + MCFG_SOUND_ADD("ldac", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) // unknown DAC + MCFG_SOUND_ADD("rdac", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) // unknown DAC + MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) + MCFG_SOUND_ROUTE_EX(0, "ldac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE_EX(0, "ldac", -1.0, DAC_VREF_NEG_INPUT) + MCFG_SOUND_ROUTE_EX(0, "rdac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE_EX(0, "rdac", -1.0, DAC_VREF_NEG_INPUT) +MACHINE_CONFIG_END + +// RAM +ROM_START( pc9801_86 ) + ROM_REGION( 0x100000, "opna", ROMREGION_ERASE00 ) +ROM_END + +const tiny_rom_entry *pc9801_86_device::device_rom_region() const +{ + return ROM_NAME( pc9801_86 ); +} + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( pc9801_86 ) + PORT_START("OPNA_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( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("OPNA_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( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("OPNA_DSW") + PORT_CONFNAME( 0x01, 0x01, "PC-9801-86: Port Base" ) + PORT_CONFSETTING( 0x00, "0x088" ) + PORT_CONFSETTING( 0x01, "0x188" ) +INPUT_PORTS_END + +ioport_constructor pc9801_86_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( pc9801_86 ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pc9801_86_device - constructor +//------------------------------------------------- + +pc9801_86_device::pc9801_86_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, PC9801_86, tag, owner, clock), + m_opna(*this, "opna"), + m_ldac(*this, "ldac"), + m_rdac(*this, "rdac"), + m_queue(QUEUE_SIZE) +{ +} + + +//------------------------------------------------- +// device_validity_check - perform validity checks +// on this device +//------------------------------------------------- + +void pc9801_86_device::device_validity_check(validity_checker &valid) const +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc9801_86_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler) +{ + int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; + switch(buswidth) + { + case 8: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0); + break; + case 16: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffff); + break; + case 32: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); + break; + default: + fatalerror("PC-9801-86: Bus width %d not supported\n", buswidth); + } +} + + +void pc9801_86_device::device_start() +{ + m_dac_timer = timer_alloc(); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pc9801_86_device::device_reset() +{ + uint16_t port_base = (ioport("OPNA_DSW")->read() & 1) << 8; + install_device(port_base + 0x0088, port_base + 0x008f, read8_delegate(FUNC(pc9801_86_device::opn_r), this), write8_delegate(FUNC(pc9801_86_device::opn_w), this) ); + install_device(0xa460, 0xa463, read8_delegate(FUNC(pc9801_86_device::id_r), this), write8_delegate(FUNC(pc9801_86_device::mask_w), this)); + install_device(0xa464, 0xa46f, read8_delegate(FUNC(pc9801_86_device::pcm_r), this), write8_delegate(FUNC(pc9801_86_device::pcm_w), this)); + m_mask = 0; + m_head = m_tail = m_count = 0; + m_fmirq = m_pcmirq = false; + m_irq_rate = 0; + m_pcm_ctrl = m_pcm_mode = 0; + memset(&m_queue[0], 0, QUEUE_SIZE); +} + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + + +READ8_MEMBER(pc9801_86_device::opn_r) +{ + if((offset & 1) == 0) + return m_opna->read(space, offset >> 1); + else // odd + { + logerror("PC9801-86: Read to undefined port [%02x]\n",offset+0x188); + return 0xff; + } +} + +WRITE8_MEMBER(pc9801_86_device::opn_w) +{ + if((offset & 1) == 0) + m_opna->write(space, offset >> 1,data); + else // odd + logerror("PC9801-86: Write to undefined port [%02x] %02x\n",offset+0x188,data); +} + +READ8_MEMBER(pc9801_86_device::id_r) +{ + return 0x40 | m_mask; +} + +WRITE8_MEMBER(pc9801_86_device::mask_w) +{ + m_mask = data & 1; +} + +READ8_MEMBER(pc9801_86_device::pcm_r) +{ + if((offset & 1) == 0) + { + switch(offset >> 1) + { + case 1: + return ((queue_count() == QUEUE_SIZE) ? 0x80 : 0) | + (!queue_count() ? 0x40 : 0); + case 2: + return m_pcm_ctrl | (m_pcmirq ? 0x10 : 0); + case 3: + return m_pcm_mode; + case 4: + return 0; + case 5: + return m_pcm_mute; + } + } + else // odd + logerror("PC9801-86: Read to undefined port [%02x]\n",offset+0xa464); + return 0xff; +} + +WRITE8_MEMBER(pc9801_86_device::pcm_w) +{ + const int rates[] = {44100, 33075, 22050, 16538, 11025, 8268, 5513, 4134}; + if((offset & 1) == 0) + { + switch(offset >> 1) + { + case 1: + m_vol[data >> 5] = data & 0x0f; + break; + case 2: + m_pcm_ctrl = data & ~0x10; + if(data & 0x80) + m_dac_timer->adjust(attotime::from_hz(rates[data & 7]), 0, attotime::from_hz(rates[data & 7])); + else + m_dac_timer->adjust(attotime::never); + if(data & 8) + m_head = m_tail = m_count = 0; + if(!(data & 0x10)) + { + m_pcmirq = false; + machine().device(":pic8259_slave")->ir4_w(m_fmirq ? ASSERT_LINE : CLEAR_LINE); + } + break; + case 3: + if(m_pcm_ctrl & 0x20) + m_irq_rate = (data + 1) * 128; + else + m_pcm_mode = data; + break; + case 4: + if(queue_count() < QUEUE_SIZE) + { + m_queue[m_head++] = data; + m_head %= QUEUE_SIZE; + m_count++; + } + break; + case 5: + m_pcm_mute = data; + break; + } + } + else // odd + logerror("PC9801-86: Write to undefined port [%02x] %02x\n",offset+0xa464,data); +} + +int pc9801_86_device::queue_count() +{ + return m_count; +} + +uint8_t pc9801_86_device::queue_pop() +{ + if(!queue_count()) + return 0; + uint8_t ret = m_queue[m_tail++]; + m_tail %= QUEUE_SIZE; + m_count--; + return ret; +} + +void pc9801_86_device::device_timer(emu_timer& timer, device_timer_id id, int param, void* ptr) +{ + int16_t lsample, rsample; + + if((m_pcm_ctrl & 0x40) || !(m_pcm_ctrl & 0x80) || !queue_count()) + return; + + switch(m_pcm_mode & 0x70) + { + case 0x70: // 8bit stereo + m_ldac->write(queue_pop() << 8); + m_rdac->write(queue_pop() << 8); + break; + case 0x60: // 8bit left only + m_ldac->write(queue_pop() << 8); + break; + case 0x50: // 8bit right only + m_rdac->write(queue_pop() << 8); + break; + case 0x30: // 16bit stereo + lsample = queue_pop(); + lsample |= queue_pop() << 8; + rsample = queue_pop(); + rsample |= queue_pop() << 8; + m_ldac->write(lsample); + m_rdac->write(rsample); + break; + case 0x20: // 16bit left only + lsample = queue_pop(); + lsample |= queue_pop() << 8; + m_ldac->write(lsample); + break; + case 0x10: // 16bit right only + rsample = queue_pop(); + rsample |= queue_pop() << 8; + m_rdac->write(rsample); + break; + } + if((queue_count() < m_irq_rate) && (m_pcm_ctrl & 0x20)) + { + m_pcmirq = true; + machine().device(":pic8259_slave")->ir4_w(ASSERT_LINE); + } +} diff --git a/src/devices/bus/cbus/pc9801_86.h b/src/devices/bus/cbus/pc9801_86.h new file mode 100644 index 00000000000..29d2e79c071 --- /dev/null +++ b/src/devices/bus/cbus/pc9801_86.h @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + NEC PC-9801-86 + +***************************************************************************/ + +#ifndef MAME_BUS_CBUS_PC9801_86_H +#define MAME_BUS_CBUS_PC9801_86_H + +#pragma once + + +#include "machine/pic8259.h" +#include "sound/2608intf.h" +#include "sound/dac.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> pc9801_86_device + +class pc9801_86_device : public device_t +{ +public: + // construction/destruction + pc9801_86_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + DECLARE_READ8_MEMBER(opn_r); + DECLARE_WRITE8_MEMBER(opn_w); + DECLARE_READ8_MEMBER(id_r); + DECLARE_WRITE8_MEMBER(mask_w); + DECLARE_READ8_MEMBER(pcm_r); + DECLARE_WRITE8_MEMBER(pcm_w); + +protected: + // device-level overrides + virtual void device_validity_check(validity_checker &valid) const override; + virtual void device_start() override; + virtual void device_reset() override; + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + virtual const tiny_rom_entry *device_rom_region() const override; + void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + +private: + int queue_count(); + uint8_t queue_pop(); + + uint8_t m_joy_sel, m_mask, m_pcm_mode, m_vol[7], m_pcm_ctrl, m_pcm_mute; + uint16_t m_head, m_tail, m_count, m_irq_rate; + bool m_pcmirq, m_fmirq; + required_device m_opna; + required_device m_ldac; + required_device m_rdac; + std::vector m_queue; + emu_timer *m_dac_timer; + + DECLARE_WRITE_LINE_MEMBER(sound_irq); + DECLARE_READ8_MEMBER(opn_porta_r); + DECLARE_WRITE8_MEMBER(opn_portb_w); +}; + + +// device type definition +DECLARE_DEVICE_TYPE(PC9801_86, pc9801_86_device) + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif // MAME_BUS_CBUS_PC9801_86_H diff --git a/src/devices/bus/cbus/pc9801_cbus.cpp b/src/devices/bus/cbus/pc9801_cbus.cpp new file mode 100644 index 00000000000..06af21561d3 --- /dev/null +++ b/src/devices/bus/cbus/pc9801_cbus.cpp @@ -0,0 +1,81 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/********************************************************************** + + CCBUS Slot interface for PC-98xx family + +**********************************************************************/ + +#include "emu.h" +#include "pc9801_cbus.h" + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(PC9801CBUS_SLOT, pc9801_slot_device, "pc9801_slot", "PC-9801 sound cbus slot") + + + +//************************************************************************** +// DEVICE PC9801 CARD INTERFACE +//************************************************************************** + +#if 0 +//------------------------------------------------- +// device_pc9801cbus_card_interface - constructor +//------------------------------------------------- + +device_pc9801cbus_card_interface::device_pc9801cbus_card_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device) +{ +} + + +//------------------------------------------------- +// ~device_pc9801cbus_card_interface - destructor +//------------------------------------------------- + +device_pc9801cbus_card_interface::~device_pc9801cbus_card_interface() +{ +} +#endif + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pc9801_slot_device - constructor +//------------------------------------------------- + +pc9801_slot_device::pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, PC9801CBUS_SLOT, tag, owner, clock), + device_slot_interface(mconfig, *this) +{ +} + + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pc9801_slot_device::device_config_complete() +{ + // ... +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc9801_slot_device::device_start() +{ +// m_card = dynamic_cast(get_card_device()); +} diff --git a/src/devices/bus/cbus/pc9801_cbus.h b/src/devices/bus/cbus/pc9801_cbus.h new file mode 100644 index 00000000000..1b1084d8961 --- /dev/null +++ b/src/devices/bus/cbus/pc9801_cbus.h @@ -0,0 +1,74 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/********************************************************************** + + +**********************************************************************/ +#ifndef MAME_MACHINE_PC9801_CBUS_H +#define MAME_MACHINE_PC9801_CBUS_H + +#pragma once + + + + +//************************************************************************** +// CONSTANTS +//************************************************************************** + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + + +#define MCFG_PC9801CBUS_SLOT_ADD(_tag, _slot_intf, _def_slot) \ + MCFG_DEVICE_ADD(_tag, PC9801CBUS_SLOT, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + + + + +//class pc9801_slot_device; + +#if 0 +class device_pc9801_slot_card_interface : public device_slot_card_interface +{ + friend class pc9801_slot_device; + +public: + // construction/destruction + device_pc9801_slot_card_interface(const machine_config &mconfig, device_t &device); + virtual ~device_pc9801_card_interface(); +}; +#endif + +// ======================> pc9801_slot_device + +class pc9801_slot_device : public device_t, public device_slot_interface +{ +public: + // construction/destruction + pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_config_complete() override; +//private: +// device_pc9801_slot_card_interface *m_card; + +}; + + +// device type definition +DECLARE_DEVICE_TYPE(PC9801CBUS_SLOT, pc9801_slot_device) + +#endif // MAME_MACHINE_PC9801_CBUS_H diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index 200cd82133a..bba8da85dae 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -410,10 +410,11 @@ Keyboard TX commands: #include "video/upd7220.h" -#include "machine/pc9801_26.h" -#include "machine/pc9801_86.h" -#include "machine/pc9801_118.h" -#include "machine/pc9801_cbus.h" +#include "bus/cbus/pc9801_26.h" +#include "bus/cbus/pc9801_86.h" +#include "bus/cbus/pc9801_118.h" +#include "bus/cbus/mpu_pc98.h" +#include "bus/cbus/pc9801_cbus.h" #include "machine/pc9801_kbd.h" #include "machine/pc9801_cd.h" @@ -693,7 +694,7 @@ public: private: uint8_t m_sdip_read(uint16_t port, uint8_t sdip_offset); void m_sdip_write(uint16_t port, uint8_t sdip_offset,uint8_t data); - uint16_t egc_do_partial_op(int plane, uint16_t src, uint16_t pat, uint16_t dst); + uint16_t egc_do_partial_op(int plane, uint16_t src, uint16_t pat, uint16_t dst) const; uint16_t egc_shift(int plane, uint16_t val); public: DECLARE_MACHINE_START(pc9801_common); @@ -1326,7 +1327,7 @@ uint16_t pc9801_state::egc_shift(int plane, uint16_t val) return out; } -uint16_t pc9801_state::egc_do_partial_op(int plane, uint16_t src, uint16_t pat, uint16_t dst) +uint16_t pc9801_state::egc_do_partial_op(int plane, uint16_t src, uint16_t pat, uint16_t dst) const { uint16_t out = 0; @@ -1453,7 +1454,8 @@ uint16_t pc9801_state::egc_blit_r(uint32_t offset, uint16_t mem_mask) if(m_egc.first && !m_egc.init) { m_egc.leftover[0] = m_egc.leftover[1] = m_egc.leftover[2] = m_egc.leftover[3] = 0; - m_egc.init = true; + if(((m_egc.regs[6] >> 4) & 0xf) >= (m_egc.regs[6] & 0xf)) // check if we have enough bits + m_egc.init = true; } for(int i = 0; i < 4; i++) m_egc.src[i] = egc_shift(i, m_video_ram_2[plane_off + (((i + 1) & 3) * 0x4000)]); @@ -3002,6 +3004,7 @@ static SLOT_INTERFACE_START( pc9801_cbus ) // Speak Board // Spark Board // AMD-98 (AmuseMent boarD) + SLOT_INTERFACE( "mpu_pc98", MPU_PC98 ) SLOT_INTERFACE_END // Jast Sound, could be put independently diff --git a/src/mame/machine/pc9801_118.cpp b/src/mame/machine/pc9801_118.cpp deleted file mode 100644 index 1681dfe5df4..00000000000 --- a/src/mame/machine/pc9801_118.cpp +++ /dev/null @@ -1,225 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - NEC PC-9801-118 sound card - - YMF288 + some extra ports - - TODO: - - preliminary, presumably needs CS-4231 too - - joystick code should be shared between -26, -86 and -118 - -***************************************************************************/ - -#include "emu.h" -#include "machine/pc9801_118.h" - -#include "machine/pic8259.h" -#include "sound/2608intf.h" -#include "speaker.h" - - -#define MAIN_CLOCK_X2 XTAL_2_4576MHz - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -// device type definition -DEFINE_DEVICE_TYPE(PC9801_118, pc9801_118_device, "pc9801_118", "pc9801_118") - - -READ8_MEMBER(pc9801_118_device::opn_porta_r) -{ - if(m_joy_sel & 0x80) - return ioport(m_joy_sel & 0x40 ? "OPN3_PA2" : "OPN3_PA1")->read(); - - return 0xff; -} - -WRITE8_MEMBER(pc9801_118_device::opn_portb_w){ m_joy_sel = data; } - -WRITE_LINE_MEMBER(pc9801_118_device::pc9801_sound_irq) -{ - /* TODO: seems to die very often */ - machine().device(":pic8259_slave")->ir4_w(state); -} - -//------------------------------------------------- -// device_add_mconfig - add device configuration -//------------------------------------------------- - -MACHINE_CONFIG_MEMBER( pc9801_118_device::device_add_mconfig ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("opn3", YM2608, MAIN_CLOCK_X2*4) // actually YMF288, unknown clock / divider, might be X1 x 5 actually - MCFG_YM2608_IRQ_HANDLER(WRITELINE(pc9801_118_device, pc9801_sound_irq)) - MCFG_AY8910_PORT_A_READ_CB(READ8(pc9801_118_device, opn_porta_r)) - //MCFG_AY8910_PORT_B_READ_CB(READ8(pc9801_state, opn_portb_r)) - //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(pc9801_state, opn_porta_w)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(pc9801_118_device, opn_portb_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -static INPUT_PORTS_START( pc9801_118 ) - PORT_START("OPN3_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( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("OPN3_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( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("OPN3_DSW") - PORT_CONFNAME( 0x01, 0x00, "PC-9801-118: Port Base" ) - PORT_CONFSETTING( 0x00, "0x088" ) - PORT_CONFSETTING( 0x01, "0x188" ) -INPUT_PORTS_END - -ioport_constructor pc9801_118_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( pc9801_118 ); -} - -// RAM -ROM_START( pc9801_118 ) - ROM_REGION( 0x100000, "opn3", ROMREGION_ERASE00 ) -ROM_END - -const tiny_rom_entry *pc9801_118_device::device_rom_region() const -{ - return ROM_NAME( pc9801_118 ); -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// pc9801_118_device - constructor -//------------------------------------------------- - -pc9801_118_device::pc9801_118_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, PC9801_118, tag, owner, clock), -// m_maincpu(*this, "^maincpu"), - m_opn3(*this, "opn3") -{ -} - - -//------------------------------------------------- -// device_validity_check - perform validity checks -// on this device -//------------------------------------------------- - -void pc9801_118_device::device_validity_check(validity_checker &valid) const -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void pc9801_118_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler) -{ - int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; - switch(buswidth) - { - case 8: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0); - break; - case 16: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffff); - break; - case 32: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); - break; - default: - fatalerror("PC-9801-118: Bus width %d not supported\n", buswidth); - } -} - - -void pc9801_118_device::device_start() -{ -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void pc9801_118_device::device_reset() -{ - uint16_t port_base = (ioport("OPN3_DSW")->read() & 1) << 8; - install_device(port_base + 0x0088, port_base + 0x008f, read8_delegate(FUNC(pc9801_118_device::pc9801_118_r), this), write8_delegate(FUNC(pc9801_118_device::pc9801_118_w), this) ); - install_device(0xa460, 0xa463, read8_delegate(FUNC(pc9801_118_device::pc9801_118_ext_r), this), write8_delegate(FUNC(pc9801_118_device::pc9801_118_ext_w), this) ); - m_ext_reg = 1; // TODO: enabled or disabled? -} - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - - -READ8_MEMBER(pc9801_118_device::pc9801_118_r) -{ - if(((offset & 5) == 0) || m_ext_reg) - return m_opn3->read(space, offset >> 1); - else // odd - { - //printf("PC9801-118: Read to undefined port [%02x]\n",offset+0x188); - return 0xff; - } -} - - -WRITE8_MEMBER(pc9801_118_device::pc9801_118_w) -{ - if(((offset & 5) == 0) || m_ext_reg) - m_opn3->write(space, offset >> 1,data); - //else // odd - // printf("PC9801-118: Write to undefined port [%02x] %02x\n",offset+0x188,data); -} - -READ8_MEMBER( pc9801_118_device::pc9801_118_ext_r ) -{ - if(offset == 0) - { - printf("OPN3 EXT read ID [%02x]\n",offset); - return 0x80 | (m_ext_reg & 1); - } - - printf("OPN3 EXT read unk [%02x]\n",offset); - return 0xff; -} - -WRITE8_MEMBER( pc9801_118_device::pc9801_118_ext_w ) -{ - if(offset == 0) - { - m_ext_reg = data & 1; - /* TODO: apparently writing a 1 doubles the available channels (and presumably enables CS-4231 too) */ - if(data) - printf("PC-9801-118: extended register %02x write\n",data); - return; - } - - printf("OPN3 EXT write unk %02x -> [%02x]\n",data,offset); -} diff --git a/src/mame/machine/pc9801_118.h b/src/mame/machine/pc9801_118.h deleted file mode 100644 index f9f66be540b..00000000000 --- a/src/mame/machine/pc9801_118.h +++ /dev/null @@ -1,71 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - NEC PC-9801-118 - -***************************************************************************/ - -#ifndef MAME_MACHINE_PC9801_118_H -#define MAME_MACHINE_PC9801_118_H - -#pragma once - - -#include "machine/pic8259.h" -#include "sound/2608intf.h" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> pc9801_118_device - -class pc9801_118_device : public device_t -{ -public: - // construction/destruction - pc9801_118_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - DECLARE_READ8_MEMBER(pc9801_118_r); - DECLARE_WRITE8_MEMBER(pc9801_118_w); - DECLARE_READ8_MEMBER(pc9801_118_ext_r); - DECLARE_WRITE8_MEMBER(pc9801_118_ext_w); - -protected: - // device-level overrides - virtual void device_validity_check(validity_checker &valid) const override; - virtual void device_start() override; - virtual void device_reset() override; - // optional information overrides - virtual void device_add_mconfig(machine_config &config) override; - virtual ioport_constructor device_input_ports() const override; - virtual const tiny_rom_entry *device_rom_region() const override; - void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler); - -private: -// required_device m_maincpu; - required_device m_opn3; - - uint8_t m_joy_sel; - uint8_t m_ext_reg; - - DECLARE_READ8_MEMBER(opn_porta_r); - DECLARE_WRITE8_MEMBER(opn_portb_w); - DECLARE_WRITE_LINE_MEMBER(pc9801_sound_irq); -}; - - -// device type definition -DECLARE_DEVICE_TYPE(PC9801_118, pc9801_118_device) - - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - - - -#endif // MAME_MACHINE_PC9801_118_H diff --git a/src/mame/machine/pc9801_26.cpp b/src/mame/machine/pc9801_26.cpp deleted file mode 100644 index ab509584137..00000000000 --- a/src/mame/machine/pc9801_26.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - NEC PC-9801-26 sound card - - Legacy sound card for PC-98xx family, composed by a single YM2203 - - TODO: - - joystick code should be shared between -26, -86 and -118 - -***************************************************************************/ - -#include "emu.h" -#include "machine/pc9801_26.h" - -#include "machine/pic8259.h" -#include "sound/2203intf.h" -#include "speaker.h" - - -#define MAIN_CLOCK_X1 XTAL_1_9968MHz - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -// 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 */ - machine().device(":pic8259_slave")->ir4_w(state); -} - - -//------------------------------------------------- -// device_add_mconfig - add device configuration -//------------------------------------------------- - -MACHINE_CONFIG_MEMBER( pc9801_26_device::device_add_mconfig ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider - MCFG_YM2203_IRQ_HANDLER(WRITELINE(pc9801_26_device, pc9801_sound_irq)) - MCFG_AY8910_PORT_A_READ_CB(READ8(pc9801_26_device, opn_porta_r)) - //MCFG_AY8910_PORT_B_READ_CB(READ8(pc9801_state, opn_portb_r)) - //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(pc9801_state, opn_porta_w)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(pc9801_26_device, opn_portb_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -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_START("OPN_DSW") - PORT_CONFNAME( 0x01, 0x01, "PC-9801-26: Port Base" ) - PORT_CONFSETTING( 0x00, "0x088" ) - PORT_CONFSETTING( 0x01, "0x188" ) -INPUT_PORTS_END - -ioport_constructor pc9801_26_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( pc9801_26 ); -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// pc9801_26_device - constructor -//------------------------------------------------- - -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), -// m_maincpu(*this, "^maincpu"), - m_opn(*this, "opn") -{ -} - - -//------------------------------------------------- -// device_validity_check - perform validity checks -// on this device -//------------------------------------------------- - -void pc9801_26_device::device_validity_check(validity_checker &valid) const -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void pc9801_26_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler) -{ - int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; - switch(buswidth) - { - case 8: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0); - break; - case 16: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffff); - break; - case 32: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); - break; - default: - fatalerror("PC-9801-26: Bus width %d not supported\n", buswidth); - } -} - - -void pc9801_26_device::device_start() -{ -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void pc9801_26_device::device_reset() -{ - uint16_t port_base = (ioport("OPN_DSW")->read() & 1) << 8; - install_device(port_base + 0x0088, port_base + 0x008b, read8_delegate(FUNC(pc9801_26_device::pc9801_26_r), this), write8_delegate(FUNC(pc9801_26_device::pc9801_26_w), this) ); -} - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - - -READ8_MEMBER(pc9801_26_device::pc9801_26_r) -{ - if((offset & 1) == 0) - { - return offset & 4 ? 0xff : m_opn->read(space, offset >> 1); - } - else // odd - { - printf("Read to undefined port [%02x]\n",offset+0x188); - return 0xff; - } -} - - -WRITE8_MEMBER(pc9801_26_device::pc9801_26_w) -{ - if((offset & 5) == 0) - m_opn->write(space, offset >> 1, data); - else // odd - printf("PC9801-26: Write to undefined port [%02x] %02x\n",offset+0x188,data); -} diff --git a/src/mame/machine/pc9801_26.h b/src/mame/machine/pc9801_26.h deleted file mode 100644 index 67dbbf18c1a..00000000000 --- a/src/mame/machine/pc9801_26.h +++ /dev/null @@ -1,67 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - -Template for skeleton device - -***************************************************************************/ - -#ifndef MAME_MACHINE_PC9801_26_H -#define MAME_MACHINE_PC9801_26_H - -#pragma once - - -#include "machine/pic8259.h" -#include "sound/2203intf.h" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> pc9801_26_device - -class pc9801_26_device : public device_t -{ -public: - // construction/destruction - pc9801_26_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - DECLARE_READ8_MEMBER(pc9801_26_r); - DECLARE_WRITE8_MEMBER(pc9801_26_w); - -protected: - // device-level overrides - virtual void device_validity_check(validity_checker &valid) const override; - virtual void device_start() override; - virtual void device_reset() override; - // optional information overrides - virtual void device_add_mconfig(machine_config &config) override; - virtual ioport_constructor device_input_ports() const override; - void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler); - -private: -// required_device m_maincpu; - required_device m_opn; - - uint8_t m_joy_sel; - - DECLARE_WRITE_LINE_MEMBER(pc9801_sound_irq); - DECLARE_READ8_MEMBER(opn_porta_r); - DECLARE_WRITE8_MEMBER(opn_portb_w); -}; - - -// device type definition -DECLARE_DEVICE_TYPE(PC9801_26, pc9801_26_device) - - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - - - -#endif // MAME_MACHINE_PC9801_26_H diff --git a/src/mame/machine/pc9801_86.cpp b/src/mame/machine/pc9801_86.cpp deleted file mode 100644 index 29f94f2fa4c..00000000000 --- a/src/mame/machine/pc9801_86.cpp +++ /dev/null @@ -1,357 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - NEC PC-9801-86 sound card - - Similar to PC-9801-26, this one has YM2608 instead of YM2203 and an - additional DAC port - - TODO: - - joystick code should be shared between -26, -86 and -118 - - Test all pcm modes - - Make volume work - - Recording - -***************************************************************************/ - -#include "emu.h" -#include "machine/pc9801_86.h" -#include "sound/volt_reg.h" -#include "speaker.h" - -#define MAIN_CLOCK_X1 XTAL_1_9968MHz -#define QUEUE_SIZE 32768 - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -// device type definition -DEFINE_DEVICE_TYPE(PC9801_86, pc9801_86_device, "pc9801_86", "pc9801_86") - - -READ8_MEMBER(pc9801_86_device::opn_porta_r) -{ - if(m_joy_sel & 0x80) - return ioport(m_joy_sel & 0x40 ? "OPNA_PA2" : "OPNA_PA1")->read(); - - return 0xff; -} - -WRITE8_MEMBER(pc9801_86_device::opn_portb_w){ m_joy_sel = data; } - -WRITE_LINE_MEMBER(pc9801_86_device::sound_irq) -{ - m_fmirq = state ? true : false; - /* TODO: seems to die very often */ - machine().device(":pic8259_slave")->ir4_w(state || (m_pcmirq ? ASSERT_LINE : CLEAR_LINE)); -} - - -//------------------------------------------------- -// device_add_mconfig - add device configuration -//------------------------------------------------- - -MACHINE_CONFIG_MEMBER( pc9801_86_device::device_add_mconfig ) - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("opna", YM2608, MAIN_CLOCK_X1*4) // unknown clock / divider - MCFG_YM2608_IRQ_HANDLER(WRITELINE(pc9801_86_device, sound_irq)) - MCFG_AY8910_PORT_A_READ_CB(READ8(pc9801_86_device, opn_porta_r)) - //MCFG_AY8910_PORT_B_READ_CB(READ8(pc9801_state, opn_portb_r)) - //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(pc9801_state, opn_porta_w)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(pc9801_86_device, opn_portb_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.00) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.00) - MCFG_SOUND_ADD("ldac", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) // unknown DAC - MCFG_SOUND_ADD("rdac", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) // unknown DAC - MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) - MCFG_SOUND_ROUTE_EX(0, "ldac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE_EX(0, "ldac", -1.0, DAC_VREF_NEG_INPUT) - MCFG_SOUND_ROUTE_EX(0, "rdac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE_EX(0, "rdac", -1.0, DAC_VREF_NEG_INPUT) -MACHINE_CONFIG_END - -// RAM -ROM_START( pc9801_86 ) - ROM_REGION( 0x100000, "opna", ROMREGION_ERASE00 ) -ROM_END - -const tiny_rom_entry *pc9801_86_device::device_rom_region() const -{ - return ROM_NAME( pc9801_86 ); -} - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -static INPUT_PORTS_START( pc9801_86 ) - PORT_START("OPNA_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( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("OPNA_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( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("OPNA_DSW") - PORT_CONFNAME( 0x01, 0x01, "PC-9801-86: Port Base" ) - PORT_CONFSETTING( 0x00, "0x088" ) - PORT_CONFSETTING( 0x01, "0x188" ) -INPUT_PORTS_END - -ioport_constructor pc9801_86_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( pc9801_86 ); -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// pc9801_86_device - constructor -//------------------------------------------------- - -pc9801_86_device::pc9801_86_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, PC9801_86, tag, owner, clock), - m_opna(*this, "opna"), - m_ldac(*this, "ldac"), - m_rdac(*this, "rdac"), - m_queue(QUEUE_SIZE) -{ -} - - -//------------------------------------------------- -// device_validity_check - perform validity checks -// on this device -//------------------------------------------------- - -void pc9801_86_device::device_validity_check(validity_checker &valid) const -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void pc9801_86_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler) -{ - int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; - switch(buswidth) - { - case 8: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0); - break; - case 16: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffff); - break; - case 32: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); - break; - default: - fatalerror("PC-9801-86: Bus width %d not supported\n", buswidth); - } -} - - -void pc9801_86_device::device_start() -{ - m_dac_timer = timer_alloc(); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void pc9801_86_device::device_reset() -{ - uint16_t port_base = (ioport("OPNA_DSW")->read() & 1) << 8; - install_device(port_base + 0x0088, port_base + 0x008f, read8_delegate(FUNC(pc9801_86_device::opn_r), this), write8_delegate(FUNC(pc9801_86_device::opn_w), this) ); - install_device(0xa460, 0xa463, read8_delegate(FUNC(pc9801_86_device::id_r), this), write8_delegate(FUNC(pc9801_86_device::mask_w), this)); - install_device(0xa464, 0xa46f, read8_delegate(FUNC(pc9801_86_device::pcm_r), this), write8_delegate(FUNC(pc9801_86_device::pcm_w), this)); - m_mask = 0; - m_head = m_tail = m_count = 0; - m_fmirq = m_pcmirq = false; - m_irq_rate = 0; - m_pcm_ctrl = m_pcm_mode = 0; - memset(&m_queue[0], 0, QUEUE_SIZE); -} - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - - -READ8_MEMBER(pc9801_86_device::opn_r) -{ - if((offset & 1) == 0) - return m_opna->read(space, offset >> 1); - else // odd - { - logerror("PC9801-86: Read to undefined port [%02x]\n",offset+0x188); - return 0xff; - } -} - -WRITE8_MEMBER(pc9801_86_device::opn_w) -{ - if((offset & 1) == 0) - m_opna->write(space, offset >> 1,data); - else // odd - logerror("PC9801-86: Write to undefined port [%02x] %02x\n",offset+0x188,data); -} - -READ8_MEMBER(pc9801_86_device::id_r) -{ - return 0x40 | m_mask; -} - -WRITE8_MEMBER(pc9801_86_device::mask_w) -{ - m_mask = data & 1; -} - -READ8_MEMBER(pc9801_86_device::pcm_r) -{ - if((offset & 1) == 0) - { - switch(offset >> 1) - { - case 1: - return ((queue_count() == QUEUE_SIZE) ? 0x80 : 0) | - (!queue_count() ? 0x40 : 0); - case 2: - return m_pcm_ctrl | (m_pcmirq ? 0x10 : 0); - case 3: - return m_pcm_mode; - case 4: - return 0; - case 5: - return m_pcm_mute; - } - } - else // odd - logerror("PC9801-86: Read to undefined port [%02x]\n",offset+0xa464); - return 0xff; -} - -WRITE8_MEMBER(pc9801_86_device::pcm_w) -{ - const int rates[] = {44100, 33075, 22050, 16538, 11025, 8268, 5513, 4134}; - if((offset & 1) == 0) - { - switch(offset >> 1) - { - case 1: - m_vol[data >> 5] = data & 0x0f; - break; - case 2: - m_pcm_ctrl = data & ~0x10; - if(data & 0x80) - m_dac_timer->adjust(attotime::from_hz(rates[data & 7]), 0, attotime::from_hz(rates[data & 7])); - else - m_dac_timer->adjust(attotime::never); - if(data & 8) - m_head = m_tail = m_count = 0; - if(!(data & 0x10)) - { - m_pcmirq = false; - machine().device(":pic8259_slave")->ir4_w(m_fmirq ? ASSERT_LINE : CLEAR_LINE); - } - break; - case 3: - if(m_pcm_ctrl & 0x20) - m_irq_rate = (data + 1) * 128; - else - m_pcm_mode = data; - break; - case 4: - if(queue_count() < QUEUE_SIZE) - { - m_queue[m_head++] = data; - m_head %= QUEUE_SIZE; - m_count++; - } - break; - case 5: - m_pcm_mute = data; - break; - } - } - else // odd - logerror("PC9801-86: Write to undefined port [%02x] %02x\n",offset+0xa464,data); -} - -int pc9801_86_device::queue_count() -{ - return m_count; -} - -uint8_t pc9801_86_device::queue_pop() -{ - if(!queue_count()) - return 0; - uint8_t ret = m_queue[m_tail++]; - m_tail %= QUEUE_SIZE; - m_count--; - return ret; -} - -void pc9801_86_device::device_timer(emu_timer& timer, device_timer_id id, int param, void* ptr) -{ - int16_t lsample, rsample; - - if((m_pcm_ctrl & 0x40) || !(m_pcm_ctrl & 0x80) || !queue_count()) - return; - - switch(m_pcm_mode & 0x70) - { - case 0x70: // 8bit stereo - m_ldac->write(queue_pop() << 8); - m_rdac->write(queue_pop() << 8); - break; - case 0x60: // 8bit left only - m_ldac->write(queue_pop() << 8); - break; - case 0x50: // 8bit right only - m_rdac->write(queue_pop() << 8); - break; - case 0x30: // 16bit stereo - lsample = queue_pop(); - lsample |= queue_pop() << 8; - rsample = queue_pop(); - rsample |= queue_pop() << 8; - m_ldac->write(lsample); - m_rdac->write(rsample); - break; - case 0x20: // 16bit left only - lsample = queue_pop(); - lsample |= queue_pop() << 8; - m_ldac->write(lsample); - break; - case 0x10: // 16bit right only - rsample = queue_pop(); - rsample |= queue_pop() << 8; - m_rdac->write(rsample); - break; - } - if((queue_count() < m_irq_rate) && (m_pcm_ctrl & 0x20)) - { - m_pcmirq = true; - machine().device(":pic8259_slave")->ir4_w(ASSERT_LINE); - } -} diff --git a/src/mame/machine/pc9801_86.h b/src/mame/machine/pc9801_86.h deleted file mode 100644 index 4bb8de0701e..00000000000 --- a/src/mame/machine/pc9801_86.h +++ /dev/null @@ -1,80 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - NEC PC-9801-86 - -***************************************************************************/ - -#ifndef MAME_MACHINE_PC9801_86_H -#define MAME_MACHINE_PC9801_86_H - -#pragma once - - -#include "machine/pic8259.h" -#include "sound/2608intf.h" -#include "sound/dac.h" - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> pc9801_86_device - -class pc9801_86_device : public device_t -{ -public: - // construction/destruction - pc9801_86_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - DECLARE_READ8_MEMBER(opn_r); - DECLARE_WRITE8_MEMBER(opn_w); - DECLARE_READ8_MEMBER(id_r); - DECLARE_WRITE8_MEMBER(mask_w); - DECLARE_READ8_MEMBER(pcm_r); - DECLARE_WRITE8_MEMBER(pcm_w); - -protected: - // device-level overrides - virtual void device_validity_check(validity_checker &valid) const override; - virtual void device_start() override; - virtual void device_reset() override; - // optional information overrides - virtual void device_add_mconfig(machine_config &config) override; - virtual ioport_constructor device_input_ports() const override; - virtual const tiny_rom_entry *device_rom_region() const override; - void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - -private: - int queue_count(); - uint8_t queue_pop(); - - uint8_t m_joy_sel, m_mask, m_pcm_mode, m_vol[7], m_pcm_ctrl, m_pcm_mute; - uint16_t m_head, m_tail, m_count, m_irq_rate; - bool m_pcmirq, m_fmirq; - required_device m_opna; - required_device m_ldac; - required_device m_rdac; - std::vector m_queue; - emu_timer *m_dac_timer; - - DECLARE_WRITE_LINE_MEMBER(sound_irq); - DECLARE_READ8_MEMBER(opn_porta_r); - DECLARE_WRITE8_MEMBER(opn_portb_w); -}; - - -// device type definition -DECLARE_DEVICE_TYPE(PC9801_86, pc9801_86_device) - - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - - - -#endif // MAME_MACHINE_PC9801_86_H diff --git a/src/mame/machine/pc9801_cbus.cpp b/src/mame/machine/pc9801_cbus.cpp deleted file mode 100644 index 06af21561d3..00000000000 --- a/src/mame/machine/pc9801_cbus.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/********************************************************************** - - CCBUS Slot interface for PC-98xx family - -**********************************************************************/ - -#include "emu.h" -#include "pc9801_cbus.h" - - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -DEFINE_DEVICE_TYPE(PC9801CBUS_SLOT, pc9801_slot_device, "pc9801_slot", "PC-9801 sound cbus slot") - - - -//************************************************************************** -// DEVICE PC9801 CARD INTERFACE -//************************************************************************** - -#if 0 -//------------------------------------------------- -// device_pc9801cbus_card_interface - constructor -//------------------------------------------------- - -device_pc9801cbus_card_interface::device_pc9801cbus_card_interface(const machine_config &mconfig, device_t &device) - : device_slot_card_interface(mconfig, device) -{ -} - - -//------------------------------------------------- -// ~device_pc9801cbus_card_interface - destructor -//------------------------------------------------- - -device_pc9801cbus_card_interface::~device_pc9801cbus_card_interface() -{ -} -#endif - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// pc9801_slot_device - constructor -//------------------------------------------------- - -pc9801_slot_device::pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, PC9801CBUS_SLOT, tag, owner, clock), - device_slot_interface(mconfig, *this) -{ -} - - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void pc9801_slot_device::device_config_complete() -{ - // ... -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void pc9801_slot_device::device_start() -{ -// m_card = dynamic_cast(get_card_device()); -} diff --git a/src/mame/machine/pc9801_cbus.h b/src/mame/machine/pc9801_cbus.h deleted file mode 100644 index 1b1084d8961..00000000000 --- a/src/mame/machine/pc9801_cbus.h +++ /dev/null @@ -1,74 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/********************************************************************** - - -**********************************************************************/ -#ifndef MAME_MACHINE_PC9801_CBUS_H -#define MAME_MACHINE_PC9801_CBUS_H - -#pragma once - - - - -//************************************************************************** -// CONSTANTS -//************************************************************************** - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - - -#define MCFG_PC9801CBUS_SLOT_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, PC9801CBUS_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - - - - -//class pc9801_slot_device; - -#if 0 -class device_pc9801_slot_card_interface : public device_slot_card_interface -{ - friend class pc9801_slot_device; - -public: - // construction/destruction - device_pc9801_slot_card_interface(const machine_config &mconfig, device_t &device); - virtual ~device_pc9801_card_interface(); -}; -#endif - -// ======================> pc9801_slot_device - -class pc9801_slot_device : public device_t, public device_slot_interface -{ -public: - // construction/destruction - pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - -protected: - // device-level overrides - virtual void device_start() override; - virtual void device_config_complete() override; -//private: -// device_pc9801_slot_card_interface *m_card; - -}; - - -// device type definition -DECLARE_DEVICE_TYPE(PC9801CBUS_SLOT, pc9801_slot_device) - -#endif // MAME_MACHINE_PC9801_CBUS_H -- cgit v1.2.3