From 42b42714ed4d5444d50c9b0f0edadceac14abc65 Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Tue, 25 Sep 2018 17:09:19 +0100 Subject: [PATCH] bbc_tube_6502/65c102: Added ReCo6502 Tube 1.21 ROM. - Rewritten using bankdev and combined 6502/65c102 variants (nw) --- scripts/src/bus.lua | 2 - src/devices/bus/bbc/tube/tube.cpp | 1 - src/devices/bus/bbc/tube/tube_6502.cpp | 125 +++++++++++------- src/devices/bus/bbc/tube/tube_6502.h | 33 ++++- src/devices/bus/bbc/tube/tube_65c102.cpp | 157 ----------------------- src/devices/bus/bbc/tube/tube_65c102.h | 66 ---------- 6 files changed, 108 insertions(+), 276 deletions(-) delete mode 100644 src/devices/bus/bbc/tube/tube_65c102.cpp delete mode 100644 src/devices/bus/bbc/tube/tube_65c102.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 0abd88b3765..e86393a9e8f 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -353,8 +353,6 @@ if (BUSES["BBC_TUBE"]~=null) then MAME_DIR .. "src/devices/bus/bbc/tube/tube.h", MAME_DIR .. "src/devices/bus/bbc/tube/tube_6502.cpp", MAME_DIR .. "src/devices/bus/bbc/tube/tube_6502.h", - MAME_DIR .. "src/devices/bus/bbc/tube/tube_65c102.cpp", - MAME_DIR .. "src/devices/bus/bbc/tube/tube_65c102.h", MAME_DIR .. "src/devices/bus/bbc/tube/tube_80186.cpp", MAME_DIR .. "src/devices/bus/bbc/tube/tube_80186.h", MAME_DIR .. "src/devices/bus/bbc/tube/tube_80286.cpp", diff --git a/src/devices/bus/bbc/tube/tube.cpp b/src/devices/bus/bbc/tube/tube.cpp index c69b57cd45f..521497361ee 100644 --- a/src/devices/bus/bbc/tube/tube.cpp +++ b/src/devices/bus/bbc/tube/tube.cpp @@ -113,7 +113,6 @@ WRITE8_MEMBER(bbc_tube_slot_device::host_w) // slot devices #include "tube_6502.h" -#include "tube_65c102.h" #include "tube_80186.h" #include "tube_80286.h" //#include "tube_a500.h" diff --git a/src/devices/bus/bbc/tube/tube_6502.cpp b/src/devices/bus/bbc/tube/tube_6502.cpp index 3aa3c6a1175..8120ab16812 100644 --- a/src/devices/bus/bbc/tube/tube_6502.cpp +++ b/src/devices/bus/bbc/tube/tube_6502.cpp @@ -6,6 +6,10 @@ http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ANC01_65022ndproc.html + Acorn ADC06 65C102 Co-processor + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ADC06_65C102CoPro.html + **********************************************************************/ @@ -18,7 +22,8 @@ // DEVICE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(BBC_TUBE_6502, bbc_tube_6502_device, "bbc_tube_6502", "Acorn 6502 2nd Processor") +DEFINE_DEVICE_TYPE(BBC_TUBE_6502, bbc_tube_6502_device, "bbc_tube_6502", "Acorn 6502 2nd Processor") +DEFINE_DEVICE_TYPE(BBC_TUBE_65C102, bbc_tube_65c102_device, "bbc_tube_65c102", "Acorn 65C102 Co-Processor") //------------------------------------------------- @@ -27,7 +32,17 @@ DEFINE_DEVICE_TYPE(BBC_TUBE_6502, bbc_tube_6502_device, "bbc_tube_6502", "Acorn void bbc_tube_6502_device::tube_6502_mem(address_map &map) { - map(0x0000, 0xffff).rw(FUNC(bbc_tube_6502_device::read), FUNC(bbc_tube_6502_device::write)); + map(0x0000, 0xffff).m(m_bankdev, FUNC(address_map_bank_device::amap8)); + map(0xfef0, 0xfeff).rw(FUNC(bbc_tube_6502_device::tube_r), FUNC(bbc_tube_6502_device::tube_w)); +} + +void bbc_tube_6502_device::tube_6502_bank(address_map &map) +{ + // ROM enabled + map(0x00000, 0x0ffff).ram().share("ram"); + map(0x0f000, 0x0ffff).rom().region("rom", 0); + // ROM disabled + map(0x10000, 0x1ffff).ram().share("ram"); } //------------------------------------------------- @@ -36,21 +51,33 @@ void bbc_tube_6502_device::tube_6502_mem(address_map &map) ROM_START( tube_6502 ) ROM_REGION(0x1000, "rom", 0) - ROM_LOAD("6502tube.rom", 0x0000, 0x1000, CRC(98b5fe42) SHA1(338269d03cf6bfa28e09d1651c273ea53394323b)) + ROM_DEFAULT_BIOS("110") + ROM_SYSTEM_BIOS(0, "110", "Tube 1.10") + ROMX_LOAD("6502tube.rom", 0x0000, 0x1000, CRC(98b5fe42) SHA1(338269d03cf6bfa28e09d1651c273ea53394323b), ROM_BIOS(0)) + ROM_SYSTEM_BIOS(1, "121", "Tube 1.21 (ReCo6502)") + ROMX_LOAD("reco6502tube.rom", 0x0000, 0x1000, CRC(75b2a466) SHA1(9ecef24de58a48c3fbe01b12888c3f6a5d24f57f), ROM_BIOS(1)) +ROM_END + +ROM_START( tube_65c102 ) + ROM_REGION(0x1000, "rom", 0) + ROM_DEFAULT_BIOS("110") + ROM_SYSTEM_BIOS(0, "110", "Tube 1.10") + ROMX_LOAD("65c102_boot_110.rom", 0x0000, 0x1000, CRC(ad5b70cc) SHA1(0ac9a1c70e55a79e2c81e102afae1d016af229fa), ROM_BIOS(0)) // 2201,243-02 + ROM_SYSTEM_BIOS(1, "121", "Tube 1.21 (ReCo6502)") + ROMX_LOAD("reco6502tube.rom", 0x0000, 0x1000, CRC(75b2a466) SHA1(9ecef24de58a48c3fbe01b12888c3f6a5d24f57f), ROM_BIOS(1)) ROM_END //------------------------------------------------- // device_add_mconfig - add device configuration //------------------------------------------------- -void bbc_tube_6502_device::device_add_mconfig(machine_config &config) +void bbc_tube_6502_device::add_common_devices(machine_config &config) { - M65C02(config, m_m6502, 12_MHz_XTAL / 4); - m_m6502->set_addrmap(AS_PROGRAM, &bbc_tube_6502_device::tube_6502_mem); + ADDRESS_MAP_BANK(config, m_bankdev).set_map(&bbc_tube_6502_device::tube_6502_bank).set_options(ENDIANNESS_LITTLE, 8, 17, 0x10000); TUBE(config, m_ula); - m_ula->pnmi_handler().set_inputline(m_m6502, M65C02_NMI_LINE); - m_ula->pirq_handler().set_inputline(m_m6502, M65C02_IRQ_LINE); + m_ula->pnmi_handler().set_inputline(m_maincpu, M65C02_NMI_LINE); + m_ula->pirq_handler().set_inputline(m_maincpu, M65C02_IRQ_LINE); /* internal ram */ RAM(config, m_ram).set_default_size("64K").set_default_value(0); @@ -60,6 +87,22 @@ void bbc_tube_6502_device::device_add_mconfig(machine_config &config) SOFTWARE_LIST(config, "flop_ls_65c102").set_original("bbc_flop_65c102"); } +void bbc_tube_6502_device::device_add_mconfig(machine_config &config) +{ + M65C02(config, m_maincpu, 12_MHz_XTAL / 4); + m_maincpu->set_addrmap(AS_PROGRAM, &bbc_tube_6502_device::tube_6502_mem); + + add_common_devices(config); +} + +void bbc_tube_65c102_device::device_add_mconfig(machine_config &config) +{ + M65C02(config, m_maincpu, 16_MHz_XTAL / 4); + m_maincpu->set_addrmap(AS_PROGRAM, &bbc_tube_65c102_device::tube_6502_mem); + + add_common_devices(config); +} + //------------------------------------------------- // rom_region - device-specific ROM region //------------------------------------------------- @@ -69,6 +112,11 @@ const tiny_rom_entry *bbc_tube_6502_device::device_rom_region() const return ROM_NAME( tube_6502 ); } +const tiny_rom_entry *bbc_tube_65c102_device::device_rom_region() const +{ + return ROM_NAME( tube_65c102 ); +} + //************************************************************************** // LIVE DEVICE //************************************************************************** @@ -77,14 +125,24 @@ const tiny_rom_entry *bbc_tube_6502_device::device_rom_region() const // bbc_tube_6502_device - constructor //------------------------------------------------- +bbc_tube_6502_device::bbc_tube_6502_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_bbc_tube_interface(mconfig, *this) + , m_maincpu(*this, "maincpu") + , m_bankdev(*this, "bankdev") + , m_ula(*this, "ula") + , m_ram(*this, "ram") + , m_rom(*this, "rom") +{ +} + bbc_tube_6502_device::bbc_tube_6502_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, BBC_TUBE_6502, tag, owner, clock), - device_bbc_tube_interface(mconfig, *this), - m_m6502(*this, "m6502"), - m_ula(*this, "ula"), - m_ram(*this, "ram"), - m_rom(*this, "rom"), - m_rom_enabled(true) + : bbc_tube_6502_device(mconfig, BBC_TUBE_6502, tag, owner, clock) +{ +} + +bbc_tube_65c102_device::bbc_tube_65c102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : bbc_tube_6502_device(mconfig, BBC_TUBE_65C102, tag, owner, clock) { } @@ -94,7 +152,6 @@ bbc_tube_6502_device::bbc_tube_6502_device(const machine_config &mconfig, const void bbc_tube_6502_device::device_start() { - m_slot = dynamic_cast(owner()); } //------------------------------------------------- @@ -103,9 +160,7 @@ void bbc_tube_6502_device::device_start() void bbc_tube_6502_device::device_reset() { - m_ula->reset(); - - m_rom_enabled = true; + m_bankdev->set_bank(0); } @@ -124,34 +179,16 @@ WRITE8_MEMBER(bbc_tube_6502_device::host_w) } -READ8_MEMBER(bbc_tube_6502_device::read) +READ8_MEMBER(bbc_tube_6502_device::tube_r) { - uint8_t data; + // Disable ROM on first access + if (!machine().side_effects_disabled()) + m_bankdev->set_bank(1); - if (offset >= 0xfef0 && offset <= 0xfeff) - { - if (!machine().side_effects_disabled()) m_rom_enabled = false; - data = m_ula->parasite_r(space, offset); - } - else if (m_rom_enabled && (offset >= 0xf000)) - { - data = m_rom->base()[offset & 0xfff]; - } - else - { - data = m_ram->pointer()[offset]; - } - return data; + return m_ula->parasite_r(space, offset); } -WRITE8_MEMBER(bbc_tube_6502_device::write) +WRITE8_MEMBER(bbc_tube_6502_device::tube_w) { - if (offset >= 0xfef0 && offset <= 0xfeff) - { - m_ula->parasite_w(space, offset, data); - } - else - { - m_ram->pointer()[offset] = data; - } + m_ula->parasite_w(space, offset, data); } diff --git a/src/devices/bus/bbc/tube/tube_6502.h b/src/devices/bus/bbc/tube/tube_6502.h index 67d14bd539f..244eb9f2105 100644 --- a/src/devices/bus/bbc/tube/tube_6502.h +++ b/src/devices/bus/bbc/tube/tube_6502.h @@ -6,6 +6,10 @@ http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ANC01_65022ndproc.html + Acorn ADC06 65C102 Co-processor + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ADC06_65C102CoPro.html + **********************************************************************/ @@ -14,6 +18,7 @@ #include "tube.h" #include "cpu/m6502/m65c02.h" +#include "machine/bankdev.h" #include "machine/ram.h" #include "machine/tube.h" @@ -32,6 +37,8 @@ public: bbc_tube_6502_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: + bbc_tube_6502_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; @@ -40,26 +47,40 @@ protected: virtual void device_add_mconfig(machine_config &config) override; virtual const tiny_rom_entry *device_rom_region() const override; + void tube_6502_bank(address_map &map); + void tube_6502_mem(address_map &map); + + void add_common_devices(machine_config &config); + virtual DECLARE_READ8_MEMBER( host_r ) override; virtual DECLARE_WRITE8_MEMBER( host_w ) override; -private: - required_device m_m6502; + virtual DECLARE_READ8_MEMBER( tube_r ); + virtual DECLARE_WRITE8_MEMBER( tube_w ); + + required_device m_maincpu; + required_device m_bankdev; required_device m_ula; required_device m_ram; required_memory_region m_rom; +}; - bool m_rom_enabled; - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); +class bbc_tube_65c102_device : public bbc_tube_6502_device +{ +public: + bbc_tube_65c102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - void tube_6502_mem(address_map &map); +protected: + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; }; // device type definition DECLARE_DEVICE_TYPE(BBC_TUBE_6502, bbc_tube_6502_device) +DECLARE_DEVICE_TYPE(BBC_TUBE_65C102, bbc_tube_65c102_device) #endif /* MAME_BUS_BBC_TUBE_6502_H */ diff --git a/src/devices/bus/bbc/tube/tube_65c102.cpp b/src/devices/bus/bbc/tube/tube_65c102.cpp deleted file mode 100644 index 1ef92732526..00000000000 --- a/src/devices/bus/bbc/tube/tube_65c102.cpp +++ /dev/null @@ -1,157 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nigel Barnes -/********************************************************************** - - Acorn ADC06 65C102 Co-processor - - http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ADC06_65C102CoPro.html - -**********************************************************************/ - - -#include "emu.h" -#include "tube_65c102.h" -#include "softlist_dev.h" - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -DEFINE_DEVICE_TYPE(BBC_TUBE_65C102, bbc_tube_65c102_device, "bbc_tube_65c102", "Acorn 65C102 Co-Processor") - - -//------------------------------------------------- -// ADDRESS_MAP( tube_6502_mem ) -//------------------------------------------------- - -void bbc_tube_65c102_device::tube_6502_mem(address_map &map) -{ - map(0x0000, 0xffff).rw(FUNC(bbc_tube_65c102_device::read), FUNC(bbc_tube_65c102_device::write)); -} - -//------------------------------------------------- -// ROM( tube_65c102 ) -//------------------------------------------------- - -ROM_START( tube_65c102 ) - ROM_REGION(0x1000, "rom", 0) - ROM_LOAD("65c102_boot_110.rom", 0x0000, 0x1000, CRC(ad5b70cc) SHA1(0ac9a1c70e55a79e2c81e102afae1d016af229fa)) // 2201,243-02 -ROM_END - -//------------------------------------------------- -// device_add_mconfig - add device configuration -//------------------------------------------------- - -void bbc_tube_65c102_device::device_add_mconfig(machine_config &config) -{ - M65C02(config, m_maincpu, 16_MHz_XTAL / 4); - m_maincpu->set_addrmap(AS_PROGRAM, &bbc_tube_65c102_device::tube_6502_mem); - - TUBE(config, m_ula); - m_ula->pnmi_handler().set_inputline(m_maincpu, M65C02_NMI_LINE); - m_ula->pirq_handler().set_inputline(m_maincpu, M65C02_IRQ_LINE); - - /* internal ram */ - RAM(config, m_ram).set_default_size("64K").set_default_value(0); - - /* software lists */ - SOFTWARE_LIST(config, "flop_ls_6502").set_original("bbc_flop_6502"); - SOFTWARE_LIST(config, "flop_ls_65c102").set_original("bbc_flop_65c102"); -} - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const tiny_rom_entry *bbc_tube_65c102_device::device_rom_region() const -{ - return ROM_NAME( tube_65c102 ); -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// bbc_tube_65c102_device - constructor -//------------------------------------------------- - -bbc_tube_65c102_device::bbc_tube_65c102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, BBC_TUBE_65C102, tag, owner, clock), - device_bbc_tube_interface(mconfig, *this), - m_maincpu(*this, "maincpu"), - m_ula(*this, "ula"), - m_ram(*this, "ram"), - m_rom(*this, "rom"), - m_rom_enabled(true) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void bbc_tube_65c102_device::device_start() -{ - m_slot = dynamic_cast(owner()); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void bbc_tube_65c102_device::device_reset() -{ - m_ula->reset(); - - m_rom_enabled = true; -} - - -//************************************************************************** -// IMPLEMENTATION -//************************************************************************** - -READ8_MEMBER(bbc_tube_65c102_device::host_r) -{ - return m_ula->host_r(space, offset); -} - -WRITE8_MEMBER(bbc_tube_65c102_device::host_w) -{ - m_ula->host_w(space, offset, data); -} - - -READ8_MEMBER(bbc_tube_65c102_device::read) -{ - uint8_t data; - - if ((offset >= 0xfef0) && (offset <= 0xfeff)) - { - if (!machine().side_effects_disabled()) m_rom_enabled = false; - data = m_ula->parasite_r(space, offset); - } - else if (m_rom_enabled && (offset >= 0xf000)) - { - data = m_rom->base()[offset & 0xfff]; - } - else - { - data = m_ram->pointer()[offset]; - } - return data; -} - -WRITE8_MEMBER(bbc_tube_65c102_device::write) -{ - if ((offset >= 0xfef0) && (offset <= 0xfeff)) - { - m_ula->parasite_w(space, offset, data); - } - else - { - m_ram->pointer()[offset] = data; - } -} diff --git a/src/devices/bus/bbc/tube/tube_65c102.h b/src/devices/bus/bbc/tube/tube_65c102.h deleted file mode 100644 index 1ba891739d1..00000000000 --- a/src/devices/bus/bbc/tube/tube_65c102.h +++ /dev/null @@ -1,66 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nigel Barnes -/********************************************************************** - - Acorn ADC06 65C102 Co-processor - - http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ADC06_65C102CoPro.html - -**********************************************************************/ - - -#ifndef MAME_BUS_BBC_TUBE_65C102_H -#define MAME_BUS_BBC_TUBE_65C102_H - -#include "tube.h" -#include "cpu/m6502/m65c02.h" -#include "machine/ram.h" -#include "machine/tube.h" - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> bbc_tube_65c102_device - -class bbc_tube_65c102_device : - public device_t, - public device_bbc_tube_interface -{ -public: - // construction/destruction - bbc_tube_65c102_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; - - // optional information overrides - virtual void device_add_mconfig(machine_config &config) override; - virtual const tiny_rom_entry *device_rom_region() const override; - - virtual DECLARE_READ8_MEMBER( host_r ) override; - virtual DECLARE_WRITE8_MEMBER( host_w ) override; - -private: - required_device m_maincpu; - required_device m_ula; - required_device m_ram; - required_memory_region m_rom; - - bool m_rom_enabled; - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - void tube_6502_mem(address_map &map); -}; - - - -// device type definition -DECLARE_DEVICE_TYPE(BBC_TUBE_65C102, bbc_tube_65c102_device) - - -#endif /* MAME_BUS_BBC_TUBE_65C102_H */