diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index ab13afec201..465f6c586b5 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -238,6 +238,31 @@ if (BUSES["APRICOT_KEYBOARD"]~=null) then end +--------------------------------------------------- +-- +--@src/devices/bus/aquarius/slot.h,BUSES["AQUARIUS"] = true +--------------------------------------------------- + +if (BUSES["AQUARIUS"]~=null) then + files { + MAME_DIR .. "src/devices/bus/aquarius/slot.cpp", + MAME_DIR .. "src/devices/bus/aquarius/slot.h", + MAME_DIR .. "src/devices/bus/aquarius/c1541.cpp", + MAME_DIR .. "src/devices/bus/aquarius/c1541.h", + MAME_DIR .. "src/devices/bus/aquarius/mini.cpp", + MAME_DIR .. "src/devices/bus/aquarius/mini.h", + MAME_DIR .. "src/devices/bus/aquarius/qdisk.cpp", + MAME_DIR .. "src/devices/bus/aquarius/qdisk.h", + MAME_DIR .. "src/devices/bus/aquarius/ram.cpp", + MAME_DIR .. "src/devices/bus/aquarius/ram.h", + MAME_DIR .. "src/devices/bus/aquarius/rom.cpp", + MAME_DIR .. "src/devices/bus/aquarius/rom.h", + MAME_DIR .. "src/devices/bus/aquarius/supercart.cpp", + MAME_DIR .. "src/devices/bus/aquarius/supercart.h", + } +end + + --------------------------------------------------- -- --@src/devices/bus/arcadia/slot.h,BUSES["ARCADIA"] = true diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index dd9bc41e97e..9634635eb85 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -800,6 +800,7 @@ BUSES["ADAMNET"] = true BUSES["APF"] = true BUSES["APRICOT_EXPANSION"] = true BUSES["APRICOT_KEYBOARD"] = true +BUSES["AQUARIUS"] = true BUSES["AMIGA_KEYBOARD"] = true BUSES["ARCADIA"] = true BUSES["ASTROCADE"] = true diff --git a/src/devices/bus/aquarius/c1541.cpp b/src/devices/bus/aquarius/c1541.cpp new file mode 100644 index 00000000000..40ac2679422 --- /dev/null +++ b/src/devices/bus/aquarius/c1541.cpp @@ -0,0 +1,92 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius C1541 DOS Interface by Ron Koenig + +**********************************************************************/ + + +#include "emu.h" +#include "c1541.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_C1541, aquarius_c1541_device, "aquarius_c1541", "Aquarius C1541 DOS Interface") + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void aquarius_c1541_device::device_add_mconfig(machine_config &config) +{ + cbm_iec_slot_device::add(config, m_iec, "c1541"); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_c1541_device - constructor +//------------------------------------------------- + +aquarius_c1541_device::aquarius_c1541_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_C1541, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) + , m_iec(*this, "iec_bus") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_c1541_device::device_start() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t aquarius_c1541_device::mreq_ce_r(offs_t offset) +{ + return get_rom_base()[offset & 0x3fff]; +} + + +uint8_t aquarius_c1541_device::iorq_r(offs_t offset) +{ + uint8_t data = 0xff; + + if (offset == 0x60) + { + // TODO: unknown connections + data = 0x00; + data |= m_iec->clk_r() << 7; + data |= m_iec->data_r() << 3; + logerror("iorq_r: %02x = %02x\n", offset, data); + } + + return data; +} + +void aquarius_c1541_device::iorq_w(offs_t offset, uint8_t data) +{ + if (offset == 0x60) + { + logerror("iorq_w: %02x = %02x\n", offset, data); + // TODO: unknown connections + m_iec->host_atn_w(BIT(data, 6)); + m_iec->host_clk_w(BIT(data, 5)); + m_iec->host_data_w(BIT(data, 4)); + } +} diff --git a/src/devices/bus/aquarius/c1541.h b/src/devices/bus/aquarius/c1541.h new file mode 100644 index 00000000000..3a9e16e290c --- /dev/null +++ b/src/devices/bus/aquarius/c1541.h @@ -0,0 +1,53 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius C1541 DOS Interface by Ron Koenig + +**********************************************************************/ + +#ifndef MAME_BUS_AQUARIUS_C1541_H +#define MAME_BUS_AQUARIUS_C1541_H + +#pragma once + +#include "slot.h" +#include "bus/cbmiec/cbmiec.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class aquarius_c1541_device : + public device_t, + public device_aquarius_cartridge_interface +{ +public: + // construction/destruction + aquarius_c1541_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + static constexpr feature_type unemulated_features() { return feature::DISK; } + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_ce_r(offs_t offset) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; + +private: + required_device m_iec; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_C1541, aquarius_c1541_device) + + +#endif // MAME_BUS_AQUARIUS_C1541_H diff --git a/src/devices/bus/aquarius/mini.cpp b/src/devices/bus/aquarius/mini.cpp new file mode 100644 index 00000000000..dee7c4cd294 --- /dev/null +++ b/src/devices/bus/aquarius/mini.cpp @@ -0,0 +1,221 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius Mini Expander + +**********************************************************************/ + + +#include "emu.h" +#include "mini.h" +#include "speaker.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_MINI, aquarius_mini_device, "aquarius_mini", "Aquarius Mini Expander") + + +//------------------------------------------------- +// INPUT_PORTS( mini ) +//------------------------------------------------- + +static INPUT_PORTS_START(mini) + PORT_START("RIGHT") + PORT_BIT( 0x001000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) PORT_NAME("P1 12:00 (Up)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1fb) + PORT_BIT( 0x002000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) PORT_NAME("P1 01:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1eb) + PORT_BIT( 0x004000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 01:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1e9) + PORT_BIT( 0x008000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 02:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1f9) + PORT_BIT( 0x000001, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 03:00 (Right)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1fd) + PORT_BIT( 0x000002, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 04:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1ed) + PORT_BIT( 0x000004, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 04:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1ec) + PORT_BIT( 0x000008, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 05:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1fc) + PORT_BIT( 0x000010, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 06:00 (Down)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1fe) + PORT_BIT( 0x000020, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 06:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1ee) + PORT_BIT( 0x000040, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 07:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1e6) + PORT_BIT( 0x000080, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 08:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1f6) + PORT_BIT( 0x000100, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 09:00 (Left)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1f7) + PORT_BIT( 0x000200, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 09:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1e7) + PORT_BIT( 0x000400, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) PORT_NAME("P1 10:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1e3) + PORT_BIT( 0x000800, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) PORT_NAME("P1 11:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1f3) + PORT_BIT( 0x010000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1bf) + PORT_BIT( 0x020000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x17b) + PORT_BIT( 0x040000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x15f) + PORT_BIT( 0x080000, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1df) + PORT_BIT( 0x100000, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x17d) + PORT_BIT( 0x200000, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x17e) + + PORT_START("LEFT") + PORT_BIT( 0x001000, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) PORT_NAME("P2 12:00 (Up)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0fb) + PORT_BIT( 0x002000, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) PORT_NAME("P2 01:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0eb) + PORT_BIT( 0x004000, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 01:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0e9) + PORT_BIT( 0x008000, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 02:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0f9) + PORT_BIT( 0x000001, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 03:00 (Right)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0fd) + PORT_BIT( 0x000002, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 04:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0ed) + PORT_BIT( 0x000004, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 04:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0ec) + PORT_BIT( 0x000008, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 05:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0fc) + PORT_BIT( 0x000010, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 06:00 (Down)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0fe) + PORT_BIT( 0x000020, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 06:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0ee) + PORT_BIT( 0x000040, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 07:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0e6) + PORT_BIT( 0x000080, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 08:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0f6) + PORT_BIT( 0x000100, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 09:00 (Left)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0f7) + PORT_BIT( 0x000200, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 09:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0e7) + PORT_BIT( 0x000400, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) PORT_NAME("P2 10:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0e3) + PORT_BIT( 0x000800, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) PORT_NAME("P2 11:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0f3) + PORT_BIT( 0x010000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0bf) + PORT_BIT( 0x020000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x07b) + PORT_BIT( 0x040000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x05f) + PORT_BIT( 0x080000, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0df) + PORT_BIT( 0x100000, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x07d) + PORT_BIT( 0x200000, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x07e) +INPUT_PORTS_END + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor aquarius_mini_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(mini); +} + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void aquarius_mini_device::device_add_mconfig(machine_config &config) +{ + INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::irq_w)); + + /* sound hardware */ + SPEAKER(config, "mono").front_center(); + + AY8910(config, m_ay, DERIVED_CLOCK(1, 2)); + m_ay->port_a_read_callback().set([this] () { return m_ctrl_input[0]; }); + m_ay->port_b_read_callback().set([this] () { return m_ctrl_input[1]; }); + m_ay->add_route(ALL_OUTPUTS, "mono", 0.25); + + /* cartridge */ + AQUARIUS_CARTRIDGE_SLOT(config, m_exp[0], DERIVED_CLOCK(1,1), aquarius_cartridge_devices, nullptr); + m_exp[0]->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>)); + m_exp[0]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::nmi_w)); + + AQUARIUS_CARTRIDGE_SLOT(config, m_exp[1], DERIVED_CLOCK(1,1), aquarius_cartridge_devices, nullptr); + m_exp[1]->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>)); + m_exp[1]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::nmi_w)); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_mini_device - constructor +//------------------------------------------------- + +aquarius_mini_device::aquarius_mini_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_MINI, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) + , m_irqs(*this, "irqs") + , m_exp(*this, "exp%u", 1U) + , m_ay(*this, "ay8910") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_mini_device::device_start() +{ + m_ctrl_input[0] = 0xff; + m_ctrl_input[1] = 0xff; + + save_item(NAME(m_ctrl_input)); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +INPUT_CHANGED_MEMBER(aquarius_mini_device::input_changed) +{ + if (newval) + m_ctrl_input[BIT(param, 8)] &= param; + else + m_ctrl_input[BIT(param, 8)] |= ~param; +} + +uint8_t aquarius_mini_device::mreq_r(offs_t offset) +{ + uint8_t data = 0xff; + + data &= m_exp[0]->mreq_r(offset); + data &= m_exp[1]->mreq_r(offset); + + return data; +} + +void aquarius_mini_device::mreq_w(offs_t offset, uint8_t data) +{ + m_exp[0]->mreq_w(offset, data); + m_exp[1]->mreq_w(offset, data); +} + + +uint8_t aquarius_mini_device::mreq_ce_r(offs_t offset) +{ + uint8_t data = 0xff; + + data &= m_exp[0]->mreq_ce_r(offset); + data &= m_exp[1]->mreq_ce_r(offset); + + return data; +} + +void aquarius_mini_device::mreq_ce_w(offs_t offset, uint8_t data) +{ + m_exp[0]->mreq_ce_w(offset, data); + m_exp[1]->mreq_ce_w(offset, data); +} + + +uint8_t aquarius_mini_device::iorq_r(offs_t offset) +{ + uint8_t data = 0xff; + + switch (offset & 0xff) + { + case 0xf6: + data &= m_ay->data_r(); + break; + case 0xf7: + break; + } + + data &= m_exp[0]->iorq_r(offset); + data &= m_exp[1]->iorq_r(offset); + + return data; +} + +void aquarius_mini_device::iorq_w(offs_t offset, uint8_t data) +{ + switch (offset & 0xff) + { + case 0xf6: + m_ay->data_w(data); + break; + case 0xf7: + m_ay->address_w(data); + break; + } + + m_exp[0]->iorq_w(offset, data); + m_exp[1]->iorq_w(offset, data); +} diff --git a/src/devices/bus/aquarius/mini.h b/src/devices/bus/aquarius/mini.h new file mode 100644 index 00000000000..ed9cc1af641 --- /dev/null +++ b/src/devices/bus/aquarius/mini.h @@ -0,0 +1,59 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius Mini Expander + +**********************************************************************/ + + +#ifndef MAME_BUS_AQUARIUS_MINI_H +#define MAME_BUS_AQUARIUS_MINI_H + +#include "slot.h" +#include "machine/input_merger.h" +#include "sound/ay8910.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class aquarius_mini_device: + public device_t, + public device_aquarius_cartridge_interface +{ +public: + // construction/destruction + aquarius_mini_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + DECLARE_INPUT_CHANGED_MEMBER(input_changed); + +protected: + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_r(offs_t offset) override; + virtual void mreq_w(offs_t offset, uint8_t data) override; + virtual uint8_t mreq_ce_r(offs_t offset) override; + virtual void mreq_ce_w(offs_t offset, uint8_t data) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; + +private: + required_device m_irqs; + required_device_array m_exp; + required_device m_ay; + + uint8_t m_ctrl_input[2]; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_MINI, aquarius_mini_device) + + +#endif /* MAME_BUS_AQUARIUS_MINI_H */ diff --git a/src/devices/bus/aquarius/qdisk.cpp b/src/devices/bus/aquarius/qdisk.cpp new file mode 100644 index 00000000000..ba06201f554 --- /dev/null +++ b/src/devices/bus/aquarius/qdisk.cpp @@ -0,0 +1,164 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Radofin Aquarius Quick Disk + + Specifications: + Capacity 64K byte per side + Read/Write time 64K/8sec + Transmitting speed 101K [BPS] + Recording density 4410 [BPI] + Track density 59 [TPI] + Number of track 1 (spiral) + Recoding system MFM + Rotation speed 423 [RPM] + Disk 2.8" + Number of heads 1 + + TODO: + + - floppy support (I/O 0xe6-0xe7 = drive 1, 0xea-0xeb = drive 2) + +**********************************************************************/ + + +#include "emu.h" +#include "qdisk.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_QDISK, aquarius_qdisk_device, "aquarius_qdisk", "Aquarius Quick Disk") + + +//------------------------------------------------- +// INPUT_PORTS( qdisk ) +//------------------------------------------------- + +static INPUT_PORTS_START(qdisk) + PORT_START("SW1") + PORT_DIPNAME(0x01, 0x00, "Drive Selection") + PORT_DIPSETTING(0x00, "1") + PORT_DIPSETTING(0x01, "2") +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor aquarius_qdisk_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(qdisk); +} + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void aquarius_qdisk_device::device_add_mconfig(machine_config &config) +{ + MC6852(config, m_ssda, 6.5_MHz_XTAL); + + AQUARIUS_CARTRIDGE_SLOT(config, m_exp, DERIVED_CLOCK(1,1), aquarius_cartridge_devices, nullptr); + m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::irq_w)); + m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::nmi_w)); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_qdisk_device - constructor +//------------------------------------------------- + +aquarius_qdisk_device::aquarius_qdisk_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_QDISK, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) + , m_ssda(*this, "mc6852") + , m_exp(*this, "exp") + , m_sw1(*this, "SW1") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_qdisk_device::device_start() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t aquarius_qdisk_device::mreq_r(offs_t offset) +{ + return m_exp->mreq_r(offset); +} + +void aquarius_qdisk_device::mreq_w(offs_t offset, uint8_t data) +{ + m_exp->mreq_w(offset, data); +} + + +uint8_t aquarius_qdisk_device::mreq_ce_r(offs_t offset) +{ + uint8_t data = get_rom_base()[offset & 0x1fff]; + + data &= m_exp->mreq_ce_r(offset); + + return data; +} + +void aquarius_qdisk_device::mreq_ce_w(offs_t offset, uint8_t data) +{ + m_exp->mreq_ce_w(offset, data); +} + + +uint8_t aquarius_qdisk_device::iorq_r(offs_t offset) +{ + uint8_t data = m_exp->iorq_r(offset); + + switch (offset & 0xfe) + { + case 0xe6: case 0xea: + if (BIT(offset, 3) == m_sw1->read()) + { + data = m_ssda->read(offset & 0x01); + } + logerror("iorq_r: %02x = %02x\n", offset, data); + break; + } + + data &= m_exp->iorq_r(offset); + + return data; +} + +void aquarius_qdisk_device::iorq_w(offs_t offset, uint8_t data) +{ + switch (offset & 0xfe) + { + case 0xe6: case 0xea: + if (BIT(offset, 3) == m_sw1->read()) + { + m_ssda->write(offset & 0x01, data); + } + logerror("iorq_w: %02x = %02x\n", offset, data); + break; + } + + m_exp->iorq_w(offset, data); +} diff --git a/src/devices/bus/aquarius/qdisk.h b/src/devices/bus/aquarius/qdisk.h new file mode 100644 index 00000000000..303ed90affa --- /dev/null +++ b/src/devices/bus/aquarius/qdisk.h @@ -0,0 +1,59 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Radofin Aquarius Quick Disk + +**********************************************************************/ + +#ifndef MAME_BUS_AQUARIUS_QDISK_H +#define MAME_BUS_AQUARIUS_QDISK_H + +#pragma once + +#include "slot.h" +#include "machine/mc6852.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class aquarius_qdisk_device : + public device_t, + public device_aquarius_cartridge_interface +{ +public: + // construction/destruction + aquarius_qdisk_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + static constexpr feature_type unemulated_features() { return feature::DISK; } + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_r(offs_t offset) override; + virtual void mreq_w(offs_t offset, uint8_t data) override; + virtual uint8_t mreq_ce_r(offs_t offset) override; + virtual void mreq_ce_w(offs_t offset, uint8_t data) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; + +private: + required_device m_ssda; + required_device m_exp; + required_ioport m_sw1; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_QDISK, aquarius_qdisk_device) + + +#endif // MAME_BUS_AQUARIUS_QDISK_H diff --git a/src/devices/bus/aquarius/ram.cpp b/src/devices/bus/aquarius/ram.cpp new file mode 100644 index 00000000000..753a1fbf3a3 --- /dev/null +++ b/src/devices/bus/aquarius/ram.cpp @@ -0,0 +1,110 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius Memory Cartridges + +**********************************************************************/ + +#include "emu.h" +#include "ram.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_RAM4, aquarius_ram4_device, "aquarius_ram4", "Aquarius 4K Memory Cartridge") +DEFINE_DEVICE_TYPE(AQUARIUS_RAM16, aquarius_ram16_device, "aquarius_ram16", "Aquarius 16K Memory Cartridge") +DEFINE_DEVICE_TYPE(AQUARIUS_RAM32, aquarius_ram32_device, "aquarius_ram32", "Aquarius 32K Memory Cartridge") +DEFINE_DEVICE_TYPE(AQUARIUS_RAM16P, aquarius_ram16p_device, "aquarius_ram16p", "Aquarius 16K+ Memory Cartridge") + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_ram_device - constructor +//------------------------------------------------- + +aquarius_ram_device::aquarius_ram_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint16_t size) + : device_t(mconfig, type, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) + , m_ram_size(size) +{ +} + +aquarius_ram4_device::aquarius_ram4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : aquarius_ram_device(mconfig, AQUARIUS_RAM4, tag, owner, clock, 0x1000) +{ +} + +aquarius_ram16_device::aquarius_ram16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : aquarius_ram_device(mconfig, AQUARIUS_RAM16, tag, owner, clock, 0x4000) +{ +} + +aquarius_ram32_device::aquarius_ram32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : aquarius_ram_device(mconfig, AQUARIUS_RAM32, tag, owner, clock, 0x8000) +{ +} + +aquarius_ram16p_device::aquarius_ram16p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_RAM16P, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_ram_device::device_start() +{ + m_ram = make_unique_clear(m_ram_size); + + save_pointer(NAME(m_ram), m_ram_size); +} + +void aquarius_ram16p_device::device_start() +{ + m_ram = make_unique_clear(0x4000); + + save_pointer(NAME(m_ram), 0x4000); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t aquarius_ram_device::mreq_r(offs_t offset) +{ + if (offset < m_ram_size) + { + return m_ram[offset]; + } + + return 0xff; +} + +void aquarius_ram_device::mreq_w(offs_t offset, uint8_t data) +{ + if (offset < m_ram_size) + { + m_ram[offset] = data; + } +} + + +uint8_t aquarius_ram16p_device::mreq_ce_r(offs_t offset) +{ + return m_ram[offset]; +} + +void aquarius_ram16p_device::mreq_ce_w(offs_t offset, uint8_t data) +{ + m_ram[offset] = data; +} diff --git a/src/devices/bus/aquarius/ram.h b/src/devices/bus/aquarius/ram.h new file mode 100644 index 00000000000..3721314bb0f --- /dev/null +++ b/src/devices/bus/aquarius/ram.h @@ -0,0 +1,102 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius Memory Cartridges + +**********************************************************************/ + +#ifndef MAME_BUS_AQUARIUS_RAM_H +#define MAME_BUS_AQUARIUS_RAM_H + +#pragma once + +#include "slot.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> aquarius_ram_device + +class aquarius_ram_device : + public device_t, + public device_aquarius_cartridge_interface +{ +protected: + // construction/destruction + aquarius_ram_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock, uint16_t size); + + // device-level overrides + virtual void device_start() override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_r(offs_t offset) override; + virtual void mreq_w(offs_t offset, uint8_t data) override; + +private: + uint16_t m_ram_size; + + std::unique_ptr m_ram; +}; + +// ======================> aquarius_ram4_device + +class aquarius_ram4_device : public aquarius_ram_device +{ +public: + // construction/destruction + aquarius_ram4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + +// ======================> aquarius_ram16_device + +class aquarius_ram16_device : public aquarius_ram_device +{ +public: + // construction/destruction + aquarius_ram16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + +// ======================> aquarius_ram32_device + +class aquarius_ram32_device : public aquarius_ram_device +{ +public: + // construction/destruction + aquarius_ram32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + + +// ======================> aquarius_ram16p_device + +class aquarius_ram16p_device : + public device_t, + public device_aquarius_cartridge_interface +{ +public: + // construction/destruction + aquarius_ram16p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_ce_r(offs_t offset) override; + virtual void mreq_ce_w(offs_t offset, uint8_t data) override; + +private: + std::unique_ptr m_ram; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_RAM4, aquarius_ram4_device) +DECLARE_DEVICE_TYPE(AQUARIUS_RAM16, aquarius_ram16_device) +DECLARE_DEVICE_TYPE(AQUARIUS_RAM32, aquarius_ram32_device) +DECLARE_DEVICE_TYPE(AQUARIUS_RAM16P, aquarius_ram16p_device) + + +#endif // MAME_BUS_AQUARIUS_RAM_H diff --git a/src/devices/bus/aquarius/rom.cpp b/src/devices/bus/aquarius/rom.cpp new file mode 100644 index 00000000000..87f7df97079 --- /dev/null +++ b/src/devices/bus/aquarius/rom.cpp @@ -0,0 +1,51 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/*************************************************************************** + + Aquarius Software Cartridges + +***************************************************************************/ + +#include "emu.h" +#include "rom.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_ROM, aquarius_rom_device, "aquarius_rom", "Aquarius ROM Cartridge") + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_rom_device - constructor +//------------------------------------------------- + +aquarius_rom_device::aquarius_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_ROM, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_rom_device::device_start() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t aquarius_rom_device::mreq_ce_r(offs_t offset) +{ + return get_rom_base()[offset & (get_rom_size() - 1)]; +} diff --git a/src/devices/bus/aquarius/rom.h b/src/devices/bus/aquarius/rom.h new file mode 100644 index 00000000000..9e25f9e9ab0 --- /dev/null +++ b/src/devices/bus/aquarius/rom.h @@ -0,0 +1,44 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/*************************************************************************** + + Aquarius Software Cartridges + +***************************************************************************/ + +#ifndef MAME_BUS_AQUARIUS_ROM_H +#define MAME_BUS_AQUARIUS_ROM_H + +#pragma once + +#include "slot.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> aquarius_rom_device + +class aquarius_rom_device : + public device_t, + public device_aquarius_cartridge_interface +{ +public: + // construction/destruction + aquarius_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_ce_r(offs_t offset) override; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_ROM, aquarius_rom_device) + + +#endif // MAME_BUS_AQUARIUS_ROM_H diff --git a/src/devices/bus/aquarius/slot.cpp b/src/devices/bus/aquarius/slot.cpp new file mode 100644 index 00000000000..825e03f39d5 --- /dev/null +++ b/src/devices/bus/aquarius/slot.cpp @@ -0,0 +1,225 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius Cartridge Port emulation + +**********************************************************************/ + +#include "emu.h" +#include "slot.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_CARTRIDGE_SLOT, aquarius_cartridge_slot_device, "aquarius_cartridge_slot", "Aquarius Cartridge port") + + +//************************************************************************** +// DEVICE AQUARIUS_CARTRIDGE CARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_aquarius_cartridge_interface - constructor +//------------------------------------------------- + +device_aquarius_cartridge_interface::device_aquarius_cartridge_interface(const machine_config &mconfig, device_t &device) + : device_interface(device, "aquariuscart") + , m_rom(nullptr) + , m_rom_size(0) +{ + m_slot = dynamic_cast(device.owner()); +} + + +//------------------------------------------------- +// rom_alloc - alloc the space for the ROM +//------------------------------------------------- + +void device_aquarius_cartridge_interface::rom_alloc(uint32_t size, const char *tag) +{ + if (m_rom == nullptr) + { + m_rom = device().machine().memory().region_alloc(std::string(tag).append(AQUARIUS_CART_ROM_REGION_TAG).c_str(), size, 1, ENDIANNESS_LITTLE)->base(); + m_rom_size = size; + } +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_cartridge_slot_device - constructor +//------------------------------------------------- + +aquarius_cartridge_slot_device::aquarius_cartridge_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_CARTRIDGE_SLOT, tag, owner, clock) + , device_image_interface(mconfig, *this) + , device_single_card_slot_interface(mconfig, *this) + , m_cart(nullptr) + , m_irq_handler(*this) + , m_nmi_handler(*this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_cartridge_slot_device::device_start() +{ + m_cart = get_card_device(); + + // resolve callbacks + m_irq_handler.resolve_safe(); + m_nmi_handler.resolve_safe(); +} + +//------------------------------------------------- +// call_load +//------------------------------------------------- + +image_init_result aquarius_cartridge_slot_device::call_load() +{ + if (m_cart) + { + uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom"); + + if (size % 0x1000) + { + seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid ROM size"); + return image_init_result::FAIL; + } + + m_cart->rom_alloc(size, tag()); + + if (!loaded_through_softlist()) + fread(m_cart->get_rom_base(), size); + else + memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); + } + + return image_init_result::PASS; +} + +//------------------------------------------------- +// get_default_card_software +//------------------------------------------------- + +std::string aquarius_cartridge_slot_device::get_default_card_software(get_default_card_software_hook &hook) const +{ + static const unsigned char SC08_HEADER[16] = { 0x53, 0x43, 0x30, 0x38, 0x4b, 0x9c, 0xb5, 0xb0, 0xa8, 0x6c, 0xac, 0x64, 0xcc, 0xa8, 0x06, 0x70 }; + static const unsigned char SC16_HEADER[16] = { 0x53, 0x43, 0x31, 0x36, 0x4b, 0x9c, 0xb5, 0xb0, 0xa8, 0x6c, 0xac, 0x64, 0xcc, 0xa8, 0x08, 0x70 }; + + if (hook.image_file()) + { + const char *slot_string = "rom"; + uint32_t len = hook.image_file()->size(); + + if (len >= 0x10000) + { + std::vector header(16); + + hook.image_file()->seek(len - 0x2000, SEEK_SET); + hook.image_file()->read(&header[0], 16); + + // detect SuperCart header + if (!memcmp(&header[0], SC08_HEADER, 16) || !memcmp(&header[0], SC16_HEADER, 16)) + slot_string = "sc1"; + } + + return std::string(slot_string); + } + else + return software_get_default_slot("rom"); +} + +//------------------------------------------------- +// iorq_r +//------------------------------------------------- + +uint8_t aquarius_cartridge_slot_device::iorq_r(offs_t offset) +{ + if (m_cart) + return m_cart->iorq_r(offset); + else + return 0xff; +} + +//------------------------------------------------- +// iorq_w +//------------------------------------------------- + +void aquarius_cartridge_slot_device::iorq_w(offs_t offset, uint8_t data) +{ + if (m_cart) + m_cart->iorq_w(offset, data); +} + +//------------------------------------------------- +// mreq_r +//------------------------------------------------- + +uint8_t aquarius_cartridge_slot_device::mreq_r(offs_t offset) +{ + if (m_cart) + return m_cart->mreq_r(offset); + else + return 0xff; +} + +uint8_t aquarius_cartridge_slot_device::mreq_ce_r(offs_t offset) +{ + if (m_cart) + return m_cart->mreq_ce_r(offset); + else + return 0xff; +} + +//------------------------------------------------- +// mreq_w +//------------------------------------------------- + +void aquarius_cartridge_slot_device::mreq_w(offs_t offset, uint8_t data) +{ + if (m_cart) + m_cart->mreq_w(offset, data); +} + +void aquarius_cartridge_slot_device::mreq_ce_w(offs_t offset, uint8_t data) +{ + if (m_cart) + m_cart->mreq_ce_w(offset, data); +} + + +//------------------------------------------------- +// SLOT_INTERFACE( aquarius_cartridge_devices ) +//------------------------------------------------- + + +// slot devices +#include "c1541.h" +#include "mini.h" +#include "qdisk.h" +#include "ram.h" +#include "rom.h" +#include "supercart.h" + + +void aquarius_cartridge_devices(device_slot_interface &device) +{ + device.option_add("mini", AQUARIUS_MINI); + device.option_add("ram4", AQUARIUS_RAM4); + device.option_add("ram16", AQUARIUS_RAM16); + device.option_add("ram16p", AQUARIUS_RAM16P); + device.option_add("ram32", AQUARIUS_RAM32); + device.option_add_internal("c1541", AQUARIUS_C1541); + device.option_add_internal("qdisk", AQUARIUS_QDISK); + device.option_add_internal("rom", AQUARIUS_ROM); + device.option_add_internal("sc1", AQUARIUS_SC1); +} diff --git a/src/devices/bus/aquarius/slot.h b/src/devices/bus/aquarius/slot.h new file mode 100644 index 00000000000..3c836803ab1 --- /dev/null +++ b/src/devices/bus/aquarius/slot.h @@ -0,0 +1,126 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius Cartridge Port emulation + +**********************************************************************/ + +#ifndef MAME_BUS_AQUARIUS_SLOT_H +#define MAME_BUS_AQUARIUS_SLOT_H + +#pragma once + +#include "softlist_dev.h" + + +#define AQUARIUS_CART_ROM_REGION_TAG ":cart:rom" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> aquarius_cartridge_slot_device + +class device_aquarius_cartridge_interface; + +class aquarius_cartridge_slot_device : public device_t, + public device_image_interface, + public device_single_card_slot_interface +{ +public: + // construction/destruction + template + aquarius_cartridge_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock, T &&slot_options, const char *default_option) + : aquarius_cartridge_slot_device(mconfig, tag, owner, clock) + { + option_reset(); + slot_options(*this); + set_default_option(default_option); + set_fixed(false); + } + + aquarius_cartridge_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock); + + // callbacks + auto irq_handler() { return m_irq_handler.bind(); } + auto nmi_handler() { return m_nmi_handler.bind(); } + + // image-level overrides + virtual image_init_result call_load() override; + + virtual iodevice_t image_type() const noexcept override { return IO_CARTSLOT; } + virtual bool is_readable() const noexcept override { return true; } + virtual bool is_writeable() const noexcept override { return true; } + virtual bool is_creatable() const noexcept override { return false; } + virtual bool must_be_loaded() const noexcept override { return false; } + virtual bool is_reset_on_load() const noexcept override { return true; } + virtual const char *image_interface() const noexcept override { return "aquarius_cart"; } + virtual const char *file_extensions() const noexcept override { return "rom,bin"; } + + // slot interface overrides + virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; + + // reading and writing + uint8_t mreq_r(offs_t offset); + void mreq_w(offs_t offset, uint8_t data); + uint8_t mreq_ce_r(offs_t offset); + void mreq_ce_w(offs_t offset, uint8_t data); + uint8_t iorq_r(offs_t offset); + void iorq_w(offs_t offset, uint8_t data); + + DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); } + DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); } + +protected: + // device-level overrides + virtual void device_start() override; + + // device_image_interface implementation + virtual const software_list_loader &get_software_list_loader() const override { return rom_software_list_loader::instance(); } + + device_aquarius_cartridge_interface *m_cart; + +private: + devcb_write_line m_irq_handler; + devcb_write_line m_nmi_handler; +}; + + +// ======================> device_aquarius_cartridge_interface + +class device_aquarius_cartridge_interface : public device_interface +{ +public: + // reading and writing + virtual uint8_t mreq_r(offs_t offset) { return 0xff; } + virtual void mreq_w(offs_t offset, uint8_t data) { } + virtual uint8_t mreq_ce_r(offs_t offset) { return 0xff; } + virtual void mreq_ce_w(offs_t offset, uint8_t data) { } + virtual uint8_t iorq_r(offs_t offset) { return 0xff; } + virtual void iorq_w(offs_t offset, uint8_t data) { } + + void rom_alloc(uint32_t size, const char *tag); + uint8_t* get_rom_base() { return m_rom; } + uint32_t get_rom_size() { return m_rom_size; } + +protected: + // construction/destruction + device_aquarius_cartridge_interface(const machine_config &mconfig, device_t &device); + + aquarius_cartridge_slot_device *m_slot; + +private: + // internal state + uint8_t *m_rom; + uint32_t m_rom_size; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_CARTRIDGE_SLOT, aquarius_cartridge_slot_device) + +void aquarius_cartridge_devices(device_slot_interface &device); + + +#endif // MAME_BUS_AQUARIUS_SLOT_H diff --git a/src/devices/bus/aquarius/supercart.cpp b/src/devices/bus/aquarius/supercart.cpp new file mode 100644 index 00000000000..2bc2ad82fd8 --- /dev/null +++ b/src/devices/bus/aquarius/supercart.cpp @@ -0,0 +1,101 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/*************************************************************************** + + Aquarius SuperCart Cartridge + +***************************************************************************/ + +#include "emu.h" +#include "supercart.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_SC1, aquarius_sc1_device, "aquarius_sc1", "Aquarius SuperCart I Cartridge") + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_sc1_device - constructor +//------------------------------------------------- + +aquarius_sc1_device::aquarius_sc1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_SC1, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) + , m_bank(0) + , m_mode(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_sc1_device::device_start() +{ + save_item(NAME(m_bank)); + save_item(NAME(m_mode)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void aquarius_sc1_device::device_reset() +{ + static const unsigned char SC08_HEADER[16] = { 0x53, 0x43, 0x30, 0x38, 0x4b, 0x9c, 0xb5, 0xb0, 0xa8, 0x6c, 0xac, 0x64, 0xcc, 0xa8, 0x06, 0x70 }; + static const unsigned char SC16_HEADER[16] = { 0x53, 0x43, 0x31, 0x36, 0x4b, 0x9c, 0xb5, 0xb0, 0xa8, 0x6c, 0xac, 0x64, 0xcc, 0xa8, 0x08, 0x70 }; + + uint8_t* header = get_rom_base() + get_rom_size() - 0x2000; + + // select bank switching mode + if (!memcmp(header, SC08_HEADER, 16)) + m_mode = 0; + else if (!memcmp(header, SC16_HEADER, 16)) + m_mode = 1; + else + fatalerror("Invalid SuperCart mode header\n"); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t aquarius_sc1_device::mreq_ce_r(offs_t offset) +{ + switch (m_mode) + { + case 0: // 8K Mode + if (offset & 0x2000) + { + offset |= get_rom_size() - 0x2000; + } + else + { + offset |= m_bank << 13; + } + break; + + case 1: // 16K Mode + offset |= (m_bank & 0x7e) << 13; + break; + } + + return get_rom_base()[offset & (get_rom_size() - 1)]; +} + +void aquarius_sc1_device::mreq_ce_w(offs_t offset, uint8_t data) +{ + if (offset & 0x2000) + { + m_bank = data & 0x7f; + } +} diff --git a/src/devices/bus/aquarius/supercart.h b/src/devices/bus/aquarius/supercart.h new file mode 100644 index 00000000000..9242c1dc667 --- /dev/null +++ b/src/devices/bus/aquarius/supercart.h @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/*************************************************************************** + + Aquarius SuperCart Cartridge + +***************************************************************************/ + +#ifndef MAME_BUS_AQUARIUS_SUPERCART_H +#define MAME_BUS_AQUARIUS_SUPERCART_H + +#pragma once + +#include "slot.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> aquarius_sc1_device + +class aquarius_sc1_device : + public device_t, + public device_aquarius_cartridge_interface +{ +public: + // construction/destruction + aquarius_sc1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_ce_r(offs_t offset) override; + virtual void mreq_ce_w(offs_t offset, uint8_t data) override; + +private: + uint8_t m_bank; + int m_mode; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_SC1, aquarius_sc1_device) + + +#endif // MAME_BUS_AQUARIUS_SUPERCART_H diff --git a/src/mame/drivers/aquarius.cpp b/src/mame/drivers/aquarius.cpp index df0fd1e31d8..8463082353e 100644 --- a/src/mame/drivers/aquarius.cpp +++ b/src/mame/drivers/aquarius.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Nathan Woods +// copyright-holders:Nathan Woods,Nigel Barnes /*************************************************************************** Mattel Aquarius @@ -7,10 +7,6 @@ TODO: - - slot interface for cartridges - - hand controllers - - scramble RAM also - - memory mapper - proper video timings - PAL mode - floppy support (I/O 0xe6-0xe7 = drive 1, 0xea-0xeb = drive 2) @@ -109,6 +105,7 @@ uint8_t aquarius_state::vsync_r() */ void aquarius_state::mapper_w(uint8_t data) { + m_mapper->set_bank(BIT(data, 0)); } @@ -119,18 +116,19 @@ void aquarius_state::mapper_w(uint8_t data) */ uint8_t aquarius_state::printer_r() { - return 1; /* ready */ + return m_printer->cts_r(); /* ready */ } /* This is a single bit I/O at D0, it will perform as a serial output port under software control. Since timing is done by software the - baudrate is variable. In BASIC this is a 1200 baud printer port for + baud rate is variable. In BASIC this is a 1200 baud printer port for the 40 column thermal printer. */ void aquarius_state::printer_w(uint8_t data) { + m_printer->write_txd(BIT(data, 0)); } @@ -149,14 +147,14 @@ uint8_t aquarius_state::keyboard_r(offs_t offset) { uint8_t result = 0xff; - if (!BIT(offset, 8)) result &= m_y0->read(); - if (!BIT(offset, 9)) result &= m_y1->read(); - if (!BIT(offset, 10)) result &= m_y2->read(); - if (!BIT(offset, 11)) result &= m_y3->read(); - if (!BIT(offset, 12)) result &= m_y4->read(); - if (!BIT(offset, 13)) result &= m_y5->read(); - if (!BIT(offset, 14)) result &= m_y6->read(); - if (!BIT(offset, 15)) result &= m_y7->read(); + if (!BIT(offset, 8)) result &= m_y[0]->read(); + if (!BIT(offset, 9)) result &= m_y[1]->read(); + if (!BIT(offset, 10)) result &= m_y[2]->read(); + if (!BIT(offset, 11)) result &= m_y[3]->read(); + if (!BIT(offset, 12)) result &= m_y[4]->read(); + if (!BIT(offset, 13)) result &= m_y[5]->read(); + if (!BIT(offset, 14)) result &= m_y[6]->read(); + if (!BIT(offset, 15)) result &= m_y[7]->read(); return result; } @@ -185,30 +183,20 @@ void aquarius_state::scrambler_w(uint8_t data) m_scrambler = data; } -uint8_t aquarius_state::cartridge_r(offs_t offset) -{ - uint8_t data = 0; - if (m_cart->exists()) - data = m_cart->read_rom(offset); - - return data ^ m_scrambler; -} - /*************************************************************************** DRIVER INIT ***************************************************************************/ -void aquarius_state::init_aquarius() +void aquarius_state::machine_start() { - /* install expansion memory if available */ - if (m_ram->size() > 0x1000) - { - address_space &space = m_maincpu->space(AS_PROGRAM); + save_item(NAME(m_scrambler)); +} - space.install_readwrite_bank(0x4000, 0x4000 + m_ram->size() - 0x1000 - 1, "bank1"); - membank("bank1")->set_base(m_ram->pointer()); - } +void aquarius_state::machine_reset() +{ + /* reset memory mapper after power up */ + m_mapper->set_bank(0); } @@ -218,19 +206,31 @@ void aquarius_state::init_aquarius() void aquarius_state::aquarius_mem(address_map &map) { - map(0x0000, 0x1fff).rom(); - map(0x3000, 0x33ff).ram().w(FUNC(aquarius_state::aquarius_videoram_w)).share("videoram"); - map(0x3400, 0x37ff).ram().w(FUNC(aquarius_state::aquarius_colorram_w)).share("colorram"); - map(0x3800, 0x3fff).ram(); - map(0x4000, 0xbfff).noprw(); /* expansion ram */ - map(0xc000, 0xffff).r(FUNC(aquarius_state::cartridge_r)); + map(0x0000, 0xffff).m(m_mapper, FUNC(address_map_bank_device::amap8)); +} + +void aquarius_state::aquarius_map(address_map &map) +{ + /* Normal mode */ + map(0x00000, 0x02fff).rom().region("maincpu", 0); + map(0x03000, 0x033ff).ram().w(FUNC(aquarius_state::aquarius_videoram_w)).share("videoram"); + map(0x03400, 0x037ff).ram().w(FUNC(aquarius_state::aquarius_colorram_w)).share("colorram"); + map(0x03800, 0x03fff).ram(); + map(0x04000, 0x0bfff).lrw8(NAME([this](offs_t offset) { return m_exp->mreq_r(offset) ^ m_scrambler; }), NAME([this](offs_t offset, u8 data) { m_exp->mreq_w(offset, data ^ m_scrambler); })); + map(0x0c000, 0x0ffff).lrw8(NAME([this](offs_t offset) { return m_exp->mreq_ce_r(offset) ^ m_scrambler; }), NAME([this](offs_t offset, u8 data) { m_exp->mreq_ce_w(offset, data ^ m_scrambler); })); + /* CP/M mode */ + map(0x10000, 0x13fff).lrw8(NAME([this](offs_t offset) { return m_exp->mreq_ce_r(offset) ^ m_scrambler; }), NAME([this](offs_t offset, u8 data) { m_exp->mreq_ce_w(offset, data ^ m_scrambler); })); + map(0x14000, 0x1bfff).lrw8(NAME([this](offs_t offset) { return m_exp->mreq_r(offset) ^ m_scrambler; }), NAME([this](offs_t offset, u8 data) { m_exp->mreq_w(offset, data ^ m_scrambler); })); + map(0x1c000, 0x1efff).rom().region("maincpu", 0); + map(0x1f000, 0x1f3ff).ram().w(FUNC(aquarius_state::aquarius_videoram_w)).share("videoram"); + map(0x1f400, 0x1f7ff).ram().w(FUNC(aquarius_state::aquarius_colorram_w)).share("colorram"); + map(0x1f800, 0x1ffff).ram(); } void aquarius_state::aquarius_io(address_map &map) { + map(0x00, 0xff).mirror(0xff00).rw(m_exp, FUNC(aquarius_cartridge_slot_device::iorq_r), FUNC(aquarius_cartridge_slot_device::iorq_w)); // map(0x7e, 0x7f).mirror(0xff00).rw(FUNC(aquarius_state::modem_r), FUNC(aquarius_state::modem_w)); - map(0xf6, 0xf6).mirror(0xff00).rw("ay8910", FUNC(ay8910_device::data_r), FUNC(ay8910_device::data_w)); - map(0xf7, 0xf7).mirror(0xff00).w("ay8910", FUNC(ay8910_device::address_w)); map(0xfc, 0xfc).mirror(0xff00).rw(FUNC(aquarius_state::cassette_r), FUNC(aquarius_state::cassette_w)); map(0xfd, 0xfd).mirror(0xff00).rw(FUNC(aquarius_state::vsync_r), FUNC(aquarius_state::mapper_w)); map(0xfe, 0xfe).mirror(0xff00).rw(FUNC(aquarius_state::printer_r), FUNC(aquarius_state::printer_w)); @@ -323,12 +323,6 @@ static INPUT_PORTS_START( aquarius ) PORT_START("RESET") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_state, aquarius_reset, 0) - - PORT_START("LEFT") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("RIGHT") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) INPUT_PORTS_END @@ -354,6 +348,24 @@ static GFXDECODE_START( gfx_aquarius ) GFXDECODE_END +/*************************************************************************** + DEVICE CONFIGURATION +***************************************************************************/ + +static DEVICE_INPUT_DEFAULTS_START(printer) + DEVICE_INPUT_DEFAULTS("RS232_RXBAUD", 0xff, RS232_BAUD_1200) + DEVICE_INPUT_DEFAULTS("RS232_TXBAUD", 0xff, RS232_BAUD_1200) + DEVICE_INPUT_DEFAULTS("RS232_STARTBITS", 0xff, RS232_STARTBITS_1) + DEVICE_INPUT_DEFAULTS("RS232_DATABITS", 0xff, RS232_DATABITS_8) + DEVICE_INPUT_DEFAULTS("RS232_PARITY", 0xff, RS232_PARITY_NONE) + DEVICE_INPUT_DEFAULTS("RS232_STOPBITS", 0xff, RS232_STOPBITS_2) +DEVICE_INPUT_DEFAULTS_END + +void aquarius_state::cfg_ram16(device_t* device) +{ + device->subdevice("exp2")->set_default_option("ram16"); +} + /*************************************************************************** MACHINE DRIVERS ***************************************************************************/ @@ -366,6 +378,8 @@ void aquarius_state::aquarius(machine_config &config) m_maincpu->set_addrmap(AS_IO, &aquarius_state::aquarius_io); m_maincpu->set_vblank_int("screen", FUNC(aquarius_state::irq0_line_hold)); + ADDRESS_MAP_BANK(config, m_mapper).set_map(&aquarius_state::aquarius_map).set_options(ENDIANNESS_LITTLE, 8, 17, 0x10000); + /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60); @@ -383,12 +397,6 @@ void aquarius_state::aquarius(machine_config &config) SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25); - /* mini expander */ - ay8910_device &ay8910(AY8910(config, "ay8910", XTAL(3'579'545)/2)); // ??? AY-3-8914 - ay8910.port_a_read_callback().set_ioport("RIGHT"); - ay8910.port_b_read_callback().set_ioport("LEFT"); - ay8910.add_route(ALL_OUTPUTS, "mono", 0.25); - /* cassette */ CASSETTE(config, m_cassette); m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED); @@ -396,11 +404,15 @@ void aquarius_state::aquarius(machine_config &config) m_cassette->set_formats(aquarius_cassette_formats); m_cassette->set_interface("aquarius_cass"); - /* cartridge */ - GENERIC_CARTSLOT(config, m_cart, generic_linear_slot, "aquarius_cart"); + /* printer */ + RS232_PORT(config, m_printer, default_rs232_devices, "printer"); + m_printer->set_option_device_input_defaults("printer", DEVICE_INPUT_DEFAULTS_NAME(printer)); - /* internal ram */ - RAM(config, RAM_TAG).set_default_size("20K").set_extra_options("4K,8K,36K"); + /* cartridge */ + AQUARIUS_CARTRIDGE_SLOT(config, m_exp, 7.15909_MHz_XTAL / 2, aquarius_cartridge_devices, "mini"); + m_exp->set_option_machine_config("mini", cfg_ram16); + m_exp->irq_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_exp->nmi_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); /* software lists */ SOFTWARE_LIST(config, "cart_list").set_original("aquarius_cart"); @@ -413,7 +425,7 @@ void aquarius_state::aquarius(machine_config &config) ***************************************************************************/ ROM_START( aquarius ) - ROM_REGION(0x10000, "maincpu", 0) + ROM_REGION(0x3000, "maincpu", ROMREGION_ERASE00) /* basic rom */ ROM_DEFAULT_BIOS("rev2") @@ -423,8 +435,8 @@ ROM_START( aquarius ) ROMX_LOAD("aq1.u2", 0x0000, 0x2000, NO_DUMP, ROM_BIOS(1)) /* charrom */ - ROM_REGION(0x800, "gfx1", 0) - ROM_LOAD("aq2.u5", 0x000, 0x800, CRC(e117f57c) SHA1(3588c0267c67dfbbda615bcf8dc3d3a5c5bd815a)) + ROM_REGION(0x0800, "gfx1", 0) + ROM_LOAD("aq2.u5", 0x0000, 0x0800, CRC(e117f57c) SHA1(3588c0267c67dfbbda615bcf8dc3d3a5c5bd815a)) ROM_END diff --git a/src/mame/includes/aquarius.h b/src/mame/includes/aquarius.h index d2c54611710..41aa202c091 100644 --- a/src/mame/includes/aquarius.h +++ b/src/mame/includes/aquarius.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Nathan Woods +// copyright-holders:Nathan Woods,Nigel Barnes /***************************************************************************** * * includes/aquarius.h @@ -12,13 +12,12 @@ #include "cpu/z80/z80.h" #include "imagedev/cassette.h" -#include "machine/ram.h" -#include "sound/ay8910.h" +#include "machine/bankdev.h" #include "sound/spkrdev.h" #include "video/tea1002.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" +#include "bus/aquarius/slot.h" +#include "bus/rs232/rs232.h" #include "formats/aquarius_caq.h" @@ -35,49 +34,39 @@ public: , m_maincpu(*this, "maincpu") , m_cassette(*this, "cassette") , m_speaker(*this, "speaker") - , m_cart(*this, "cartslot") - , m_ram(*this, RAM_TAG) + , m_exp(*this, "exp") + , m_printer(*this, "printer") + , m_mapper(*this, "mapper") , m_videoram(*this, "videoram") , m_colorram(*this, "colorram") - , m_y0(*this, "Y0") - , m_y1(*this, "Y1") - , m_y2(*this, "Y2") - , m_y3(*this, "Y3") - , m_y4(*this, "Y4") - , m_y5(*this, "Y5") - , m_y6(*this, "Y6") - , m_y7(*this, "Y7") + , m_y(*this, "Y%u", 0U) , m_gfxdecode(*this, "gfxdecode") , m_screen(*this, "screen") , m_tea1002(*this, "encoder") , m_palette(*this, "palette") { } - void init_aquarius(); - DECLARE_INPUT_CHANGED_MEMBER(aquarius_reset); void aquarius(machine_config &config); + static void cfg_ram16(device_t* device); + protected: + virtual void machine_start() override; + virtual void machine_reset() override; virtual void video_start() override; private: required_device m_maincpu; required_device m_cassette; required_device m_speaker; - required_device m_cart; - required_device m_ram; + required_device m_exp; + required_device m_printer; + required_device m_mapper; required_shared_ptr m_videoram; required_shared_ptr m_colorram; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; + required_ioport_array<8> m_y; required_device m_gfxdecode; required_device m_screen; required_device m_tea1002; @@ -96,12 +85,13 @@ private: void printer_w(uint8_t data); uint8_t keyboard_r(offs_t offset); void scrambler_w(uint8_t data); - uint8_t cartridge_r(offs_t offset); TILE_GET_INFO_MEMBER(aquarius_gettileinfo); void aquarius_palette(palette_device &palette) const; uint32_t screen_update_aquarius(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void aquarius_io(address_map &map); void aquarius_mem(address_map &map); + void aquarius_map(address_map &map); }; #endif // MAME_INCLUDES_AQUARIUS_H