summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2021-07-17 12:45:53 -0400
committer arbee <rb6502@users.noreply.github.com>2021-07-17 12:45:53 -0400
commit064bc3aafb167e29333def8de78386904bd2255d (patch)
treed0b57b3c49cd147d3278e15ef7941f998406e811
parentc8e377c5d21fd65897c8dab39031a21a0ed168df (diff)
apple3: Preliminary support for Microsoft SoftCard /// [Rob Justice, R. Belmont]
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/a2bus/softcard3.cpp226
-rw-r--r--src/devices/bus/a2bus/softcard3.h66
-rw-r--r--src/mame/drivers/apple3.cpp4
4 files changed, 297 insertions, 1 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 76127276113..f575c3b396d 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -2476,6 +2476,8 @@ if (BUSES["A2BUS"]~=null) then
MAME_DIR .. "src/devices/bus/a2bus/ramcard16k.h",
MAME_DIR .. "src/devices/bus/a2bus/sider.cpp",
MAME_DIR .. "src/devices/bus/a2bus/sider.h",
+ MAME_DIR .. "src/devices/bus/a2bus/softcard3.cpp",
+ MAME_DIR .. "src/devices/bus/a2bus/softcard3.h",
MAME_DIR .. "src/devices/bus/a2bus/ssbapple.cpp",
MAME_DIR .. "src/devices/bus/a2bus/ssbapple.h",
MAME_DIR .. "src/devices/bus/a2bus/ssprite.cpp",
diff --git a/src/devices/bus/a2bus/softcard3.cpp b/src/devices/bus/a2bus/softcard3.cpp
new file mode 100644
index 00000000000..fb3da1eb291
--- /dev/null
+++ b/src/devices/bus/a2bus/softcard3.cpp
@@ -0,0 +1,226 @@
+// license:BSD-3-Clause
+// copyright-holders:Rob Justice, R. Belmont
+/*********************************************************************
+
+ softcard3.cpp
+
+ Implementation of the Microsoft SoftCard /// Z-80 card
+
+ Best guess at the moment based on disassembly of the boot disk
+ and some manual checks with the real hardware
+
+*********************************************************************/
+
+#include "emu.h"
+#include "softcard3.h"
+#include "cpu/z80/z80.h"
+
+/***************************************************************************
+ PARAMETERS
+***************************************************************************/
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+DEFINE_DEVICE_TYPE(A2BUS_SOFTCARD3, a2bus_softcard3_device, "softcard3", "Microsoft SoftCard ///")
+
+void a2bus_softcard3_device::z80_mem(address_map &map)
+{
+ map(0x0000, 0xffff).rw(FUNC(a2bus_softcard3_device::dma_r), FUNC(a2bus_softcard3_device::dma_w));
+}
+
+ROM_START( softcard3 )
+ ROM_REGION(0x100, "mapping_prom", 0)
+ ROM_LOAD("softcard3.rom", 0x0000, 0x0100, CRC(9d4433b2) SHA1(aff45dd8850641b4616b61750c104e7ee45a99a4))
+ROM_END
+
+void a2bus_softcard3_device::z80_io(address_map &map)
+{
+ map(0x00, 0x00).w(FUNC(a2bus_softcard3_device::z80_io_w));
+}
+
+/***************************************************************************
+ FUNCTION PROTOTYPES
+***************************************************************************/
+
+//-------------------------------------------------
+// device_add_mconfig - add device configuration
+//-------------------------------------------------
+
+void a2bus_softcard3_device::device_add_mconfig(machine_config &config)
+{
+ Z80(config, m_z80, 1021800*2); // Z80 runs at 2M based on comment in the manual
+ m_z80->set_addrmap(AS_PROGRAM, &a2bus_softcard3_device::z80_mem);
+ m_z80->set_addrmap(AS_IO, &a2bus_softcard3_device::z80_io);
+ TIMER(config, "timer").configure_generic(FUNC(a2bus_softcard3_device::timercallback));
+}
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+a2bus_softcard3_device::a2bus_softcard3_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_a2bus_card_interface(mconfig, *this),
+ m_z80(*this, "z80"),
+ m_prom(*this, "mapping_prom"),
+ m_timer(*this, "timer"),
+ m_bEnabled(false),
+ m_reset(false),
+ m_enable_fffx(false)
+{
+}
+
+a2bus_softcard3_device::a2bus_softcard3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ a2bus_softcard3_device(mconfig, A2BUS_SOFTCARD3, tag, owner, clock)
+{
+}
+
+const tiny_rom_entry *a2bus_softcard3_device::device_rom_region() const
+{
+ return ROM_NAME(softcard3);
+}
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void a2bus_softcard3_device::device_start()
+{
+ save_item(NAME(m_bEnabled));
+ save_item(NAME(m_reset));
+ save_item(NAME(m_enable_fffx));
+}
+
+void a2bus_softcard3_device::device_reset()
+{
+ m_bEnabled = false;
+ m_reset = false;
+ m_enable_fffx = false;
+ m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
+ m_timer->adjust(attotime::never);
+}
+
+uint8_t a2bus_softcard3_device::read_c0nx(uint8_t offset)
+{
+ return 0x50; //software is looking for 0x50, needs to be checked if this can return other flags
+}
+
+void a2bus_softcard3_device::write_c0nx(uint8_t offset, uint8_t data)
+{
+ switch (data)
+ {
+ case 0x01: // reset
+ m_reset = true; // flag we need a reset when we enable the Z80
+ break;
+
+ case 0x10: // enable the card fffc & fffd memory mapped address to appear
+ m_enable_fffx = true;
+ break;
+
+ default:
+ //printf("Softcard3: %02x to unhandled c0n%x\n", data, offset);
+ break;
+ }
+}
+
+// read to fffc halts 6502 and enables z80
+uint8_t a2bus_softcard3_device::read_inh_rom(uint16_t offset)
+{
+ if (offset == 0xfffc)
+ {
+ m_bEnabled = true;
+ raise_slot_dma();
+ m_z80->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
+ if (m_reset)
+ {
+ m_z80->reset();
+ }
+ m_timer->adjust(attotime::from_hz(5.0)); //start supervision timer
+ //printf("timer start\n");
+ }
+
+ if (offset == 0xfffd)
+ {
+ m_timer->adjust(attotime::never); //disable supervision timer
+ //printf("disable timer\n");
+ }
+
+ return 0xff;
+}
+
+// returns if we want to /INH a read or write to a specific address
+bool a2bus_softcard3_device::inh_check(u16 offset, bool bIsWrite)
+{
+ if (!m_enable_fffx)
+ {
+ return false;
+ }
+
+ if (!(bIsWrite) && (offset == 0xfffc)) //only a read to fffc is mapped in
+ {
+ return true;
+ }
+
+ if (!(bIsWrite) && (offset == 0xfffd)) //only a read to fffd is mapped in
+ {
+ return true;
+ }
+
+ return false;
+}
+
+// this io write halts the z80 and returns to the 6502
+void a2bus_softcard3_device::z80_io_w(offs_t offset, uint8_t data)
+{
+ m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
+ lower_slot_dma();
+ m_bEnabled = false;
+ m_enable_fffx = false;
+ m_reset = false;
+ m_timer->adjust(attotime::never);
+ //printf("z80 io timer stop\n");
+}
+
+// fires if Z80 has not handed back to the 6502 in this timer period
+// this ensures 6502 can run and service console i/o
+// actual time to be checked on real hw
+TIMER_DEVICE_CALLBACK_MEMBER(a2bus_softcard3_device::timercallback)
+{
+ m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
+ lower_slot_dma();
+ m_bEnabled = false;
+ m_enable_fffx = false;
+ m_reset = false;
+ //printf("timer callback stop\n");
+}
+
+//memory mapping based on a dump of the mapping rom 256x8
+//maps the top 8 address lines
+uint8_t a2bus_softcard3_device::dma_r(offs_t offset)
+{
+ if (m_bEnabled)
+ {
+ return slot_dma_read((offset & 0xff) + (m_prom[offset >> 8] << 8));
+ }
+
+ return 0xff;
+}
+
+//-------------------------------------------------
+// dma_w -
+//-------------------------------------------------
+
+void a2bus_softcard3_device::dma_w(offs_t offset, uint8_t data)
+{
+ if (m_bEnabled)
+ {
+ slot_dma_write((offset & 0xff) + (m_prom[offset >> 8] << 8), data);
+ }
+}
+
+bool a2bus_softcard3_device::take_c800()
+{
+ return false;
+}
diff --git a/src/devices/bus/a2bus/softcard3.h b/src/devices/bus/a2bus/softcard3.h
new file mode 100644
index 00000000000..a048c9e754d
--- /dev/null
+++ b/src/devices/bus/a2bus/softcard3.h
@@ -0,0 +1,66 @@
+// license:BSD-3-Clause
+// copyright-holders:Rob Justice, R. Belmont
+/*********************************************************************
+
+ softcard3.h
+
+ Implementation of the Microsoft SoftCard /// Z-80 card
+
+*********************************************************************/
+
+#ifndef MAME_BUS_A2BUS_SOFTCARD3_H
+#define MAME_BUS_A2BUS_SOFTCARD3_H
+
+#include "a2bus.h"
+#include "machine/timer.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class a2bus_softcard3_device:
+ public device_t,
+ public device_a2bus_card_interface
+{
+public:
+
+ // construction/destruction
+ a2bus_softcard3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ void z80_io_w(offs_t offset, uint8_t data);
+
+protected:
+ a2bus_softcard3_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void device_add_mconfig(machine_config &config) override;
+ virtual const tiny_rom_entry *device_rom_region() const override;
+
+ // overrides of standard a2bus slot functions
+ virtual uint8_t read_c0nx(uint8_t offset) override;
+ virtual void write_c0nx(uint8_t offset, uint8_t data) override;
+ virtual bool take_c800() override;
+ virtual u8 read_inh_rom(u16 offset) override;
+ virtual bool inh_check(uint16_t offset, bool bIsWrite) override;
+ TIMER_DEVICE_CALLBACK_MEMBER(timercallback);
+
+private:
+ required_device<cpu_device> m_z80;
+ required_region_ptr<u8> m_prom;
+ required_device<timer_device> m_timer;
+ bool m_bEnabled;
+ bool m_reset;
+ bool m_enable_fffx;
+
+ uint8_t dma_r(offs_t offset);
+ void dma_w(offs_t offset, uint8_t data);
+
+ void z80_io(address_map &map);
+ void z80_mem(address_map &map);
+};
+
+// device type definition
+DECLARE_DEVICE_TYPE(A2BUS_SOFTCARD3, a2bus_softcard3_device)
+
+#endif // MAME_BUS_A2BUS_SOFTCARD3_H
diff --git a/src/mame/drivers/apple3.cpp b/src/mame/drivers/apple3.cpp
index 32262a419a8..e462569d25e 100644
--- a/src/mame/drivers/apple3.cpp
+++ b/src/mame/drivers/apple3.cpp
@@ -28,6 +28,7 @@
#include "bus/a2bus/cmsscsi.h"
#include "bus/a2bus/titan3plus2.h"
#include "bus/a2bus/a2mockingboard.h"
+#include "bus/a2bus/softcard3.h"
#include "bus/rs232/rs232.h"
@@ -50,7 +51,8 @@ static void apple3_cards(device_slot_interface &device)
device.option_add("focusdrive", A2BUS_FOCUSDRIVE); // Focus Drive IDE card
device.option_add("cmsscsi", A2BUS_CMSSCSI); // CMS Apple II SCSI Card
device.option_add("titan3plus2", A2BUS_TITAN3PLUS2); // Titan /// Plus 2 card
- device.option_add("mockingboard", A2BUS_MOCKINGBOARD);
+ device.option_add("mockingboard", A2BUS_MOCKINGBOARD); // Sweet Micro Systems Mockingboard (experimental on ///)
+ device.option_add("softcard3", A2BUS_SOFTCARD3); // Microsoft SoftCard ///
}
static void a3_floppies(device_slot_interface &device)