From d29757f8bf2c7ebaf4e942bec366e97f94b2cc11 Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Fri, 18 Feb 2022 18:26:29 +0000 Subject: bus/bbc/tube: Added pre-production and extended variants of the 6502 2nd Processor. --- src/devices/bus/bbc/tube/tube.cpp | 4 + src/devices/bus/bbc/tube/tube_6502.cpp | 185 ++++++++++++++++++++++++++++----- src/devices/bus/bbc/tube/tube_6502.h | 50 +++++++-- 3 files changed, 209 insertions(+), 30 deletions(-) diff --git a/src/devices/bus/bbc/tube/tube.cpp b/src/devices/bus/bbc/tube/tube.cpp index 371326cf487..505b7a25030 100644 --- a/src/devices/bus/bbc/tube/tube.cpp +++ b/src/devices/bus/bbc/tube/tube.cpp @@ -112,6 +112,8 @@ void bbc_tube_slot_device::host_w(offs_t offset, uint8_t data) void bbc_tube_devices(device_slot_interface &device) { device.option_add("6502", BBC_TUBE_6502); /* Acorn ANC01 6502 2nd processor */ + device.option_add("6502p", BBC_TUBE_6502P); /* Acorn 6502 2nd processor (pre-production) */ + device.option_add("6502e", BBC_TUBE_6502E); /* Acorn Extended 6502 2nd processor */ device.option_add("z80", BBC_TUBE_Z80); /* Acorn ANC04 Z80 2nd processor */ device.option_add("z80w", BBC_TUBE_Z80W); /* Acorn ANC04 Z80 2nd processor (Winchester) */ device.option_add("16032", BBC_TUBE_16032); /* Acorn 16032 2nd processor */ @@ -146,6 +148,7 @@ void bbc_tube_devices(device_slot_interface &device) void bbc_extube_devices(device_slot_interface &device) { device.option_add("6502", BBC_TUBE_6502); /* Acorn ANC01 6502 2nd processor */ + device.option_add("6502e", BBC_TUBE_6502E); /* Acorn Extended 6502 2nd processor */ device.option_add("z80", BBC_TUBE_Z80); /* Acorn ANC04 Z80 2nd processor */ device.option_add("z80w", BBC_TUBE_Z80W); /* Acorn ANC04 Z80 2nd processor (Winchester) */ device.option_add("32016", BBC_TUBE_32016); /* Acorn ANC05 32016 2nd processor */ @@ -187,6 +190,7 @@ void bbc_intube_devices(device_slot_interface &device) void electron_tube_devices(device_slot_interface &device) { device.option_add("6502", BBC_TUBE_6502); /* Acorn ANC01 6502 2nd processor */ + device.option_add("6502e", BBC_TUBE_6502E); /* Acorn Extended 6502 2nd processor */ device.option_add("z80", BBC_TUBE_Z80); /* Acorn ANC04 Z80 2nd processor */ device.option_add("32016", BBC_TUBE_32016); /* Acorn ANC05 32016 2nd processor */ device.option_add("32016l", BBC_TUBE_32016L); /* Acorn Large 32016 2nd processor */ diff --git a/src/devices/bus/bbc/tube/tube_6502.cpp b/src/devices/bus/bbc/tube/tube_6502.cpp index 5571975a9f2..f35de49c1ac 100644 --- a/src/devices/bus/bbc/tube/tube_6502.cpp +++ b/src/devices/bus/bbc/tube/tube_6502.cpp @@ -6,6 +6,18 @@ http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ANC01_65022ndproc.html + Acorn 6502 2nd Processor (pre-production) + Pre-production Iss.C and Iss.F boards have been seen running earlier versions + of the Tube OS. The boards are different in that they map the Tube ULA at + &FF78-&FF7F instead of the usual &FEF8-&FEFF. They also require an earlier + version of the Tube Host which can be found in NFS 3.34, the usual DNFS 1.20 + will hang at the Tube startup banner. + + Acorn Extended 6502 2nd Processor (non-commercial) + Used internally at Acorn, it extends the addressing of indexed indirect Y instructions + to address 256K RAM. Only two applications were created to make use of this, which + were turboMASM and turboBASIC. + Acorn ADC06 65C102 Co-processor http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ADC06_65C102CoPro.html @@ -23,6 +35,8 @@ //************************************************************************** DEFINE_DEVICE_TYPE(BBC_TUBE_6502, bbc_tube_6502_device, "bbc_tube_6502", "Acorn 6502 2nd Processor") +DEFINE_DEVICE_TYPE(BBC_TUBE_6502P, bbc_tube_6502p_device, "bbc_tube_6502p", "Acorn 6502 2nd Processor (pre-production)") +DEFINE_DEVICE_TYPE(BBC_TUBE_6502E, bbc_tube_6502e_device, "bbc_tube_6502e", "Acorn Extended 6502 2nd Processor") DEFINE_DEVICE_TYPE(BBC_TUBE_65C102, bbc_tube_65c102_device, "bbc_tube_65c102", "Acorn 65C102 Co-Processor") @@ -32,19 +46,38 @@ DEFINE_DEVICE_TYPE(BBC_TUBE_65C102, bbc_tube_65c102_device, "bbc_tube_65c102", void bbc_tube_6502_device::tube_6502_mem(address_map &map) { - 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)); + map(0x0000, 0xffff).view(m_view); + // ROM enabled + m_view[0](0x0000, 0xffff).ram().share("ram"); + m_view[0](0xf000, 0xffff).rom().region("rom", 0); + // ROM disabled + m_view[1](0x0000, 0xffff).ram().share("ram"); + map(0xfef8, 0xfeff).rw(FUNC(bbc_tube_6502_device::tube_r), FUNC(bbc_tube_6502_device::tube_w)); +} + +void bbc_tube_6502p_device::tube_6502p_mem(address_map &map) +{ + map(0x0000, 0xffff).view(m_view); + // ROM enabled + m_view[0](0x0000, 0xffff).ram().share("ram"); + m_view[0](0xf000, 0xffff).rom().region("rom", 0); + // ROM disabled + m_view[1](0x0000, 0xffff).ram().share("ram"); + map(0xff78, 0xff7f).rw(FUNC(bbc_tube_6502p_device::tube_r), FUNC(bbc_tube_6502p_device::tube_w)); } -void bbc_tube_6502_device::tube_6502_bank(address_map &map) +void bbc_tube_6502e_device::tube_6502e_mem(address_map &map) { + map(0x0000, 0xffff).view(m_view); // ROM enabled - map(0x00000, 0x0ffff).ram().share("ram"); - map(0x0f000, 0x0ffff).rom().region("rom", 0); + m_view[0](0x0000, 0xffff).rw(FUNC(bbc_tube_6502e_device::ram_r), FUNC(bbc_tube_6502e_device::ram_w)); + m_view[0](0xf000, 0xffff).rom().region("rom", 0); // ROM disabled - map(0x10000, 0x1ffff).ram().share("ram"); + m_view[1](0x0000, 0xffff).rw(FUNC(bbc_tube_6502e_device::ram_r), FUNC(bbc_tube_6502e_device::ram_w)); + map(0xfef8, 0xfeff).rw(FUNC(bbc_tube_6502e_device::tube_r), FUNC(bbc_tube_6502e_device::tube_w)); } + //------------------------------------------------- // ROM( tube_6502 ) //------------------------------------------------- @@ -53,53 +86,80 @@ ROM_START( tube_6502 ) ROM_REGION(0x1000, "rom", 0) 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)) + ROMX_LOAD("6502tube_110.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_6502p ) + ROM_REGION(0x1000, "rom", 0) + ROM_DEFAULT_BIOS("005") + ROM_SYSTEM_BIOS(0, "005", "Tube 0.05") // Iss.F + ROMX_LOAD("6502tube_005.rom", 0x0000, 0x1000, CRC(0d4cd088) SHA1(f68a74f2529e2719193f81032af298e606792ce8), ROM_BIOS(0)) + ROM_SYSTEM_BIOS(1, "004", "Tube 0.04") + ROMX_LOAD("6502tube_004.rom", 0x0000, 0x1000, CRC(64698ffa) SHA1(b7d47ac65291a7d7bd03b6b82ee08cff291c8609), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(2, "001", "Tube 0.01") // Iss.C + ROMX_LOAD("6502tube_001.rom", 0x0000, 0x1000, CRC(83bee05d) SHA1(4a00d4d3deec0ab43dc6647ac591bd71f4b24a51), ROM_BIOS(2)) +ROM_END + +ROM_START( tube_6502e ) + ROM_REGION(0x1000, "rom", 0) + ROM_DEFAULT_BIOS("120") + ROM_SYSTEM_BIOS(0, "120", "Tube 1.20") // built from source, not an actual dump + ROMX_LOAD("6502tube256_120.rom", 0x0000, 0x1000, BAD_DUMP CRC(967ee712) SHA1(ebca4bb471cd18608882668edda811ed88b4cee5), ROM_BIOS(0)) +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)) + ROMX_LOAD("65c102_boot_110.rom", 0x0000, 0x1000, CRC(ad5b70cc) SHA1(0ac9a1c70e55a79e2c81e102afae1d016af229fa), ROM_BIOS(0)) // 2201,243-01 + ROM_SYSTEM_BIOS(1, "120", "Tube 1.20") + ROMX_LOAD("65c102_boot_120.rom", 0x0000, 0x1000, CRC(1462f0f7) SHA1(7dc03d3c4862159baefebf1662de7e05987ddf7b), ROM_BIOS(1)) // 2201,243-02 + ROM_SYSTEM_BIOS(2, "121", "Tube 1.21 (ReCo6502)") + ROMX_LOAD("reco6502tube.rom", 0x0000, 0x1000, CRC(75b2a466) SHA1(9ecef24de58a48c3fbe01b12888c3f6a5d24f57f), ROM_BIOS(2)) ROM_END + //------------------------------------------------- // device_add_mconfig - add device configuration //------------------------------------------------- -void bbc_tube_6502_device::add_common_devices(machine_config &config) +void bbc_tube_6502_device::device_add_mconfig(machine_config &config) { - ADDRESS_MAP_BANK(config, m_bankdev).set_map(&bbc_tube_6502_device::tube_6502_bank).set_options(ENDIANNESS_LITTLE, 8, 17, 0x10000); + M65C02(config, m_maincpu, 12_MHz_XTAL / 4); + m_maincpu->set_addrmap(AS_PROGRAM, &bbc_tube_6502_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"); } -void bbc_tube_6502_device::device_add_mconfig(machine_config &config) +void bbc_tube_6502p_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); + bbc_tube_6502_device::device_add_mconfig(config); - add_common_devices(config); + m_maincpu->set_addrmap(AS_PROGRAM, &bbc_tube_6502p_device::tube_6502p_mem); +} + +void bbc_tube_6502e_device::device_add_mconfig(machine_config &config) +{ + bbc_tube_6502_device::device_add_mconfig(config); + + m_maincpu->set_addrmap(AS_PROGRAM, &bbc_tube_6502e_device::tube_6502e_mem); + + m_ram->set_default_size("256K").set_default_value(0); } 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); + bbc_tube_6502_device::device_add_mconfig(config); - add_common_devices(config); + m_maincpu->set_clock(16_MHz_XTAL / 4); } //------------------------------------------------- @@ -111,6 +171,16 @@ const tiny_rom_entry *bbc_tube_6502_device::device_rom_region() const return ROM_NAME( tube_6502 ); } +const tiny_rom_entry *bbc_tube_6502p_device::device_rom_region() const +{ + return ROM_NAME( tube_6502p ); +} + +const tiny_rom_entry *bbc_tube_6502e_device::device_rom_region() const +{ + return ROM_NAME( tube_6502e ); +} + const tiny_rom_entry *bbc_tube_65c102_device::device_rom_region() const { return ROM_NAME( tube_65c102 ); @@ -128,7 +198,7 @@ bbc_tube_6502_device::bbc_tube_6502_device(const machine_config &mconfig, device : device_t(mconfig, type, tag, owner, clock) , device_bbc_tube_interface(mconfig, *this) , m_maincpu(*this, "maincpu") - , m_bankdev(*this, "bankdev") + , m_view(*this, "view") , m_ula(*this, "ula") , m_ram(*this, "ram") , m_rom(*this, "rom") @@ -140,6 +210,19 @@ bbc_tube_6502_device::bbc_tube_6502_device(const machine_config &mconfig, const { } +bbc_tube_6502p_device::bbc_tube_6502p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : bbc_tube_6502_device(mconfig, BBC_TUBE_6502P, tag, owner, clock) +{ +} + +bbc_tube_6502e_device::bbc_tube_6502e_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : bbc_tube_6502_device(mconfig, BBC_TUBE_6502E, tag, owner, clock) + , m_opcode_ind_y(false) + , m_page(0) + , m_cycles(0) +{ +} + 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) { @@ -153,13 +236,20 @@ void bbc_tube_6502_device::device_start() { } +void bbc_tube_6502e_device::device_start() +{ + save_item(NAME(m_opcode_ind_y)); + save_item(NAME(m_page)); + save_item(NAME(m_cycles)); +} + //------------------------------------------------- // device_reset - device-specific reset //------------------------------------------------- void bbc_tube_6502_device::device_reset() { - m_bankdev->set_bank(0); + m_view.select(0); } @@ -182,7 +272,7 @@ uint8_t bbc_tube_6502_device::tube_r(offs_t offset) { // Disable ROM on first access if (!machine().side_effects_disabled()) - m_bankdev->set_bank(1); + m_view.select(1); return m_ula->parasite_r(offset); } @@ -191,3 +281,50 @@ void bbc_tube_6502_device::tube_w(offs_t offset, uint8_t data) { m_ula->parasite_w(offset, data); } + + +uint8_t bbc_tube_6502e_device::ram_r(offs_t offset) +{ + uint8_t data = m_ram->pointer()[offset]; + + if (!machine().side_effects_disabled()) + { + /* opcode fetch */ + if (m_maincpu->get_sync()) + { + /* indexed indirect Y addressing */ + m_opcode_ind_y = ((data & 0x1f) == 0x11 || (data & 0x1f) == 0x12) ? true : false; + + m_cycles = m_maincpu->total_cycles(); + } + + if (m_opcode_ind_y) + { + if (m_maincpu->total_cycles() - m_cycles == 1) + { + /* fetch extra byte from &3xx where xx is low byte of ZP address */ + m_page = m_ram->pointer()[0x301 + data] & 0x03; + } + else if (m_maincpu->total_cycles() - m_cycles > 3) + { + /* read data from extended address */ + data = m_ram->pointer()[m_page << 16 | offset]; + } + } + } + + return data; +} + +void bbc_tube_6502e_device::ram_w(offs_t offset, uint8_t data) +{ + if (m_opcode_ind_y) + { + /* write data to extended address */ + m_ram->pointer()[m_page << 16 | offset] = data; + } + else + { + m_ram->pointer()[offset] = data; + } +} diff --git a/src/devices/bus/bbc/tube/tube_6502.h b/src/devices/bus/bbc/tube/tube_6502.h index abb907ef3bd..d6c2f6d0eec 100644 --- a/src/devices/bus/bbc/tube/tube_6502.h +++ b/src/devices/bus/bbc/tube/tube_6502.h @@ -18,7 +18,6 @@ #include "tube.h" #include "cpu/m6502/m65c02.h" -#include "machine/bankdev.h" #include "machine/ram.h" #include "machine/tube.h" @@ -47,25 +46,62 @@ 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 uint8_t host_r(offs_t offset) override; virtual void host_w(offs_t offset, uint8_t data) override; virtual uint8_t tube_r(offs_t offset); virtual void tube_w(offs_t offset, uint8_t data); - required_device m_maincpu; - required_device m_bankdev; + required_device m_maincpu; + memory_view m_view; required_device m_ula; required_device m_ram; required_memory_region m_rom; }; +class bbc_tube_6502p_device : public bbc_tube_6502_device +{ +public: + bbc_tube_6502p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry* device_rom_region() const override; + +private: + void tube_6502p_mem(address_map& map); +}; + + +class bbc_tube_6502e_device : public bbc_tube_6502_device +{ +public: + bbc_tube_6502e_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 const tiny_rom_entry *device_rom_region() const override; + +private: + void tube_6502e_mem(address_map &map); + + uint8_t ram_r(offs_t offset); + void ram_w(offs_t offset, uint8_t data); + + bool m_opcode_ind_y; + uint8_t m_page; + uint64_t m_cycles; +}; + + class bbc_tube_65c102_device : public bbc_tube_6502_device { public: @@ -80,6 +116,8 @@ protected: // device type definition DECLARE_DEVICE_TYPE(BBC_TUBE_6502, bbc_tube_6502_device) +DECLARE_DEVICE_TYPE(BBC_TUBE_6502P, bbc_tube_6502p_device) +DECLARE_DEVICE_TYPE(BBC_TUBE_6502E, bbc_tube_6502e_device) DECLARE_DEVICE_TYPE(BBC_TUBE_65C102, bbc_tube_65c102_device) -- cgit v1.2.3