diff options
author | npwoods <npwoods@alumni.cmu.edu> | 2017-06-01 06:45:51 -0400 |
---|---|---|
committer | Olivier Galibert <galibert@pobox.com> | 2017-06-01 12:45:51 +0200 |
commit | 4d50a021114654c2aad0ed92e3b57a664cb9f22d (patch) | |
tree | e52042d4ec27c8d0b01fb703f90dcc574dfeeed0 | |
parent | b991f2acd6daa49e92c22858044def89e58d03bb (diff) |
CoCo: Overhaul to the cartridge slot subsystem and Speech/Sound Cartridge support [Nathan Woods, Tim Lindner]
26 files changed, 1382 insertions, 653 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index b8ed118d246..49600891ed3 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -2502,18 +2502,16 @@ if (BUSES["COCO"]~=null) then files { MAME_DIR .. "src/devices/bus/coco/cococart.cpp", MAME_DIR .. "src/devices/bus/coco/cococart.h", - MAME_DIR .. "src/devices/bus/coco/coco_232.cpp", - MAME_DIR .. "src/devices/bus/coco/coco_232.h", + MAME_DIR .. "src/devices/bus/coco/coco_rs232.cpp", + MAME_DIR .. "src/devices/bus/coco/coco_dcmodem.cpp", MAME_DIR .. "src/devices/bus/coco/coco_orch90.cpp", - MAME_DIR .. "src/devices/bus/coco/coco_orch90.h", + MAME_DIR .. "src/devices/bus/coco/coco_ssc.cpp", MAME_DIR .. "src/devices/bus/coco/coco_pak.cpp", MAME_DIR .. "src/devices/bus/coco/coco_pak.h", MAME_DIR .. "src/devices/bus/coco/coco_fdc.cpp", MAME_DIR .. "src/devices/bus/coco/coco_fdc.h", MAME_DIR .. "src/devices/bus/coco/coco_gmc.cpp", - MAME_DIR .. "src/devices/bus/coco/coco_gmc.h", MAME_DIR .. "src/devices/bus/coco/coco_multi.cpp", - MAME_DIR .. "src/devices/bus/coco/coco_multi.h", MAME_DIR .. "src/devices/bus/coco/coco_dwsock.cpp", MAME_DIR .. "src/devices/bus/coco/coco_dwsock.h", MAME_DIR .. "src/devices/bus/coco/dragon_fdc.cpp", diff --git a/src/devices/bus/coco/coco_232.cpp b/src/devices/bus/coco/coco_232.cpp deleted file mode 100644 index 9729cee8384..00000000000 --- a/src/devices/bus/coco/coco_232.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - coco_232.c - - Code for emulating the CoCo RS-232 PAK - -***************************************************************************/ - -#include "emu.h" -#include "coco_232.h" - - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define UART_TAG "uart" - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - -static MACHINE_CONFIG_START(coco_rs232) - MCFG_DEVICE_ADD(UART_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) -MACHINE_CONFIG_END - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -DEFINE_DEVICE_TYPE(COCO_232, coco_232_device, "coco_232", "CoCo RS-232 PAK") - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// coco_232_device - constructor -//------------------------------------------------- - -coco_232_device::coco_232_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, COCO_232, tag, owner, clock) - , device_cococart_interface(mconfig, *this) - , m_uart(*this, UART_TAG) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void coco_232_device::device_start() -{ -} - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor coco_232_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( coco_rs232 ); -} - -/*------------------------------------------------- - read --------------------------------------------------*/ - -READ8_MEMBER(coco_232_device::read) -{ - uint8_t result = 0x00; - - if ((offset >= 0x28) && (offset <= 0x2F)) - result = m_uart->read(space, offset - 0x28); - - return result; -} - - -/*------------------------------------------------- - write --------------------------------------------------*/ - -WRITE8_MEMBER(coco_232_device::write) -{ - if ((offset >= 0x28) && (offset <= 0x2F)) - m_uart->write(space, offset - 0x28, data); -} diff --git a/src/devices/bus/coco/coco_232.h b/src/devices/bus/coco/coco_232.h deleted file mode 100644 index 6b2a2d9de1e..00000000000 --- a/src/devices/bus/coco/coco_232.h +++ /dev/null @@ -1,41 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -#ifndef MAME_BUS_COCO_COCO_232_H -#define MAME_BUS_COCO_COCO_232_H - -#pragma once - -#include "cococart.h" -#include "machine/mos6551.h" - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> coco_232_device - -class coco_232_device : - public device_t, - public device_cococart_interface -{ -public: - // construction/destruction - coco_232_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const override; -protected: - // device-level overrides - virtual void device_start() override; - virtual DECLARE_READ8_MEMBER(read) override; - virtual DECLARE_WRITE8_MEMBER(write) override; -private: - // internal state - required_device<mos6551_device> m_uart; -}; - - -// device type definition -DECLARE_DEVICE_TYPE(COCO_232, coco_232_device) - -#endif // MAME_BUS_COCO_COCO_232_H diff --git a/src/devices/bus/coco/coco_dcmodem.cpp b/src/devices/bus/coco/coco_dcmodem.cpp new file mode 100644 index 00000000000..1905bae7172 --- /dev/null +++ b/src/devices/bus/coco/coco_dcmodem.cpp @@ -0,0 +1,110 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + coco_dcmodem.cpp + + Code for emulating the CoCo Direct Connect Modem PAK + + This is just a "skeleton device"; the UART is emulated but pretty much + nothing else + +***************************************************************************/ + +#include "emu.h" +#include "cococart.h" +#include "machine/mos6551.h" + + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define UART_TAG "uart" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> coco_dc_modem_device + +namespace +{ + class coco_dc_modem_device : + public device_t, + public device_cococart_interface + { + public: + // construction/destruction + coco_dc_modem_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, COCO_DCMODEM, tag, owner, clock) + , device_cococart_interface(mconfig, *this) + , m_uart(*this, UART_TAG) + { + } + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + // callbacks + WRITE_LINE_MEMBER(uart_irq_w) + { + set_line_value(cococart_slot_device::line::CART, state + ? cococart_slot_device::line_value::ASSERT + : cococart_slot_device::line_value::CLEAR); + } + + protected: + // device-level overrides + virtual void device_start() override + { + install_readwrite_handler(0xFF6C, 0xFF6F, + read8_delegate(FUNC(mos6551_device::read), (mos6551_device *)m_uart), + write8_delegate(FUNC(mos6551_device::write), (mos6551_device *)m_uart)); + } + + virtual const tiny_rom_entry *device_rom_region() const override; + + // CoCo cartridge level overrides + virtual uint8_t *get_cart_base() override + { + return memregion("eprom")->base(); + } + + private: + // internal state + required_device<mos6551_device> m_uart; + }; +}; + + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +MACHINE_CONFIG_MEMBER(coco_dc_modem_device::device_add_mconfig) + MCFG_DEVICE_ADD(UART_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + MCFG_MOS6551_IRQ_HANDLER(WRITELINE(coco_dc_modem_device, uart_irq_w)) +MACHINE_CONFIG_END + + +ROM_START(coco_dcmodem) + ROM_REGION(0x2000, "eprom", ROMREGION_ERASE00) + ROM_LOAD("Direct Connect Modem Pak (1985) (26-2228) (Tandy).rom", 0x0000, 0x2000, CRC(667bc55d) SHA1(703fe0aba4a603591078cb675ffd26a67c02df88)) +ROM_END + +DEFINE_DEVICE_TYPE(COCO_DCMODEM, coco_dc_modem_device, "coco_dcmodem", "CoCo Direct Connect Modem PAK") + + +//------------------------------------------------- +// device_rom_region +//------------------------------------------------- + +const tiny_rom_entry *coco_dc_modem_device::device_rom_region() const +{ + return ROM_NAME(coco_dcmodem); +} + + diff --git a/src/devices/bus/coco/coco_fdc.cpp b/src/devices/bus/coco/coco_fdc.cpp index 19df2a24c37..b914238ddf2 100644 --- a/src/devices/bus/coco/coco_fdc.cpp +++ b/src/devices/bus/coco/coco_fdc.cpp @@ -84,9 +84,9 @@ protected: }; // device-level overrides - virtual DECLARE_READ8_MEMBER(read) override; - virtual DECLARE_WRITE8_MEMBER(write) override; - virtual machine_config_constructor device_mconfig_additions() const override; + virtual DECLARE_READ8_MEMBER(scs_read) override; + virtual DECLARE_WRITE8_MEMBER(scs_write) override; + virtual void device_add_mconfig(machine_config &config) override; // methods virtual void update_lines() override; @@ -121,7 +121,7 @@ static SLOT_INTERFACE_START( coco_fdc_floppies ) SLOT_INTERFACE("qd", FLOPPY_525_QD) SLOT_INTERFACE_END -static MACHINE_CONFIG_START(coco_fdc) +MACHINE_CONFIG_MEMBER(coco_fdc_device_base::device_add_mconfig ) MCFG_WD1773_ADD(WD_TAG, XTAL_8MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(coco_fdc_device_base, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(coco_fdc_device_base, fdc_drq_w)) @@ -217,17 +217,6 @@ coco_fdc_device_base::rtc_type coco_fdc_device_base::real_time_clock() //------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor coco_fdc_device_base::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME(coco_fdc); -} - - -//------------------------------------------------- // update_lines - CoCo specific disk // controller lines //------------------------------------------------- @@ -269,12 +258,11 @@ void coco_fdc_device_base::dskreg_w(uint8_t data) data); } - /* An email from John Kowalski informed me that if the DS3 is - * high, and one of the other drive bits is selected (DS0-DS2), then the - * second side of DS0, DS1, or DS2 is selected. If multiple bits are - * selected in other situations, then both drives are selected, and any - * read signals get yucky. - */ + // An email from John Kowalski informed me that if the DS3 is + // high, and one of the other drive bits is selected (DS0-DS2), then the + // second side of DS0, DS1, or DS2 is selected. If multiple bits are + // selected in other situations, then both drives are selected, and any + // read signals get yucky. if (data & 0x04) drive = 2; @@ -289,7 +277,7 @@ void coco_fdc_device_base::dskreg_w(uint8_t data) { floppy_image_device *floppy = m_floppies[i]->get_device(); if (floppy) - floppy->mon_w(i == drive ? CLEAR_LINE : ASSERT_LINE); + floppy->mon_w(((i == drive) && (data & 0x08)) ? CLEAR_LINE : ASSERT_LINE); } head = ((data & 0x40) && (drive != 3)) ? 1 : 0; @@ -309,14 +297,14 @@ void coco_fdc_device_base::dskreg_w(uint8_t data) //------------------------------------------------- -// read +// scs_read //------------------------------------------------- -READ8_MEMBER(coco_fdc_device_base::read) +READ8_MEMBER(coco_fdc_device_base::scs_read) { uint8_t result = 0; - switch(offset & 0xEF) + switch(offset & 0x1F) { case 8: result = m_wd17xx->status_r(space, 0); @@ -333,38 +321,37 @@ READ8_MEMBER(coco_fdc_device_base::read) } /* other stuff for RTCs */ - switch(offset) + switch (offset) { - case 0x10: /* FF50 */ - if (real_time_clock() == rtc_type::DISTO) - result = m_disto_msm6242->read(space,m_msm6242_rtc_address); - break; - - case 0x38: /* FF78 */ - if (real_time_clock() == rtc_type::CLOUD9) - m_ds1315->read_0(space, offset); - break; - - case 0x39: /* FF79 */ - if (real_time_clock() == rtc_type::CLOUD9) - m_ds1315->read_1(space, offset); - break; - - case 0x3C: /* FF7C */ - if (real_time_clock() == rtc_type::CLOUD9) - result = m_ds1315->read_data(space, offset); - break; + case 0x10: /* FF50 */ + if (real_time_clock() == rtc_type::DISTO) + result = m_disto_msm6242->read(space, m_msm6242_rtc_address); + break; + + case 0x38: /* FF78 */ + if (real_time_clock() == rtc_type::CLOUD9) + m_ds1315->read_0(space, offset); + break; + + case 0x39: /* FF79 */ + if (real_time_clock() == rtc_type::CLOUD9) + m_ds1315->read_1(space, offset); + break; + + case 0x3C: /* FF7C */ + if (real_time_clock() == rtc_type::CLOUD9) + result = m_ds1315->read_data(space, offset); + break; } return result; } - //------------------------------------------------- -// write +// scs_write //------------------------------------------------- -WRITE8_MEMBER(coco_fdc_device_base::write) +WRITE8_MEMBER(coco_fdc_device_base::scs_write) { switch(offset & 0x1F) { @@ -382,7 +369,6 @@ WRITE8_MEMBER(coco_fdc_device_base::write) m_wd17xx->sector_w(space, 0, data); break; case 11: - //printf("data w %02x\n", data); m_wd17xx->data_w(space, 0, data); break; }; diff --git a/src/devices/bus/coco/coco_fdc.h b/src/devices/bus/coco/coco_fdc.h index c596dfeef33..dfd78f813f8 100644 --- a/src/devices/bus/coco/coco_fdc.h +++ b/src/devices/bus/coco/coco_fdc.h @@ -4,7 +4,7 @@ coco_fdc.h - CoCo/Dragon Floppy Disk Controller + CoCo/Dragon Floppy Disk Controller base classes *********************************************************************/ @@ -74,14 +74,4 @@ private: bool m_drq; }; -// device type definitions - CoCo FDC -extern const device_type COCO_FDC; -extern const device_type COCO_FDC_V11; -extern const device_type COCO3_HDB1; -extern const device_type CP400_FDC; - -// device type definitions - Dragon FDC -extern const device_type DRAGON_FDC; -extern const device_type SDTANDY_FDC; - #endif // MAME_BUS_COCO_COCO_FDC_H diff --git a/src/devices/bus/coco/coco_gmc.cpp b/src/devices/bus/coco/coco_gmc.cpp index 9e05673f2ca..8e9ac52d4a9 100644 --- a/src/devices/bus/coco/coco_gmc.cpp +++ b/src/devices/bus/coco/coco_gmc.cpp @@ -17,17 +17,45 @@ ***************************************************************************/ #include "emu.h" -#include "coco_gmc.h" +#include "coco_pak.h" +#include "sound/sn76496.h" #include "speaker.h" #define SN76489AN_TAG "gmc_psg" -static MACHINE_CONFIG_START(cocopak_gmc) +//************************************************************************** +// TYPE DECLARATIONS +//************************************************************************** + +namespace +{ + // ======================> coco_pak_banked_device + + class coco_pak_gmc_device : + public coco_pak_banked_device + { + public: + // construction/destruction + coco_pak_gmc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + virtual void device_add_mconfig(machine_config &config) override; + + protected: + // device-level overrides + virtual DECLARE_WRITE8_MEMBER(scs_write) override; + + private: + required_device<sn76489a_device> m_psg; + }; +}; + + +MACHINE_CONFIG_MEMBER(coco_pak_gmc_device::device_add_mconfig) MCFG_SPEAKER_STANDARD_MONO("gmc_speaker") MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, XTAL_4MHz) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "gmc_speaker", 1.0) MACHINE_CONFIG_END + //************************************************************************** // GLOBAL VARIABLES //************************************************************************** @@ -44,27 +72,18 @@ coco_pak_gmc_device::coco_pak_gmc_device(const machine_config &mconfig, const ch { } -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor coco_pak_gmc_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( cocopak_gmc ); -} //------------------------------------------------- -// write +// scs_write //------------------------------------------------- -WRITE8_MEMBER(coco_pak_gmc_device::write) +WRITE8_MEMBER(coco_pak_gmc_device::scs_write) { switch(offset) { case 0: /* set the bank */ - coco_pak_banked_device::write(space,offset,data,mem_mask); + coco_pak_banked_device::scs_write(space, offset, data, mem_mask); break; case 1: m_psg->write(data); diff --git a/src/devices/bus/coco/coco_gmc.h b/src/devices/bus/coco/coco_gmc.h deleted file mode 100644 index df2dbb255c8..00000000000 --- a/src/devices/bus/coco/coco_gmc.h +++ /dev/null @@ -1,32 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:tim lindner -#ifndef MAME_DEVICES_BUS_COCO_COCO_GMC_H -#define MAME_DEVICES_BUS_COCO_COCO_GMC_H - -#pragma once - -#include "coco_pak.h" -#include "sound/sn76496.h" - -// ======================> coco_pak_banked_device - -class coco_pak_gmc_device : - public coco_pak_banked_device -{ -public: - // construction/destruction - coco_pak_gmc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - virtual machine_config_constructor device_mconfig_additions() const override; - -protected: - // device-level overrides - virtual DECLARE_WRITE8_MEMBER(write) override; -private: - required_device<sn76489a_device> m_psg; -}; - - -// device type definition -DECLARE_DEVICE_TYPE(COCO_PAK_GMC, coco_pak_gmc_device) - -#endif // MAME_DEVICES_BUS_COCO_COCO_GMC_H diff --git a/src/devices/bus/coco/coco_multi.cpp b/src/devices/bus/coco/coco_multi.cpp index 48ab877e71a..cacb78f1bb5 100644 --- a/src/devices/bus/coco/coco_multi.cpp +++ b/src/devices/bus/coco/coco_multi.cpp @@ -54,12 +54,7 @@ ***************************************************************************/ #include "emu.h" -#include "coco_multi.h" -#include "coco_232.h" -#include "coco_orch90.h" -#include "coco_gmc.h" -#include "coco_pak.h" -#include "coco_fdc.h" +#include "cococart.h" #define SLOT1_TAG "slot1" #define SLOT2_TAG "slot2" @@ -67,14 +62,85 @@ #define SLOT4_TAG "slot4" +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> coco_multipak_device + +namespace +{ + class coco_multipak_device + : public device_t + , public device_cococart_interface + , public device_cococart_host_interface + { + public: + // construction/destruction + coco_multipak_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + virtual uint8_t* get_cart_base() override; + + // these are only public so they can be in a MACHINE_CONFIG_START + // declaration; don't think about them as publically accessable + DECLARE_WRITE_LINE_MEMBER(multi_slot1_cart_w); + DECLARE_WRITE_LINE_MEMBER(multi_slot1_nmi_w); + DECLARE_WRITE_LINE_MEMBER(multi_slot1_halt_w); + DECLARE_WRITE_LINE_MEMBER(multi_slot2_cart_w); + DECLARE_WRITE_LINE_MEMBER(multi_slot2_nmi_w); + DECLARE_WRITE_LINE_MEMBER(multi_slot2_halt_w); + DECLARE_WRITE_LINE_MEMBER(multi_slot3_cart_w); + DECLARE_WRITE_LINE_MEMBER(multi_slot3_nmi_w); + DECLARE_WRITE_LINE_MEMBER(multi_slot3_halt_w); + DECLARE_WRITE_LINE_MEMBER(multi_slot4_cart_w); + DECLARE_WRITE_LINE_MEMBER(multi_slot4_nmi_w); + DECLARE_WRITE_LINE_MEMBER(multi_slot4_halt_w); + + virtual address_space &cartridge_space() override; + + protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + virtual READ8_MEMBER(scs_read) override; + virtual WRITE8_MEMBER(scs_write) override; + virtual void set_sound_enable(bool sound_enable) override; + + private: + // device references + required_device_array<cococart_slot_device, 4> m_slots; + + // internal state + uint8_t m_select; + + // internal accessors + cococart_slot_device &owning_slot(); + int active_scs_slot_number() const; + int active_cts_slot_number() const; + cococart_slot_device &slot(int slot_number); + cococart_slot_device &active_scs_slot(); + cococart_slot_device &active_cts_slot(); + + // methods + void set_select(uint8_t new_select); + DECLARE_WRITE8_MEMBER(ff7f_write); + void update_line(int slot_number, cococart_slot_device::line line); + }; +}; + /*************************************************************************** IMPLEMENTATION ***************************************************************************/ static SLOT_INTERFACE_START(coco_cart_slot1_3) - SLOT_INTERFACE("rs232", COCO_232) + SLOT_INTERFACE("rs232", COCO_RS232) + SLOT_INTERFACE("dcmodem", COCO_DCMODEM) SLOT_INTERFACE("orch90", COCO_ORCH90) + SLOT_INTERFACE("ssc", COCO_SSC) MCFG_SLOT_OPTION_CLOCK("ssc", DERIVED_CLOCK(1, 1)) SLOT_INTERFACE("games_master", COCO_PAK_GMC) SLOT_INTERFACE("banked_16k", COCO_PAK_BANKED) SLOT_INTERFACE("pak", COCO_PAK) @@ -82,15 +148,17 @@ SLOT_INTERFACE_END static SLOT_INTERFACE_START(coco_cart_slot4) SLOT_INTERFACE("cc3hdb1", COCO3_HDB1) SLOT_INTERFACE("fdcv11", COCO_FDC_V11) - SLOT_INTERFACE("rs232", COCO_232) + SLOT_INTERFACE("rs232", COCO_RS232) + SLOT_INTERFACE("dcmodem", COCO_DCMODEM) SLOT_INTERFACE("orch90", COCO_ORCH90) + SLOT_INTERFACE("ssc", COCO_SSC) MCFG_SLOT_OPTION_CLOCK("ssc", DERIVED_CLOCK(1, 1)) SLOT_INTERFACE("games_master", COCO_PAK_GMC) SLOT_INTERFACE("banked_16k", COCO_PAK_BANKED) SLOT_INTERFACE("pak", COCO_PAK) SLOT_INTERFACE_END -static MACHINE_CONFIG_START(coco_multi) +MACHINE_CONFIG_MEMBER(coco_multipak_device::device_add_mconfig) MCFG_COCO_CARTRIDGE_ADD(SLOT1_TAG, coco_cart_slot1_3, nullptr) MCFG_COCO_CARTRIDGE_CART_CB(DEVWRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot1_cart_w)) MCFG_COCO_CARTRIDGE_NMI_CB(DEVWRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot1_nmi_w)) @@ -141,8 +209,7 @@ coco_multipak_device::coco_multipak_device(const machine_config &mconfig, const void coco_multipak_device::device_start() { // install $FF7F handler - write8_delegate wh = write8_delegate(FUNC(coco_multipak_device::ff7f_write), this); - machine().device(":maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xFF7F, 0xFF7F, wh); + install_write_handler(0xFF7F, 0xFF7F, write8_delegate(FUNC(coco_multipak_device::ff7f_write), this)); // initial state m_select = 0xFF; @@ -162,17 +229,6 @@ void coco_multipak_device::device_reset() } -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor coco_multipak_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( coco_multi ); -} - - //************************************************************************** // INTERNAL ACCESSORS //************************************************************************** @@ -330,22 +386,22 @@ uint8_t* coco_multipak_device::get_cart_base() //------------------------------------------------- -// read +// scs_read //------------------------------------------------- -READ8_MEMBER(coco_multipak_device::read) +READ8_MEMBER(coco_multipak_device::scs_read) { - return active_scs_slot().read(space, offset); + return active_scs_slot().scs_read(space, offset); } //------------------------------------------------- -// write +// scs_write //------------------------------------------------- -WRITE8_MEMBER(coco_multipak_device::write) +WRITE8_MEMBER(coco_multipak_device::scs_write) { - active_scs_slot().write(space, offset, data); + active_scs_slot().scs_write(space, offset, data); } @@ -365,3 +421,13 @@ WRITE_LINE_MEMBER(coco_multipak_device::multi_slot3_halt_w) { update_line(3, coc WRITE_LINE_MEMBER(coco_multipak_device::multi_slot4_cart_w) { update_line(4, cococart_slot_device::line::CART); } WRITE_LINE_MEMBER(coco_multipak_device::multi_slot4_nmi_w) { update_line(4, cococart_slot_device::line::NMI); } WRITE_LINE_MEMBER(coco_multipak_device::multi_slot4_halt_w) { update_line(4, cococart_slot_device::line::HALT); } + + +//------------------------------------------------- +// cartridge_space +//------------------------------------------------- + +address_space &coco_multipak_device::cartridge_space() +{ + return device_cococart_interface::cartridge_space(); +} diff --git a/src/devices/bus/coco/coco_multi.h b/src/devices/bus/coco/coco_multi.h deleted file mode 100644 index 7f5fc1d4ccb..00000000000 --- a/src/devices/bus/coco/coco_multi.h +++ /dev/null @@ -1,87 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - coco_multi.h - - Multi-Pak interface emulation - -***************************************************************************/ - -#ifndef MAME_BUS_COCO_COCO_MULTI_H -#define MAME_BUS_COCO_COCO_MULTI_H - -#pragma once - -#include "cococart.h" - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> coco_multipak_device - -class coco_multipak_device : - public device_t, - public device_cococart_interface -{ -public: - // construction/destruction - coco_multipak_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const override; - - virtual uint8_t* get_cart_base() override; - - // these are only public so they can be in a MACHINE_CONFIG_START - // declaration; don't think about them as publically accessable - DECLARE_WRITE_LINE_MEMBER(multi_slot1_cart_w); - DECLARE_WRITE_LINE_MEMBER(multi_slot1_nmi_w); - DECLARE_WRITE_LINE_MEMBER(multi_slot1_halt_w); - DECLARE_WRITE_LINE_MEMBER(multi_slot2_cart_w); - DECLARE_WRITE_LINE_MEMBER(multi_slot2_nmi_w); - DECLARE_WRITE_LINE_MEMBER(multi_slot2_halt_w); - DECLARE_WRITE_LINE_MEMBER(multi_slot3_cart_w); - DECLARE_WRITE_LINE_MEMBER(multi_slot3_nmi_w); - DECLARE_WRITE_LINE_MEMBER(multi_slot3_halt_w); - DECLARE_WRITE_LINE_MEMBER(multi_slot4_cart_w); - DECLARE_WRITE_LINE_MEMBER(multi_slot4_nmi_w); - DECLARE_WRITE_LINE_MEMBER(multi_slot4_halt_w); - -protected: - // device-level overrides - virtual void device_start() override; - virtual void device_reset() override; - virtual DECLARE_READ8_MEMBER(read) override; - virtual DECLARE_WRITE8_MEMBER(write) override; - virtual void set_sound_enable(bool sound_enable) override; - -private: - // device references - required_device_array<cococart_slot_device, 4> m_slots; - - // internal state - uint8_t m_select; - - // internal accessors - cococart_slot_device &owning_slot(); - int active_scs_slot_number() const; - int active_cts_slot_number() const; - cococart_slot_device &slot(int slot_number); - cococart_slot_device &active_scs_slot(); - cococart_slot_device &active_cts_slot(); - - // methods - void set_select(uint8_t new_select); - DECLARE_WRITE8_MEMBER(ff7f_write); - void update_line(int slot_number, cococart_slot_device::line line); -}; - - -// device type definition -DECLARE_DEVICE_TYPE(COCO_MULTIPAK, coco_multipak_device) - -#endif // MAME_BUS_COCO_COCO_MULTI_H diff --git a/src/devices/bus/coco/coco_orch90.cpp b/src/devices/bus/coco/coco_orch90.cpp index 50ea7934dea..1466f8c9131 100644 --- a/src/devices/bus/coco/coco_orch90.cpp +++ b/src/devices/bus/coco/coco_orch90.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nathan Woods /*************************************************************************** - orch90.c + coco_orch90.cpp Code for emulating the CoCo Orch-90 (Orchestra 90) sound cartridge @@ -13,75 +13,98 @@ ***************************************************************************/ #include "emu.h" -#include "coco_orch90.h" +#include "cococart.h" +#include "sound/dac.h" #include "sound/volt_reg.h" #include "speaker.h" -static MACHINE_CONFIG_START(coco_orch90) - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("ldac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.5) // ls374.ic5 + r7 (8x20k) + r9 (8x10k) - MCFG_SOUND_ADD("rdac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) // ls374.ic4 + r6 (8x20k) + r8 (8x10k) - 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 - //************************************************************************** -// GLOBAL VARIABLES +// ROM DECLARATIONS //************************************************************************** -DEFINE_DEVICE_TYPE(COCO_ORCH90, coco_orch90_device, "coco_orch90", "CoCo Orch-90 PAK") +ROM_START(coco_orch90) + ROM_REGION(0x2000, "eprom", ROMREGION_ERASE00) + ROM_LOAD("orchestra 90 (1984)(26 - 3143)(tandy).rom", 0x0000, 0x2000, CRC(15fb39af) SHA1(6a20fee9c70b36a6435ac8378f31d5b626017df0)) +ROM_END + //************************************************************************** -// LIVE DEVICE +// ORCH90 DEVICE CLASS //************************************************************************** -//------------------------------------------------- -// coco_orch90_device - constructor -//------------------------------------------------- - -coco_orch90_device::coco_orch90_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, COCO_ORCH90, tag, owner, clock) - , device_cococart_interface(mconfig, *this ) - , m_ldac(*this, "ldac") - , m_rdac(*this, "rdac") +namespace { -} + // ======================> coco_orch90_device -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- + class coco_orch90_device : + public device_t, + public device_cococart_interface + { + public: + // construction/destruction + coco_orch90_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, COCO_ORCH90, tag, owner, clock) + , device_cococart_interface(mconfig, *this) + , m_ldac(*this, "ldac") + , m_rdac(*this, "rdac") + { + } + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + protected: + // device-level overrides + virtual void device_start() override + { + // install handlers + install_write_handler(0xFF7A, 0xFF7A, write8_delegate(FUNC(coco_orch90_device::write_left), this)); + install_write_handler(0xFF7B, 0xFF7B, write8_delegate(FUNC(coco_orch90_device::write_right), this)); + + // Orch-90 ties CART to Q + set_line_value(cococart_slot_device::line::CART, cococart_slot_device::line_value::Q); + } + + virtual const tiny_rom_entry *device_rom_region() const override + { + return ROM_NAME(coco_orch90); + } + + // CoCo cartridge level overrides + virtual uint8_t *get_cart_base() override + { + return memregion("eprom")->base(); + } + + private: + WRITE8_MEMBER(write_left) { m_ldac->write(data); } + WRITE8_MEMBER(write_right) { m_rdac->write(data); } + + // internal state + required_device<dac_byte_interface> m_ldac; + required_device<dac_byte_interface> m_rdac; + }; +}; -void coco_orch90_device::device_start() -{ -} -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- +//************************************************************************** +// MACHINE AND ROM DECLARATIONS +//************************************************************************** -machine_config_constructor coco_orch90_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( coco_orch90 ); -} +MACHINE_CONFIG_MEMBER(coco_orch90_device::device_add_mconfig) + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("ldac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.5) // ls374.ic5 + r7 (8x20k) + r9 (8x10k) + MCFG_SOUND_ADD("rdac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) // ls374.ic4 + r6 (8x20k) + r8 (8x10k) + 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 -/*------------------------------------------------- - write --------------------------------------------------*/ -WRITE8_MEMBER(coco_orch90_device::write) -{ - switch(offset) - { - case 0x3A: - m_ldac->write(data); - break; - - case 0x3B: - m_rdac->write(data); - break; - } -} +//************************************************************************** +// DEVICE DECLARATION +//************************************************************************** + +DEFINE_DEVICE_TYPE(COCO_ORCH90, coco_orch90_device, "coco_orch90", "CoCo Orch-90 PAK") diff --git a/src/devices/bus/coco/coco_orch90.h b/src/devices/bus/coco/coco_orch90.h deleted file mode 100644 index ceed461ba36..00000000000 --- a/src/devices/bus/coco/coco_orch90.h +++ /dev/null @@ -1,41 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -#ifndef MAME_BUS_COCO_COCO_ORCH90_H -#define MAME_BUS_COCO_COCO_ORCH90_H - -#pragma once - -#include "cococart.h" -#include "sound/dac.h" - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> coco_orch90_device - -class coco_orch90_device : - public device_t, - public device_cococart_interface -{ -public: - // construction/destruction - coco_orch90_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const override; -protected: - // device-level overrides - virtual void device_start() override; - virtual DECLARE_WRITE8_MEMBER(write) override; -private: - // internal state - required_device<dac_byte_interface> m_ldac; - required_device<dac_byte_interface> m_rdac; -}; - - -// device type definition -DECLARE_DEVICE_TYPE(COCO_ORCH90, coco_orch90_device) - -#endif // MAME_BUS_COCO_COCO_ORCH90_H diff --git a/src/devices/bus/coco/coco_pak.cpp b/src/devices/bus/coco/coco_pak.cpp index b413268b550..b47a6060150 100644 --- a/src/devices/bus/coco/coco_pak.cpp +++ b/src/devices/bus/coco/coco_pak.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nathan Woods /*************************************************************************** - coco_pak.c + coco_pak.cpp Code for emulating standard CoCo cartridges @@ -14,13 +14,11 @@ #define CARTSLOT_TAG "cart" #define CART_AUTOSTART_TAG "cart_autostart" + /*************************************************************************** IMPLEMENTATION ***************************************************************************/ -static MACHINE_CONFIG_START(coco_pak) -MACHINE_CONFIG_END - ROM_START( coco_pak ) ROM_REGION(0x8000, CARTSLOT_TAG, ROMREGION_ERASE00) // this region is filled by cococart_slot_device::call_load() @@ -55,7 +53,7 @@ DEFINE_DEVICE_TYPE(COCO_PAK, coco_pak_device, "cocopak", "CoCo Program PAK") coco_pak_device::coco_pak_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) , device_cococart_interface(mconfig, *this) - , m_cart(nullptr), m_owner(nullptr), m_autostart(*this, CART_AUTOSTART_TAG) + , m_cart(nullptr), m_autostart(*this, CART_AUTOSTART_TAG) { } @@ -74,15 +72,6 @@ void coco_pak_device::device_start() m_owner = dynamic_cast<cococart_slot_device *>(owner()); } -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor coco_pak_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( coco_pak ); -} //------------------------------------------------- // input_ports - device-specific input ports @@ -115,7 +104,7 @@ void coco_pak_device::device_reset() : cococart_slot_device::line_value::CLEAR; // normal CoCo PAKs tie their CART line to Q - the system clock - m_owner->set_line_value(cococart_slot_device::line::CART, cart_line); + set_line_value(cococart_slot_device::line::CART, cart_line); } } @@ -188,16 +177,17 @@ void coco_pak_banked_device::banked_pak_set_bank(uint32_t bank) } } -/*------------------------------------------------- - write --------------------------------------------------*/ -WRITE8_MEMBER(coco_pak_banked_device::write) +//------------------------------------------------- +// scs_write +//------------------------------------------------- + +WRITE8_MEMBER(coco_pak_banked_device::scs_write) { switch(offset) { case 0: - /* set the bank */ + // set the bank banked_pak_set_bank(data); break; } diff --git a/src/devices/bus/coco/coco_pak.h b/src/devices/bus/coco/coco_pak.h index bd349167318..68a50ae9c27 100644 --- a/src/devices/bus/coco/coco_pak.h +++ b/src/devices/bus/coco/coco_pak.h @@ -22,7 +22,6 @@ public: coco_pak_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const override; virtual const tiny_rom_entry *device_rom_region() const override; virtual ioport_constructor device_input_ports() const override; @@ -37,15 +36,11 @@ protected: // internal state device_image_interface *m_cart; - cococart_slot_device *m_owner; optional_ioport m_autostart; }; -// device type definition -DECLARE_DEVICE_TYPE(COCO_PAK, coco_pak_device) - // ======================> coco_pak_banked_device class coco_pak_banked_device : public coco_pak_device @@ -59,13 +54,10 @@ protected: // device-level overrides virtual void device_reset() override; - virtual DECLARE_WRITE8_MEMBER(write) override; + virtual DECLARE_WRITE8_MEMBER(scs_write) override; + private: void banked_pak_set_bank(uint32_t bank); }; - -// device type definition -DECLARE_DEVICE_TYPE(COCO_PAK_BANKED, coco_pak_banked_device) - #endif // MAME_BUS_COCO_COCO_PAK_H diff --git a/src/devices/bus/coco/coco_rs232.cpp b/src/devices/bus/coco/coco_rs232.cpp new file mode 100644 index 00000000000..bee862b3a5f --- /dev/null +++ b/src/devices/bus/coco/coco_rs232.cpp @@ -0,0 +1,78 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + coco_rs232.cpp + + Code for emulating the CoCo RS-232 PAK + +***************************************************************************/ + +#include "emu.h" +#include "cococart.h" +#include "machine/mos6551.h" + + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define UART_TAG "uart" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> coco_rs232_device + +namespace +{ + class coco_rs232_device : + public device_t, + public device_cococart_interface + { + public: + // construction/destruction + coco_rs232_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, COCO_RS232, tag, owner, clock) + , device_cococart_interface(mconfig, *this) + , m_uart(*this, UART_TAG) + { + } + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + + protected: + // device-level overrides + virtual void device_start() override + { + install_readwrite_handler(0xFF68, 0xFF6B, + read8_delegate(FUNC(mos6551_device::read), (mos6551_device *)m_uart), + write8_delegate(FUNC(mos6551_device::write), (mos6551_device *)m_uart)); + } + + private: + // internal state + required_device<mos6551_device> m_uart; + }; +}; + + +/*************************************************************************** +IMPLEMENTATION +***************************************************************************/ + +MACHINE_CONFIG_MEMBER(coco_rs232_device::device_add_mconfig) + MCFG_DEVICE_ADD(UART_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) +MACHINE_CONFIG_END + + +//************************************************************************** +// DEVICE DECLARATION +//************************************************************************** + +DEFINE_DEVICE_TYPE(COCO_RS232, coco_rs232_device, "coco_rs232", "CoCo RS-232 PAK") diff --git a/src/devices/bus/coco/coco_ssc.cpp b/src/devices/bus/coco/coco_ssc.cpp new file mode 100644 index 00000000000..d3bd20fd9af --- /dev/null +++ b/src/devices/bus/coco/coco_ssc.cpp @@ -0,0 +1,562 @@ +// license:BSD-3-Clause +// copyright-holders:tim lindner +/*************************************************************************** + + coco_ssc.cpp + + Code for emulating the CoCo Speech / Sound Cartridge + + The SSC was a complex sound cartridge. A TMS-7040 microcontroller, + SPO256-AL2 speech processor, AY-3-8913 programable sound generator, and + 2K of RAM. + + All four ports of the microcontroller are under software control. + + Port A is input from the host CPU. + Port B is A0-A7 for the 2k of RAM. + Port C is the internal bus controller: + bit 7 6 5 4 3 2 1 0 + | | | | | | | | + | | | | | | | + A8 for RAM and BC1 of AY3-8913 + | | | | | | +-- A9 for RAM + | | | | | +---- A10 for RAM + | | | | +------ R/W* for RAM and BDIR for AY3-8913 + | | | +-------- CS* for RAM + | | +---------- ALD* for SP0256 + | +------------ CS* for AY3-8913 + +-------------- BUSY* for host CPU (connects to a latch) + * – Active low + Port D is the 8-bit data bus. + +***************************************************************************/ + +#include "emu.h" +#include "sound/ay8910.h" +#include "sound/sp0256.h" +#include "machine/netlist.h" +#include "netlist/devices/net_lib.h" +#include "cpu/tms7000/tms7000.h" +#include "speaker.h" +#include "cococart.h" +#include "machine/ram.h" + +#define LOG_SSC 0 +#define PIC_TAG "pic7040" +#define AY_TAG "cocossc_ay" +#define SP0256_TAG "sp0256" + +#define SP0256_GAIN 1.75 +#define AY8913_GAIN 2.0 + +#define C_A8 0x01 +#define C_BC1 0x01 +#define C_A9 0x02 +#define C_A10 0x04 +#define C_RRW 0x08 +#define C_BDR 0x08 +#define C_RCS 0x10 +#define C_ALD 0x20 +#define C_ACS 0x40 +#define C_BSY 0x80 + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +namespace +{ + class cocossc_sac_device; + + // ======================> coco_ssc_device + + class coco_ssc_device : + public device_t, + public device_cococart_interface + { + public: + // construction/destruction + coco_ssc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual const tiny_rom_entry *device_rom_region() const override; + virtual void device_add_mconfig(machine_config &config) override; + virtual void device_reset() override; + + DECLARE_READ8_MEMBER(ssc_port_a_r); + DECLARE_WRITE8_MEMBER(ssc_port_b_w); + DECLARE_READ8_MEMBER(ssc_port_c_r); + DECLARE_WRITE8_MEMBER(ssc_port_c_w); + DECLARE_READ8_MEMBER(ssc_port_d_r); + DECLARE_WRITE8_MEMBER(ssc_port_d_w); + + protected: + // device-level overrides + virtual void device_start() override; + virtual DECLARE_READ8_MEMBER(ff7d_read); + virtual DECLARE_WRITE8_MEMBER(ff7d_write); + virtual void set_sound_enable(bool sound_enable) override; + private: + uint8_t m_reset_line; + bool m_host_busy; + uint8_t m_tms7000_porta; + uint8_t m_tms7000_portb; + uint8_t m_tms7000_portc; + uint8_t m_tms7000_portd; + required_device<cpu_device> m_tms7040; + required_device<ram_device> m_staticram; + required_device<ay8910_device> m_ay; + required_device<sp0256_device> m_spo; + required_device<cocossc_sac_device> m_sac; + }; + + // ======================> Color Computer Sound Activity Circuit filter + + class cocossc_sac_device : public device_t, + public device_sound_interface + { + public: + cocossc_sac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + ~cocossc_sac_device() { } + bool sound_activity_circuit_output(); + + protected: + // device-level overrides + virtual void device_start() override; + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; + + private: + sound_stream* m_stream; + double m_rms[16]; + int m_index; + }; +}; + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(COCO_SSC, coco_ssc_device, "coco_ssc", "CoCo S/SC PAK"); +DEFINE_DEVICE_TYPE(COCOSSC_SAC, cocossc_sac_device, "cocossc_sac", "CoCo SSC Sound Activity Circuit"); + + +//************************************************************************** +// MACHINE FRAGMENTS AND ADDRESS MAPS +//************************************************************************** + +static ADDRESS_MAP_START(ssc_io_map, AS_IO, 8, coco_ssc_device) + AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(ssc_port_a_r) + AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(ssc_port_b_w) + AM_RANGE(TMS7000_PORTC, TMS7000_PORTC) AM_READWRITE(ssc_port_c_r, ssc_port_c_w) + AM_RANGE(TMS7000_PORTD, TMS7000_PORTD) AM_READWRITE(ssc_port_d_r, ssc_port_d_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ssc_rom, AS_PROGRAM, 8, coco_ssc_device) + AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(PIC_TAG, 0) +ADDRESS_MAP_END + +MACHINE_CONFIG_MEMBER(coco_ssc_device::device_add_mconfig) + MCFG_CPU_ADD(PIC_TAG, TMS7040, DERIVED_CLOCK(1, 2)) + MCFG_CPU_PROGRAM_MAP(ssc_rom) + MCFG_CPU_IO_MAP(ssc_io_map) + + MCFG_RAM_ADD("staticram") + MCFG_RAM_DEFAULT_SIZE("2K") + MCFG_RAM_DEFAULT_VALUE(0x00) + + MCFG_SPEAKER_STANDARD_MONO("ssc_audio") + + MCFG_SOUND_ADD(SP0256_TAG, SP0256, XTAL_3_12MHz) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "ssc_audio", SP0256_GAIN) + MCFG_SP0256_DATA_REQUEST_CB(INPUTLINE(PIC_TAG, TMS7000_INT1_LINE)) + + MCFG_SOUND_ADD(AY_TAG, AY8913, DERIVED_CLOCK(1, 2)) + MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "coco_sac_tag", AY8913_GAIN) + + MCFG_DEVICE_ADD("coco_sac_tag", COCOSSC_SAC, DERIVED_CLOCK(1, 2)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "ssc_audio", 1.0) +MACHINE_CONFIG_END + +ROM_START(coco_ssc) + ROM_REGION(0x1000, PIC_TAG, 0) + ROM_LOAD("pic-7040-510.bin", 0x0000, 0x1000, CRC(a8e2eb98) SHA1(7c17dcbc21757535ce0b3a9e1ce5ca61319d3606)) // pic7040 cpu rom + ROM_REGION(0x10000, SP0256_TAG, 0) + ROM_LOAD("sp0256-al2.bin", 0x1000, 0x0800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc)) +ROM_END + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// coco_ssc_device - constructor +//------------------------------------------------- + +coco_ssc_device::coco_ssc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, COCO_SSC, tag, owner, clock), + device_cococart_interface(mconfig, *this ), + m_tms7040(*this, PIC_TAG), + m_staticram(*this, "staticram"), + m_ay(*this, AY_TAG), + m_spo(*this, SP0256_TAG), + m_sac(*this, "coco_sac_tag") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void coco_ssc_device::device_start() +{ + // install $FF7D-E handler + write8_delegate wh = write8_delegate(FUNC(coco_ssc_device::ff7d_write), this); + read8_delegate rh = read8_delegate(FUNC(coco_ssc_device::ff7d_read), this); + install_readwrite_handler(0xFF7D, 0xFF7E, rh, wh); + + save_item(NAME(m_reset_line)); + save_item(NAME(m_host_busy)); + save_item(NAME(m_tms7000_porta)); + save_item(NAME(m_tms7000_portb)); + save_item(NAME(m_tms7000_portc)); + save_item(NAME(m_tms7000_portd)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void coco_ssc_device::device_reset() +{ + m_reset_line = 0; + m_host_busy = false; +} + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const tiny_rom_entry *coco_ssc_device::device_rom_region() const +{ + return ROM_NAME( coco_ssc ); +} + + +//------------------------------------------------- +// set_sound_enable +//------------------------------------------------- + +void coco_ssc_device::set_sound_enable(bool sound_enable) +{ + if( sound_enable ) + { + m_sac->set_output_gain(0, 1.0); + m_spo->set_output_gain(0, 1.0); + } + else + { + m_sac->set_output_gain(0, 0.0); + m_spo->set_output_gain(0, 0.0); + } +} + +//------------------------------------------------- +// ff7d_read +//------------------------------------------------- + +READ8_MEMBER(coco_ssc_device::ff7d_read) +{ + uint8_t data = 0xff; + + switch(offset) + { + case 0x00: + data = 0xff; + + if (LOG_SSC) + { + logerror( "[%s] ff7d read: %02x\n", machine().describe_context(), data ); + } + break; + + case 0x01: + data = 0x1f; + + if( m_host_busy == false ) + { + data |= 0x80; + } + + if( m_spo->sby_r() ) + { + data |= 0x40; + } + + if( ! m_sac->sound_activity_circuit_output() ) + { + data |= 0x20; + } + + if (LOG_SSC) + { + logerror( "[%s] ff7e read: %c%c%c%c %c%c%c%c (%02x)\n", + machine().describe_context(), + data & 0x80 ? '.' : 'B', + data & 0x40 ? '.' : 'S', + data & 0x20 ? '.' : 'P', + data & 0x10 ? '.' : '1', + data & 0x08 ? '.' : '1', + data & 0x04 ? '.' : '1', + data & 0x02 ? '.' : '1', + data & 0x01 ? '.' : '1', + data ); + } + break; + } + + return data; +} + + +//------------------------------------------------- +// ff7d_write +//------------------------------------------------- + +WRITE8_MEMBER(coco_ssc_device::ff7d_write) +{ + switch(offset) + { + case 0x00: + if (LOG_SSC) + { + logerror( "[%s] ff7d write: %02x\n", machine().describe_context(), data ); + } + + if( (m_reset_line & 1) == 1 ) + { + if( (data & 1) == 0 ) + { + m_tms7040->reset(); + m_ay->reset(); + m_spo->reset(); + m_host_busy = false; + } + } + + m_reset_line = data; + break; + + case 0x01: + + if (LOG_SSC) + { + logerror( "[%s] ff7e write: %02x\n", machine().describe_context(), data ); + } + + m_tms7000_porta = data; + m_host_busy = true; + m_tms7040->set_input_line(TMS7000_INT3_LINE, ASSERT_LINE); + break; + } +} + + +//------------------------------------------------- +// Handlers for secondary CPU ports +//------------------------------------------------- + +READ8_MEMBER(coco_ssc_device::ssc_port_a_r) +{ + if (LOG_SSC) + { + logerror( "[%s] port a read: %02x\n", machine().describe_context(), m_tms7000_porta ); + } + + m_tms7040->set_input_line(TMS7000_INT3_LINE, CLEAR_LINE); + + return m_tms7000_porta; +} + +WRITE8_MEMBER(coco_ssc_device::ssc_port_b_w) +{ + if (LOG_SSC) + { + logerror( "[%s] port b write: %02x\n", machine().describe_context(), data ); + } + + m_tms7000_portb = data; +} + +READ8_MEMBER(coco_ssc_device::ssc_port_c_r) +{ + if (LOG_SSC) + { + logerror( "[%s] port c read: %02x\n", machine().describe_context(), m_tms7000_portc ); + } + + return m_tms7000_portc; +} + +WRITE8_MEMBER(coco_ssc_device::ssc_port_c_w) +{ + if( (data & C_RCS) == 0 && (data & C_RRW) == 0) /* static RAM write */ + { + uint16_t address = (uint16_t)data << 8; + address += m_tms7000_portb; + address &= 0x7ff; + + m_staticram->write(address, m_tms7000_portd); + } + + if( (data & C_ACS) == 0 ) /* chip select for AY-3-8913 */ + { + if( (data & (C_BDR|C_BC1)) == (C_BDR|C_BC1) ) /* BDIR = 1, BC1 = 1: latch address */ + { + m_ay->address_w(space, 0, m_tms7000_portd); + } + + if( ((data & C_BDR) == C_BDR) && ((data & C_BC1) == 0) ) /* BDIR = 1, BC1 = 0: write data */ + { + m_ay->data_w(space, 0, m_tms7000_portd); + } + } + + if( (data & C_ALD) == 0 ) + { + m_spo->ald_w(space, 0, m_tms7000_portd); + } + + if( (data & C_BSY) == 0 ) + { + m_host_busy = false; + } + + if (LOG_SSC) + { + logerror( "[%s] port c write: %c%c%c%c %c%c%c%c (%02x)\n", + machine().describe_context(), + data & 0x80 ? '.' : 'B', + data & 0x40 ? '.' : 'P', + data & 0x20 ? '.' : 'V', + data & 0x10 ? '.' : 'R', + data & 0x40 ? (data & 0x08 ? 'R' : 'W') : (data & 0x08 ? 'D' : '.'), + data & 0x04 ? '1' : '0', + data & 0x02 ? '1' : '0', + data & 0x40 ? (data & 0x01 ? '1' : '0') : (data & 0x01 ? 'C' : '.'), + data ); + } + + m_tms7000_portc = data; +} + +READ8_MEMBER(coco_ssc_device::ssc_port_d_r) +{ + if( ((m_tms7000_portc & C_RCS) == 0) && ((m_tms7000_portc & C_ACS) == 0)) + logerror( "[%s] Warning: Reading RAM and PSG at the same time!\n", machine().describe_context() ); + + if( ((m_tms7000_portc & C_RCS) == 0) && ((m_tms7000_portc & C_RRW) == C_RRW)) /* static ram chip select (low) and static ram chip read (high) */ + { + uint16_t address = (uint16_t)m_tms7000_portc << 8; + address += m_tms7000_portb; + address &= 0x7ff; + + m_tms7000_portd = m_staticram->read(address); + } + + if( (m_tms7000_portc & C_ACS) == 0 ) /* chip select for AY-3-8913 */ + { + if( ((m_tms7000_portc & C_BDR) == 0) && ((m_tms7000_portc & C_BC1) == C_BC1) ) /* psg read data */ + { + m_tms7000_portd = m_ay->data_r(space, 0); + } + } + + if (LOG_SSC) + { + logerror( "[%s] port d read: %02x\n", machine().describe_context(), m_tms7000_portd ); + } + + return m_tms7000_portd; +} + +WRITE8_MEMBER(coco_ssc_device::ssc_port_d_w) +{ + if (LOG_SSC) + { + logerror( "[%s] port d write: %02x\n", machine().describe_context(), data ); + } + + m_tms7000_portd = data; +} + + +//------------------------------------------------- +// cocossc_sac_device - constructor +//------------------------------------------------- + +cocossc_sac_device::cocossc_sac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, COCOSSC_SAC, tag, owner, clock), + device_sound_interface(mconfig, *this), + m_stream(nullptr), + m_index(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cocossc_sac_device::device_start() +{ + m_stream = stream_alloc(1, 1, machine().sample_rate()); +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void cocossc_sac_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + stream_sample_t *src = inputs[0]; + stream_sample_t *dst = outputs[0]; + + double n = samples; + + while (samples--) + { + m_rms[m_index] += ( (double)*src * (double)*src ); + *dst++ = (*src++); + } + + m_rms[m_index] = m_rms[m_index] / n; + m_rms[m_index] = sqrt(m_rms[m_index]); + + m_index++; + m_index &= 0x0f; +} + + +//------------------------------------------------- +// sound_activity_circuit_output - making sound +//------------------------------------------------- + +bool cocossc_sac_device::sound_activity_circuit_output() +{ + double average = m_rms[0] + m_rms[1] + m_rms[2] + m_rms[3] + m_rms[4] + + m_rms[5] + m_rms[6] + m_rms[7] + m_rms[8] + m_rms[9] + m_rms[10] + + m_rms[11] + m_rms[12] + m_rms[13] + m_rms[14] + m_rms[15]; + + average /= 16.0; + + if( average > 10400.0 ) + return true; + + return false; +} diff --git a/src/devices/bus/coco/coco_t4426.cpp b/src/devices/bus/coco/coco_t4426.cpp index 7e8b6baa655..262ff8b49ce 100644 --- a/src/devices/bus/coco/coco_t4426.cpp +++ b/src/devices/bus/coco/coco_t4426.cpp @@ -40,7 +40,10 @@ ***************************************************************************/ #include "emu.h" -#include "coco_t4426.h" +#include "cococart.h" +#include "machine/6850acia.h" +#include "machine/6821pia.h" + #define LOG_GENERAL 0x01 #define LOG_SETUP 0x02 @@ -75,11 +78,59 @@ #define CARTSLOT_TAG "t4426" #define CART_AUTOSTART_TAG "cart_autostart" +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +namespace +{ + // ======================> coco_t4426_device + + class coco_t4426_device : + public device_t, + public device_cococart_interface + { + public: + // construction/destruction + coco_t4426_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + virtual ioport_constructor device_input_ports() const override; + + virtual uint8_t* get_cart_base() override; + DECLARE_WRITE8_MEMBER(pia_A_w); + + protected: + coco_t4426_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // internal state + device_image_interface *m_cart; + cococart_slot_device *m_owner; + uint8_t m_select; + + optional_ioport m_autostart; + + virtual DECLARE_READ8_MEMBER(scs_read) override; + virtual DECLARE_WRITE8_MEMBER(scs_write) override; + private: + // internal state + required_device<acia6850_device> m_uart; + required_device<pia6821_device> m_pia; + }; +}; + + /*************************************************************************** IMPLEMENTATION ***************************************************************************/ -static MACHINE_CONFIG_START(coco_t4426) +MACHINE_CONFIG_MEMBER(coco_t4426_device::device_add_mconfig) MCFG_DEVICE_ADD(UART_TAG, ACIA6850, 0) // TODO: Figure out address mapping for ACIA MCFG_DEVICE_ADD(PIA_TAG, PIA6821, 0) MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_t4426_device, pia_A_w)) @@ -162,16 +213,6 @@ void coco_t4426_device::device_start() m_owner = dynamic_cast<cococart_slot_device *>(owner()); } -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor coco_t4426_device::device_mconfig_additions() const -{ - LOG("%s()\n", FUNCNAME ); - return MACHINE_CONFIG_NAME( coco_t4426 ); -} //------------------------------------------------- // rom_region - device-specific ROM region @@ -205,11 +246,11 @@ void coco_t4426_device::device_reset() } /*------------------------------------------------- - read + scs_read The 4426 cartridge PIA is located at ff44-ff47 -------------------------------------------------*/ -READ8_MEMBER(coco_t4426_device::read) +READ8_MEMBER(coco_t4426_device::scs_read) { uint8_t result = 0x00; @@ -223,11 +264,11 @@ READ8_MEMBER(coco_t4426_device::read) } /*------------------------------------------------- - write + scs_write The 4426 cartridge PIA is located at ff44-ff47 -------------------------------------------------*/ -WRITE8_MEMBER(coco_t4426_device::write) +WRITE8_MEMBER(coco_t4426_device::scs_write) { LOG("%s(%02x)\n", FUNCNAME, data); LOGSETUP(" * Offs:%02x <- %02x\n", offset, data); diff --git a/src/devices/bus/coco/coco_t4426.h b/src/devices/bus/coco/coco_t4426.h deleted file mode 100644 index 3d1aafacd7d..00000000000 --- a/src/devices/bus/coco/coco_t4426.h +++ /dev/null @@ -1,60 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -#ifndef MAME_BUS_COCO_T4426_H -#define MAME_BUS_COCO_T4426_H - -#pragma once - -#include "cococart.h" -#include "machine/6850acia.h" -#include "machine/6821pia.h" - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> coco_t4426_device - -class coco_t4426_device : - public device_t, - public device_cococart_interface -{ -public: - // construction/destruction - coco_t4426_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const override; - virtual const tiny_rom_entry *device_rom_region() const override; - virtual ioport_constructor device_input_ports() const override; - - virtual uint8_t* get_cart_base() override; - DECLARE_WRITE8_MEMBER( pia_A_w ); - -protected: - coco_t4426_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - - // device-level overrides - virtual void device_start() override; - virtual void device_reset() override; - - // internal state - device_image_interface *m_cart; - cococart_slot_device *m_owner; - uint8_t m_select; - - optional_ioport m_autostart; - - virtual DECLARE_READ8_MEMBER(read) override; - virtual DECLARE_WRITE8_MEMBER(write) override; -private: - // internal state - required_device<acia6850_device> m_uart; - required_device<pia6821_device> m_pia; -}; - - -// device type definition -DECLARE_DEVICE_TYPE(COCO_T4426, coco_t4426_device) - -#endif // MAME_BUS_COCO_T4426_H diff --git a/src/devices/bus/coco/cococart.cpp b/src/devices/bus/coco/cococart.cpp index db2651e32ee..199e4ee8d31 100644 --- a/src/devices/bus/coco/cococart.cpp +++ b/src/devices/bus/coco/cococart.cpp @@ -2,15 +2,45 @@ // copyright-holders:Nathan Woods /********************************************************************* - cococart.c - - CoCo/Dragon cartridge management + cococart.cpp + + CoCo/Dragon cartridge slot - typically used for "Program Paks" + (which are simple ROMs) but in practice is the main extensibility + mechanism for CoCo hardware + + CoCo and Dragon pinout listing + --- ------- --- ------- + 1 -12V 21 A2 + 2 +12V 22 A3 + 3 HALT 23 A4 + 4 NMI 24 A5 + 5 RESET 25 A6 + 6 EIN 26 A7 + 7 QIN 27 A8 + 8 CART 28 A9 + 9 +5V 29 A10 + 10 D0 30 A11 + 11 D1 31 A12 + 12 D2 32 CTS + 13 D3 33 GND + 14 D4 34 GND + 15 D5 35 SND + 16 D6 36 SCS + 17 D7 37 A13 + 18 R/!W 38 A14 + 19 A0 39 A15 + 20 A1 40 SLENB + + Notes: + CTS - ROM read $C000-$FEFF ($FDFF on CoCo 3) + SCS - Spare Chip Select: IO space between $FF40-5F *********************************************************************/ #include "emu.h" #include "cococart.h" + /*************************************************************************** PARAMETERS ***************************************************************************/ @@ -18,7 +48,6 @@ #define LOG_LINE 0 - //************************************************************************** // GLOBAL VARIABLES //************************************************************************** @@ -26,7 +55,6 @@ DEFINE_DEVICE_TYPE(COCOCART_SLOT, cococart_slot_device, "cococart_slot", "CoCo Cartridge Slot") - //************************************************************************** // LIVE DEVICE //************************************************************************** @@ -68,8 +96,7 @@ void cococart_slot_device::device_start() m_cart_line.callback = &m_cart_callback; m_nmi_line.timer_index = 0; - /* 12 allowed one more instruction to finished after the line is pulled */ - m_nmi_line.delay = 12; + m_nmi_line.delay = 0; m_nmi_line.value = line_value::CLEAR; m_nmi_line.line = 0; m_nmi_line.q_count = 0; @@ -77,8 +104,7 @@ void cococart_slot_device::device_start() m_nmi_line.callback = &m_nmi_callback; m_halt_line.timer_index = 0; - /* 6 allowed one more instruction to finished after the line is pulled */ - m_halt_line.delay = 6; + m_halt_line.delay = 0; m_halt_line.value = line_value::CLEAR; m_halt_line.line = 0; m_halt_line.q_count = 0; @@ -113,28 +139,27 @@ void cococart_slot_device::device_timer(emu_timer &timer, device_timer_id id, in } - //------------------------------------------------- -// coco_cartridge_r +// scs_read //------------------------------------------------- -READ8_MEMBER(cococart_slot_device::read) +READ8_MEMBER(cococart_slot_device::scs_read) { uint8_t result = 0x00; if (m_cart) - result = m_cart->read(space, offset); + result = m_cart->scs_read(space, offset); return result; } //------------------------------------------------- -// coco_cartridge_w +// scs_write //------------------------------------------------- -WRITE8_MEMBER(cococart_slot_device::write) +WRITE8_MEMBER(cococart_slot_device::scs_write) { if (m_cart) - m_cart->write(space, offset, data); + m_cart->scs_write(space, offset, data); } @@ -158,13 +183,12 @@ const char *cococart_slot_device::line_value_string(line_value value) s = "Q"; break; default: - fatalerror("Invalid value\n"); + throw false && "Invalid value"; } return s; } - //------------------------------------------------- // set_line //------------------------------------------------- @@ -205,9 +229,8 @@ void cococart_slot_device::set_line(const char *line_name, coco_cartridge_line & } - //------------------------------------------------- -// set_line_timer() +// set_line_timer //------------------------------------------------- void cococart_slot_device::set_line_timer(coco_cartridge_line &line, cococart_slot_device::line_value value) @@ -222,7 +245,6 @@ void cococart_slot_device::set_line_timer(coco_cartridge_line &line, cococart_sl } - //------------------------------------------------- // twiddle_line_if_q //------------------------------------------------- @@ -237,7 +259,6 @@ void cococart_slot_device::twiddle_line_if_q(coco_cartridge_line &line) } - //------------------------------------------------- // twiddle_q_lines - hack to support twiddling the // Q line @@ -279,6 +300,31 @@ void cococart_slot_device::set_line_value(cococart_slot_device::line which, coco } +//------------------------------------------------- +// set_line_delay +//------------------------------------------------- + +void cococart_slot_device::set_line_delay(cococart_slot_device::line which, int cycles) +{ + switch (which) + { + case cococart_slot_device::line::CART: + m_cart_line.delay = cycles; + break; + + case cococart_slot_device::line::NMI: + m_nmi_line.delay = cycles; + break; + + case cococart_slot_device::line::HALT: + m_halt_line.delay = cycles; + break; + + default: + throw false; + } +} + //------------------------------------------------- // get_line_value @@ -321,19 +367,17 @@ uint8_t* cococart_slot_device::get_cart_base() } - //------------------------------------------------- // set_cart_base_update //------------------------------------------------- void cococart_slot_device::set_cart_base_update(cococart_base_update_delegate update) { - if (m_cart != nullptr) + if (m_cart) m_cart->set_cart_base_update(update); } - //------------------------------------------------- // call_load //------------------------------------------------- @@ -363,7 +407,6 @@ image_init_result cococart_slot_device::call_load() } - //------------------------------------------------- // get_default_card_software //------------------------------------------------- @@ -375,9 +418,9 @@ std::string cococart_slot_device::get_default_card_software(get_default_card_sof - //************************************************************************** -// DEVICE COCO CART INTERFACE +// DEVICE COCO CART INTERFACE - Implemented by devices that plug into +// CoCo cartridge slots //************************************************************************** //------------------------------------------------- @@ -390,7 +433,6 @@ device_cococart_interface::device_cococart_interface(const machine_config &mconf } - //------------------------------------------------- // ~device_cococart_interface - destructor //------------------------------------------------- @@ -400,28 +442,27 @@ device_cococart_interface::~device_cococart_interface() } - //------------------------------------------------- -// read +// scs_read - Signifies a read where the SCS pin +// on the cartridge slot was asserted ($FF40-5F) //------------------------------------------------- -READ8_MEMBER(device_cococart_interface::read) +READ8_MEMBER(device_cococart_interface::scs_read) { return 0x00; } - //------------------------------------------------- -// write +// scs_write - Signifies a write where the SCS pin +// on the cartridge slot was asserted ($FF40-5F) //------------------------------------------------- -WRITE8_MEMBER(device_cococart_interface::write) +WRITE8_MEMBER(device_cococart_interface::scs_write) { } - //------------------------------------------------- // set_sound_enable //------------------------------------------------- @@ -431,7 +472,6 @@ void device_cococart_interface::set_sound_enable(bool sound_enable) } - //------------------------------------------------- // get_cart_base //------------------------------------------------- @@ -442,7 +482,6 @@ uint8_t* device_cococart_interface::get_cart_base() } - //------------------------------------------------- // set_cart_base_update //------------------------------------------------- @@ -453,7 +492,6 @@ void device_cococart_interface::set_cart_base_update(cococart_base_update_delega } - //------------------------------------------------- // cart_base_changed //------------------------------------------------- @@ -463,3 +501,63 @@ void device_cococart_interface::cart_base_changed(void) if (!m_update.isnull()) m_update(get_cart_base()); } + + +//------------------------------------------------- +// cartridge_space +//------------------------------------------------- + +address_space &device_cococart_interface::cartridge_space() +{ + // sanity check - our parent should always be a cococart_slot_device + assert(dynamic_cast<cococart_slot_device *>(device().owner())); + + // get my owner's owner - it had better implement device_cococart_host_interface + device_cococart_host_interface *host = dynamic_cast<device_cococart_host_interface *>(device().owner()->owner()); + assert(host); + return host->cartridge_space(); +} + + +//------------------------------------------------- +// install_read_handler +//------------------------------------------------- + +void device_cococart_interface::install_read_handler(uint16_t addrstart, uint16_t addrend, read8_delegate rhandler) +{ + address_space &space(cartridge_space()); + space.install_read_handler(addrstart, addrend, rhandler); +} + + +//------------------------------------------------- +// install_write_handler +//------------------------------------------------- + +void device_cococart_interface::install_write_handler(uint16_t addrstart, uint16_t addrend, write8_delegate whandler) +{ + address_space &space(cartridge_space()); + space.install_write_handler(addrstart, addrend, whandler); +} + + +//------------------------------------------------- +// install_readwrite_handler +//------------------------------------------------- + +void device_cococart_interface::install_readwrite_handler(uint16_t addrstart, uint16_t addrend, read8_delegate rhandler, write8_delegate whandler) +{ + address_space &space(cartridge_space()); + space.install_read_handler(addrstart, addrend, rhandler); + space.install_write_handler(addrstart, addrend, whandler); +} + + +//------------------------------------------------- +// set_line_value +//------------------------------------------------- + +void device_cococart_interface::set_line_value(cococart_slot_device::line line, cococart_slot_device::line_value value) +{ + dynamic_cast<cococart_slot_device *>(device().owner())->set_line_value(line, value); +} diff --git a/src/devices/bus/coco/cococart.h b/src/devices/bus/coco/cococart.h index 1d6049119e7..03e3ad35a21 100644 --- a/src/devices/bus/coco/cococart.h +++ b/src/devices/bus/coco/cococart.h @@ -15,6 +15,23 @@ #include "softlist_dev.h" +// The following are modules included by the various CoCo cartridge +// devices. For some reason, the build system will not necessarily +// identify them as dependencies. Adding these #include's here seems +// to rectify the problem +#include "cpu/tms7000/tms7000.h" +#include "machine/mos6551.h" +#include "machine/6850acia.h" +#include "machine/msm6242.h" +#include "machine/ds1315.h" +#include "machine/wd_fdc.h" +#include "sound/ay8910.h" +#include "sound/sp0256.h" +#include "sound/sn76496.h" +#include "formats/dmk_dsk.h" +#include "formats/jvc_dsk.h" +#include "formats/vdk_dsk.h" + /*************************************************************************** TYPE DEFINITIONS @@ -88,12 +105,13 @@ public: // slot interface overrides virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; - // reading and writing to $FF40-$FF7F - DECLARE_READ8_MEMBER(read); - DECLARE_WRITE8_MEMBER(write); + // reading and writing to $FF40-$FF5F + DECLARE_READ8_MEMBER(scs_read); + DECLARE_WRITE8_MEMBER(scs_write); // manipulation of cartridge lines void set_line_value(line line, line_value value); + void set_line_delay(line line, int cycles); line_value get_line_value(line line) const; // hack to support twiddling the Q line @@ -102,7 +120,7 @@ public: // cart base uint8_t* get_cart_base(); void set_cart_base_update(cococart_base_update_delegate update); - + private: // TIMER_POOL: Must be power of two static constexpr int TIMER_POOL = 2; @@ -148,6 +166,17 @@ private: extern const device_type COCOCART_SLOT; DECLARE_DEVICE_TYPE(COCOCART_SLOT, cococart_slot_device) + +// ======================> device_cococart_host_interface + +// this is implemented by the CoCo root device itself and the Multi-Pak interface +class device_cococart_host_interface +{ +public: + virtual address_space &cartridge_space() = 0; +}; + + // ======================> device_cococart_interface class device_cococart_interface : public device_slot_card_interface @@ -156,8 +185,8 @@ public: // construction/destruction virtual ~device_cococart_interface(); - virtual DECLARE_READ8_MEMBER(read); - virtual DECLARE_WRITE8_MEMBER(write); + virtual DECLARE_READ8_MEMBER(scs_read); + virtual DECLARE_WRITE8_MEMBER(scs_write); virtual void set_sound_enable(bool sound_enable); virtual uint8_t* get_cart_base(); @@ -168,10 +197,22 @@ protected: void cart_base_changed(void); + // CoCo cartridges can read directly from the address bus. This is used by a number of + // cartridges (e.g. - Orch-90, Multi-Pak interface) for their control registers, independently + // of the SCS or CTS lines + address_space &cartridge_space(); + void install_read_handler(uint16_t addrstart, uint16_t addrend, read8_delegate rhandler); + void install_write_handler(uint16_t addrstart, uint16_t addrend, write8_delegate whandler); + void install_readwrite_handler(uint16_t addrstart, uint16_t addrend, read8_delegate rhandler, write8_delegate whandler); + + // setting line values + void set_line_value(cococart_slot_device::line line, cococart_slot_device::line_value value); + private: cococart_base_update_delegate m_update; }; + /*************************************************************************** DEVICE CONFIGURATION MACROS ***************************************************************************/ @@ -183,4 +224,30 @@ private: #define MCFG_COCO_CARTRIDGE_REMOVE(_tag) \ MCFG_DEVICE_REMOVE(_tag) + +/*************************************************************************** + COCO CARTRIDGE DEVICES +***************************************************************************/ + +// device type definitions - CoCo FDC +extern const device_type COCO_FDC; +extern const device_type COCO_FDC_V11; +extern const device_type COCO3_HDB1; +extern const device_type CP400_FDC; + +// device type definitions - Dragon FDC +extern const device_type DRAGON_FDC; +extern const device_type SDTANDY_FDC; + +// device type definitions - other +extern const device_type COCO_ORCH90; +extern const device_type COCO_MULTIPAK; +extern const device_type COCO_RS232; +extern const device_type COCO_DCMODEM; +extern const device_type COCO_SSC; +extern const device_type COCO_PAK; +extern const device_type COCO_PAK_BANKED; +extern const device_type COCO_PAK_GMC; +extern const device_type COCO_T4426; + #endif // MAME_BUS_COCO_COCOCART_H diff --git a/src/devices/bus/coco/dragon_fdc.cpp b/src/devices/bus/coco/dragon_fdc.cpp index 8638d9abad5..4e8fb57cbb9 100644 --- a/src/devices/bus/coco/dragon_fdc.cpp +++ b/src/devices/bus/coco/dragon_fdc.cpp @@ -97,9 +97,9 @@ namespace dragon_fdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); // device-level overrides - virtual DECLARE_READ8_MEMBER(read) override; - virtual DECLARE_WRITE8_MEMBER(write) override; - virtual machine_config_constructor device_mconfig_additions() const override; + virtual DECLARE_READ8_MEMBER(scs_read) override; + virtual DECLARE_WRITE8_MEMBER(scs_write) override; + virtual void device_add_mconfig(machine_config &config) override; virtual void update_lines() override; private: @@ -121,7 +121,7 @@ static SLOT_INTERFACE_START(dragon_fdc_device_base) SLOT_INTERFACE_END -static MACHINE_CONFIG_START(dragon_fdc) +MACHINE_CONFIG_MEMBER(dragon_fdc_device_base::device_add_mconfig) MCFG_WD2797_ADD(WD2797_TAG, XTAL_1MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(dragon_fdc_device_base, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(dragon_fdc_device_base, fdc_drq_w)) @@ -153,17 +153,6 @@ dragon_fdc_device_base::dragon_fdc_device_base(const machine_config &mconfig, de //------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor dragon_fdc_device_base::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME(dragon_fdc); -} - - -//------------------------------------------------- // update_lines - Dragon specific disk // controller lines //------------------------------------------------- @@ -216,10 +205,10 @@ void dragon_fdc_device_base::dskreg_w(uint8_t data) //------------------------------------------------- -// read +// scs_read //------------------------------------------------- -READ8_MEMBER(dragon_fdc_device_base::read) +READ8_MEMBER(dragon_fdc_device_base::scs_read) { uint8_t result = 0; switch (offset & 0xEF) @@ -243,10 +232,10 @@ READ8_MEMBER(dragon_fdc_device_base::read) //------------------------------------------------- -// write +// scs_write //------------------------------------------------- -WRITE8_MEMBER(dragon_fdc_device_base::write) +WRITE8_MEMBER(dragon_fdc_device_base::scs_write) { switch (offset & 0xEF) { diff --git a/src/mame/drivers/coco12.cpp b/src/mame/drivers/coco12.cpp index 4ed938d86b1..fb6b48812a3 100644 --- a/src/mame/drivers/coco12.cpp +++ b/src/mame/drivers/coco12.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nathan Woods /*************************************************************************** - coco12.c + coco12.cpp TRS-80 Radio Shack Color Computer 1/2 @@ -26,14 +26,7 @@ #include "emu.h" #include "includes/coco12.h" -#include "bus/coco/coco_232.h" #include "bus/coco/coco_dwsock.h" -#include "bus/coco/coco_fdc.h" -#include "bus/coco/coco_multi.h" -#include "bus/coco/coco_orch90.h" -#include "bus/coco/coco_gmc.h" -#include "bus/coco/coco_pak.h" -#include "bus/coco/coco_t4426.h" #include "cpu/m6809/m6809.h" #include "imagedev/cassette.h" @@ -251,12 +244,14 @@ SLOT_INTERFACE_START( coco_cart ) SLOT_INTERFACE("fdcv11", COCO_FDC_V11) SLOT_INTERFACE("cc3hdb1", COCO3_HDB1) SLOT_INTERFACE("cp400_fdc", CP400_FDC) - SLOT_INTERFACE("rs232", COCO_232) + SLOT_INTERFACE("rs232", COCO_RS232) + SLOT_INTERFACE("dcmodem", COCO_DCMODEM) SLOT_INTERFACE("orch90", COCO_ORCH90) + SLOT_INTERFACE("ssc", COCO_SSC) MCFG_SLOT_OPTION_CLOCK("ssc", DERIVED_CLOCK(1, 1)) SLOT_INTERFACE("games_master", COCO_PAK_GMC) SLOT_INTERFACE("banked_16k", COCO_PAK_BANKED) SLOT_INTERFACE("pak", COCO_PAK) - SLOT_INTERFACE("multi", COCO_MULTIPAK) MCFG_SLOT_OPTION_CLOCK("multi", DERIVED_CLOCK(1, 1)) + SLOT_INTERFACE("multi", COCO_MULTIPAK) MCFG_SLOT_OPTION_CLOCK("multi", DERIVED_CLOCK(1, 1)) SLOT_INTERFACE_END //------------------------------------------------- @@ -288,6 +283,28 @@ MACHINE_CONFIG_START( coco_sound ) MACHINE_CONFIG_END +//------------------------------------------------- +// MACHINE_CONFIG ( coco_floating ) +//------------------------------------------------- + +static ADDRESS_MAP_START(coco_floating_map, AS_PROGRAM, 8, coco_state) + AM_RANGE(0x0000, 0xFFFF) AM_READ(floating_bus_read) +ADDRESS_MAP_END + + +MACHINE_CONFIG_START( coco_floating ) + MCFG_DEVICE_ADD(FLOATING_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(coco_floating_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(16) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// DEVICE_INPUT_DEFAULTS_START( printer ) +//------------------------------------------------- + static DEVICE_INPUT_DEFAULTS_START( printer ) DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_600 ) DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) @@ -363,6 +380,9 @@ static MACHINE_CONFIG_START( coco ) MCFG_RAM_DEFAULT_SIZE("64K") MCFG_RAM_EXTRA_OPTIONS("4K,16K,32K") + // floating space + MCFG_FRAGMENT_ADD( coco_floating ) + // software lists MCFG_SOFTWARE_LIST_ADD("coco_cart_list", "coco_cart") MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("dragon_cart_list", "dragon_cart") diff --git a/src/mame/drivers/coco3.cpp b/src/mame/drivers/coco3.cpp index 6253fd7b9c1..25c36149853 100644 --- a/src/mame/drivers/coco3.cpp +++ b/src/mame/drivers/coco3.cpp @@ -325,6 +325,9 @@ static MACHINE_CONFIG_START( coco3 ) MCFG_RAM_DEFAULT_SIZE("512K") MCFG_RAM_EXTRA_OPTIONS("128K,2M,8M") + // floating space + MCFG_FRAGMENT_ADD(coco_floating) + // software lists MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") diff --git a/src/mame/drivers/dragon.cpp b/src/mame/drivers/dragon.cpp index a981c6d7229..c080bbf921b 100644 --- a/src/mame/drivers/dragon.cpp +++ b/src/mame/drivers/dragon.cpp @@ -14,12 +14,6 @@ #include "imagedev/cassette.h" #include "formats/coco_cas.h" #include "cpu/m6809/m6809.h" -#include "bus/coco/coco_232.h" -#include "bus/coco/coco_orch90.h" -#include "bus/coco/coco_gmc.h" -#include "bus/coco/coco_pak.h" -#include "bus/coco/coco_fdc.h" -#include "bus/coco/coco_multi.h" #include "formats/vdk_dsk.h" #include "formats/dmk_dsk.h" #include "formats/sdf_dsk.h" @@ -196,6 +190,9 @@ static MACHINE_CONFIG_START( dragon_base ) // sound hardware MCFG_FRAGMENT_ADD( coco_sound ) + // floating space + MCFG_FRAGMENT_ADD( coco_floating ) + // software lists MCFG_SOFTWARE_LIST_ADD("dragon_cart_list", "dragon_cart") MCFG_SOFTWARE_LIST_ADD("dragon_cass_list", "dragon_cass") diff --git a/src/mame/includes/coco.h b/src/mame/includes/coco.h index 17313f4db37..db380183b8b 100644 --- a/src/mame/includes/coco.h +++ b/src/mame/includes/coco.h @@ -21,6 +21,7 @@ #include "machine/coco_vhd.h" #include "bus/coco/coco_dwsock.h" #include "machine/ram.h" +#include "machine/bankdev.h" #include "sound/dac.h" #include "sound/wave.h" @@ -53,6 +54,7 @@ SLOT_INTERFACE_EXTERN( coco_cart ); #define DWSOCK_TAG "dwsock" #define VHD0_TAG "vhd0" #define VHD1_TAG "vhd1" +#define FLOATING_TAG "floating" // inputs #define CTRL_SEL_TAG "ctrl_sel" @@ -75,6 +77,7 @@ SLOT_INTERFACE_EXTERN( coco_cart ); #define DIECOM_LIGHTGUN_BUTTONS_TAG "dclg_triggers" MACHINE_CONFIG_EXTERN( coco_sound ); +MACHINE_CONFIG_EXTERN( coco_floating ); @@ -82,7 +85,7 @@ MACHINE_CONFIG_EXTERN( coco_sound ); // TYPE DEFINITIONS //************************************************************************** -class coco_state : public driver_device +class coco_state : public driver_device, public device_cococart_host_interface { public: coco_state(const machine_config &mconfig, device_type type, const char *tag); @@ -96,6 +99,7 @@ public: required_device<cococart_slot_device> m_cococart; required_device<ram_device> m_ram; required_device<cassette_image_device> m_cassette; + required_device<address_map_bank_device> m_floating; optional_device<rs232_port_device> m_rs232; optional_device<coco_vhd_image_device> m_vhd_0; optional_device<coco_vhd_image_device> m_vhd_1; @@ -134,10 +138,14 @@ public: DECLARE_WRITE_LINE_MEMBER( pia1_firq_a ); DECLARE_WRITE_LINE_MEMBER( pia1_firq_b ); - // floating bus + // floating bus & "space" DECLARE_READ8_MEMBER( floating_bus_read ) { return floating_bus_read(); } + uint8_t floating_space_read(offs_t offset); + void floating_space_write(offs_t offset, uint8_t data); + // cartridge stuff DECLARE_WRITE_LINE_MEMBER( cart_w ) { cart_w((bool) state); } + virtual address_space &cartridge_space() override; // disassembly override static offs_t os9_dasm_override(device_t &device, std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, int options); @@ -261,6 +269,9 @@ private: // VHD selection uint8_t m_vhd_select; + // address space for "floating access" + //address_space m_floating_space; + // safety to prevent stack overflow when reading floating bus bool m_in_floating_bus_read; }; diff --git a/src/mame/machine/coco.cpp b/src/mame/machine/coco.cpp index 6bdfa8bf137..0ec8f2e5ab9 100644 --- a/src/mame/machine/coco.cpp +++ b/src/mame/machine/coco.cpp @@ -92,6 +92,7 @@ coco_state::coco_state(const machine_config &mconfig, device_type type, const ch m_cococart(*this, CARTRIDGE_TAG), m_ram(*this, RAM_TAG), m_cassette(*this, "cassette"), + m_floating(*this, FLOATING_TAG), m_rs232(*this, RS232_TAG), m_vhd_0(*this, VHD0_TAG), m_vhd_1(*this, VHD1_TAG), @@ -99,7 +100,8 @@ coco_state::coco_state(const machine_config &mconfig, device_type type, const ch m_beckerportconfig(*this, BECKERPORT_TAG), m_keyboard(*this, "row%u", 0), m_joystick_type_control(*this, CTRL_SEL_TAG), - m_joystick_hires_control(*this, HIRES_INTF_TAG) + m_joystick_hires_control(*this, HIRES_INTF_TAG), + m_in_floating_bus_read(false) { } @@ -125,10 +127,10 @@ void coco_state::analog_port_start(analog_input_t *analog, const char *rx_tag, c void coco_state::device_start() { - /* call base device_start */ + // call base device_start driver_device::device_start(); - /* look up analog ports */ + // look up analog ports analog_port_start(&m_joystick, JOYSTICK_RX_TAG, JOYSTICK_RY_TAG, JOYSTICK_LX_TAG, JOYSTICK_LY_TAG, JOYSTICK_BUTTONS_TAG); analog_port_start(&m_rat_mouse, RAT_MOUSE_RX_TAG, RAT_MOUSE_RY_TAG, @@ -136,15 +138,17 @@ void coco_state::device_start() analog_port_start(&m_diecom_lightgun, DIECOM_LIGHTGUN_RX_TAG, DIECOM_LIGHTGUN_RY_TAG, DIECOM_LIGHTGUN_LX_TAG, DIECOM_LIGHTGUN_LY_TAG, DIECOM_LIGHTGUN_BUTTONS_TAG); - /* timers */ + // timers m_hiresjoy_transition_timer[0] = timer_alloc(TIMER_HIRES_JOYSTICK_X); m_hiresjoy_transition_timer[1] = timer_alloc(TIMER_HIRES_JOYSTICK_Y); m_diecom_lightgun_timer = timer_alloc(TIMER_DIECOM_LIGHTGUN); - /* cart base update */ + // cart slot m_cococart->set_cart_base_update(cococart_base_update_delegate(&coco_state::update_cart_base, this)); + m_cococart->set_line_delay(cococart_slot_device::line::NMI, 12); // 12 allowed one more instruction to finished after the line is pulled + m_cococart->set_line_delay(cococart_slot_device::line::HALT, 6); // 6 allowed one more instruction to finished after the line is pulled - /* save state support */ + // save state support save_item(NAME(m_dac_output)); save_item(NAME(m_hiresjoy_ca)); save_item(NAME(m_dclg_previous_bit)); @@ -291,6 +295,31 @@ uint8_t coco_state::floating_bus_read(void) } +//------------------------------------------------- +// floating_space_read +//------------------------------------------------- + +uint8_t coco_state::floating_space_read(offs_t offset) +{ + // The "floating space" is intended to be a catch all for address space + // not handled by the normal CoCo infrastructure, but may be read directly + // by cartridge hardware and other miscellany + // + // Most of the time, the read below will result in floating_bus_read() being + // invoked + return m_floating->read8(m_floating->space(address_spacenum::AS_0), offset); +} + + +//------------------------------------------------- +// floating_space_write +//------------------------------------------------- + +void coco_state::floating_space_write(offs_t offset, uint8_t data) +{ + m_floating->write8(m_floating->space(address_spacenum::AS_0), offset, data); +} + /*************************************************************************** PIA0 ($FF00-$FF1F) (Chip U8) @@ -1130,7 +1159,7 @@ READ8_MEMBER( coco_state::ff60_read ) } else { - result = floating_bus_read(); + result = floating_space_read(0xFF60 + offset); } return result; @@ -1153,6 +1182,10 @@ WRITE8_MEMBER( coco_state::ff60_write ) /* writes to $FF86 will switch the VHD */ m_vhd_select = data; } + else + { + floating_space_write(0xFF60 + offset, data); + } } @@ -1172,11 +1205,10 @@ READ8_MEMBER( coco_state::ff40_read ) return m_beckerport->read(space, offset-1, mem_mask); } - return m_cococart->read(space, offset, mem_mask); + return m_cococart->scs_read(space, offset, mem_mask); } - //------------------------------------------------- // ff40_write //------------------------------------------------- @@ -1188,11 +1220,10 @@ WRITE8_MEMBER( coco_state::ff40_write ) return m_beckerport->write(space, offset-1, data, mem_mask); } - m_cococart->write(space, offset, data, mem_mask); + m_cococart->scs_write(space, offset, data, mem_mask); } - //------------------------------------------------- // cart_w //------------------------------------------------- @@ -1202,6 +1233,17 @@ void coco_state::cart_w(bool state) m_pia_1->cb1_w(state); } + +//------------------------------------------------- +// cartridge_space +//------------------------------------------------- + +address_space &coco_state::cartridge_space() +{ + return m_floating->space(address_spacenum::AS_0); +} + + /*************************************************************************** DISASSEMBLY OVERRIDE (OS9 syscalls) ***************************************************************************/ |