diff options
author | 2020-01-03 13:51:59 +0000 | |
---|---|---|
committer | 2020-01-07 12:39:16 +0000 | |
commit | b1d16b6c9ae6fe1e828c69e5dc731013c0f12263 (patch) | |
tree | 0418a49777c5a74f45316bc55c25b8c82836794d | |
parent | ec751fc8c669a5725e1678a59e6b6efc91dafd6e (diff) |
bus/bbc/1mhzbus: Added BeebOPL FM Synthesiser.
-rw-r--r-- | scripts/src/bus.lua | 2 | ||||
-rw-r--r-- | src/devices/bus/bbc/1mhzbus/1mhzbus.cpp | 3 | ||||
-rw-r--r-- | src/devices/bus/bbc/1mhzbus/beebopl.cpp | 95 | ||||
-rw-r--r-- | src/devices/bus/bbc/1mhzbus/beebopl.h | 52 | ||||
-rw-r--r-- | src/emu/xtal.cpp | 1 |
5 files changed, 153 insertions, 0 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 17261a3addb..3f645f4d1b5 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -467,6 +467,8 @@ if (BUSES["BBC_1MHZBUS"]~=null) then MAME_DIR .. "src/devices/bus/bbc/1mhzbus/1mhzbus.h", MAME_DIR .. "src/devices/bus/bbc/1mhzbus/autoprom.cpp", MAME_DIR .. "src/devices/bus/bbc/1mhzbus/autoprom.h", + MAME_DIR .. "src/devices/bus/bbc/1mhzbus/beebopl.cpp", + MAME_DIR .. "src/devices/bus/bbc/1mhzbus/beebopl.h", MAME_DIR .. "src/devices/bus/bbc/1mhzbus/beebsid.cpp", MAME_DIR .. "src/devices/bus/bbc/1mhzbus/beebsid.h", MAME_DIR .. "src/devices/bus/bbc/1mhzbus/emrmidi.cpp", diff --git a/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp b/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp index 50edb6e5506..3acebb1215b 100644 --- a/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp +++ b/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp @@ -121,6 +121,7 @@ void bbc_1mhzbus_slot_device::jim_w(offs_t offset, uint8_t data) #include "pms64k.h" #include "ramdisc.h" //#include "graduate.h" +#include "beebopl.h" #include "beebsid.h" //#include "prisma3.h" #include "sprite.h" @@ -145,6 +146,7 @@ void bbc_1mhzbus_devices(device_slot_interface &device) device.option_add("pms64k", BBC_PMS64K); /* PMS 64K Non-Volatile Ram Module */ device.option_add("ramdisc", BBC_RAMDISC); /* Morley Electronics RAM Disc */ //device.option_add("graduate", BBC_GRADUATE); /* The Torch Graduate G400/G800 */ + device.option_add("beebopl", BBC_BEEBOPL); /* BeebOPL */ device.option_add("beebsid", BBC_BEEBSID); /* BeebSID */ //device.option_add("prisma3", BBC_PRISMA3); /* PRISMA-3 - Millipede 1989 */ device.option_add("sprite", BBC_SPRITE); /* Logotron Sprite Board */ @@ -170,6 +172,7 @@ void bbcm_1mhzbus_devices(device_slot_interface &device) device.option_add("pms64k", BBC_PMS64K); /* PMS 64K Non-Volatile Ram Module */ device.option_add("ramdisc", BBC_RAMDISC); /* Morley Electronics RAM Disc */ //device.option_add("graduate", BBC_GRADUATE); /* The Torch Graduate G400/G800 */ + device.option_add("beebopl", BBC_BEEBOPL); /* BeebOPL */ device.option_add("beebsid", BBC_BEEBSID); /* BeebSID */ //device.option_add("prisma3", BBC_PRISMA3); /* PRISMA-3 - Millipede 1989 */ device.option_add("sprite", BBC_SPRITE); /* Logotron Sprite Board */ diff --git a/src/devices/bus/bbc/1mhzbus/beebopl.cpp b/src/devices/bus/bbc/1mhzbus/beebopl.cpp new file mode 100644 index 00000000000..9c3db9ca6ff --- /dev/null +++ b/src/devices/bus/bbc/1mhzbus/beebopl.cpp @@ -0,0 +1,95 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + BeebOPL FM Synthesiser emulation + + https://github.com/JudgeBeeb/BeebOPL + +**********************************************************************/ + + +#include "emu.h" +#include "beebopl.h" +#include "speaker.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(BBC_BEEBOPL, bbc_beebopl_device, "beebopl", "BeebOPL FM Synthesiser") + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void bbc_beebopl_device::device_add_mconfig(machine_config &config) +{ + SPEAKER(config, "speaker").front_center(); + + YM3812(config, m_ym3812, 3.579_MHz_XTAL); + m_ym3812->irq_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w)); + m_ym3812->add_route(ALL_OUTPUTS, "speaker", 1.0); + + BBC_1MHZBUS_SLOT(config, m_1mhzbus, DERIVED_CLOCK(1, 1), bbc_1mhzbus_devices, nullptr); + m_1mhzbus->irq_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w)); + m_1mhzbus->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::nmi_w)); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// bbc_beebopl_device - constructor +//------------------------------------------------- + +bbc_beebopl_device::bbc_beebopl_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, BBC_BEEBOPL, tag, owner, clock) + , device_bbc_1mhzbus_interface(mconfig, *this) + , m_1mhzbus(*this, "1mhzbus") + , m_ym3812(*this, "ym3812") +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t bbc_beebopl_device::fred_r(offs_t offset) +{ + uint8_t data = 0xff; + + if ((offset & 0xfe) == 0x04) + { + data = m_ym3812->read(offset); + } + + data &= m_1mhzbus->fred_r(offset); + + return data; +} + +void bbc_beebopl_device::fred_w(offs_t offset, uint8_t data) +{ + if ((offset & 0xfe) == 0x04) + { + m_ym3812->write(offset, data); + } + + m_1mhzbus->fred_w(offset, data); +} + +uint8_t bbc_beebopl_device::jim_r(offs_t offset) +{ + return m_1mhzbus->jim_r(offset); +} + +void bbc_beebopl_device::jim_w(offs_t offset, uint8_t data) +{ + m_1mhzbus->jim_w(offset, data); +} diff --git a/src/devices/bus/bbc/1mhzbus/beebopl.h b/src/devices/bus/bbc/1mhzbus/beebopl.h new file mode 100644 index 00000000000..b3f9fb19fb2 --- /dev/null +++ b/src/devices/bus/bbc/1mhzbus/beebopl.h @@ -0,0 +1,52 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + BeebOPL FM Synthesiser emulation + +**********************************************************************/ + +#ifndef MAME_BUS_BBC_1MHZBUS_BEEBOPL_H +#define MAME_BUS_BBC_1MHZBUS_BEEBOPL_H + +#include "1mhzbus.h" +#include "sound/3812intf.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> bbc_beebopl_device + +class bbc_beebopl_device : + public device_t, + public device_bbc_1mhzbus_interface +{ +public: + // construction/destruction + bbc_beebopl_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override { } + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + virtual uint8_t fred_r(offs_t offset) override; + virtual void fred_w(offs_t offset, uint8_t data) override; + virtual uint8_t jim_r(offs_t offset) override; + virtual void jim_w(offs_t offset, uint8_t data) override; + +private: + required_device<bbc_1mhzbus_slot_device> m_1mhzbus; + required_device<ym3812_device> m_ym3812; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(BBC_BEEBOPL, bbc_beebopl_device) + + +#endif // MAME_BUS_BBC_1MHZBUS_BEEBOPL_H diff --git a/src/emu/xtal.cpp b/src/emu/xtal.cpp index fe5c8b2895c..b9f28f9c137 100644 --- a/src/emu/xtal.cpp +++ b/src/emu/xtal.cpp @@ -89,6 +89,7 @@ const double XTAL::known_xtals[] = { 3'521'280, /* 3.52128_MHz_XTAL RCA COSMAC VIP */ 3'570'000, /* 3.57_MHz_XTAL Telmac TMC-600 */ 3'578'640, /* 3.57864_MHz_XTAL Atari Portfolio PCD3311T */ + 3'579'000, /* 3.579_MHz_XTAL BeebOPL */ 3'579'545, /* 3.579545_MHz_XTAL NTSC color subcarrier, extremely common, used on 100's of PCBs (Keytronic custom part #48-300-010 is equivalent) */ 3'686'400, /* 3.6864_MHz_XTAL Baud rate clock for MC68681 and similar UARTs */ 3'840'000, /* 3.84_MHz_XTAL Fairlight CMI Alphanumeric Keyboard */ |