From 8050b0c4665e883a090077ff736a2e2b86a476c1 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Sun, 5 May 2019 15:53:36 +0300 Subject: c64: Added skeleton for BusCard cartridge. [Curt Coder] --- scripts/src/bus.lua | 2 + src/devices/bus/c64/buscard.cpp | 174 ++++++++++++++++++++++++++++++++++++++++ src/devices/bus/c64/buscard.h | 63 +++++++++++++++ src/devices/bus/c64/exp.cpp | 2 + 4 files changed, 241 insertions(+) create mode 100644 src/devices/bus/c64/buscard.cpp create mode 100644 src/devices/bus/c64/buscard.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index f13d8c0b6cb..c10d46044e6 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -475,6 +475,8 @@ if (BUSES["C64"]~=null) then files { MAME_DIR .. "src/devices/bus/c64/exp.cpp", 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/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/buscard.cpp b/src/devices/bus/c64/buscard.cpp new file mode 100644 index 00000000000..68e15cb41f5 --- /dev/null +++ b/src/devices/bus/c64/buscard.cpp @@ -0,0 +1,174 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Batteries Included BusCard cartridge emulation + + Enable BASIC 4.0 with SYS 61000 + Disable BASIC 4.0 with SYS 61003 + +**********************************************************************/ + +#include "emu.h" +#include "buscard.h" + + + +//************************************************************************** +// MACROS/CONSTANTS +//************************************************************************** + +#define I8255_TAG "i8255" +#define CENTRONICS_TAG "centronics" +#define EXPANSION_TAG "exp" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(C64_BUSCARD, buscard_t, "c64_buscard", "C64 BusCard cartridge") + + +//------------------------------------------------- +// ROM( buscard ) +//------------------------------------------------- + +ROM_START( buscard ) + ROM_REGION( 0x2000, "rom", 0 ) + ROM_LOAD( "buscardv0.9-tms2564.bin", 0x0000, 0x2000, CRC(175e8c96) SHA1(8fb4ba7e3d0b58dc01b66ef962955596f1b125b5) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const tiny_rom_entry *buscard_t::device_rom_region() const +{ + return ROM_NAME( buscard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( buscard ) +//------------------------------------------------- + +static INPUT_PORTS_START( buscard ) + PORT_START("SW") + PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW:1" ) + PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW:2" ) + PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW:3" ) + PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW:4" ) + PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW:5" ) + PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW:6" ) + PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW:7" ) + PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW:8" ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor buscard_t::device_input_ports() const +{ + return INPUT_PORTS_NAME( buscard ); +} + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void buscard_t::device_add_mconfig(machine_config &config) +{ + I8255A(config, m_ppi, 0); + + IEEE488(config, m_bus, 0); + ieee488_slot_device::add_cbm_defaults(config, nullptr); + + CENTRONICS(config, m_centronics, centronics_devices, nullptr); + + C64_EXPANSION_SLOT(config, m_exp, DERIVED_CLOCK(1, 1), c64_expansion_cards, nullptr); + m_exp->set_passthrough(); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// buscard_t - constructor +//------------------------------------------------- + +buscard_t::buscard_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, C64_BUSCARD, tag, owner, clock), + device_c64_expansion_card_interface(mconfig, *this), + m_ppi(*this, I8255_TAG), + m_bus(*this, IEEE488_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_exp(*this, EXPANSION_TAG) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void buscard_t::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void buscard_t::device_reset() +{ +} + + +//------------------------------------------------- +// c64_cd_r - cartridge data read +//------------------------------------------------- + +uint8_t buscard_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 buscard_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 buscard_t::c64_game_r(offs_t offset, int sphi2, int ba, int rw) +{ + return m_exp->game_r(offset, sphi2, ba, rw, m_slot->hiram()); +} + + +//------------------------------------------------- +// c64_exrom_r - cartridge EXROM read +//------------------------------------------------- + +int buscard_t::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) +{ + return m_exp->exrom_r(offset, sphi2, ba, rw, m_slot->hiram()); +} diff --git a/src/devices/bus/c64/buscard.h b/src/devices/bus/c64/buscard.h new file mode 100644 index 00000000000..07bf0a7310a --- /dev/null +++ b/src/devices/bus/c64/buscard.h @@ -0,0 +1,63 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Batteries Included BusCard cartridge emulation + +**********************************************************************/ + +#ifndef MAME_BUS_C64_BUSCARD_H +#define MAME_BUS_C64_BUSCARD_H + +#pragma once + + +#include "bus/c64/exp.h" +#include "bus/centronics/ctronics.h" +#include "bus/ieee488/ieee488.h" +#include "machine/i8255.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> buscard_t + +class buscard_t : public device_t, + public device_c64_expansion_card_interface +{ +public: + // construction/destruction + buscard_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 m_ppi; + required_device m_bus; + required_device m_centronics; + required_device m_exp; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(C64_BUSCARD, buscard_t) + + +#endif // MAME_BUS_C64_BUSCARD_H diff --git a/src/devices/bus/c64/exp.cpp b/src/devices/bus/c64/exp.cpp index 2d4743fe7c4..7f9f5f10993 100644 --- a/src/devices/bus/c64/exp.cpp +++ b/src/devices/bus/c64/exp.cpp @@ -304,6 +304,7 @@ void c64_expansion_slot_device::set_passthrough() // slot devices #include "16kb.h" +#include "buscard.h" #include "c128_comal80.h" #include "c128_partner.h" #include "comal80.h" @@ -393,6 +394,7 @@ void c64_expansion_cards(device_slot_interface &device) device.option_add("supercpu", C64_SUPERCPU); device.option_add("swiftlink", C64_SWIFTLINK); device.option_add("turbo232", C64_TURBO232); + device.option_add("buscard", C64_BUSCARD); // the following need ROMs from the software list device.option_add_internal("standard", C64_STD); -- cgit v1.2.3