summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/coco/coco_orch90.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/coco/coco_orch90.cpp')
-rw-r--r--src/devices/bus/coco/coco_orch90.cpp131
1 files changed, 77 insertions, 54 deletions
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")