From bd7cbf196c21c4164f182585cca87bab4b853004 Mon Sep 17 00:00:00 2001 From: arbee Date: Fri, 3 Nov 2017 21:50:59 -0400 Subject: apple2: preliminary support for AE TransWarp accelerator card [R. Belmont, Apple II Documentation Project] --- scripts/src/bus.lua | 2 + src/devices/bus/a2bus/transwarp.cpp | 256 ++++++++++++++++++++++++++++++++++++ src/devices/bus/a2bus/transwarp.h | 61 +++++++++ src/mame/drivers/apple2e.cpp | 2 + 4 files changed, 321 insertions(+) create mode 100644 src/devices/bus/a2bus/transwarp.cpp create mode 100644 src/devices/bus/a2bus/transwarp.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index bebcde91fae..916b4e6f76c 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -1762,6 +1762,8 @@ if (BUSES["A2BUS"]~=null) then MAME_DIR .. "src/devices/bus/a2bus/ssprite.h", MAME_DIR .. "src/devices/bus/a2bus/ssbapple.cpp", MAME_DIR .. "src/devices/bus/a2bus/ssbapple.h", + MAME_DIR .. "src/devices/bus/a2bus/transwarp.cpp", + MAME_DIR .. "src/devices/bus/a2bus/transwarp.h", } end diff --git a/src/devices/bus/a2bus/transwarp.cpp b/src/devices/bus/a2bus/transwarp.cpp new file mode 100644 index 00000000000..ddb12d8ec07 --- /dev/null +++ b/src/devices/bus/a2bus/transwarp.cpp @@ -0,0 +1,256 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + transwarp.cpp + + Implementation of the Applied Engineering TransWarp accelerator + + TODO: + - needs built-in language card, it's advertised to work w/o one. + - C074 speed control + - Doesn't work with Swyft but advertised to; how does h/w get + around the Fxxx ROM not checksumming right? + +*********************************************************************/ + +#include "emu.h" +#include "transwarp.h" +#include "cpu/m6502/m6502.h" +#include "cpu/m6502/m65c02.h" + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(A2BUS_TRANSWARP, a2bus_transwarp_device, "a2twarp", "Applied Engineering TransWarp") + +#define CPU_TAG "tw65c02" + +static ADDRESS_MAP_START( m65c02_mem, AS_PROGRAM, 8, a2bus_transwarp_device ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(dma_r, dma_w) +ADDRESS_MAP_END + +ROM_START( warprom ) + ROM_REGION(0x1000, "twrom", 0) + ROM_LOAD( "ae transwarp rom v1.4.bin", 0x000000, 0x001000, CRC(afe37f55) SHA1(7b75534e7895e04859a0b1337801c6eeb0cef52a) ) +ROM_END + +static INPUT_PORTS_START( warp ) + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x01, "Slot 1" ) + PORT_DIPSETTING( 0x00, "Language Card" ) + PORT_DIPSETTING( 0x01, "Non-LC" ) + PORT_DIPNAME( 0x02, 0x02, "Slot 2" ) + PORT_DIPSETTING( 0x00, "Language Card" ) + PORT_DIPSETTING( 0x02, "Non-LC" ) + PORT_DIPNAME( 0x04, 0x04, "Slot 3" ) + PORT_DIPSETTING( 0x00, "Language Card" ) + PORT_DIPSETTING( 0x04, "Non-LC" ) + PORT_DIPNAME( 0x08, 0x08, "Slot 4" ) + PORT_DIPSETTING( 0x00, "Language Card" ) + PORT_DIPSETTING( 0x08, "Non-LC" ) + PORT_DIPNAME( 0x10, 0x10, "Slot 5" ) + PORT_DIPSETTING( 0x00, "Language Card" ) + PORT_DIPSETTING( 0x10, "Non-LC" ) + PORT_DIPNAME( 0x20, 0x20, "Slot 6" ) + PORT_DIPSETTING( 0x00, "Language Card" ) + PORT_DIPSETTING( 0x20, "Non-LC" ) + PORT_DIPNAME( 0x40, 0x40, "Slot 7" ) + PORT_DIPSETTING( 0x00, "Language Card" ) + PORT_DIPSETTING( 0x40, "Non-LC" ) + PORT_DIPNAME( 0x80, 0x00, "Speed" ) + PORT_DIPSETTING( 0x00, "Full acceleration" ) + PORT_DIPSETTING( 0x80, "Half acceleration" ) + + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x01, "Slot 1" ) + PORT_DIPSETTING( 0x00, "Stock speed" ) + PORT_DIPSETTING( 0x01, "Accelerated" ) + PORT_DIPNAME( 0x02, 0x02, "Slot 2" ) + PORT_DIPSETTING( 0x00, "Stock speed" ) + PORT_DIPSETTING( 0x02, "Accelerated" ) + PORT_DIPNAME( 0x04, 0x04, "Slot 3" ) + PORT_DIPSETTING( 0x00, "Stock speed" ) + PORT_DIPSETTING( 0x04, "Accelerated" ) + PORT_DIPNAME( 0x08, 0x08, "Slot 4" ) + PORT_DIPSETTING( 0x00, "Stock speed" ) + PORT_DIPSETTING( 0x08, "Accelerated" ) + PORT_DIPNAME( 0x10, 0x10, "Slot 5" ) + PORT_DIPSETTING( 0x00, "Stock speed" ) + PORT_DIPSETTING( 0x10, "Accelerated" ) + PORT_DIPNAME( 0x20, 0x00, "Slot 6" ) + PORT_DIPSETTING( 0x00, "Stock speed" ) + PORT_DIPSETTING( 0x20, "Accelerated" ) + PORT_DIPNAME( 0x40, 0x40, "Slot 7" ) + PORT_DIPSETTING( 0x00, "Stock speed" ) + PORT_DIPSETTING( 0x40, "Accelerated" ) + PORT_DIPNAME( 0x80, 0x00, "Transwarp Enable" ) + PORT_DIPSETTING( 0x00, "Acceleration enabled" ) + PORT_DIPSETTING( 0x80, "Acceleration disabled" ) +INPUT_PORTS_END + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +/*------------------------------------------------- + rom_region - device-specific ROM region +-------------------------------------------------*/ + +const tiny_rom_entry *a2bus_transwarp_device::device_rom_region() const +{ + return ROM_NAME(warprom); +} + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor a2bus_transwarp_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( warp ); +} + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_MEMBER( a2bus_transwarp_device::device_add_mconfig ) + MCFG_CPU_ADD(CPU_TAG, M65C02, XTAL_14_31818MHz/4) + MCFG_CPU_PROGRAM_MAP(m65c02_mem) +MACHINE_CONFIG_END + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +a2bus_transwarp_device::a2bus_transwarp_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_bEnabled(false), + m_ourcpu(*this, CPU_TAG), + m_rom(*this, "twrom"), + m_dsw1(*this, "DSW1"), + m_dsw2(*this, "DSW2") +{ +} + +a2bus_transwarp_device::a2bus_transwarp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + a2bus_transwarp_device(mconfig, A2BUS_TRANSWARP, tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void a2bus_transwarp_device::device_start() +{ + // set_a2bus_device makes m_slot valid + set_a2bus_device(); + + m_timer = timer_alloc(0); + + save_item(NAME(m_bEnabled)); +} + +void a2bus_transwarp_device::device_reset() +{ + m_bEnabled = true; + m_bReadA2ROM = false; + set_maincpu_halt(ASSERT_LINE); + + if (!(m_dsw2->read() & 0x80)) + { + if (m_dsw1->read() & 0x80) + { + m_ourcpu->set_unscaled_clock(XTAL_14_31818MHz/8); + } + else + { + m_ourcpu->set_unscaled_clock(XTAL_14_31818MHz/4); + } + } + else + { + m_ourcpu->set_unscaled_clock(1021800); + } +} + +void a2bus_transwarp_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (!(m_dsw2->read() & 0x80)) + { + if (m_dsw1->read() & 0x80) + { + m_ourcpu->set_unscaled_clock(XTAL_14_31818MHz/8); + } + else + { + m_ourcpu->set_unscaled_clock(XTAL_14_31818MHz/4); + } + } + m_timer->adjust(attotime::never); +} + +READ8_MEMBER( a2bus_transwarp_device::dma_r ) +{ + if ((offset >= 0xc090) && (offset <= 0xc0ff)) + { + hit_slot(((offset >> 4) & 0xf) - 8); + } + + if ((offset >= 0xf000) && (!m_bReadA2ROM)) + { + return m_rom[offset & 0xfff]; + } + + return slot_dma_read(space, offset); +} + + +//------------------------------------------------- +// dma_w - +//------------------------------------------------- + +WRITE8_MEMBER( a2bus_transwarp_device::dma_w ) +{ + //if ((offset >= 0xc070) && (offset <= 0xc07f)) printf("%02x to %04x\n", data, offset); + + if (offset == 0xc072) + { + m_bReadA2ROM = true; + } + + if ((offset >= 0xc090) && (offset <= 0xc0ff)) + { + hit_slot(((offset >> 4) & 0xf) - 8); + } + + slot_dma_write(space, offset, data); +} + +bool a2bus_transwarp_device::take_c800() +{ + return false; +} + +void a2bus_transwarp_device::hit_slot(int slot) +{ + // only do slot slowdown if acceleration is enabled + if (!(m_dsw2->read() & 0x80)) + { + // accleration's on, check the specific slot + if (m_dsw2->read() & (1<<(slot-1))) + { + m_ourcpu->set_unscaled_clock(1021800); + // slow down for around 20 cycles, should be more than enough + m_timer->adjust(attotime::from_usec(20)); + } + } +} \ No newline at end of file diff --git a/src/devices/bus/a2bus/transwarp.h b/src/devices/bus/a2bus/transwarp.h new file mode 100644 index 00000000000..7d69f1f050a --- /dev/null +++ b/src/devices/bus/a2bus/transwarp.h @@ -0,0 +1,61 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + transwarp.h + + Implementation of the Applied Engineering TransWarp accelerator + +*********************************************************************/ + +#ifndef MAME_BUS_A2BUS_A2TRANSWARP_H +#define MAME_BUS_A2BUS_A2TRANSWARP_H + +#include "a2bus.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class a2bus_transwarp_device: + public device_t, + public device_a2bus_card_interface +{ +public: + // construction/destruction + a2bus_transwarp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + virtual const tiny_rom_entry *device_rom_region() const override; + + DECLARE_READ8_MEMBER( dma_r ); + DECLARE_WRITE8_MEMBER( dma_w ); + +protected: + a2bus_transwarp_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + // overrides of device_t functions + virtual void device_start() override; + virtual void device_reset() override; + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + + // overrides of standard a2bus slot functions + virtual bool take_c800() override; + +private: + bool m_bEnabled; + bool m_bReadA2ROM; + emu_timer *m_timer; + + required_device m_ourcpu; + required_region_ptr m_rom; + required_ioport m_dsw1, m_dsw2; + + void hit_slot(int slot); +}; + +// device type definition +DECLARE_DEVICE_TYPE(A2BUS_TRANSWARP, a2bus_transwarp_device) + +#endif // MAME_BUS_A2BUS_TRANSWARP_H diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index 4bc11785de1..8b61d7c97a9 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -149,6 +149,7 @@ Address bus A0-A11 is Y0-Y11 #include "bus/a2bus/a2eramworks3.h" #include "bus/a2bus/ssprite.h" #include "bus/a2bus/ssbapple.h" +#include "bus/a2bus/transwarp.h" #include "bus/rs232/rs232.h" @@ -3745,6 +3746,7 @@ static SLOT_INTERFACE_START(apple2_cards) SLOT_INTERFACE("pcxport", A2BUS_PCXPORTER) /* Applied Engineering PC Transporter */ SLOT_INTERFACE("ssprite", A2BUS_SSPRITE) /* Synetix SuperSprite Board */ SLOT_INTERFACE("ssbapple", A2BUS_SSBAPPLE) /* SSB Apple speech board */ + SLOT_INTERFACE("twarp", A2BUS_TRANSWARP) /* AE TransWarp accelerator */ SLOT_INTERFACE_END static SLOT_INTERFACE_START(apple2eaux_cards) -- cgit v1.2.3