diff options
author | 2012-12-18 00:40:17 +0000 | |
---|---|---|
committer | 2012-12-18 00:40:17 +0000 | |
commit | 4a807320a985fcfe6aaf04daec5e599e47a68822 (patch) | |
tree | 0f5cf012d67992addf9a5a24f92f27098d4d2a1a /src | |
parent | 8b185b0edc1240d9a2becd7ab518eff103319c02 (diff) |
Preliminary slot interface for PC-9801, added support for PC-9801-26 sound board as an example
Diffstat (limited to 'src')
-rw-r--r-- | src/mess/drivers/pc9801.c | 145 | ||||
-rw-r--r-- | src/mess/machine/pc9801_26.c | 209 | ||||
-rw-r--r-- | src/mess/machine/pc9801_26.h | 69 | ||||
-rw-r--r-- | src/mess/machine/pc9801_slot.c | 81 | ||||
-rw-r--r-- | src/mess/machine/pc9801_slot.h | 75 | ||||
-rw-r--r-- | src/mess/mess.mak | 7 |
6 files changed, 478 insertions, 108 deletions
diff --git a/src/mess/drivers/pc9801.c b/src/mess/drivers/pc9801.c index 8ae3e8adaa3..588d33a163c 100644 --- a/src/mess/drivers/pc9801.c +++ b/src/mess/drivers/pc9801.c @@ -54,6 +54,8 @@ - Beast (keeps reading command sense) - Beast 2 - Bells Avenue (disk swap?) + - Bible Master 2 (at new game loading) + - Birdy World - Bokosuka Wars - Dokkin Minako Sensei (2dd image) @@ -82,6 +84,9 @@ - Bakasuka Wars: drawing seems busted (either mouse or upd7220) - Band-Kun: (how to run this without installing?) - Battle Chess: wants some dip-switches to be on in DSW4, too slow during IA thinking? + - Bishoujo Audition: Moans with a "(program) ended. remove the floppy disk and turn off the poewr." + - Bishoujo Hunter ZX: Doesn't color cycle at intro (seems stuck?), doesn't clear text selection at new game screen; + - Bishoujo Shanshinkan: has white rectangles all over the place; - Dragon Buster: slight issue with window masking; - Far Side Moon: doesn't detect sound board (tied to 0x00ec ports) @@ -318,11 +323,13 @@ #include "machine/i8251.h" #include "sound/beep.h" #include "sound/speaker.h" -#include "sound/2203intf.h" #include "sound/2608intf.h" #include "video/upd7220.h" #include "machine/ram.h" #include "formats/pc98fdi_dsk.h" +#include "machine/pc9801_26.h" +#include "machine/pc9801_slot.h" + #define UPD1990A_TAG "upd1990a" #define UPD8251_TAG "upd8251" @@ -340,7 +347,7 @@ public: m_sio(*this, UPD8251_TAG), m_hgdc1(*this, "upd7220_chr"), m_hgdc2(*this, "upd7220_btm"), - m_opn(*this, "opn"), +// m_opn(*this, "opn"), // m_opna(*this, "opna"), m_video_ram_1(*this, "video_ram_1"), m_video_ram_2(*this, "video_ram_2"){ } @@ -353,7 +360,7 @@ public: required_device<i8251_device> m_sio; required_device<upd7220_device> m_hgdc1; required_device<upd7220_device> m_hgdc2; - required_device<ym2203_device> m_opn; +// required_device<ym2203_device> m_opn; // optional_device<ym2608_device> m_opna; required_shared_ptr<UINT8> m_video_ram_1; @@ -412,7 +419,6 @@ public: UINT8 mode; UINT8 tile[4], tile_index; }m_grcg; - UINT8 m_has_opna; /* PC9821 specific */ UINT8 m_sdip[24], m_sdip_bank; @@ -1591,38 +1597,6 @@ inline void pc9801_state::m_pc9801rs_grcg_w(UINT32 offset,int vbank,UINT8 data) } -READ8_MEMBER(pc9801_state::pc9801_opn_r) -{ - if((offset & 1) == 0) - { - //if(m_has_opna) - // return ym2608_r(m_opna, space, offset >> 1); - - return offset & 4 ? 0xff : ym2203_r(m_opn,space, offset >> 1); - } - else // odd - { - printf("Read to undefined port [%02x]\n",offset+0x188); - return 0xff; - } -} - -WRITE8_MEMBER(pc9801_state::pc9801_opn_w) -{ - if((offset & 1) == 0) - { - /*if(m_has_opna) - ym2608_w(m_opna,space, offset >> 1,data); - else */ - if((offset & 4) == 0) - ym2203_w(m_opn,space, offset >> 1,data); - } - else // odd - { - printf("Write to undefined port [%02x] %02x\n",offset+0x188,data); - } -} - READ8_MEMBER(pc9801_state::pc9801_mouse_r) { if((offset & 1) == 0) @@ -1658,6 +1632,7 @@ ADDRESS_MAP_END /* first device is even offsets, second one is odd offsets */ static ADDRESS_MAP_START( pc9801_io, AS_IO, 16, pc9801_state ) + ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x001f) AM_READWRITE8(pc9801_00_r,pc9801_00_w,0xffff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA AM_RANGE(0x0020, 0x0027) AM_READWRITE8(pc9801_20_r,pc9801_20_w,0xffff) // RTC / DMA registers (LS244) AM_RANGE(0x0030, 0x0037) AM_READWRITE8(pc9801_30_r,pc9801_30_w,0xffff) //i8251 RS232c / i8255 system port @@ -1672,7 +1647,7 @@ static ADDRESS_MAP_START( pc9801_io, AS_IO, 16, pc9801_state ) AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801_fdc_2hd_r,pc9801_fdc_2hd_w,0xffff) //upd765a 2hd / cmt AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9801_a0_r,pc9801_a0_w,0xffff) //upd7220 bitmap ports / display registers AM_RANGE(0x00c8, 0x00cd) AM_READWRITE8(pc9801_fdc_2dd_r,pc9801_fdc_2dd_w,0xffff) //upd765a 2dd / <undefined> - AM_RANGE(0x0188, 0x018b) AM_READWRITE8(pc9801_opn_r,pc9801_opn_w,0xffff) //ym2203 opn / <undefined> +// AM_RANGE(0x0188, 0x018b) AM_READWRITE8(pc9801_opn_r,pc9801_opn_w,0xffff) //ym2203 opn / <undefined> AM_RANGE(0x7fd8, 0x7fdf) AM_READWRITE8(pc9801_mouse_r,pc9801_mouse_w,0xffff) // <undefined> / mouse ppi8255 ports ADDRESS_MAP_END @@ -2097,6 +2072,7 @@ static ADDRESS_MAP_START( pc9801rs_map, AS_PROGRAM, 32, pc9801_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( pc9801rs_io, AS_IO, 32, pc9801_state ) + ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x001f) AM_READWRITE8(pc9801_00_r, pc9801_00_w, 0xffffffff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA AM_RANGE(0x0020, 0x0027) AM_READWRITE8(pc9801_20_r, pc9801_20_w, 0xffffffff) // RTC / DMA registers (LS244) AM_RANGE(0x0030, 0x0037) AM_READWRITE8(pc9801rs_30_r, pc9801_30_w, 0xffffffff) //i8251 RS232c / i8255 system port @@ -2114,7 +2090,7 @@ static ADDRESS_MAP_START( pc9801rs_io, AS_IO, 32, pc9801_state ) AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffffffff) // AM_RANGE(0x00ec, 0x00ef) PC-9801-86 sound board AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(pc9801rs_f0_r, pc9801rs_f0_w, 0xffffffff) - AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r, pc9801_opn_w, 0xffffffff) //ym2203 opn / <undefined> +// AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r, pc9801_opn_w, 0xffffffff) //ym2203 opn / <undefined> AM_RANGE(0x0438, 0x043b) AM_READWRITE8(pc9801rs_access_ctrl_r,pc9801rs_access_ctrl_w,0xffffffff) AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w, 0xffffffff) //ROM/RAM bank AM_RANGE(0x7fd8, 0x7fdf) AM_READWRITE8(pc9801_mouse_r, pc9801_mouse_w, 0xffffffff) // <undefined> / mouse ppi8255 ports @@ -2162,6 +2138,7 @@ static ADDRESS_MAP_START( pc9801ux_map, AS_PROGRAM, 16, pc9801_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( pc9801ux_io, AS_IO, 16, pc9801_state ) + ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x001f) AM_READWRITE8(pc9801_00_r, pc9801_00_w, 0xffff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA AM_RANGE(0x0020, 0x0027) AM_READWRITE8(pc9801_20_r, pc9801_20_w, 0xffff) // RTC / DMA registers (LS244) AM_RANGE(0x0030, 0x0037) AM_READWRITE8(pc9801rs_30_r, pc9801_30_w, 0xffff) //i8251 RS232c / i8255 system port @@ -2176,7 +2153,7 @@ static ADDRESS_MAP_START( pc9801ux_io, AS_IO, 16, pc9801_state ) AM_RANGE(0x00bc, 0x00bf) AM_READWRITE8(pc9810rs_fdc_ctrl_r,pc9810rs_fdc_ctrl_w,0xffff) AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffff) AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(pc9801rs_f0_r, pc9801rs_f0_w, 0xffff) - AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r, pc9801_opn_w, 0xffff) //ym2203 opn / <undefined> +// AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r, pc9801_opn_w, 0xffff) //ym2203 opn / <undefined> AM_RANGE(0x0438, 0x043b) AM_READWRITE8(pc9801rs_access_ctrl_r,pc9801rs_access_ctrl_w,0xffff) AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w, 0xffff) //ROM/RAM bank AM_RANGE(0x7fd8, 0x7fdf) AM_READWRITE8(pc9801_mouse_r, pc9801_mouse_w, 0xffff) // <undefined> / mouse ppi8255 ports @@ -2462,6 +2439,7 @@ static ADDRESS_MAP_START( pc9821_map, AS_PROGRAM, 32, pc9801_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( pc9821_io, AS_IO, 32, pc9801_state ) + ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x001f) AM_READWRITE8(pc9801_00_r, pc9801_00_w, 0xffffffff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA AM_RANGE(0x0020, 0x0027) AM_READWRITE8(pc9801_20_r, pc9801_20_w, 0xffffffff) // RTC / DMA registers (LS244) AM_RANGE(0x0030, 0x0037) AM_READWRITE8(pc9801rs_30_r, pc9801_30_w, 0xffffffff) //i8251 RS232c / i8255 system port @@ -2482,7 +2460,7 @@ static ADDRESS_MAP_START( pc9821_io, AS_IO, 32, pc9801_state ) AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffffffff) // AM_RANGE(0x00d8, 0x00df) AMD98 (sound?) board AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(pc9801rs_f0_r, pc9801rs_f0_w, 0xffffffff) - AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r, pc9801_opn_w, 0xffffffff) //ym2203 opn / <undefined> +// AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r, pc9801_opn_w, 0xffffffff) //ym2203 opn / <undefined> // AM_RANGE(0x018c, 0x018f) YM2203 OPN extended ports / <undefined> // AM_RANGE(0x0430, 0x0430) IDE bank register // AM_RANGE(0x0432, 0x0432) IDE bank register (mirror) @@ -2866,24 +2844,6 @@ static INPUT_PORTS_START( pc9801 ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_START("OPN_PA1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - 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("OPN_PA2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) - 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("MOUSE_X") PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_RESET PORT_SENSITIVITY(30) PORT_KEYDELTA(30) @@ -3338,6 +3298,20 @@ static SLOT_INTERFACE_START( pc9801_floppies ) SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) SLOT_INTERFACE_END +static SLOT_INTERFACE_START( pc9801_sound ) +// PC-9801-14 + SLOT_INTERFACE( "pc9801_26", PC9801_26 ) +// PC-9801-86 +// PC-9801-26 + PC-9801-86 (?) +// PC-9801-86 + Chibi-Oto +// PC-9801-118 +// Speak Board +// Spark Board +// AMD-98 (AmuseMent boarD) +SLOT_INTERFACE_END + +// Jast Sound, could be put independently + void pc9801_state::fdc_2hd_irq(bool state) { // printf("IRQ 2HD %d\n",state); @@ -3593,43 +3567,6 @@ INTERRUPT_GEN_MEMBER(pc9801_state::pc9801_vrtc_irq) // pic8259_ir2_w(machine().device("pic8259_master"), 0); } -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); -} - -READ8_MEMBER(pc9801_state::opn_porta_r) -{ - if(m_joy_sel == 0x80) - return machine().root_device().ioport("OPN_PA1")->read(); - - if(m_joy_sel == 0xc0) - return machine().root_device().ioport("OPN_PA2")->read(); - -// 0x81? -// printf("%02x\n",m_joy_sel); - return 0xff; -} - -WRITE8_MEMBER(pc9801_state::opn_portb_w){ m_joy_sel = data; } - - -static const ym2203_interface pc98_ym2203_intf = -{ - { - AY8910_LEGACY_OUTPUT, - AY8910_DEFAULT_LOADS, - DEVCB_DRIVER_MEMBER(pc9801_state,opn_porta_r), - DEVCB_NULL,//(pc9801_state,opn_portb_r), - DEVCB_NULL,//(pc9801_state,opn_porta_w), - DEVCB_DRIVER_MEMBER(pc9801_state,opn_portb_w), - }, - DEVCB_LINE(pc9801_sound_irq) -}; - #if 0 static const ym2608_interface pc98_ym2608_intf = { @@ -3702,6 +3639,8 @@ static MACHINE_CONFIG_START( pc9801, pc9801_state ) MCFG_SOFTWARE_LIST_ADD("disk_list","pc98") + MCFG_PC9801BUS_SLOT_ADD("sound_bus", pc9801_sound, NULL, NULL) + #if 0 MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("128K") @@ -3725,10 +3664,6 @@ static MACHINE_CONFIG_START( pc9801, pc9801_state ) MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider - MCFG_SOUND_CONFIG(pc98_ym2203_intf) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.15) MACHINE_CONFIG_END @@ -3767,6 +3702,8 @@ static MACHINE_CONFIG_START( pc9801rs, pc9801_state ) MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:0", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:1", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats) + MCFG_PC9801BUS_SLOT_ADD("sound_bus", pc9801_sound, NULL, NULL) + MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("1664K") MCFG_RAM_EXTRA_OPTIONS("640K,3712K,7808K") @@ -3787,10 +3724,6 @@ static MACHINE_CONFIG_START( pc9801rs, pc9801_state ) MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider - MCFG_SOUND_CONFIG(pc98_ym2203_intf) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - // MCFG_SOUND_ADD("opna", YM2608, MAIN_CLOCK_X1*4) // unknown clock / divider // MCFG_SOUND_CONFIG(pc98_ym2608_intf) // MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) @@ -3834,6 +3767,8 @@ static MACHINE_CONFIG_START( pc9821, pc9801_state ) MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:0", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:1", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats) + MCFG_PC9801BUS_SLOT_ADD("sound_bus", pc9801_sound, NULL, NULL) + MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("1664K") MCFG_RAM_EXTRA_OPTIONS("3712K,7808K") @@ -3854,10 +3789,6 @@ static MACHINE_CONFIG_START( pc9821, pc9801_state ) MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider - MCFG_SOUND_CONFIG(pc98_ym2203_intf) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - // MCFG_SOUND_ADD("opna", YM2608, MAIN_CLOCK_X1*4) // unknown clock / divider // MCFG_SOUND_CONFIG(pc98_ym2608_intf) // MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) diff --git a/src/mess/machine/pc9801_26.c b/src/mess/machine/pc9801_26.c new file mode 100644 index 00000000000..9803b3db403 --- /dev/null +++ b/src/mess/machine/pc9801_26.c @@ -0,0 +1,209 @@ +/*************************************************************************** + + NEC PC-9801-26 sound card + + The legacy sound card, composed by a single YM2203 + +***************************************************************************/ + +#include "emu.h" +#include "machine/pc9801_26.h" +#include "machine/pic8259.h" +#include "sound/2203intf.h" + +#define MAIN_CLOCK_X1 XTAL_1_9968MHz + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +const device_type PC9801_26 = &device_creator<pc9801_26_device>; + + +READ8_MEMBER(pc9801_26_device::opn_porta_r) +{ + if(m_joy_sel == 0x80) + return ioport("OPN_PA1")->read(); + + if(m_joy_sel == 0xc0) + return ioport("OPN_PA2")->read(); + +// 0x81? +// printf("%02x\n",m_joy_sel); + return 0xff; +} + +WRITE8_MEMBER(pc9801_26_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 ym2203_interface pc98_ym2203_intf = +{ + { + AY8910_LEGACY_OUTPUT, + AY8910_DEFAULT_LOADS, + DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, pc9801_26_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_26_device,opn_portb_w), + }, + DEVCB_LINE(pc9801_sound_irq) +}; + +static MACHINE_CONFIG_FRAGMENT( pc9801_26_config ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider + MCFG_SOUND_CONFIG(pc98_ym2203_intf) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor pc9801_26_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pc9801_26_config ); +} + + +//------------------------------------------------- +// 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( 0xc0, 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( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) +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 clock) + : device_t(mconfig, PC9801_26, "pc9801_26", tag, owner, clock), +// m_maincpu(*owner, "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, 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("IBM5160_MOTHERBOARD: Bus width %d not supported\n", buswidth); + break; + } +} + + +void pc9801_26_device::device_start() +{ + install_device(0x0188, 0x018b, 0, 0, read8_delegate(FUNC(pc9801_26_device::pc9801_26_r), this), write8_delegate(FUNC(pc9801_26_device::pc9801_26_w), this) ); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pc9801_26_device::device_reset() +{ +} + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + + +READ8_MEMBER(pc9801_26_device::pc9801_26_r) +{ + if((offset & 1) == 0) + { + //if(m_has_opna) + // return ym2608_r(m_opna, space, offset >> 1); + + return offset & 4 ? 0xff : ym2203_r(m_opn,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 & 1) == 0) + { + /*if(m_has_opna) + ym2608_w(m_opna,space, offset >> 1,data); + else */ + if((offset & 4) == 0) + ym2203_w(m_opn,space, offset >> 1,data); + } + else // odd + { + printf("PC9801-26: Write to undefined port [%02x] %02x\n",offset+0x188,data); + } +}
\ No newline at end of file diff --git a/src/mess/machine/pc9801_26.h b/src/mess/machine/pc9801_26.h new file mode 100644 index 00000000000..536603d31ae --- /dev/null +++ b/src/mess/machine/pc9801_26.h @@ -0,0 +1,69 @@ +/*************************************************************************** + +Template for skeleton device + +***************************************************************************/ + + +#pragma once + +#ifndef __PC9801_26DEV_H__ +#define __PC9801_26DEV_H__ + +#include "machine/pic8259.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 +//************************************************************************** + +// ======================> 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 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_26_r); + DECLARE_WRITE8_MEMBER(pc9801_26_w); + +// required_device<cpu_device> m_maincpu; + required_device<ym2203_device> m_opn; +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_26"; } + 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; + +}; + + +// device type definition +extern const device_type PC9801_26; + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif diff --git a/src/mess/machine/pc9801_slot.c b/src/mess/machine/pc9801_slot.c new file mode 100644 index 00000000000..9069010e246 --- /dev/null +++ b/src/mess/machine/pc9801_slot.c @@ -0,0 +1,81 @@ +/********************************************************************** + + Slot interface for PC-98xx family + +**********************************************************************/ + +#include "pc9801_slot.h" + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type PC9801BUS_SLOT = &device_creator<pc9801_slot_device>; + + + +//************************************************************************** +// DEVICE PC9801 CARD INTERFACE +//************************************************************************** + +#if 0 +//------------------------------------------------- +// device_abc1600bus_card_interface - constructor +//------------------------------------------------- + +device_pc9801bus_card_interface::device_pc9801bus_card_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device) +{ +} + + +//------------------------------------------------- +// ~device_abc1600bus_card_interface - destructor +//------------------------------------------------- + +device_pc9801bus_card_interface::~device_pc9801bus_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 clock) : + device_t(mconfig, PC9801BUS_SLOT, "PC-9801 sound bus 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<device_pc9801_slot_card_interface *>(get_card_device()); +} + + + diff --git a/src/mess/machine/pc9801_slot.h b/src/mess/machine/pc9801_slot.h new file mode 100644 index 00000000000..3bbfbcc745c --- /dev/null +++ b/src/mess/machine/pc9801_slot.h @@ -0,0 +1,75 @@ +/********************************************************************** + + +**********************************************************************/ + +#pragma once + +#ifndef __PC9801_SLOTBUS__ +#define __PC9801_SLOTBUS__ + +#include "emu.h" + + +//************************************************************************** +// CONSTANTS +//************************************************************************** + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + + +#define MCFG_PC9801BUS_SLOT_ADD(_tag, _slot_intf, _def_slot, _def_inp) \ + MCFG_DEVICE_ADD(_tag, PC9801BUS_SLOT, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, 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 clock); + + // device-level overrides + virtual void device_start(); + virtual void device_config_complete(); +//private: +// device_pc9801_slot_card_interface *m_card; + +}; + + +// device type definition +extern const device_type PC9801BUS_SLOT; + + + +#endif diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 8aa69b44e23..088063c4654 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -350,6 +350,7 @@ DRVLIBS += \ $(MESSOBJ)/palm.a \ $(MESSOBJ)/parker.a \ $(MESSOBJ)/pc.a \ + $(MESSOBJ)/pc9801.a \ $(MESSOBJ)/pcshare.a \ $(MESSOBJ)/pdp1.a \ $(MESSOBJ)/pel.a \ @@ -1458,7 +1459,7 @@ $(MESSOBJ)/parker.a: \ $(MESSOBJ)/pitronic.a: \ $(MESS_DRIVERS)/beta.o \ -$(MESSOBJ)/pc.a: \ +$(MESSOBJ)/pc.a: \ $(MESS_VIDEO)/pc_aga.o \ $(MESS_MACHINE)/tandy1t.o \ $(MESS_MACHINE)/europc.o \ @@ -1469,6 +1470,10 @@ $(MESSOBJ)/pc.a: \ $(MESS_DRIVERS)/ibmpc.o \ $(MESS_VIDEO)/pc_t1t.o \ +$(MESSOBJ)/pc9801.a: \ + $(MESS_MACHINE)/pc9801_26.o \ + $(MESS_MACHINE)/pc9801_slot.o \ + $(MESSOBJ)/pcshare.a: \ $(MESS_MACHINE)/pc_turbo.o \ $(MESS_MACHINE)/pc_fdc.o \ |