Another magician trick, this time with PC-9801-118 (preliminary)
This commit is contained in:
parent
2f5449614c
commit
fae6b8c00e
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -7173,6 +7173,8 @@ src/mess/machine/pc1401.c svneol=native#text/plain
|
|||||||
src/mess/machine/pc1403.c svneol=native#text/plain
|
src/mess/machine/pc1403.c svneol=native#text/plain
|
||||||
src/mess/machine/pc1512kb.c svneol=native#text/plain
|
src/mess/machine/pc1512kb.c svneol=native#text/plain
|
||||||
src/mess/machine/pc1512kb.h svneol=native#text/plain
|
src/mess/machine/pc1512kb.h svneol=native#text/plain
|
||||||
|
src/mess/machine/pc9801_118.c svneol=native#text/plain
|
||||||
|
src/mess/machine/pc9801_118.h svneol=native#text/plain
|
||||||
src/mess/machine/pc9801_26.c svneol=native#text/plain
|
src/mess/machine/pc9801_26.c svneol=native#text/plain
|
||||||
src/mess/machine/pc9801_26.h svneol=native#text/plain
|
src/mess/machine/pc9801_26.h svneol=native#text/plain
|
||||||
src/mess/machine/pc9801_86.c svneol=native#text/plain
|
src/mess/machine/pc9801_86.c svneol=native#text/plain
|
||||||
|
@ -329,6 +329,7 @@
|
|||||||
#include "formats/pc98fdi_dsk.h"
|
#include "formats/pc98fdi_dsk.h"
|
||||||
#include "machine/pc9801_26.h"
|
#include "machine/pc9801_26.h"
|
||||||
#include "machine/pc9801_86.h"
|
#include "machine/pc9801_86.h"
|
||||||
|
#include "machine/pc9801_118.h"
|
||||||
#include "machine/pc9801_cbus.h"
|
#include "machine/pc9801_cbus.h"
|
||||||
|
|
||||||
|
|
||||||
@ -3283,7 +3284,7 @@ static SLOT_INTERFACE_START( pc9801_cbus )
|
|||||||
// PC-9801-86
|
// PC-9801-86
|
||||||
// PC-9801-26 + PC-9801-86 (?)
|
// PC-9801-26 + PC-9801-86 (?)
|
||||||
// PC-9801-86 + Chibi-Oto
|
// PC-9801-86 + Chibi-Oto
|
||||||
// PC-9801-118
|
SLOT_INTERFACE( "pc9801_118", PC9801_118 )
|
||||||
// Speak Board
|
// Speak Board
|
||||||
// Spark Board
|
// Spark Board
|
||||||
// AMD-98 (AmuseMent boarD)
|
// AMD-98 (AmuseMent boarD)
|
||||||
@ -3589,7 +3590,7 @@ static MACHINE_CONFIG_FRAGMENT( pc9801_mouse )
|
|||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
static MACHINE_CONFIG_FRAGMENT( pc9801_cbus )
|
static MACHINE_CONFIG_FRAGMENT( pc9801_cbus )
|
||||||
MCFG_PC9801CBUS_SLOT_ADD("cbus0", pc9801_cbus, NULL, NULL)
|
MCFG_PC9801CBUS_SLOT_ADD("cbus0", pc9801_cbus, "pc9801_26", NULL)
|
||||||
// TODO: six max slots
|
// TODO: six max slots
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
|
227
src/mess/machine/pc9801_118.c
Normal file
227
src/mess/machine/pc9801_118.c
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
NEC PC-9801-118 sound card
|
||||||
|
|
||||||
|
YMF288 + some extra ports
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
- preliminary, presumably needs CS-4231 too
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
#include "machine/pc9801_118.h"
|
||||||
|
#include "machine/pic8259.h"
|
||||||
|
#include "sound/2608intf.h"
|
||||||
|
|
||||||
|
#define MAIN_CLOCK_X1 XTAL_1_9968MHz
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// GLOBAL VARIABLES
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
// device type definition
|
||||||
|
const device_type PC9801_118 = &device_creator<pc9801_118_device>;
|
||||||
|
|
||||||
|
|
||||||
|
READ8_MEMBER(pc9801_118_device::opn_porta_r)
|
||||||
|
{
|
||||||
|
if(m_joy_sel == 0x80)
|
||||||
|
return ioport("OPNA_PA1")->read();
|
||||||
|
|
||||||
|
if(m_joy_sel == 0xc0)
|
||||||
|
return ioport("OPNA_PA2")->read();
|
||||||
|
|
||||||
|
// 0x81?
|
||||||
|
// printf("%02x\n",m_joy_sel);
|
||||||
|
return 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE8_MEMBER(pc9801_118_device::opn_portb_w){ m_joy_sel = data; }
|
||||||
|
|
||||||
|
static void pc9801_sound_irq( device_t *device, int irq )
|
||||||
|
{
|
||||||
|
// pc9801_state *state = device->machine().driver_data<pc9801_state>();
|
||||||
|
|
||||||
|
/* TODO: seems to die very often */
|
||||||
|
pic8259_ir4_w(device->machine().device("pic8259_slave"), irq);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const ym2608_interface pc98_ym2608_intf =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
AY8910_LEGACY_OUTPUT,
|
||||||
|
AY8910_DEFAULT_LOADS,
|
||||||
|
DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, pc9801_118_device,opn_porta_r),
|
||||||
|
DEVCB_NULL,//(pc9801_state,opn_portb_r),
|
||||||
|
DEVCB_NULL,//(pc9801_state,opn_porta_w),
|
||||||
|
DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, pc9801_118_device,opn_portb_w),
|
||||||
|
},
|
||||||
|
pc9801_sound_irq
|
||||||
|
};
|
||||||
|
|
||||||
|
static MACHINE_CONFIG_FRAGMENT( pc9801_118_config )
|
||||||
|
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||||
|
MCFG_SOUND_ADD("opn3", YM2608, MAIN_CLOCK_X1*4) // actually YMF288, unknown clock / divider
|
||||||
|
MCFG_SOUND_CONFIG(pc98_ym2608_intf)
|
||||||
|
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
|
||||||
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// machine_config_additions - device-specific
|
||||||
|
// machine configurations
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
machine_config_constructor pc9801_118_device::device_mconfig_additions() const
|
||||||
|
{
|
||||||
|
return MACHINE_CONFIG_NAME( pc9801_118_config );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// input_ports - device-specific input ports
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
static INPUT_PORTS_START( pc9801_118 )
|
||||||
|
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 )
|
||||||
|
INPUT_PORTS_END
|
||||||
|
|
||||||
|
ioport_constructor pc9801_118_device::device_input_ports() const
|
||||||
|
{
|
||||||
|
return INPUT_PORTS_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 clock)
|
||||||
|
: device_t(mconfig, PC9801_118, "pc9801_118", tag, owner, clock),
|
||||||
|
// m_maincpu(*owner, "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, offs_t mask, offs_t mirror, 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, mask, mirror, rhandler, whandler, 0);
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff);
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffffffff);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fatalerror("PC-9801-118: Bus width %d not supported\n", buswidth);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pc9801_118_device::device_start()
|
||||||
|
{
|
||||||
|
install_device(0x0188, 0x018f, 0, 0, read8_delegate(FUNC(pc9801_118_device::pc9801_118_r), this), write8_delegate(FUNC(pc9801_118_device::pc9801_118_w), this) );
|
||||||
|
install_device(0xa460, 0xa463, 0, 0, read8_delegate(FUNC(pc9801_118_device::pc9801_118_ext_r), this), write8_delegate(FUNC(pc9801_118_device::pc9801_118_ext_w), this) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// device_reset - device-specific reset
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void pc9801_118_device::device_reset()
|
||||||
|
{
|
||||||
|
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 ym2608_r(m_opn3, 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)
|
||||||
|
ym2608_w(m_opn3,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);
|
||||||
|
}
|
67
src/mess/machine/pc9801_118.h
Normal file
67
src/mess/machine/pc9801_118.h
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
NEC PC-9801-118
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __PC9801_118DEV_H__
|
||||||
|
#define __PC9801_118DEV_H__
|
||||||
|
|
||||||
|
#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 clock);
|
||||||
|
|
||||||
|
// optional information overrides
|
||||||
|
virtual machine_config_constructor device_mconfig_additions() const;
|
||||||
|
virtual ioport_constructor device_input_ports() const;
|
||||||
|
|
||||||
|
DECLARE_READ8_MEMBER(opn_porta_r);
|
||||||
|
DECLARE_WRITE8_MEMBER(opn_portb_w);
|
||||||
|
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);
|
||||||
|
|
||||||
|
// required_device<cpu_device> m_maincpu;
|
||||||
|
required_device<ym2608_device> m_opn3;
|
||||||
|
protected:
|
||||||
|
// device-level overrides
|
||||||
|
virtual void device_validity_check(validity_checker &valid) const;
|
||||||
|
virtual void device_start();
|
||||||
|
virtual void device_reset();
|
||||||
|
virtual void device_config_complete() { m_shortname = "pc9801_118"; }
|
||||||
|
void install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler);
|
||||||
|
|
||||||
|
private:
|
||||||
|
UINT8 m_joy_sel;
|
||||||
|
UINT8 m_ext_reg;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// device type definition
|
||||||
|
extern const device_type PC9801_118;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// GLOBAL VARIABLES
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -13,10 +13,6 @@ Template for skeleton device
|
|||||||
#include "machine/pic8259.h"
|
#include "machine/pic8259.h"
|
||||||
#include "sound/2203intf.h"
|
#include "sound/2203intf.h"
|
||||||
|
|
||||||
#define MCFG_PC9801_26_SLOT_ADD(_tag, _slot_intf, _def_slot, _def_inp) \
|
|
||||||
MCFG_DEVICE_ADD(_tag, PC9801_26, 0) \
|
|
||||||
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
|
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// TYPE DEFINITIONS
|
// TYPE DEFINITIONS
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
Almost the same thing as PC-9801-86, but this one has YM2608 instead of
|
Almost the same thing as PC-9801-86, but this one has YM2608 instead of
|
||||||
YM2203
|
YM2203
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
- i/o port base jumper
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
Template for skeleton device
|
NEC PC-9801-86
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
@ -13,11 +13,6 @@ Template for skeleton device
|
|||||||
#include "machine/pic8259.h"
|
#include "machine/pic8259.h"
|
||||||
#include "sound/2608intf.h"
|
#include "sound/2608intf.h"
|
||||||
|
|
||||||
#define MCFG_PC9801_86_SLOT_ADD(_tag, _slot_intf, _def_slot, _def_inp) \
|
|
||||||
MCFG_DEVICE_ADD(_tag, PC9801_86, 0) \
|
|
||||||
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
|
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// TYPE DEFINITIONS
|
// TYPE DEFINITIONS
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
@ -1473,6 +1473,7 @@ $(MESSOBJ)/pc.a: \
|
|||||||
$(MESSOBJ)/pc9801.a: \
|
$(MESSOBJ)/pc9801.a: \
|
||||||
$(MESS_MACHINE)/pc9801_26.o \
|
$(MESS_MACHINE)/pc9801_26.o \
|
||||||
$(MESS_MACHINE)/pc9801_86.o \
|
$(MESS_MACHINE)/pc9801_86.o \
|
||||||
|
$(MESS_MACHINE)/pc9801_118.o \
|
||||||
$(MESS_MACHINE)/pc9801_cbus.o \
|
$(MESS_MACHINE)/pc9801_cbus.o \
|
||||||
|
|
||||||
$(MESSOBJ)/pcshare.a: \
|
$(MESSOBJ)/pcshare.a: \
|
||||||
|
Loading…
Reference in New Issue
Block a user