Spectrum betadisk stuff (#5564)

* spectrum bus : rename beta.cpp to beta128.cpp as the original beta is somewhat different (nw)

* (nw)

* start making a device for the actual original beta disk interfaces (nw)

* flesh out beta stuff a bit (nw)
This commit is contained in:
David Haywood 2019-08-28 22:15:06 +01:00 committed by MetalliC
parent a1b1b325b1
commit b77d8ecb03
6 changed files with 614 additions and 78 deletions

View File

@ -3471,6 +3471,8 @@ if (BUSES["SPECTRUM"]~=null) then
MAME_DIR .. "src/devices/bus/spectrum/exp.h",
MAME_DIR .. "src/devices/bus/spectrum/beta.cpp",
MAME_DIR .. "src/devices/bus/spectrum/beta.h",
MAME_DIR .. "src/devices/bus/spectrum/beta128.cpp",
MAME_DIR .. "src/devices/bus/spectrum/beta128.h",
MAME_DIR .. "src/devices/bus/spectrum/intf1.cpp",
MAME_DIR .. "src/devices/bus/spectrum/intf1.h",
MAME_DIR .. "src/devices/bus/spectrum/intf2.cpp",

View File

@ -1,8 +1,67 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
// copyright-holders:Nigel Barnes, David Haywood
/*********************************************************************
Technology Research Beta 128 Disk interface
Technology Research Beta Disk interface & clones
these are designed for the 48k Spectrum models
There are multiple versions of this
'hand made' PCB with V2 ROM:
- possible prototype / low production run
- 4k ROM
- FORMAT, COPY etc. must be loaded from a disk to be used
- disks are password protected
- uses 1771 disk controller
https://www.youtube.com/watch?v=gSJIuZjbFYs
Original Beta Disk release with V3 ROM:
- same features as above
- uses a 1793 controller
Re-release dubbed "Beta Disk plus" with V4 ROM:
- many operations moved into a larger capacity (8k) ROM rather
than requiring a utility disk
- uses a 1793 controller
- adds 'magic button' to dump the running state of the machine
to disk
- disk password system removed
Many clones exist, some specific to the various Spectrum clones.
(not yet added)
Original Beta Disk (V3) clones
- Sandy FDD2 SP-DOS
- AC DOS P.Z.APINA
Beta Disk plus (V4) clones
- CAS DOS Cheyenne Advanced System
- CBI-95
- SYNCHRON IDS91
- SYNCHRON IDS2001ne
- ARCADE AR-20
- Vision Desktop Betadisk
Some units also exist that allow population of both V3 and V4
ROM types with a switch (unofficial, for compatibility?)
---
NOTE:
ROMs really need verifying, real dumps appear to be bitswapped
on original boards, so we're using those ones where possible,
however sizes are unconfirmed (some sources state that the data
is duplicated across the 16k in ROM, others state it just mirrors
in memory) and some might be modified or bad.
beta128.cpp could be modified to expand on this, as it builds
on the features of the betaplus, but for now I've kept them
separate as the enable / disable mechanisms are different and
remaining mappings of devices unconfirmed
These devices are not currently working as the disable logic is
not understood.
*********************************************************************/
@ -14,32 +73,9 @@
DEVICE DEFINITIONS
***************************************************************************/
DEFINE_DEVICE_TYPE(SPECTRUM_BETA128, spectrum_beta128_device, "spectrum_beta128", "TR Beta 128 Disk Interface")
//-------------------------------------------------
// INPUT_PORTS( beta128 )
//-------------------------------------------------
INPUT_PORTS_START(beta128)
PORT_START("BUTTON")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Magic Button") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, spectrum_beta128_device, magic_button, 0)
PORT_START("SWITCH")
PORT_CONFNAME(0x03, 0x01, "System Switch") //PORT_CHANGED_MEMBER(DEVICE_SELF, spectrum_beta128_device, switch_changed, 0)
PORT_CONFSETTING(0x00, "Off (128)")
PORT_CONFSETTING(0x01, "Normal (auto-boot)")
//PORT_CONFSETTING(0x02, "Reset") // TODO: implement RESET callback
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor spectrum_beta128_device::device_input_ports() const
{
return INPUT_PORTS_NAME(beta128);
}
DEFINE_DEVICE_TYPE(SPECTRUM_BETAV2, spectrum_betav2_device, "spectrum_betav2", "TR Beta Disk Interface (older, FD1771 based)")
DEFINE_DEVICE_TYPE(SPECTRUM_BETAV3, spectrum_betav3_device, "spectrum_betav3", "TR Beta Disk Interface (newer, FD1793 based)")
DEFINE_DEVICE_TYPE(SPECTRUM_BETAPLUS, spectrum_betaplus_device, "spectrum_betaplus", "TR Beta Disk Plus Interface")
//-------------------------------------------------
// SLOT_INTERFACE( beta_floppies )
@ -54,7 +90,7 @@ static void beta_floppies(device_slot_interface &device)
// floppy_format_type floppy_formats
//-------------------------------------------------
FLOPPY_FORMATS_MEMBER(spectrum_beta128_device::floppy_formats)
FLOPPY_FORMATS_MEMBER(spectrum_betav2_device::floppy_formats)
FLOPPY_TRD_FORMAT
FLOPPY_FORMATS_END
@ -62,28 +98,69 @@ FLOPPY_FORMATS_END
// ROM( beta )
//-------------------------------------------------
ROM_START(beta128)
ROM_START(betav2)
ROM_REGION(0x4000, "rom", 0)
ROM_DEFAULT_BIOS("trd504")
ROM_SYSTEM_BIOS(0, "trd501", "TR-DOS v5.01")
ROMX_LOAD("trd501.rom", 0x0000, 0x4000, CRC(3e3cdd4c) SHA1(8303ba0cc79daa6c04cd1e6ce27e8b6886a3f0de), ROM_BIOS(0))
ROM_SYSTEM_BIOS(1, "trd503", "TR-DOS v5.03")
ROMX_LOAD("trd503.rom", 0x0000, 0x4000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c), ROM_BIOS(1))
ROM_SYSTEM_BIOS(2, "trd504", "TR-DOS v5.04")
ROMX_LOAD("trd504.rom", 0x0000, 0x4000, CRC(ba310874) SHA1(05e55e37df8eee6c68601ba9cf6c92195852ce3f), ROM_BIOS(2))
ROM_DEFAULT_BIOS("trd20")
ROM_SYSTEM_BIOS(0, "trd20", "TR-DOS v2.0")
ROMX_LOAD("trd20.bin", 0x0000, 0x1000, CRC(dd269fb2) SHA1(ab394a19461f314fffd592645a273b85e76fadec), ROM_BIOS(0))
ROM_RELOAD(0x1000,0x1000)
ROM_RELOAD(0x2000,0x1000)
ROM_RELOAD(0x3000,0x1000)
ROM_END
// there is an alt set CRC(48f9149f) SHA1(52774757096fdc93ea94c55306481f6f41204e96) with differences at 30e, 3cd, 404, 7bd, it appears to be a bad dump
// 30c : call $2acd call $6acd
// 3cc : ld hl, $5b00 ld hl, $5b01
// 402 : call $2acd call $6bcd
// 7bd : ld ($5d02), hl inc hl, ld (bc),a, ld e,l
// the Profisoft version appears to be different code, maybe based on a different revision or even modified hw?
ROM_START(betav3)
ROM_REGION(0x4000, "rom", 0)
ROM_DEFAULT_BIOS("trd30")
ROM_SYSTEM_BIOS(0, "trd30", "TR-DOS v3.0 (set 1)")
ROMX_LOAD("trd30.bin", 0x0000, 0x1000, CRC(c814179d) SHA1(b617ab59639beaa7b5d8e5b4e4a543a8eb0217c8), ROM_BIOS(0))
ROM_RELOAD(0x1000,0x1000)
ROM_RELOAD(0x2000,0x1000)
ROM_RELOAD(0x3000,0x1000)
// ROM_SYSTEM_BIOS(1, "trd30a", "TR-DOS v3.0 (set 2)")
// ROMX_LOAD("trd30_alt.bin", 0x0000, 0x1000, CRC(48f9149f) SHA1(52774757096fdc93ea94c55306481f6f41204e96), ROM_BIOS(1))
// ROM_RELOAD(0x1000,0x1000)
// ROM_RELOAD(0x2000,0x1000)
// ROM_RELOAD(0x3000,0x1000)
ROM_SYSTEM_BIOS(1, "trd30p", "TR-DOS v3.0 (set 2, Profisoft)") // is this a clone device?
ROMX_LOAD("trd30ps.bin", 0x0000, 0x1000, CRC(b0f175a3) SHA1(ac95bb4d89072224deef58a1655e8029f811a7fa), ROM_BIOS(1))
ROM_RELOAD(0x1000,0x1000)
ROM_RELOAD(0x2000,0x1000)
ROM_RELOAD(0x3000,0x1000)
ROM_END
// some sources indicate these should be 16kb roms with both halves duplicated, others suggest the same but with the first byte being 0x00 instead (maybe an issue with the dumping)
// there are also some '412' unscrambled dumps with most of the data in the mirror regions as 0xff (maybe official, maybe from clone devices that should be treated separately?)
ROM_START(betaplus)
ROM_REGION(0x4000, "rom", 0)
ROM_DEFAULT_BIOS("trd409")
ROM_SYSTEM_BIOS(0, "trd409", "TR-DOS v4.09")
ROMX_LOAD("trd409.bin", 0x0000, 0x2000, CRC(18365bdc) SHA1(a0e7c80905423c54bd497575026ea8821061175a), ROM_BIOS(0))
ROM_RELOAD(0x2000,0x2000)
ROM_SYSTEM_BIOS(1, "trd411", "TR-DOS v4.11")
ROMX_LOAD("trd411.bin", 0x0000, 0x2000, CRC(26902902) SHA1(cb90fc31bf62d5968730db23a600344338e31e7e), ROM_BIOS(1))
ROM_RELOAD(0x2000,0x2000)
ROM_END
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void spectrum_beta128_device::device_add_mconfig(machine_config &config)
void spectrum_betav2_device::device_add_mconfig_base(machine_config& config)
{
FD1793(config, m_fdc, 4_MHz_XTAL / 4);
FLOPPY_CONNECTOR(config, "fdc:0", beta_floppies, "525qd", spectrum_beta128_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:1", beta_floppies, "525qd", spectrum_beta128_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:2", beta_floppies, nullptr, spectrum_beta128_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:3", beta_floppies, nullptr, spectrum_beta128_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:0", beta_floppies, "525qd", spectrum_betav2_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:1", beta_floppies, "525qd", spectrum_betav2_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:2", beta_floppies, nullptr, spectrum_betav2_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:3", beta_floppies, nullptr, spectrum_betav2_device::floppy_formats).enable_sound(true);
// passthru
SPECTRUM_EXPANSION_SLOT(config, m_exp, spectrum_expansion_devices, nullptr);
@ -91,9 +168,31 @@ void spectrum_beta128_device::device_add_mconfig(machine_config &config)
m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::nmi_w));
}
const tiny_rom_entry *spectrum_beta128_device::device_rom_region() const
void spectrum_betav2_device::device_add_mconfig(machine_config &config)
{
return ROM_NAME(beta128);
FD1771(config, m_fdc, 4_MHz_XTAL / 4);
device_add_mconfig_base(config);
}
void spectrum_betav3_device::device_add_mconfig(machine_config& config)
{
FD1793(config, m_fdc, 4_MHz_XTAL / 4);
device_add_mconfig_base(config);
}
const tiny_rom_entry *spectrum_betav2_device::device_rom_region() const
{
return ROM_NAME(betav2);
}
const tiny_rom_entry *spectrum_betav3_device::device_rom_region() const
{
return ROM_NAME(betav3);
}
const tiny_rom_entry *spectrum_betaplus_device::device_rom_region() const
{
return ROM_NAME(betaplus);
}
@ -102,69 +201,104 @@ const tiny_rom_entry *spectrum_beta128_device::device_rom_region() const
//**************************************************************************
//-------------------------------------------------
// spectrum_beta128_device - constructor
// spectrum_betav2_device - constructor
//-------------------------------------------------
spectrum_beta128_device::spectrum_beta128_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SPECTRUM_BETA128, tag, owner, clock)
spectrum_betav2_device::spectrum_betav2_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_spectrum_expansion_interface(mconfig, *this)
, m_rom(*this, "rom")
, m_fdc(*this, "fdc")
, m_floppy(*this, "fdc:%u", 0)
, m_exp(*this, "exp")
, m_switch(*this, "SWITCH")
{
}
spectrum_betav2_device::spectrum_betav2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: spectrum_betav2_device(mconfig, SPECTRUM_BETAV2, tag, owner, clock)
{
}
spectrum_betav3_device::spectrum_betav3_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: spectrum_betav2_device(mconfig, type, tag, owner, clock)
{
}
spectrum_betav3_device::spectrum_betav3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: spectrum_betav3_device(mconfig, SPECTRUM_BETAV3, tag, owner, clock)
{
}
spectrum_betaplus_device::spectrum_betaplus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: spectrum_betav3_device(mconfig, type, tag, owner, clock)
{
}
spectrum_betaplus_device::spectrum_betaplus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: spectrum_betaplus_device(mconfig, SPECTRUM_BETAPLUS, tag, owner, clock)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void spectrum_beta128_device::device_start()
void spectrum_betav2_device::device_start()
{
save_item(NAME(m_romcs));
#if 0 // we do this in realtime instead
for (int i = 0; i < m_rom->bytes(); i++)
{
uint8_t* rom = m_rom->base();
rom[i] = bitswap<8>(rom[i],0,6,5,4,3,2,1,7);
}
#endif
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void spectrum_beta128_device::device_reset()
void spectrum_betav2_device::device_reset()
{
// Page in the ROM if auto-boot is selected
if (m_switch->read() == 0x01)
m_romcs = 1;
else
m_romcs = 0;
// always paged in on boot? (no mode switch like beta128)
m_romcs = 1;
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
READ_LINE_MEMBER(spectrum_beta128_device::romcs)
READ_LINE_MEMBER(spectrum_betav2_device::romcs)
{
return m_romcs | m_exp->romcs();
}
void spectrum_beta128_device::opcode_fetch(offs_t offset)
void spectrum_betav2_device::opcode_fetch(offs_t offset)
{
m_exp->opcode_fetch(offset);
if (!machine().side_effects_disabled())
{
if ((offset == 0x0066) || (offset & 0xff00) == 0x3d00)
if ((offset & 0xff00) == 0x3c00)
m_romcs = 1;
else if (offset >= 0x4000)
m_romcs = 0;
// how does the ROM get disabled on these older beta units
// there are no RETs that end up in RAM as with the 128
// so it looks like jumps to the 0xxx and 1xxx regions, but
// that doesn't work?
}
}
uint8_t spectrum_beta128_device::iorq_r(offs_t offset)
uint8_t spectrum_betav2_device::iorq_r(offs_t offset)
{
uint8_t data = m_exp->iorq_r(offset);
#if 0 // this is the Beta 128 logic, it may or may not be the same here
if (m_romcs)
{
switch (offset & 0xff)
@ -180,11 +314,14 @@ uint8_t spectrum_beta128_device::iorq_r(offs_t offset)
break;
}
}
#endif
return data;
}
void spectrum_beta128_device::iorq_w(offs_t offset, uint8_t data)
void spectrum_betav2_device::iorq_w(offs_t offset, uint8_t data)
{
#if 0 // this is the Beta 128 logic, it may or may not be the same here
if (m_romcs)
{
switch (offset & 0xff)
@ -219,16 +356,18 @@ void spectrum_beta128_device::iorq_w(offs_t offset, uint8_t data)
break;
}
}
#endif
m_exp->iorq_w(offset, data);
}
uint8_t spectrum_beta128_device::mreq_r(offs_t offset)
uint8_t spectrum_betav2_device::mreq_r(offs_t offset)
{
uint8_t data = 0xff;
if (m_romcs)
{
data = m_rom->base()[offset & 0x3fff];
data = bitswap<8>(data,0,6,5,4,3,2,1,7); // proper dumps have bits 0 and 7 swapped?
}
if (m_exp->romcs())
@ -237,17 +376,30 @@ uint8_t spectrum_beta128_device::mreq_r(offs_t offset)
return data;
}
void spectrum_beta128_device::mreq_w(offs_t offset, uint8_t data)
void spectrum_betav2_device::mreq_w(offs_t offset, uint8_t data)
{
if (m_exp->romcs())
m_exp->mreq_w(offset, data);
}
INPUT_CHANGED_MEMBER(spectrum_beta128_device::magic_button)
// Betaplus has a 'magic button' for dumping RAM
INPUT_PORTS_START(betaplus)
PORT_START("BUTTON") // don't use F12, it clashes with the 'exit from debugger' button
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Magic Button") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, spectrum_betaplus_device, magic_button, 0)
INPUT_PORTS_END
ioport_constructor spectrum_betaplus_device::device_input_ports() const
{
return INPUT_PORTS_NAME(betaplus);
}
INPUT_CHANGED_MEMBER(spectrum_betaplus_device::magic_button)
{
if (newval && !oldval)
{
m_slot->nmi_w(ASSERT_LINE);
m_romcs = 1;
}
else
{

View File

@ -1,12 +1,12 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
// copyright-holders:Nigel Barnes, David Haywood
/*********************************************************************
Technology Research Beta 128 Disk interface
Technology Research Beta Disk interface
*********************************************************************/
#ifndef MAME_BUS_SPECTRUM_BETA_H
#define MAME_BUS_SPECTRUM_BETA_H
#ifndef MAME_BUS_SPECTRUM_BETAV2_H
#define MAME_BUS_SPECTRUM_BETAV2_H
#include "exp.h"
#include "softlist.h"
@ -18,17 +18,17 @@
// TYPE DEFINITIONS
//**************************************************************************
class spectrum_beta128_device :
class spectrum_betav2_device :
public device_t,
public device_spectrum_expansion_interface
{
public:
// construction/destruction
spectrum_beta128_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
spectrum_betav2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
spectrum_betav2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_FLOPPY_FORMATS(floppy_formats);
DECLARE_INPUT_CHANGED_MEMBER(magic_button);
protected:
// device-level overrides
@ -36,9 +36,9 @@ protected:
virtual void device_reset() override;
// optional information overrides
void device_add_mconfig_base(machine_config& config);
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
virtual void opcode_fetch(offs_t offset) override;
virtual uint8_t mreq_r(offs_t offset) override;
@ -48,17 +48,47 @@ protected:
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
required_memory_region m_rom;
required_device<fd1793_device> m_fdc;
required_device<wd_fdc_device_base> m_fdc;
required_device_array<floppy_connector, 4> m_floppy;
required_device<spectrum_expansion_slot_device> m_exp;
required_ioport m_switch;
int m_romcs;
};
class spectrum_betav3_device :
public spectrum_betav2_device
{
public:
// construction/destruction
spectrum_betav3_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
spectrum_betav3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
};
class spectrum_betaplus_device :
public spectrum_betav3_device
{
public:
// construction/destruction
spectrum_betaplus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
spectrum_betaplus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_INPUT_CHANGED_MEMBER(magic_button);
protected:
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
};
// device type definition
DECLARE_DEVICE_TYPE(SPECTRUM_BETA128, spectrum_beta128_device)
DECLARE_DEVICE_TYPE(SPECTRUM_BETAV2, spectrum_betav2_device)
DECLARE_DEVICE_TYPE(SPECTRUM_BETAV3, spectrum_betav3_device)
DECLARE_DEVICE_TYPE(SPECTRUM_BETAPLUS, spectrum_betaplus_device)
#endif // MAME_BUS_SPECTRUM_BETA_H
#endif // MAME_BUS_SPECTRUM_BETAV2_H

View File

@ -0,0 +1,284 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/*********************************************************************
Technology Research Beta 128 Disk interface
This hardware type runs TR-DOS 5.xx (official) and newer
unofficial updates. It was designed to work properly with
the 128k machines that had issues with the original Beta Disk
due to changes in the 128k ROM structure etc. (enable address
is moved from 3cxx to 3dxx for example)
Issues:
Using the FD1793 device a 'CAT' operation in the 'spectrum' driver
will always report 'No Disk' but using the Soviet clone KR1818VG93
it properly gives the disk catalogue. Despite this files can still
be loaded from disk.
The 128k Spectrum drivers have a similar issues, although even if
you replace the controller doing a 'CAT' operation seems to have
an adverse effect on the system memory setup as things become
corrupt (LOADing or MERGEing a program afterwards can cause a reset)
Neither of these issues occur in other Spectrum emulators using
the same ROMs and floppy images.
TODO:
there were many unofficial ROMs available for this, make them
available for use.
*********************************************************************/
#include "emu.h"
#include "beta128.h"
/***************************************************************************
DEVICE DEFINITIONS
***************************************************************************/
DEFINE_DEVICE_TYPE(SPECTRUM_BETA128, spectrum_beta128_device, "spectrum_beta128", "TR Beta 128 Disk Interface")
//-------------------------------------------------
// INPUT_PORTS( beta128 )
//-------------------------------------------------
INPUT_PORTS_START(beta128)
PORT_START("BUTTON") // don't use F12, it clashes with the 'exit from debugger' button
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Magic Button") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, spectrum_beta128_device, magic_button, 0)
PORT_START("SWITCH")
PORT_CONFNAME(0x03, 0x01, "System Switch") //PORT_CHANGED_MEMBER(DEVICE_SELF, spectrum_beta128_device, switch_changed, 0)
PORT_CONFSETTING(0x00, "Off (128)")
PORT_CONFSETTING(0x01, "Normal (auto-boot)")
//PORT_CONFSETTING(0x02, "Reset") // TODO: implement RESET callback
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor spectrum_beta128_device::device_input_ports() const
{
return INPUT_PORTS_NAME(beta128);
}
//-------------------------------------------------
// SLOT_INTERFACE( beta_floppies )
//-------------------------------------------------
static void beta_floppies(device_slot_interface &device)
{
device.option_add("525qd", FLOPPY_525_QD);
}
//-------------------------------------------------
// floppy_format_type floppy_formats
//-------------------------------------------------
FLOPPY_FORMATS_MEMBER(spectrum_beta128_device::floppy_formats)
FLOPPY_TRD_FORMAT
FLOPPY_FORMATS_END
//-------------------------------------------------
// ROM( beta )
//-------------------------------------------------
ROM_START(beta128)
ROM_REGION(0x4000, "rom", 0)
ROM_DEFAULT_BIOS("trd504")
ROM_SYSTEM_BIOS(0, "trd501", "TR-DOS v5.01")
ROMX_LOAD("trd501.rom", 0x0000, 0x4000, CRC(3e3cdd4c) SHA1(8303ba0cc79daa6c04cd1e6ce27e8b6886a3f0de), ROM_BIOS(0))
ROM_SYSTEM_BIOS(1, "trd503", "TR-DOS v5.03")
ROMX_LOAD("trd503.rom", 0x0000, 0x4000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c), ROM_BIOS(1))
ROM_SYSTEM_BIOS(2, "trd504", "TR-DOS v5.04")
ROMX_LOAD("trd504.rom", 0x0000, 0x4000, CRC(ba310874) SHA1(05e55e37df8eee6c68601ba9cf6c92195852ce3f), ROM_BIOS(2))
ROM_END
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void spectrum_beta128_device::device_add_mconfig(machine_config &config)
{
FD1793(config, m_fdc, 4_MHz_XTAL / 4);
//KR1818VG93(config, m_fdc, 4_MHz_XTAL / 4);
FLOPPY_CONNECTOR(config, "fdc:0", beta_floppies, "525qd", spectrum_beta128_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:1", beta_floppies, "525qd", spectrum_beta128_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:2", beta_floppies, nullptr, spectrum_beta128_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:3", beta_floppies, nullptr, spectrum_beta128_device::floppy_formats).enable_sound(true);
// passthru
SPECTRUM_EXPANSION_SLOT(config, m_exp, spectrum_expansion_devices, nullptr);
m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::irq_w));
m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::nmi_w));
}
const tiny_rom_entry *spectrum_beta128_device::device_rom_region() const
{
return ROM_NAME(beta128);
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// spectrum_beta128_device - constructor
//-------------------------------------------------
spectrum_beta128_device::spectrum_beta128_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SPECTRUM_BETA128, tag, owner, clock)
, device_spectrum_expansion_interface(mconfig, *this)
, m_rom(*this, "rom")
, m_fdc(*this, "fdc")
, m_floppy(*this, "fdc:%u", 0)
, m_exp(*this, "exp")
, m_switch(*this, "SWITCH")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void spectrum_beta128_device::device_start()
{
save_item(NAME(m_romcs));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void spectrum_beta128_device::device_reset()
{
// Page in the ROM if auto-boot is selected
if (m_switch->read() == 0x01)
m_romcs = 1;
else
m_romcs = 0;
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
READ_LINE_MEMBER(spectrum_beta128_device::romcs)
{
return m_romcs | m_exp->romcs();
}
void spectrum_beta128_device::opcode_fetch(offs_t offset)
{
m_exp->opcode_fetch(offset);
if (!machine().side_effects_disabled())
{
if ((offset == 0x0066) || (offset & 0xff00) == 0x3d00)
m_romcs = 1;
else if (offset >= 0x4000)
m_romcs = 0;
}
}
uint8_t spectrum_beta128_device::iorq_r(offs_t offset)
{
uint8_t data = m_exp->iorq_r(offset);
if (m_romcs)
{
switch (offset & 0xff)
{
case 0x1f: case 0x3f: case 0x5f: case 0x7f:
data = m_fdc->read((offset >> 5) & 0x03);
break;
case 0xff:
data &= 0x3f; // actually open bus
data |= m_fdc->drq_r() ? 0x40 : 0;
data |= m_fdc->intrq_r() ? 0x80 : 0;
break;
}
}
return data;
}
void spectrum_beta128_device::iorq_w(offs_t offset, uint8_t data)
{
if (m_romcs)
{
switch (offset & 0xff)
{
case 0x1f: case 0x3f: case 0x5f: case 0x7f:
m_fdc->write((offset >> 5) & 0x03, data);
break;
case 0xff:
floppy_image_device* floppy = m_floppy[data & 3]->get_device();
m_fdc->set_floppy(floppy);
if (floppy)
floppy->ss_w(BIT(data, 4) ? 0 : 1);
m_fdc->dden_w(BIT(data, 6));
// bit 3 connected to pin 23 "HLT" of FDC and via diode to INDEX
//m_fdc->hlt_w(BIT(data, 3)); // not handled in current wd_fdc
if (BIT(data, 2) == 0) // reset
{
m_fdc->reset();
if (floppy)
floppy->mon_w(ASSERT_LINE);
}
else
{
// TODO: implement correct motor control, FDD motor and RDY FDC pin controlled by HLD pin of FDC
if (floppy)
floppy->mon_w(CLEAR_LINE);
}
break;
}
}
m_exp->iorq_w(offset, data);
}
uint8_t spectrum_beta128_device::mreq_r(offs_t offset)
{
uint8_t data = 0xff;
if (m_romcs)
{
data = m_rom->base()[offset & 0x3fff];
}
if (m_exp->romcs())
data &= m_exp->mreq_r(offset);
return data;
}
void spectrum_beta128_device::mreq_w(offs_t offset, uint8_t data)
{
if (m_exp->romcs())
m_exp->mreq_w(offset, data);
}
INPUT_CHANGED_MEMBER(spectrum_beta128_device::magic_button)
{
if (newval && !oldval)
{
m_slot->nmi_w(ASSERT_LINE);
}
else
{
m_slot->nmi_w(CLEAR_LINE);
}
}

View File

@ -0,0 +1,64 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/*********************************************************************
Technology Research Beta 128 Disk interface
*********************************************************************/
#ifndef MAME_BUS_SPECTRUM_BETA128_H
#define MAME_BUS_SPECTRUM_BETA128_H
#include "exp.h"
#include "softlist.h"
#include "imagedev/floppy.h"
#include "machine/wd_fdc.h"
#include "formats/trd_dsk.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class spectrum_beta128_device :
public device_t,
public device_spectrum_expansion_interface
{
public:
// construction/destruction
spectrum_beta128_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_FLOPPY_FORMATS(floppy_formats);
DECLARE_INPUT_CHANGED_MEMBER(magic_button);
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 ioport_constructor device_input_ports() const override;
virtual void opcode_fetch(offs_t offset) override;
virtual uint8_t mreq_r(offs_t offset) override;
virtual void mreq_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;
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
required_memory_region m_rom;
required_device<wd_fdc_device_base> m_fdc;
required_device_array<floppy_connector, 4> m_floppy;
required_device<spectrum_expansion_slot_device> m_exp;
required_ioport m_switch;
int m_romcs;
};
// device type definition
DECLARE_DEVICE_TYPE(SPECTRUM_BETA128, spectrum_beta128_device)
#endif // MAME_BUS_SPECTRUM_BETA128_H

View File

@ -169,6 +169,7 @@ void spectrum_expansion_slot_device::mreq_w(offs_t offset, uint8_t data)
// slot devices
#include "beta.h"
#include "beta128.h"
//#include "disciple.h"
#include "intf1.h"
#include "intf2.h"
@ -189,6 +190,9 @@ void spectrum_expansion_slot_device::mreq_w(offs_t offset, uint8_t data)
void spectrum_expansion_devices(device_slot_interface &device)
{
device.option_add("betav2", SPECTRUM_BETAV2);
device.option_add("betav3", SPECTRUM_BETAV3);
device.option_add("betaplus", SPECTRUM_BETAPLUS);
device.option_add("beta128", SPECTRUM_BETA128);
//device.option_add("disciple", SPECTRUM_DISCIPLE);
device.option_add("intf1", SPECTRUM_INTF1);