From 6abfd7c0971d1ced216081385dacdcf42a1c8e75 Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Fri, 20 May 2022 22:43:01 +0100 Subject: [PATCH] tube: Implemented parasite reset PRST line, and added to all co-processors. --- src/devices/bus/bbc/tube/tube_32016.cpp | 8 +++++++ src/devices/bus/bbc/tube/tube_32016.h | 2 ++ src/devices/bus/bbc/tube/tube_6502.cpp | 14 ++++++++++-- src/devices/bus/bbc/tube/tube_6502.h | 2 ++ src/devices/bus/bbc/tube/tube_80186.cpp | 8 +++++++ src/devices/bus/bbc/tube/tube_80186.h | 2 ++ src/devices/bus/bbc/tube/tube_80286.cpp | 8 +++++++ src/devices/bus/bbc/tube/tube_80286.h | 2 ++ src/devices/bus/bbc/tube/tube_a500.cpp | 6 +++++ src/devices/bus/bbc/tube/tube_a500.h | 2 ++ src/devices/bus/bbc/tube/tube_arm.cpp | 8 +++++++ src/devices/bus/bbc/tube/tube_arm.h | 2 ++ src/devices/bus/bbc/tube/tube_arm7.cpp | 8 +++++++ src/devices/bus/bbc/tube/tube_arm7.h | 2 ++ src/devices/bus/bbc/tube/tube_rc6502.cpp | 9 ++++++++ src/devices/bus/bbc/tube/tube_rc6502.h | 2 ++ src/devices/bus/bbc/tube/tube_x25.cpp | 1 + src/devices/bus/bbc/tube/tube_z80.cpp | 8 +++++++ src/devices/bus/bbc/tube/tube_z80.h | 2 ++ src/devices/machine/tube.cpp | 29 ++++++++++++++++++++---- src/devices/machine/tube.h | 3 +++ 21 files changed, 121 insertions(+), 7 deletions(-) diff --git a/src/devices/bus/bbc/tube/tube_32016.cpp b/src/devices/bus/bbc/tube/tube_32016.cpp index 4040330dc89..e62e3003998 100644 --- a/src/devices/bus/bbc/tube/tube_32016.cpp +++ b/src/devices/bus/bbc/tube/tube_32016.cpp @@ -136,6 +136,7 @@ void bbc_tube_32016_device::device_add_mconfig(machine_config &config) TUBE(config, m_ula); m_ula->pnmi_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); m_ula->pirq_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ula->prst_handler().set(FUNC(bbc_tube_32016_device::prst_w)); RAM(config, m_ram).set_default_size("1M").set_extra_options("256K").set_default_value(0); @@ -267,6 +268,13 @@ void bbc_tube_32016_device::device_reset() // IMPLEMENTATION //************************************************************************** +WRITE_LINE_MEMBER(bbc_tube_32016_device::prst_w) +{ + device_reset(); + + m_maincpu->set_input_line(INPUT_LINE_RESET, state); +} + uint8_t bbc_tube_32016_device::host_r(offs_t offset) { return m_ula->host_r(offset); diff --git a/src/devices/bus/bbc/tube/tube_32016.h b/src/devices/bus/bbc/tube/tube_32016.h index fc83dd3f09e..242b4eb773b 100644 --- a/src/devices/bus/bbc/tube/tube_32016.h +++ b/src/devices/bus/bbc/tube/tube_32016.h @@ -60,6 +60,8 @@ protected: memory_passthrough_handler m_rom_shadow_tap; void tube_32016_mem(address_map &map); + + DECLARE_WRITE_LINE_MEMBER(prst_w); }; diff --git a/src/devices/bus/bbc/tube/tube_6502.cpp b/src/devices/bus/bbc/tube/tube_6502.cpp index 841dd69332a..e7cc3157c90 100644 --- a/src/devices/bus/bbc/tube/tube_6502.cpp +++ b/src/devices/bus/bbc/tube/tube_6502.cpp @@ -87,8 +87,10 @@ ROM_START( tube_6502 ) ROM_DEFAULT_BIOS("110") ROM_SYSTEM_BIOS(0, "110", "Tube 1.10") 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_SYSTEM_BIOS(1, "120", "Tube 1.20") // built from source, not an actual dump + ROMX_LOAD("6502tube_120.rom", 0x0000, 0x1000, CRC(50c36da5) SHA1(80e5f1c03a00cf728917242522befc17b264413f), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(2, "121", "Tube 1.21 (ReCo6502)") + ROMX_LOAD("reco6502tube.rom", 0x0000, 0x1000, CRC(75b2a466) SHA1(9ecef24de58a48c3fbe01b12888c3f6a5d24f57f), ROM_BIOS(2)) ROM_END ROM_START( tube_6502p ) @@ -133,6 +135,7 @@ void bbc_tube_6502_device::device_add_mconfig(machine_config &config) 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); + m_ula->prst_handler().set(FUNC(bbc_tube_6502_device::prst_w)); RAM(config, m_ram).set_default_size("64K").set_default_value(0); @@ -260,6 +263,13 @@ void bbc_tube_6502_device::device_reset() // IMPLEMENTATION //************************************************************************** +WRITE_LINE_MEMBER(bbc_tube_6502_device::prst_w) +{ + device_reset(); + + m_maincpu->set_input_line(INPUT_LINE_RESET, state); +} + uint8_t bbc_tube_6502_device::host_r(offs_t offset) { return m_ula->host_r(offset); diff --git a/src/devices/bus/bbc/tube/tube_6502.h b/src/devices/bus/bbc/tube/tube_6502.h index 920e9ab1cc9..a68e9c3f51e 100644 --- a/src/devices/bus/bbc/tube/tube_6502.h +++ b/src/devices/bus/bbc/tube/tube_6502.h @@ -59,6 +59,8 @@ protected: required_device m_ula; required_device m_ram; required_memory_region m_rom; + + DECLARE_WRITE_LINE_MEMBER(prst_w); }; diff --git a/src/devices/bus/bbc/tube/tube_80186.cpp b/src/devices/bus/bbc/tube/tube_80186.cpp index db48f5458d1..07456c67a38 100644 --- a/src/devices/bus/bbc/tube/tube_80186.cpp +++ b/src/devices/bus/bbc/tube/tube_80186.cpp @@ -75,6 +75,7 @@ void bbc_tube_80186_device::device_add_mconfig(machine_config &config) TUBE(config, m_ula, 0); m_ula->pirq_handler().set(m_i80186, FUNC(i80186_cpu_device::int0_w)); m_ula->drq_handler().set(m_i80186, FUNC(i80186_cpu_device::drq0_w)); + m_ula->prst_handler().set(FUNC(bbc_tube_80186_device::prst_w)); /* internal ram */ RAM(config, m_ram).set_default_size("512K"); @@ -168,6 +169,13 @@ void bbc_tube_pcplus_device::device_reset() // IMPLEMENTATION //************************************************************************** +WRITE_LINE_MEMBER(bbc_tube_80186_device::prst_w) +{ + device_reset(); + + m_i80186->set_input_line(INPUT_LINE_RESET, state); +} + uint8_t bbc_tube_80186_device::host_r(offs_t offset) { return m_ula->host_r(offset); diff --git a/src/devices/bus/bbc/tube/tube_80186.h b/src/devices/bus/bbc/tube/tube_80186.h index a3df8d72743..448ef06cc7f 100644 --- a/src/devices/bus/bbc/tube/tube_80186.h +++ b/src/devices/bus/bbc/tube/tube_80186.h @@ -52,6 +52,8 @@ protected: void tube_80186_io(address_map &map); void tube_80186_mem(address_map &map); + + DECLARE_WRITE_LINE_MEMBER(prst_w); }; diff --git a/src/devices/bus/bbc/tube/tube_80286.cpp b/src/devices/bus/bbc/tube/tube_80286.cpp index aa51a6c6b0f..ffdfc0edb6f 100644 --- a/src/devices/bus/bbc/tube/tube_80286.cpp +++ b/src/devices/bus/bbc/tube/tube_80286.cpp @@ -67,6 +67,7 @@ void bbc_tube_80286_device::device_add_mconfig(machine_config &config) TUBE(config, m_ula); m_ula->pnmi_handler().set_inputline(m_i80286, INPUT_LINE_NMI); m_ula->pirq_handler().set_inputline(m_i80286, INPUT_LINE_INT0); + m_ula->prst_handler().set(FUNC(bbc_tube_80286_device::prst_w)); /* internal ram */ RAM(config, m_ram).set_default_size("1M"); @@ -128,6 +129,13 @@ void bbc_tube_80286_device::device_reset() // IMPLEMENTATION //************************************************************************** +WRITE_LINE_MEMBER(bbc_tube_80286_device::prst_w) +{ + device_reset(); + + m_i80286->set_input_line(INPUT_LINE_RESET, state); +} + uint8_t bbc_tube_80286_device::host_r(offs_t offset) { return m_ula->host_r(offset); diff --git a/src/devices/bus/bbc/tube/tube_80286.h b/src/devices/bus/bbc/tube/tube_80286.h index 980ec7e1a74..6ac75975fa7 100644 --- a/src/devices/bus/bbc/tube/tube_80286.h +++ b/src/devices/bus/bbc/tube/tube_80286.h @@ -54,6 +54,8 @@ private: void tube_80286_io(address_map &map); void tube_80286_mem(address_map &map); + + DECLARE_WRITE_LINE_MEMBER(prst_w); }; diff --git a/src/devices/bus/bbc/tube/tube_a500.cpp b/src/devices/bus/bbc/tube/tube_a500.cpp index aeaf4e819c7..f9406f2d2f0 100644 --- a/src/devices/bus/bbc/tube/tube_a500.cpp +++ b/src/devices/bus/bbc/tube/tube_a500.cpp @@ -69,6 +69,7 @@ void bbc_tube_a500_device::device_add_mconfig(machine_config &config) TUBE(config, m_ula); m_ula->pnmi_handler().set(m_fiqs, FUNC(input_merger_device::in_w<0>)); m_ula->pirq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>)); + m_ula->prst_handler().set(FUNC(bbc_tube_a500_device::prst_w)); ACORN_MEMC(config, m_memc, 24_MHz_XTAL / 3, m_vidc); m_memc->set_addrmap(0, &bbc_tube_a500_device::a500_map); @@ -139,6 +140,11 @@ void bbc_tube_a500_device::device_start() // IMPLEMENTATION //************************************************************************** +WRITE_LINE_MEMBER(bbc_tube_a500_device::prst_w) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, state); +} + uint8_t bbc_tube_a500_device::host_r(offs_t offset) { return m_ula->host_r(offset); diff --git a/src/devices/bus/bbc/tube/tube_a500.h b/src/devices/bus/bbc/tube/tube_a500.h index b3e2ba5301d..31af8f227f1 100644 --- a/src/devices/bus/bbc/tube/tube_a500.h +++ b/src/devices/bus/bbc/tube/tube_a500.h @@ -60,6 +60,8 @@ private: void arm_mem(address_map &map); void a500_map(address_map &map); + + DECLARE_WRITE_LINE_MEMBER(prst_w); }; diff --git a/src/devices/bus/bbc/tube/tube_arm.cpp b/src/devices/bus/bbc/tube/tube_arm.cpp index 7b5c03d86fe..c015871ffa5 100644 --- a/src/devices/bus/bbc/tube/tube_arm.cpp +++ b/src/devices/bus/bbc/tube/tube_arm.cpp @@ -59,6 +59,7 @@ void bbc_tube_arm_device::device_add_mconfig(machine_config &config) TUBE(config, m_ula); m_ula->pnmi_handler().set_inputline(m_maincpu, ARM_FIRQ_LINE); m_ula->pirq_handler().set_inputline(m_maincpu, ARM_IRQ_LINE); + m_ula->prst_handler().set(FUNC(bbc_tube_arm_device::prst_w)); /* internal ram */ RAM(config, m_ram).set_default_size("4M").set_default_value(0); @@ -133,6 +134,13 @@ void bbc_tube_arm_device::device_reset() // IMPLEMENTATION //************************************************************************** +WRITE_LINE_MEMBER(bbc_tube_arm_device::prst_w) +{ + device_reset(); + + m_maincpu->set_input_line(INPUT_LINE_RESET, state); +} + uint8_t bbc_tube_arm_device::host_r(offs_t offset) { return m_ula->host_r(offset); diff --git a/src/devices/bus/bbc/tube/tube_arm.h b/src/devices/bus/bbc/tube/tube_arm.h index 3c2ecf02d2c..c84ddc97748 100644 --- a/src/devices/bus/bbc/tube/tube_arm.h +++ b/src/devices/bus/bbc/tube/tube_arm.h @@ -50,6 +50,8 @@ private: memory_passthrough_handler m_rom_shadow_tap; void tube_arm_mem(address_map &map); + + DECLARE_WRITE_LINE_MEMBER(prst_w); }; diff --git a/src/devices/bus/bbc/tube/tube_arm7.cpp b/src/devices/bus/bbc/tube/tube_arm7.cpp index e8396129057..e79b83ad997 100644 --- a/src/devices/bus/bbc/tube/tube_arm7.cpp +++ b/src/devices/bus/bbc/tube/tube_arm7.cpp @@ -63,6 +63,7 @@ void bbc_tube_arm7_device::device_add_mconfig(machine_config &config) TUBE(config, m_ula); m_ula->pnmi_handler().set(FUNC(bbc_tube_arm7_device::efiq_w)); m_ula->pirq_handler().set(FUNC(bbc_tube_arm7_device::exint3_w)); + m_ula->prst_handler().set(FUNC(bbc_tube_arm7_device::prst_w)); RAM(config, m_ram).set_default_size("32M").set_extra_options("16M,64M"); } @@ -131,6 +132,13 @@ void bbc_tube_arm7_device::device_reset() // IMPLEMENTATION //************************************************************************** +WRITE_LINE_MEMBER(bbc_tube_arm7_device::prst_w) +{ + device_reset(); + + m_maincpu->set_input_line(INPUT_LINE_RESET, state); +} + uint8_t bbc_tube_arm7_device::host_r(offs_t offset) { return m_ula->host_r(offset); diff --git a/src/devices/bus/bbc/tube/tube_arm7.h b/src/devices/bus/bbc/tube/tube_arm7.h index 951be2d0209..e203c26388a 100644 --- a/src/devices/bus/bbc/tube/tube_arm7.h +++ b/src/devices/bus/bbc/tube/tube_arm7.h @@ -67,6 +67,8 @@ private: void arm7_map(address_map& map); + DECLARE_WRITE_LINE_MEMBER(prst_w); + uint32_t oki_reg_r(offs_t offset); void oki_reg_w(offs_t offset, uint32_t data); diff --git a/src/devices/bus/bbc/tube/tube_rc6502.cpp b/src/devices/bus/bbc/tube/tube_rc6502.cpp index 18d1fbd93dc..7aeeee283a2 100644 --- a/src/devices/bus/bbc/tube/tube_rc6502.cpp +++ b/src/devices/bus/bbc/tube/tube_rc6502.cpp @@ -137,6 +137,7 @@ void bbc_tube_rc6502_device::device_add_mconfig(machine_config &config) 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); + m_ula->prst_handler().set(FUNC(bbc_tube_rc6502_device::prst_w)); } void bbc_tube_rc65816_device::device_add_mconfig(machine_config &config) @@ -149,6 +150,7 @@ void bbc_tube_rc65816_device::device_add_mconfig(machine_config &config) TUBE(config, m_ula); m_ula->pnmi_handler().set_inputline(m_maincpu, G65816_LINE_NMI); m_ula->pirq_handler().set_inputline(m_maincpu, G65816_LINE_IRQ); + m_ula->prst_handler().set(FUNC(bbc_tube_rc65816_device::prst_w)); } //------------------------------------------------- @@ -232,6 +234,13 @@ void bbc_tube_rc6502_device::device_reset() // IMPLEMENTATION //************************************************************************** +WRITE_LINE_MEMBER(bbc_tube_rc6502_device::prst_w) +{ + device_reset(); + + m_maincpu->set_input_line(INPUT_LINE_RESET, state); +} + uint8_t bbc_tube_rc6502_device::host_r(offs_t offset) { return m_ula->host_r(offset); diff --git a/src/devices/bus/bbc/tube/tube_rc6502.h b/src/devices/bus/bbc/tube/tube_rc6502.h index 5636e8694ef..cc1e12d71c8 100644 --- a/src/devices/bus/bbc/tube/tube_rc6502.h +++ b/src/devices/bus/bbc/tube/tube_rc6502.h @@ -63,6 +63,8 @@ protected: required_device m_ram; required_ioport m_config; + DECLARE_WRITE_LINE_MEMBER(prst_w); + private: void tube_rc6502_mem(address_map &map); diff --git a/src/devices/bus/bbc/tube/tube_x25.cpp b/src/devices/bus/bbc/tube/tube_x25.cpp index 54f91a7e9bd..21e03217201 100644 --- a/src/devices/bus/bbc/tube/tube_x25.cpp +++ b/src/devices/bus/bbc/tube/tube_x25.cpp @@ -100,6 +100,7 @@ void bbc_tube_x25_device::device_add_mconfig(machine_config &config) TUBE(config, m_ula); m_ula->pnmi_handler().set_inputline(m_z80[0], INPUT_LINE_NMI); m_ula->pirq_handler().set_inputline(m_z80[0], INPUT_LINE_IRQ0); + m_ula->prst_handler().set_inputline(m_z80[0], INPUT_LINE_RESET); Z80(config, m_z80[1], 12_MHz_XTAL / 4); m_z80[1]->set_addrmap(AS_PROGRAM, &bbc_tube_x25_device::secondary_mem); diff --git a/src/devices/bus/bbc/tube/tube_z80.cpp b/src/devices/bus/bbc/tube/tube_z80.cpp index e483a09c29f..f273c2f37d4 100644 --- a/src/devices/bus/bbc/tube/tube_z80.cpp +++ b/src/devices/bus/bbc/tube/tube_z80.cpp @@ -80,6 +80,7 @@ void bbc_tube_z80_device::device_add_mconfig(machine_config &config) TUBE(config, m_ula); m_ula->pnmi_handler().set_inputline(m_z80, INPUT_LINE_NMI); m_ula->pirq_handler().set_inputline(m_z80, INPUT_LINE_IRQ0); + m_ula->prst_handler().set(FUNC(bbc_tube_z80_device::prst_w)); /* software lists */ SOFTWARE_LIST(config, "flop_ls_z80").set_original("bbc_flop_z80"); @@ -154,6 +155,13 @@ void bbc_tube_z80_device::device_reset() // IMPLEMENTATION //************************************************************************** +WRITE_LINE_MEMBER(bbc_tube_z80_device::prst_w) +{ + device_reset(); + + m_z80->set_input_line(INPUT_LINE_RESET, state); +} + uint8_t bbc_tube_z80_device::host_r(offs_t offset) { return m_ula->host_r(offset); diff --git a/src/devices/bus/bbc/tube/tube_z80.h b/src/devices/bus/bbc/tube/tube_z80.h index 99d507afb27..e878f61627d 100644 --- a/src/devices/bus/bbc/tube/tube_z80.h +++ b/src/devices/bus/bbc/tube/tube_z80.h @@ -62,6 +62,8 @@ private: void tube_z80_fetch(address_map &map); void tube_z80_io(address_map &map); void tube_z80_mem(address_map &map); + + DECLARE_WRITE_LINE_MEMBER(prst_w); }; diff --git a/src/devices/machine/tube.cpp b/src/devices/machine/tube.cpp index de197a34c7d..f16fed18da5 100644 --- a/src/devices/machine/tube.cpp +++ b/src/devices/machine/tube.cpp @@ -34,6 +34,7 @@ tube_device::tube_device(const machine_config &mconfig, const char *tag, device_ , m_hirq_handler(*this) , m_pnmi_handler(*this) , m_pirq_handler(*this) + , m_prst_handler(*this) , m_drq_handler(*this) { } @@ -49,6 +50,7 @@ void tube_device::device_start() m_hirq_handler.resolve_safe(); m_pnmi_handler.resolve_safe(); m_pirq_handler.resolve_safe(); + m_prst_handler.resolve_safe(); m_drq_handler.resolve_safe(); // register for state saving @@ -74,10 +76,15 @@ void tube_device::device_start() //------------------------------------------------- void tube_device::device_reset() +{ + m_r1stat = 0; + soft_reset(); +} + +void tube_device::soft_reset() { m_ph1pos = m_hp3pos = 0; m_ph3pos = 1; - m_r1stat = 0; m_hstat[0] = m_hstat[1] = m_hstat[3] = 0x40; m_hstat[2] = 0xc0; m_pstat[0] = m_pstat[1] = m_pstat[2] = m_pstat[3] = 0x40; @@ -167,11 +174,23 @@ void tube_device::host_w(offs_t offset, uint8_t data) switch (offset & 0x07) { case 0: /* Status flags */ - if (BIT(data, 7)) - m_r1stat |= (data & 0x3f); - else - m_r1stat &= ~(data & 0x3f); m_hstat[0] = (m_hstat[0] & 0xc0) | (data & 0x3f); + if (BIT(data, 7)) + { + m_r1stat |= (data & 0x3f); + if (BIT(data, 6)) + { + soft_reset(); + } + } + else + { + m_r1stat &= ~(data & 0x3f); + } + if (BIT(data, 5)) + { + m_prst_handler(BIT(data, 7) ? ASSERT_LINE : CLEAR_LINE); + } break; case 1: /* Register 1 (1 byte write only) */ diff --git a/src/devices/machine/tube.h b/src/devices/machine/tube.h index 384cf29b8d9..079c89cf86d 100644 --- a/src/devices/machine/tube.h +++ b/src/devices/machine/tube.h @@ -30,6 +30,7 @@ public: auto hirq_handler() { return m_hirq_handler.bind(); } auto pnmi_handler() { return m_pnmi_handler.bind(); } auto pirq_handler() { return m_pirq_handler.bind(); } + auto prst_handler() { return m_prst_handler.bind(); } auto drq_handler() { return m_drq_handler.bind(); } uint8_t host_r(offs_t offset); @@ -58,11 +59,13 @@ private: int m_ph3pos; int m_hp3pos; + void soft_reset(); void update_interrupts(); devcb_write_line m_hirq_handler; devcb_write_line m_pnmi_handler; devcb_write_line m_pirq_handler; + devcb_write_line m_prst_handler; devcb_write_line m_drq_handler; };