diff options
author | 2015-06-10 09:10:54 +0200 | |
---|---|---|
committer | 2015-06-10 10:11:48 +0200 | |
commit | 30fb2540c204e32a255fbb19c1d245315c216844 (patch) | |
tree | 94b54172d391af0ef9a3a3284e7eea8583174695 | |
parent | 34d29b7e27b9ffa4e8fffeb38ec420f9ee4c9aed (diff) |
apricot: split 128/512k ram card into two devices
-rw-r--r-- | src/emu/bus/apricot/cards.c | 3 | ||||
-rw-r--r-- | src/emu/bus/apricot/ram.c | 98 | ||||
-rw-r--r-- | src/emu/bus/apricot/ram.h | 30 |
3 files changed, 94 insertions, 37 deletions
diff --git a/src/emu/bus/apricot/cards.c b/src/emu/bus/apricot/cards.c index b2369db7f90..9a97adffca6 100644 --- a/src/emu/bus/apricot/cards.c +++ b/src/emu/bus/apricot/cards.c @@ -9,6 +9,7 @@ #include "cards.h" SLOT_INTERFACE_START( apricot_expansion_cards ) + SLOT_INTERFACE("128k", APRICOT_128K_RAM) SLOT_INTERFACE("256k", APRICOT_256K_RAM) - SLOT_INTERFACE("128_512k", APRICOT_128_512K_RAM) + SLOT_INTERFACE("512k", APRICOT_512K_RAM) SLOT_INTERFACE_END diff --git a/src/emu/bus/apricot/ram.c b/src/emu/bus/apricot/ram.c index fb24fba61db..0a166c82e6d 100644 --- a/src/emu/bus/apricot/ram.c +++ b/src/emu/bus/apricot/ram.c @@ -14,7 +14,8 @@ //************************************************************************** const device_type APRICOT_256K_RAM = &device_creator<apricot_256k_ram_device>; -const device_type APRICOT_128_512K_RAM = &device_creator<apricot_128_512k_ram_device>; +const device_type APRICOT_128K_RAM = &device_creator<apricot_128k_ram_device>; +const device_type APRICOT_512K_RAM = &device_creator<apricot_512k_ram_device>; //************************************************************************** @@ -71,18 +72,68 @@ void apricot_256k_ram_device::device_reset() //************************************************************************** -// APRICOT 128/512K RAM DEVICE +// APRICOT 128K RAM DEVICE //************************************************************************** //------------------------------------------------- // input_ports - device-specific input ports //------------------------------------------------- -static INPUT_PORTS_START( apricot_128_512k ) - PORT_START("config") - PORT_CONFNAME(0x01, 0x01, "DRAM Size") - PORT_CONFSETTING(0x00, "64K") - PORT_CONFSETTING(0x01, "256K") +static INPUT_PORTS_START( apricot_128k ) + PORT_START("strap") + PORT_DIPNAME(0x03, 0x01, "Base Address") + PORT_DIPSETTING(0x00, "512K") + PORT_DIPSETTING(0x01, "256K - 384K") + PORT_DIPSETTING(0x02, "384K - 512K") +INPUT_PORTS_END + +ioport_constructor apricot_128k_ram_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( apricot_128k ); +} + +//------------------------------------------------- +// apricot_128_512k_ram_device - constructor +//------------------------------------------------- + +apricot_128k_ram_device::apricot_128k_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, APRICOT_128K_RAM, "Apricot 128/512K RAM Expansion Board (128K)", tag, owner, clock, "apricot_128k_ram", __FILE__), + device_apricot_expansion_card_interface(mconfig, *this), + m_strap(*this, "strap") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apricot_128k_ram_device::device_start() +{ + m_ram.resize(0x20000 / 2); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void apricot_128k_ram_device::device_reset() +{ + if (m_strap->read() == 1) + m_bus->m_program->install_ram(0x40000, 0x5ffff, &m_ram[0]); + else if (m_strap->read() == 2) + m_bus->m_program->install_ram(0x60000, 0x7ffff, &m_ram[0]); +} + + +//************************************************************************** +// APRICOT 512K RAM DEVICE +//************************************************************************** + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( apricot_512k ) PORT_START("strap") PORT_DIPNAME(0x03, 0x00, "Base Address") PORT_DIPSETTING(0x00, "512K") @@ -90,19 +141,18 @@ static INPUT_PORTS_START( apricot_128_512k ) PORT_DIPSETTING(0x02, "384K - 512K") INPUT_PORTS_END -ioport_constructor apricot_128_512k_ram_device::device_input_ports() const +ioport_constructor apricot_512k_ram_device::device_input_ports() const { - return INPUT_PORTS_NAME( apricot_128_512k ); + return INPUT_PORTS_NAME( apricot_512k ); } //------------------------------------------------- // apricot_128_512k_ram_device - constructor //------------------------------------------------- -apricot_128_512k_ram_device::apricot_128_512k_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, APRICOT_128_512K_RAM, "Apricot 128/512K RAM Expansion Board", tag, owner, clock, "apricot_128_512k_ram", __FILE__), +apricot_512k_ram_device::apricot_512k_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, APRICOT_512K_RAM, "Apricot 128/512K RAM Expansion Board (512K)", tag, owner, clock, "apricot_512k_ram", __FILE__), device_apricot_expansion_card_interface(mconfig, *this), - m_config(*this, "config"), m_strap(*this, "strap") { } @@ -111,31 +161,17 @@ apricot_128_512k_ram_device::apricot_128_512k_ram_device(const machine_config &m // device_start - device-specific startup //------------------------------------------------- -void apricot_128_512k_ram_device::device_start() +void apricot_512k_ram_device::device_start() { + m_ram.resize(0x80000 / 2); } //------------------------------------------------- // device_reset - device-specific reset //------------------------------------------------- -void apricot_128_512k_ram_device::device_reset() +void apricot_512k_ram_device::device_reset() { - // 128 or 512k? - if (m_config->read() == 1) - { - m_ram.resize(0x80000 / 2); - - if (m_strap->read() == 0) - m_bus->m_program->install_ram(0x40000, 0xbffff, &m_ram[0]); - } - else - { - m_ram.resize(0x20000 / 2); - - if (m_strap->read() == 1) - m_bus->m_program->install_ram(0x40000, 0x5ffff, &m_ram[0]); - else if (m_strap->read() == 2) - m_bus->m_program->install_ram(0x60000, 0x7ffff, &m_ram[0]); - } + if (m_strap->read() == 0) + m_bus->m_program->install_ram(0x40000, 0xbffff, &m_ram[0]); } diff --git a/src/emu/bus/apricot/ram.h b/src/emu/bus/apricot/ram.h index 0610585376f..20ac01f2867 100644 --- a/src/emu/bus/apricot/ram.h +++ b/src/emu/bus/apricot/ram.h @@ -40,13 +40,33 @@ private: }; -// ======================> apricot_128_512k_ram_device +// ======================> apricot_128k_ram_device -class apricot_128_512k_ram_device : public device_t, public device_apricot_expansion_card_interface +class apricot_128k_ram_device : public device_t, public device_apricot_expansion_card_interface { public: // construction/destruction - apricot_128_512k_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + apricot_128k_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + virtual ioport_constructor device_input_ports() const; + virtual void device_start(); + virtual void device_reset(); + +private: + required_ioport m_strap; + + std::vector<UINT16> m_ram; +}; + + +// ======================> apricot_512k_ram_device + +class apricot_512k_ram_device : public device_t, public device_apricot_expansion_card_interface +{ +public: + // construction/destruction + apricot_512k_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); protected: virtual ioport_constructor device_input_ports() const; @@ -54,7 +74,6 @@ protected: virtual void device_reset(); private: - required_ioport m_config; required_ioport m_strap; std::vector<UINT16> m_ram; @@ -63,7 +82,8 @@ private: // device type definition extern const device_type APRICOT_256K_RAM; -extern const device_type APRICOT_128_512K_RAM; +extern const device_type APRICOT_128K_RAM; +extern const device_type APRICOT_512K_RAM; #endif // __APRICOT_RAM__ |