spectrum: implemented Speccy-DOS and FloppyOne DOS interfaces, add "IC-DOS" Beta Plus clone

This commit is contained in:
MetalliC 2020-07-11 17:31:59 +03:00
parent 029a12bea9
commit fb7f6b7841
16 changed files with 883 additions and 6 deletions

View File

@ -3762,6 +3762,8 @@ if (BUSES["SPECTRUM"]~=null) then
MAME_DIR .. "src/devices/bus/spectrum/intf1.h",
MAME_DIR .. "src/devices/bus/spectrum/intf2.cpp",
MAME_DIR .. "src/devices/bus/spectrum/intf2.h",
MAME_DIR .. "src/devices/bus/spectrum/floppyone.cpp",
MAME_DIR .. "src/devices/bus/spectrum/floppyone.h",
MAME_DIR .. "src/devices/bus/spectrum/fuller.cpp",
MAME_DIR .. "src/devices/bus/spectrum/fuller.h",
MAME_DIR .. "src/devices/bus/spectrum/kempjoy.cpp",
@ -3782,6 +3784,8 @@ if (BUSES["SPECTRUM"]~=null) then
MAME_DIR .. "src/devices/bus/spectrum/plus2test.h",
MAME_DIR .. "src/devices/bus/spectrum/protek.cpp",
MAME_DIR .. "src/devices/bus/spectrum/protek.h",
MAME_DIR .. "src/devices/bus/spectrum/speccydos.cpp",
MAME_DIR .. "src/devices/bus/spectrum/speccydos.h",
MAME_DIR .. "src/devices/bus/spectrum/specdrum.cpp",
MAME_DIR .. "src/devices/bus/spectrum/specdrum.h",
MAME_DIR .. "src/devices/bus/spectrum/uslot.cpp",

View File

@ -821,6 +821,18 @@ if (FORMATS["FDD_DSK"]~=null or _OPTIONS["with-tools"]) then
}
end
--------------------------------------------------
--
--@src/lib/formats/fl1_dsk.h,FORMATS["FL1_DSK"] = true
--------------------------------------------------
if (FORMATS["FL1_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/fl1_dsk.cpp",
MAME_DIR.. "src/lib/formats/fl1_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/flex_dsk.h,FORMATS["FLEX_DSK"] = true
@ -1589,6 +1601,18 @@ if (FORMATS["SC3000_BIT"]~=null or _OPTIONS["with-tools"]) then
}
end
--------------------------------------------------
--
--@src/lib/formats/sdd_dsk.h,FORMATS["SDD_DSK"] = true
--------------------------------------------------
if (FORMATS["SDD_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/sdd_dsk.cpp",
MAME_DIR.. "src/lib/formats/sdd_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/sf7000_dsk.h,FORMATS["SF7000_DSK"] = true

View File

@ -1006,6 +1006,7 @@ FORMATS["ESQ8_DSK"] = true
FORMATS["EXCALI64_DSK"] = true
FORMATS["FC100_CAS"] = true
FORMATS["FDD_DSK"] = true
FORMATS["FL1_DSK"] = true
FORMATS["FLEX_DSK"] = true
FORMATS["FM7_CAS"] = true
FORMATS["FMSX_CAS"] = true
@ -1067,6 +1068,7 @@ FORMATS["QL_DSK"] = true
FORMATS["RK_CAS"] = true
FORMATS["RX50_DSK"] = true
FORMATS["SC3000_BIT"] = true
FORMATS["SDD_DSK"] = true
FORMATS["SF7000_DSK"] = true
FORMATS["SMX_DSK"] = true
FORMATS["SOL_CAS"] = true

View File

@ -46,7 +46,7 @@
- common Brazilian clones: usually use FD1797 instead of FD1793, no ROM bits D0/D7 swap, DOS ROM area 3CXX might be disabled, equiped with printer port.
- CBI-95
- SYNCHRON IDS91
- SYNCHRON IDS2001ne
- SYNCHRON IDS2001ne (added interface disable jumper)
- ARCADE AR-20
- MIDAS Gammadisk - 3 versions known to exists:
- straight clone
@ -85,7 +85,7 @@
V3-V4: D7 BDI ROM_latch (0=enable, 1=disble), D6 - FDC DDEN, D4 - SIDE, D3 - FDC HLT, D2 - FDC /MR (reset), D0-1 - floppy drive select (binary value).
CBI clones: D5 - printer port /STROBE
IO read port 0b1xxxx111 <- D7 - FDC INTRQ, D6 - FDC DRQ
CBI clones: D5 - printer port BUSY
CBI clones: D5 - printer port BUSY, D4 - printer standard select jumper (ABICOMP / MSX1.1)
IO read/write ports 0b0YYxx111 - access FDC ports YY
So mostly the same as beta128, except for new BDI ROM_latch bit
@ -202,6 +202,9 @@ ROM_START(betaplus)
ROM_SYSTEM_BIOS(5, "cas87", "CAS DOS 1987") // 4.12 with texts translated
ROMX_LOAD("cas1987.bin", 0x0000, 0x2000, CRC(a6a9450c) SHA1(b54b173a9f11ed730804d94584a1679193993e3c), ROM_BIOS(5))
ROM_RELOAD(0x2000,0x2000)
ROM_SYSTEM_BIOS(6, "icdos", "IC-DOS JUMBO v2.0") // v4.11 with name text changed
ROMX_LOAD("icdos.bin", 0x0000, 0x2000, CRC(1398d13a) SHA1(bf8cee39eb4b2a09a3f07db4cb8e7952bce4d3dd), ROM_BIOS(6))
ROM_RELOAD(0x2000,0x2000)
ROM_END
ROM_START(betaclone)

View File

@ -159,6 +159,7 @@ void spectrum_expansion_slot_device::mreq_w(offs_t offset, uint8_t data)
#include "d40.h"
#include "intf1.h"
#include "intf2.h"
#include "floppyone.h"
#include "fuller.h"
#include "kempjoy.h"
#include "kempdisc.h"
@ -170,6 +171,7 @@ void spectrum_expansion_slot_device::mreq_w(offs_t offset, uint8_t data)
#include "plus2test.h"
#include "protek.h"
#include "specdrum.h"
#include "speccydos.h"
#include "uslot.h"
#include "usource.h"
#include "uspeech.h"
@ -187,6 +189,7 @@ void spectrum_expansion_devices(device_slot_interface &device)
device.option_add("disciple", SPECTRUM_DISCIPLE);
device.option_add("intf1", SPECTRUM_INTF1);
device.option_add("intf2", SPECTRUM_INTF2);
device.option_add("flpone", SPECTRUM_FLPONE);
device.option_add("fuller", SPECTRUM_FULLER);
device.option_add("kempjoy", SPECTRUM_KEMPJOY);
device.option_add("kempdisc", SPECTRUM_KEMPDISC);
@ -201,6 +204,7 @@ void spectrum_expansion_devices(device_slot_interface &device)
device.option_add("d80", SPECTRUM_D80);
device.option_add("d80v2", SPECTRUM_D80V2);
device.option_add("protek", SPECTRUM_PROTEK);
device.option_add("speccydos", SPECTRUM_SPECCYDOS);
device.option_add("specdrum", SPECTRUM_SPECDRUM);
device.option_add("uslot", SPECTRUM_USLOT);
device.option_add("usource", SPECTRUM_USOURCE);
@ -222,6 +226,7 @@ void spec128_expansion_devices(device_slot_interface &device)
device.option_add("plusd", SPECTRUM_PLUSD);
device.option_add("plus2test", SPECTRUM_PLUS2TEST);
device.option_add("protek", SPECTRUM_PROTEK);
device.option_add("speccydos", SPECTRUM_SPECCYDOS);
device.option_add("specdrum", SPECTRUM_SPECDRUM);
device.option_add("wafadrive", SPECTRUM_WAFA);
}

View File

@ -0,0 +1,282 @@
// license:BSD-3-Clause
// copyright-holders:MetalliC
/*********************************************************************
FloppyOne DOS Interface
(c) 1984/5 Rocky P. Gush
FD1791-based floppy drive and printer interface with 4K RAM and 8K ROM
Was mainly designed as tape replacement, and sort of emulate how tapes works,
which allows to copy and use most of existing software and (not protected) games with no modification.
Doube-side drives considered as 2 separate floppies (0 and 4, 1 and 5 etc) probably to mimic tape sides A/B,
disks is password protected.
Main commands:
!D=n - change current drive, where 'n' 0-3 = FDD 0-3 side 0, 4-7 = FDD 0-3 side 1, 8 = enable LOAD from tape
CAT - list disk contents
LOAD "name" - load program, LOAD "" will load first program (unless was disabled by !d=8 command)
LOAD *"m";1;"name" - same as above
SAVE "name" - save program
!FORMAT "diskname";"password";tracks - format disk, if disk was already formatted you'll be prompted for password.
!6=n - set text mode, 0 - regular 32-column, 3 - 64-column
There is more of special "!x=n" commands, but theirs functions is not known, manual is missing.
Some information about this device https://worldofspectrum.org/forums/discussion/42944/rocky-gush-floppy-drive-interface/p1
Notes / TODOs:
- Interface1 compatibility mode is not well understood and not fully implemented
- Serial printer interface not implemented
*********************************************************************/
#include "emu.h"
#include "floppyone.h"
/***************************************************************************
DEVICE DEFINITIONS
***************************************************************************/
DEFINE_DEVICE_TYPE(SPECTRUM_FLPONE, spectrum_flpone_device, "spectrum_flpone", "FloppyOne DOS Interface")
//-------------------------------------------------
// INPUT_PORTS
//-------------------------------------------------
INPUT_PORTS_START(flpone)
PORT_START("BUTTON")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Snapshot Button") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, spectrum_flpone_device, snapshot_button, 0)
PORT_START("SW1")
PORT_CONFNAME(0x01, 0x01, "Disc Interface")
PORT_CONFSETTING(0x01, "Enabled")
PORT_CONFSETTING(0x00, "Disabled")
PORT_START("SW2")
PORT_CONFNAME(0x01, 0x00, "Interface 1")
PORT_CONFSETTING(0x01, "Enable")
PORT_CONFSETTING(0x00, "Disable")
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor spectrum_flpone_device::device_input_ports() const
{
return INPUT_PORTS_NAME(flpone);
}
//-------------------------------------------------
// SLOT_INTERFACE( floppies )
//-------------------------------------------------
static void flpone_floppies(device_slot_interface &device)
{
device.option_add("525ssdd", FLOPPY_525_SSDD);
device.option_add("525dd", FLOPPY_525_DD);
device.option_add("525ssqd", FLOPPY_525_SSQD);
device.option_add("525qd", FLOPPY_525_QD);
device.option_add("35ssdd", FLOPPY_35_SSDD);
device.option_add("35dd", FLOPPY_35_DD);
}
//-------------------------------------------------
// floppy_format_type floppy_formats
//-------------------------------------------------
FLOPPY_FORMATS_MEMBER(spectrum_flpone_device::floppy_formats)
FLOPPY_FL1_FORMAT
FLOPPY_FORMATS_END
//-------------------------------------------------
// ROM( flpone )
//-------------------------------------------------
ROM_START(flpone)
ROM_REGION(0x2000, "rom", 0)
ROM_DEFAULT_BIOS("v4")
ROM_SYSTEM_BIOS(0, "v4", "FloppyOne DOS V4")
ROMX_LOAD("fldos4.bin", 0x0000, 0x2000, CRC(a012f64f) SHA1(f54b47d83c1d45c0e1e10302e519693bc734ae5c), ROM_BIOS(0))
ROM_REGION(0x4000, "prom", 0)
ROM_LOAD("ula.bin", 0x0000, 0x2000, CRC(d67d85aa) SHA1(eb1d28bf8aa35bfab3a45a5827f252498ac2c651)) // 1st half is not used, A13 tied to Vcc
ROM_CONTINUE(0x0000, 0x2000)
ROM_END
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void spectrum_flpone_device::device_add_mconfig(machine_config &config)
{
FD1791(config, m_fdc, 1_MHz_XTAL);
FLOPPY_CONNECTOR(config, "fdc:0", flpone_floppies, "525qd", spectrum_flpone_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:1", flpone_floppies, "525qd", spectrum_flpone_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:2", flpone_floppies, nullptr, spectrum_flpone_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:3", flpone_floppies, nullptr, spectrum_flpone_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_flpone_device::device_rom_region() const
{
return ROM_NAME(flpone);
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// spectrum_flpone_device - constructor
//-------------------------------------------------
spectrum_flpone_device::spectrum_flpone_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SPECTRUM_FLPONE, tag, owner, clock)
, device_spectrum_expansion_interface(mconfig, *this)
, m_rom(*this, "rom")
, m_prom(*this, "prom")
, m_fdc(*this, "fdc")
, m_floppy(*this, "fdc:%u", 0)
, m_exp(*this, "exp")
, m_sw1(*this, "SW1")
, m_sw2(*this, "SW2")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void spectrum_flpone_device::device_start()
{
memset(m_ram, 0, sizeof(m_ram));
save_item(NAME(m_romcs));
save_item(NAME(m_ram));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void spectrum_flpone_device::device_reset()
{
m_romcs = 0;
m_if1cs = 0;
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
READ_LINE_MEMBER(spectrum_flpone_device::romcs)
{
return m_romcs | m_exp->romcs();
}
void spectrum_flpone_device::post_opcode_fetch(offs_t offset)
{
m_exp->post_opcode_fetch(offset);
if (!machine().side_effects_disabled() && m_sw1->read())
{
if (offset < 0x2000)
{
u8 data = m_prom->base()[offset];
m_romcs |= BIT(data, 4) ^ 1;
m_romcs &= BIT(data, 6);
if (m_sw2->read())
{
m_if1cs |= BIT(data, 7) ^ 1;
m_if1cs &= BIT(data, 5);
m_romcs &= !m_if1cs;
}
}
}
}
uint8_t spectrum_flpone_device::mreq_r(offs_t offset)
{
u8 data = 0xff;
if (m_romcs)
{
switch (offset & 0xf000)
{
case 0x0000: case 0x1000:
data = m_rom->base()[offset];
break;
case 0x3000:
data = m_ram[offset & 0xfff];
break;
case 0x2000:
switch (offset & 0xc)
{
case 0: case 8:
data = m_fdc->read(offset & 3);
break;
case 4: // D5 - printer BUSY / /BUSY
data = 0;
break;
case 0xc: // printer STROBE pulse
break;
}
break;
}
}
if (m_exp->romcs())
data &= m_exp->mreq_r(offset);
return data;
}
void spectrum_flpone_device::mreq_w(offs_t offset, uint8_t data)
{
if (m_romcs)
{
switch (offset & 0xf000)
{
case 0x3000:
m_ram[offset & 0xfff] = data;
break;
case 0x2000:
switch (offset & 0xc)
{
case 0: case 8:
m_fdc->write(offset & 3, data);
break;
case 4: // D7 - printer serial data
break;
case 0xc:
{
floppy_image_device* floppy = nullptr;
for (int i = 3; i >= 0; i--)
{
floppy_image_device* fl = m_floppy[i]->get_device();
if (fl)
{
fl->ss_w(BIT(data, 4));
fl->mon_w((BIT(data, 5) && BIT(data, i)) ? CLEAR_LINE : ASSERT_LINE);
if (BIT(data, i))
floppy = fl;
}
}
m_fdc->set_floppy(floppy);
}
break;
}
break;
}
}
m_exp->mreq_w(offset, data);
}

View File

@ -0,0 +1,67 @@
// license:BSD-3-Clause
// copyright-holders:MetalliC
/*********************************************************************
FloppyOne DOS Interface
(c) 1984/5 R.P.Gush
*********************************************************************/
#ifndef MAME_BUS_SPECTRUM_FLPONE_H
#define MAME_BUS_SPECTRUM_FLPONE_H
#include "exp.h"
#include "softlist.h"
#include "imagedev/floppy.h"
#include "machine/wd_fdc.h"
#include "formats/fl1_dsk.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class spectrum_flpone_device :
public device_t,
public device_spectrum_expansion_interface
{
public:
// construction/destruction
spectrum_flpone_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_FLOPPY_FORMATS(floppy_formats);
DECLARE_INPUT_CHANGED_MEMBER(snapshot_button) { m_slot->nmi_w(newval ? ASSERT_LINE : CLEAR_LINE); };
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void post_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 DECLARE_READ_LINE_MEMBER(romcs) override;
required_memory_region m_rom;
required_memory_region m_prom;
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_sw1;
required_ioport m_sw2;
int m_romcs, m_if1cs;
u8 m_ram[0x1000];
};
// device type definition
DECLARE_DEVICE_TYPE(SPECTRUM_FLPONE, spectrum_flpone_device)
#endif // MAME_BUS_SPECTRUM_FLPONE_H

View File

@ -14,6 +14,8 @@
COPY - tape to disc transfer utility
FORMAT "discname": PRINT drive#, tracks#, sides#, steprate - format disc
Manual https://archive.org/download/World_of_Spectrum_June_2017_Mirror/World%20of%20Spectrum%20June%202017%20Mirror.zip/World%20of%20Spectrum%20June%202017%20Mirror/sinclair/hardware-info/k/KempstonDiscInterface_Manual.pdf
Notes/TODO:
- schematics is missing, actual I/O ports decode might be not right
- find out port 0xDF 3 MSB bits wiring, probably FDC /DDEN, /MR

View File

@ -0,0 +1,244 @@
// license:BSD-3-Clause
// copyright-holders:MetalliC
/*********************************************************************
Speccy-DOS Interface
(c) 1987? Philips(?)
WD1770/2-based floppy drive interface with 1K RAM and 8K ROM,
presumable developed by Philips & MBLE Belgium, had some popularity in Hungary.
Main commands:
LIST * - list disc contents
LOAD *"filename" - load and run program
SAVE *"filename" - save program
FORMAT *"diskname"dd80 - format double side double density 80 tracks disk
ASN *drive# - change drive
Manual: https://sinclair.hu/speccyalista/konyvtar/kezikonyvek/SpeccyDOSv4_manual.pdf
Partially compatible with Spectrum128, useable after "USR 0" from basic128 or switch to 48K mode.
Notes / TODOs:
- address decoding performed by large DIP28 chip, probably PROM, not dumped, exact logic is not known.
- program ROMs have swapped data lines/bits 1 and 5.
- original software disc mentioned in manual is missing.
- Magic/NMI function require NMI routine preloaded in RAM by "MAGIC2.x" program (which is missing).
*********************************************************************/
#include "emu.h"
#include "speccydos.h"
/***************************************************************************
DEVICE DEFINITIONS
***************************************************************************/
DEFINE_DEVICE_TYPE(SPECTRUM_SPECCYDOS, spectrum_speccydos_device, "spectrum_speccydos", "Speccy-DOS Interface")
//-------------------------------------------------
// INPUT_PORTS
//-------------------------------------------------
INPUT_PORTS_START(speccydos)
PORT_START("BUTTON")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Magic Button") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, spectrum_speccydos_device, magic_button, 0)
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor spectrum_speccydos_device::device_input_ports() const
{
return INPUT_PORTS_NAME(speccydos);
}
//-------------------------------------------------
// SLOT_INTERFACE( floppies )
//-------------------------------------------------
static void speccydos_floppies(device_slot_interface &device)
{
device.option_add("525sssd_35t", FLOPPY_525_SSSD_35T);
device.option_add("525ssdd", FLOPPY_525_SSDD);
device.option_add("525dsdd", FLOPPY_525_DD);
device.option_add("525ssqd", FLOPPY_525_SSQD);
device.option_add("525dsqd", FLOPPY_525_QD);
device.option_add("35ssdd", FLOPPY_35_SSDD);
device.option_add("35dsdd", FLOPPY_35_DD);
}
//-------------------------------------------------
// floppy_format_type floppy_formats
//-------------------------------------------------
FLOPPY_FORMATS_MEMBER(spectrum_speccydos_device::floppy_formats)
FLOPPY_SDD_FORMAT
FLOPPY_FORMATS_END
//-------------------------------------------------
// ROM( speccydos )
//-------------------------------------------------
ROM_START(speccydos)
ROM_REGION(0x2000, "rom", 0)
ROM_DEFAULT_BIOS("sdos42")
ROM_SYSTEM_BIOS(0, "sdos41", "Speccy DOS v4.1")
ROMX_LOAD("sdos41.bin", 0x0000, 0x2000, CRC(fcfa6dac) SHA1(bcae27b334bbbee257900682859132f476c3be99), ROM_BIOS(0))
ROM_SYSTEM_BIOS(1, "sdos42", "Speccy DOS v4.2 (WD1770)")
ROMX_LOAD("sdos42.bin", 0x0000, 0x2000, CRC(208e7baa) SHA1(80e82c1dd77ff04b86989f7d2a25d93c5aa1dc42), ROM_BIOS(1))
ROM_SYSTEM_BIOS(2, "sdos422", "Speccy DOS v4.2 (WD1772)") // only 4 byte different from above - step rates for 1772
ROMX_LOAD("sdos422.bin", 0x0000, 0x2000, CRC(a7317e1d) SHA1(e72d2ea19cbe8f3459e4fc9d3c57975dc9917bd6), ROM_BIOS(2))
ROM_END
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void spectrum_speccydos_device::device_add_mconfig(machine_config &config)
{
WD1770(config, m_fdc, 8_MHz_XTAL);
FLOPPY_CONNECTOR(config, "fdc:0", speccydos_floppies, "35dsdd", spectrum_speccydos_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:1", speccydos_floppies, "35dsdd", spectrum_speccydos_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:2", speccydos_floppies, nullptr, spectrum_speccydos_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:3", speccydos_floppies, nullptr, spectrum_speccydos_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_speccydos_device::device_rom_region() const
{
return ROM_NAME(speccydos);
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// spectrum_speccydos_device - constructor
//-------------------------------------------------
spectrum_speccydos_device::spectrum_speccydos_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SPECTRUM_SPECCYDOS, 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")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void spectrum_speccydos_device::device_start()
{
memset(m_ram, 0, sizeof(m_ram));
save_item(NAME(m_romcs));
save_item(NAME(m_control));
save_item(NAME(m_ram));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void spectrum_speccydos_device::device_reset()
{
m_romcs = 0;
m_control = 0;
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
READ_LINE_MEMBER(spectrum_speccydos_device::romcs)
{
return m_romcs | m_exp->romcs();
}
void spectrum_speccydos_device::pre_opcode_fetch(offs_t offset)
{
m_exp->pre_opcode_fetch(offset);
if (!machine().side_effects_disabled())
{
switch (offset)
{
case 0x1292:
case 0x1b41:
if (!BIT(m_control, 6))
m_romcs = 1;
break;
}
}
}
uint8_t spectrum_speccydos_device::mreq_r(offs_t offset)
{
u8 data = 0xff;
if (m_romcs)
{
if (offset < 0x2000)
{
data = m_rom->base()[offset];
data = bitswap<8>(data, 7, 6, 1, 4, 3, 2, 5, 0);
}
else if (offset < 0x2400)
data = m_ram[offset & 0x3ff];
else if (offset >= 0x3290 && offset < 0x3294)
data = m_fdc->read(offset & 3);
else
logerror("SpeccyDOS unhandled read %04X\n", offset);
}
if (m_exp->romcs())
data &= m_exp->mreq_r(offset);
return data;
}
void spectrum_speccydos_device::mreq_w(offs_t offset, uint8_t data)
{
if (offset == 0x3b41)
{
m_control = data;
floppy_image_device* floppy = m_floppy[data & 3]->get_device();
m_fdc->set_floppy(floppy);
if (floppy)
floppy->ss_w(BIT(data, 2));
m_fdc->dden_w(BIT(data, 7));
m_romcs = BIT(data, 6) ? 0 : BIT(data, 3);
}
else
if (m_romcs)
{
if (offset >= 0x2000 && offset < 0x2400)
m_ram[offset & 0x3ff] = data;
else if (offset >= 0x3290 && offset < 0x3294)
m_fdc->write(offset & 3, data);
else
{
logerror("SpeccyDOS unhandled write %04X %02X\n", offset, data);
//machine().debug_break();
}
}
m_exp->mreq_w(offset, data);
}

View File

@ -0,0 +1,64 @@
// license:BSD-3-Clause
// copyright-holders:MetalliC
/*********************************************************************
Speccy DOS Interface
*********************************************************************/
#ifndef MAME_BUS_SPECTRUM_SPECCYDOS_H
#define MAME_BUS_SPECTRUM_SPECCYDOS_H
#include "exp.h"
#include "softlist.h"
#include "imagedev/floppy.h"
#include "machine/wd_fdc.h"
#include "formats/sdd_dsk.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class spectrum_speccydos_device :
public device_t,
public device_spectrum_expansion_interface
{
public:
// construction/destruction
spectrum_speccydos_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) { m_slot->nmi_w(newval ? ASSERT_LINE : CLEAR_LINE); };
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void pre_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 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;
int m_romcs;
u8 m_control;
u8 m_ram[0x400];
};
// device type definition
DECLARE_DEVICE_TYPE(SPECTRUM_SPECCYDOS, spectrum_speccydos_device)
#endif // MAME_BUS_SPECTRUM_SPECCYDOS_H

View File

@ -0,0 +1,59 @@
// license:BSD-3-Clause
// copyright-holders:MetalliC
/*********************************************************************
formats/fl1_dsk.c
FloppyOne DOS disk images
*********************************************************************/
#include <cassert>
#include "formats/fl1_dsk.h"
fl1_format::fl1_format() : wd177x_format(formats)
{
}
const char *fl1_format::name() const
{
return "fl1";
}
const char *fl1_format::description() const
{
return "FloppyOne floppy disk image";
}
const char *fl1_format::extensions() const
{
return "fl1";
}
int fl1_format::get_image_offset(const format &f, int head, int track)
{
return (f.track_count * head + track) * compute_track_size(f);
}
const fl1_format::format fl1_format::formats[] = {
{ // 5"25 800K 80 track double sided double density
floppy_image::FF_525, floppy_image::DSQD, floppy_image::MFM,
2000, 5, 80, 2, 1024, {}, 0, {}, 80, 22, 54
},
{ // 5"25 400K 80 track single sided double density
floppy_image::FF_525, floppy_image::SSQD, floppy_image::MFM,
2000, 5, 80, 1, 1024, {}, 0, {}, 80, 22, 54
},
{ // 3'5 800K 80 track double sided double density
floppy_image::FF_35, floppy_image::DSDD, floppy_image::MFM,
2000, 5, 80, 2, 1024, {}, 0, {}, 80, 22, 54
},
{ // 3'5 400K 80 track single sided double density
floppy_image::FF_35, floppy_image::SSDD, floppy_image::MFM,
2000, 5, 80, 1, 1024, {}, 0, {}, 80, 22, 54
},
{}
};
const floppy_format_type FLOPPY_FL1_FORMAT = &floppy_image_format_creator<fl1_format>;

32
src/lib/formats/fl1_dsk.h Normal file
View File

@ -0,0 +1,32 @@
// license:BSD-3-Clause
// copyright-holders:MetalliC
/*********************************************************************
formats/fl1_dsk.h
FloppyOne DOS disk images
*********************************************************************/
#ifndef MAME_FORMATS_FL1_DSK_H
#define MAME_FORMATS_FL1_DSK_H
#pragma once
#include "wd177x_dsk.h"
class fl1_format : public wd177x_format {
public:
fl1_format();
virtual const char *name() const override;
virtual const char *description() const override;
virtual const char *extensions() const override;
private:
static const format formats[];
virtual int get_image_offset(const format &f, int head, int track) override;
};
extern const floppy_format_type FLOPPY_FL1_FORMAT;
#endif // MAME_FORMATS_FL1_DSK_H

View File

@ -0,0 +1,59 @@
// license:BSD-3-Clause
// copyright-holders:MetalliC
/*********************************************************************
formats/sdd_dsk.c
Speccy-DOS SDD disk images
*********************************************************************/
#include <cassert>
#include "formats/sdd_dsk.h"
sdd_format::sdd_format() : wd177x_format(formats)
{
}
const char *sdd_format::name() const
{
return "sdd";
}
const char *sdd_format::description() const
{
return "SDD floppy disk image";
}
const char *sdd_format::extensions() const
{
return "sdd";
}
int sdd_format::get_image_offset(const format &f, int head, int track)
{
return (f.track_count * head + track) * compute_track_size(f);
}
const sdd_format::format sdd_format::formats[] = {
{ // 5"25 640K 80 track double sided double density
floppy_image::FF_525, floppy_image::DSQD, floppy_image::MFM,
2000, 16, 80, 2, 256, {}, -1, {1,12,7,2,13,8,3,14,9,4,15,10,5,16,11,6}, 60, 22, 24
},
{ // 5"25 400K 80 track double sided single density
floppy_image::FF_525, floppy_image::DSQD, floppy_image::FM,
4000, 10, 80, 2, 256, {}, -1, {1,8,5,2,9,6,3,10,7,4}, 40, 11, 10
},
{ // 3'5 640K 80 track double sided double density
floppy_image::FF_35, floppy_image::DSDD, floppy_image::MFM,
2000, 16, 80, 2, 256, {}, -1, {1,12,7,2,13,8,3,14,9,4,15,10,5,16,11,6}, 60, 22, 24
},
{ // 3'5 400K 80 track double sided single density
floppy_image::FF_35, floppy_image::DSDD, floppy_image::FM,
4000, 10, 80, 2, 256, {}, -1, {1,8,5,2,9,6,3,10,7,4}, 40, 11, 10
},
{}
};
const floppy_format_type FLOPPY_SDD_FORMAT = &floppy_image_format_creator<sdd_format>;

32
src/lib/formats/sdd_dsk.h Normal file
View File

@ -0,0 +1,32 @@
// license:BSD-3-Clause
// copyright-holders:MetalliC
/*********************************************************************
formats/sdd_dsk.h
Speccy-DOS SDD disk images
*********************************************************************/
#ifndef MAME_FORMATS_SDD_DSK_H
#define MAME_FORMATS_SDD_DSK_H
#pragma once
#include "wd177x_dsk.h"
class sdd_format : public wd177x_format {
public:
sdd_format();
virtual const char *name() const override;
virtual const char *description() const override;
virtual const char *extensions() const override;
private:
static const format formats[];
virtual int get_image_offset(const format &f, int head, int track) override;
};
extern const floppy_format_type FLOPPY_SDD_FORMAT;
#endif // MAME_FORMATS_SDD_DSK_H

View File

@ -179,8 +179,7 @@ uint8_t spectrum_state::spectrum_128_pre_opcode_fetch_r(offs_t offset)
void spectrum_state::spectrum_128_bank1_w(offs_t offset, uint8_t data)
{
if (m_exp->romcs())
m_exp->mreq_w(offset, data);
m_exp->mreq_w(offset, data);
}
uint8_t spectrum_state::spectrum_128_bank1_r(offs_t offset)

View File

@ -318,8 +318,7 @@ void spectrum_state::spectrum_data_w(offs_t offset, uint8_t data)
void spectrum_state::spectrum_rom_w(offs_t offset, uint8_t data)
{
if (m_exp->romcs())
m_exp->mreq_w(offset, data);
m_exp->mreq_w(offset, data);
}
uint8_t spectrum_state::spectrum_rom_r(offs_t offset)