summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2019-05-13 20:49:29 +0300
committer Curt Coder <curtcoder@mail.com>2019-05-13 20:49:35 +0300
commite25255a525b138ae99c64ea20e19c1142ea6b32e (patch)
treed368261304aa41f00e652828a170589d71131985
parent582b9e279f2314b2c247290b23a6fb4c640576b6 (diff)
c64: Added skeleton for BusCard II cartridge. [Curt Coder]
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/c64/buscard2.cpp215
-rw-r--r--src/devices/bus/c64/buscard2.h72
-rw-r--r--src/devices/bus/c64/exp.cpp2
4 files changed, 291 insertions, 0 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 5933424f421..feacff29ab2 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -485,6 +485,8 @@ if (BUSES["C64"]~=null) then
MAME_DIR .. "src/devices/bus/c64/exp.h",
MAME_DIR .. "src/devices/bus/c64/buscard.cpp",
MAME_DIR .. "src/devices/bus/c64/buscard.h",
+ MAME_DIR .. "src/devices/bus/c64/buscard2.cpp",
+ MAME_DIR .. "src/devices/bus/c64/buscard2.h",
MAME_DIR .. "src/devices/bus/c64/c128_comal80.cpp",
MAME_DIR .. "src/devices/bus/c64/c128_comal80.h",
MAME_DIR .. "src/devices/bus/c64/c128_partner.cpp",
diff --git a/src/devices/bus/c64/buscard2.cpp b/src/devices/bus/c64/buscard2.cpp
new file mode 100644
index 00000000000..6b14dab78c5
--- /dev/null
+++ b/src/devices/bus/c64/buscard2.cpp
@@ -0,0 +1,215 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ Batteries Included BusCard II cartridge emulation
+
+ SYS 61000 -> Enable BASIC 4.0
+ SYS 61003 -> Disable BASIC 4.0
+ SYS 61006 -> Enter Machine Language Monitor
+
+**********************************************************************/
+
+#include "emu.h"
+#include "buscard2.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define R6532_TAG "riot"
+#define MC6821_TAG "pia"
+#define CENTRONICS_TAG "centronics"
+#define EXPANSION_TAG "exp"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+DEFINE_DEVICE_TYPE(C64_BUSCARD2, buscard2_t, "c64_buscard2", "C64 BusCard II cartridge")
+
+
+//-------------------------------------------------
+// ROM( buscard2 )
+//-------------------------------------------------
+
+ROM_START( buscard2 ) // dumps coming soon
+ ROM_REGION( 0x2000, "rom", 0 )
+ ROM_LOAD( "2764.bin", 0x0000, 0x2000, NO_DUMP )
+
+ ROM_REGION( 0x200, "prom", 0 )
+ ROM_LOAD( "82s129.1", 0x000, 0x100, NO_DUMP )
+ ROM_LOAD( "82s129.2", 0x100, 0x100, NO_DUMP )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const tiny_rom_entry *buscard2_t::device_rom_region() const
+{
+ return ROM_NAME( buscard2 );
+}
+
+
+//-------------------------------------------------
+// INPUT_PORTS( buscard2 )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( buscard2 )
+ PORT_START("S1")
+ PORT_DIPNAME( 0x03, 0x00, "Device #4" ) PORT_DIPLOCATION("S1:1,2")
+ PORT_DIPSETTING( 0x00, "Serial" )
+ PORT_DIPSETTING( 0x01, "Parallel w/conv." )
+ PORT_DIPSETTING( 0x02, "IEEE" )
+ PORT_DIPSETTING( 0x03, "Parallel" )
+ PORT_DIPNAME( 0x04, 0x04, "Device #5" ) PORT_DIPLOCATION("S1:3")
+ PORT_DIPSETTING( 0x00, "IEEE" )
+ PORT_DIPSETTING( 0x04, "Serial" )
+ PORT_DIPNAME( 0x08, 0x08, "Device #6" ) PORT_DIPLOCATION("S1:4")
+ PORT_DIPSETTING( 0x00, "IEEE" )
+ PORT_DIPSETTING( 0x08, "Serial" )
+ PORT_DIPNAME( 0x10, 0x10, "Device #7" ) PORT_DIPLOCATION("S1:5")
+ PORT_DIPSETTING( 0x00, "IEEE" )
+ PORT_DIPSETTING( 0x10, "Serial" )
+ PORT_DIPNAME( 0x20, 0x20, "Device #8" ) PORT_DIPLOCATION("S1:6")
+ PORT_DIPSETTING( 0x00, "IEEE" )
+ PORT_DIPSETTING( 0x20, "Serial" )
+ PORT_DIPNAME( 0x40, 0x40, "Device #9" ) PORT_DIPLOCATION("S1:7")
+ PORT_DIPSETTING( 0x00, "IEEE" )
+ PORT_DIPSETTING( 0x40, "Serial" )
+ PORT_DIPNAME( 0x80, 0x80, "Device #10" ) PORT_DIPLOCATION("S1:8")
+ PORT_DIPSETTING( 0x00, "IEEE" )
+ PORT_DIPSETTING( 0x80, "Serial" )
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor buscard2_t::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( buscard2 );
+}
+
+
+//-------------------------------------------------
+// Centronics interface
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( buscard2_t::busy_w )
+{
+ m_busy = state;
+}
+
+
+//-------------------------------------------------
+// device_add_mconfig - add device configuration
+//-------------------------------------------------
+
+void buscard2_t::device_add_mconfig(machine_config &config)
+{
+ RIOT6532(config, m_riot, 0);
+
+ PIA6821(config, m_pia, 0);
+
+ IEEE488(config, m_bus, 0);
+ ieee488_slot_device::add_cbm_defaults(config, nullptr);
+
+ CENTRONICS(config, m_centronics, centronics_devices, nullptr);
+ m_centronics->busy_handler().set(FUNC(buscard2_t::busy_w));
+
+ C64_EXPANSION_SLOT(config, m_exp, DERIVED_CLOCK(1, 1), c64_expansion_cards, nullptr);
+ m_exp->set_passthrough();
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// buscard2_t - constructor
+//-------------------------------------------------
+
+buscard2_t::buscard2_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, C64_BUSCARD2, tag, owner, clock),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_riot(*this, R6532_TAG),
+ m_pia(*this, MC6821_TAG),
+ m_bus(*this, IEEE488_TAG),
+ m_centronics(*this, CENTRONICS_TAG),
+ m_exp(*this, EXPANSION_TAG),
+ m_s1(*this, "S1"),
+ m_rom(*this, "rom"),
+ m_prom(*this, "prom"),
+ m_busy(1)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void buscard2_t::device_start()
+{
+ // state saving
+ save_item(NAME(m_busy));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void buscard2_t::device_reset()
+{
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+uint8_t buscard2_t::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ return m_exp->cd_r(offset, data, sphi2, ba, roml, romh, io1, io2);
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void buscard2_t::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ m_exp->cd_w(offset, data, sphi2, ba, roml, romh, io1, io2);
+}
+
+
+//-------------------------------------------------
+// c64_game_r - cartridge GAME read
+//-------------------------------------------------
+
+int buscard2_t::c64_game_r(offs_t offset, int sphi2, int ba, int rw)
+{
+ return m_exp->game_r(offset, sphi2, ba, rw, m_slot->loram(), m_slot->hiram());
+}
+
+
+//-------------------------------------------------
+// c64_exrom_r - cartridge EXROM read
+//-------------------------------------------------
+
+int buscard2_t::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw)
+{
+ return m_exp->exrom_r(offset, sphi2, ba, rw, m_slot->loram(), m_slot->hiram());
+}
diff --git a/src/devices/bus/c64/buscard2.h b/src/devices/bus/c64/buscard2.h
new file mode 100644
index 00000000000..732fc299191
--- /dev/null
+++ b/src/devices/bus/c64/buscard2.h
@@ -0,0 +1,72 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ Batteries Included BusCard II cartridge emulation
+
+**********************************************************************/
+
+#ifndef MAME_BUS_C64_BUSCARD2_H
+#define MAME_BUS_C64_BUSCARD2_H
+
+#pragma once
+
+
+#include "bus/c64/exp.h"
+#include "bus/centronics/ctronics.h"
+#include "bus/ieee488/ieee488.h"
+#include "machine/6532riot.h"
+#include "machine/6821pia.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> buscard2_t
+
+class buscard2_t : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ buscard2_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ // optional information overrides
+ virtual const tiny_rom_entry *device_rom_region() const override;
+ virtual void device_add_mconfig(machine_config &config) override;
+ virtual ioport_constructor device_input_ports() const override;
+
+ // device_c64_expansion_card_interface overrides
+ virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
+ virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override;
+
+private:
+ required_device<riot6532_device> m_riot;
+ required_device<pia6821_device> m_pia;
+ required_device<ieee488_device> m_bus;
+ required_device<centronics_device> m_centronics;
+ required_device<c64_expansion_slot_device> m_exp;
+ required_ioport m_s1;
+ required_memory_region m_rom;
+ required_memory_region m_prom;
+
+ bool m_busy;
+
+ DECLARE_WRITE_LINE_MEMBER( busy_w );
+};
+
+
+// device type definition
+DECLARE_DEVICE_TYPE(C64_BUSCARD2, buscard2_t)
+
+
+#endif // MAME_BUS_C64_BUSCARD_H
diff --git a/src/devices/bus/c64/exp.cpp b/src/devices/bus/c64/exp.cpp
index 46d9890f5bf..2a996728adf 100644
--- a/src/devices/bus/c64/exp.cpp
+++ b/src/devices/bus/c64/exp.cpp
@@ -309,6 +309,7 @@ void c64_expansion_slot_device::set_passthrough()
// slot devices
#include "16kb.h"
#include "buscard.h"
+#include "buscard2.h"
#include "c128_comal80.h"
#include "c128_partner.h"
#include "comal80.h"
@@ -399,6 +400,7 @@ void c64_expansion_cards(device_slot_interface &device)
device.option_add("swiftlink", C64_SWIFTLINK);
device.option_add("turbo232", C64_TURBO232);
device.option_add("buscard", C64_BUSCARD);
+ device.option_add("buscard2", C64_BUSCARD2);
// the following need ROMs from the software list
device.option_add_internal("standard", C64_STD);