From aff3588a0458ec6d538375f5a235c82a934020ad Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 5 Nov 2016 13:42:18 -0400 Subject: [PATCH] apple2gs: switched to use z80scc, added printer & modem ports. [R. Belmont] --- src/mame/drivers/apple2gs.cpp | 18 ++++++++++++++++-- src/mame/includes/apple2gs.h | 6 ++++++ src/mame/machine/apple2gs.cpp | 29 +++++++++++++++++++++-------- 3 files changed, 43 insertions(+), 10 deletions(-) diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp index 38bffaf20cb..6e87452f8ca 100644 --- a/src/mame/drivers/apple2gs.cpp +++ b/src/mame/drivers/apple2gs.cpp @@ -55,7 +55,7 @@ #include "machine/appldriv.h" #include "sound/es5503.h" #include "machine/applefdc.h" -#include "machine/8530scc.h" +#include "machine/z80scc.h" #include "sound/speaker.h" #include "machine/ram.h" @@ -79,6 +79,8 @@ //#include "bus/a2bus/a2udrive.h" #include "bus/a2bus/a2hsscsi.h" +#include "bus/rs232/rs232.h" + #include "softlist.h" static const gfx_layout apple2gs_text_layout = @@ -386,7 +388,19 @@ static MACHINE_CONFIG_START( apple2gs, apple2gs_state ) MCFG_IWM_ADD("fdc", apple2_fdc_interface) /* SCC */ - MCFG_DEVICE_ADD("scc", SCC8530, APPLE2GS_14M/2) + MCFG_SCC85C30_ADD(SCC_TAG, APPLE2GS_14M/2, 0, 0, 0, 0) + MCFG_Z80SCC_OUT_TXDA_CB(DEVWRITELINE(RS232A_TAG, rs232_port_device, write_txd)) + MCFG_Z80SCC_OUT_TXDB_CB(DEVWRITELINE(RS232B_TAG, rs232_port_device, write_txd)) + + MCFG_RS232_PORT_ADD(RS232A_TAG, default_rs232_devices, nullptr) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(SCC_TAG, z80scc_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(SCC_TAG, z80scc_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(SCC_TAG, z80scc_device, ctsa_w)) + + MCFG_RS232_PORT_ADD(RS232B_TAG, default_rs232_devices, nullptr) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(SCC_TAG, z80scc_device, rxb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(SCC_TAG, z80scc_device, dcdb_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(SCC_TAG, z80scc_device, ctsb_w)) MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(apple2gs_floppy525_floppy_interface,15,16) MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADDITIONAL_ADD(apple2gs_floppy35_floppy_interface) diff --git a/src/mame/includes/apple2gs.h b/src/mame/includes/apple2gs.h index b72dc4b08e6..26e3a5895c6 100644 --- a/src/mame/includes/apple2gs.h +++ b/src/mame/includes/apple2gs.h @@ -18,8 +18,12 @@ #include "machine/nvram.h" #include "cpu/g65816/g65816.h" #include "cpu/m6502/m5074x.h" +#include "machine/z80scc.h" #define ADBMICRO_TAG "adbmicro" +#define SCC_TAG "scc" +#define RS232A_TAG "printer" +#define RS232B_TAG "modem" // IIgs clocks as marked on the schematics #define APPLE2GS_28M (XTAL_28_63636MHz) // IIGS master clock @@ -95,6 +99,7 @@ public: m_maincpu(*this, "maincpu"), m_es5503(*this, "es5503"), m_fdc(*this, "fdc"), + m_scc(*this, "scc"), #if RUN_ADB_MICRO m_adbmicro(*this, ADBMICRO_TAG), #endif @@ -106,6 +111,7 @@ public: required_device m_maincpu; required_device m_es5503; required_device m_fdc; + required_device m_scc; #if RUN_ADB_MICRO optional_device m_adbmicro; #endif diff --git a/src/mame/machine/apple2gs.cpp b/src/mame/machine/apple2gs.cpp index 37cee8f58e5..3e20664986f 100644 --- a/src/mame/machine/apple2gs.cpp +++ b/src/mame/machine/apple2gs.cpp @@ -895,7 +895,6 @@ int apple2gs_state::apple2gs_get_vpos() READ8_MEMBER( apple2gs_state::apple2gs_c0xx_r ) { uint8_t result; - scc8530_t *scc; if(space.debugger_access()) { @@ -1051,11 +1050,19 @@ READ8_MEMBER( apple2gs_state::apple2gs_c0xx_r ) break; case 0x38: /* C038 - SCCBREG */ + result = m_scc->cb_r(space, 0, mem_mask); + break; + case 0x39: /* C039 - SCCAREG */ + result = m_scc->ca_r(space, 0, mem_mask); + break; + case 0x3A: /* C03A - SCCBDATA */ + result = m_scc->db_r(space, 0, mem_mask); + break; + case 0x3B: /* C03B - SCCADATA */ - scc = space.machine().device("scc"); - result = scc->reg_r(space, offset & 0x03); + result = m_scc->da_r(space, 0, mem_mask); break; case 0x3C: /* C03C - SOUNDCTL */ @@ -1131,8 +1138,6 @@ READ8_MEMBER( apple2gs_state::apple2gs_c0xx_r ) WRITE8_MEMBER( apple2gs_state::apple2gs_c0xx_w ) { - scc8530_t *scc; - offset &= 0xFF; if (LOG_C0XX) @@ -1226,12 +1231,20 @@ WRITE8_MEMBER( apple2gs_state::apple2gs_c0xx_w ) break; case 0x38: /* C038 - SCCBREG */ + m_scc->cb_w(space, 0, data); + break; + case 0x39: /* C039 - SCCAREG */ + m_scc->ca_w(space, 0, data); + break; + case 0x3A: /* C03A - SCCBDATA */ + m_scc->db_w(space, 0, data); + break; + case 0x3B: /* C03B - SCCADATA */ - scc = space.machine().device("scc"); - scc->reg_w(space, offset & 0x03, data); - break; + m_scc->da_w(space, 0, data); + break; case 0x3C: /* C03C - SOUNDCTL */ case 0x3D: /* C03D - SOUNDDATA */