From 702067b866ed77d382a3986fba5efc0aacae31aa Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Thu, 3 Jan 2013 16:25:31 +0000 Subject: [PATCH] (MESS) c64: Cartridge WIP. (nw) --- .gitattributes | 2 + hash/c64_cart.xml | 2 - src/mess/machine/c64_supercpu.c | 361 ++++++++++++++++++++++++++++++++ src/mess/machine/c64_supercpu.h | 75 +++++++ src/mess/machine/c64_tdos.c | 19 -- src/mess/machine/c64_tdos.h | 2 - src/mess/machine/cbmipt.c | 1 + src/mess/machine/cbmipt.h | 1 + src/mess/mess.mak | 1 + 9 files changed, 441 insertions(+), 23 deletions(-) create mode 100644 src/mess/machine/c64_supercpu.c create mode 100644 src/mess/machine/c64_supercpu.h diff --git a/.gitattributes b/.gitattributes index 77aa40a250e..e2cbcfa47e7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6877,6 +6877,8 @@ src/mess/machine/c64_super_explode.c svneol=native#text/plain src/mess/machine/c64_super_explode.h svneol=native#text/plain src/mess/machine/c64_super_games.c svneol=native#text/plain src/mess/machine/c64_super_games.h svneol=native#text/plain +src/mess/machine/c64_supercpu.c svneol=native#text/plain +src/mess/machine/c64_supercpu.h svneol=native#text/plain src/mess/machine/c64_sw8k.c svneol=native#text/plain src/mess/machine/c64_sw8k.h svneol=native#text/plain src/mess/machine/c64_system3.c svneol=native#text/plain diff --git a/hash/c64_cart.xml b/hash/c64_cart.xml index 479163190dd..2b95f78c4b8 100644 --- a/hash/c64_cart.xml +++ b/hash/c64_cart.xml @@ -10,7 +10,6 @@ - Flash 8 (65816 @ 8 MHz, 4/8 MB RAM) - CMD SuperCPU 64 (65C816S, 64 KB RAM) - Data 20 Z-80 Video Pak (Z80, 80 column video) - - Commodore CP/M (Z80) Serial I/O: - CMD SwiftLink (6551 @ 3.6864 MHz) @@ -23,7 +22,6 @@ - Commodore REU 1700/1750/1764 - Rex RAM-Floppt 256K - Rex Goliath 1MB - - NeoRAM - RAM-Cart Hard disks: diff --git a/src/mess/machine/c64_supercpu.c b/src/mess/machine/c64_supercpu.c new file mode 100644 index 00000000000..82d29cba1ab --- /dev/null +++ b/src/mess/machine/c64_supercpu.c @@ -0,0 +1,361 @@ +/********************************************************************** + + CMD SuperCPU v2 + SuperRAM emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#include "c64_supercpu.h" + + + +//************************************************************************** +// MACROS/CONSTANTS +//************************************************************************** + +#define G65816_TAG "g65816" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type C64_SUPERCPU = &device_creator; + + +//------------------------------------------------- +// ROM( c64_supercpu ) +//------------------------------------------------- + +ROM_START( c64_supercpu ) + ROM_REGION( 0x20000, G65816_TAG, 0 ) + ROM_LOAD( "supercpu_dos_204.bin", 0x00000, 0x20000, CRC(f4151454) SHA1(6aa529a7b1b6de53e8979e407a77b4d5657727f5) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *c64_supercpu_device::device_rom_region() const +{ + return ROM_NAME( c64_supercpu ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( c64_supercpu_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( c64_supercpu_map, AS_PROGRAM, 8, c64_supercpu_device ) + AM_RANGE(0x000000, 0x01ffff) AM_RAM AM_SHARE("sram") + AM_RANGE(0x020000, 0xf7ffff) AM_RAM AM_SHARE("dimm") + AM_RANGE(0xf80000, 0xf9ffff) AM_MIRROR(0x60000) AM_ROM AM_REGION(G65816_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// C64_EXPANSION_INTERFACE( expansion_intf ) +//------------------------------------------------- + +READ8_MEMBER( c64_supercpu_device::dma_cd_r ) +{ + return m_slot->dma_cd_r(offset); +} + +WRITE8_MEMBER( c64_supercpu_device::dma_cd_w ) +{ + m_slot->dma_cd_w(offset, data); +} + +WRITE_LINE_MEMBER( c64_supercpu_device::irq_w ) +{ + m_slot->irq_w(state); +} + +WRITE_LINE_MEMBER( c64_supercpu_device::nmi_w ) +{ + m_slot->nmi_w(state); +} + +WRITE_LINE_MEMBER( c64_supercpu_device::dma_w ) +{ + m_slot->dma_w(state); +} + +WRITE_LINE_MEMBER( c64_supercpu_device::reset_w ) +{ + m_slot->reset_w(state); +} + +static C64_EXPANSION_INTERFACE( expansion_intf ) +{ + DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_supercpu_device, dma_cd_r), + DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_supercpu_device, dma_cd_w), + DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_supercpu_device, irq_w), + DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_supercpu_device, nmi_w), + DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_supercpu_device, dma_w), + DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_supercpu_device, reset_w) +}; + + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( c64_supercpu ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( c64_supercpu ) + MCFG_CPU_ADD(G65816_TAG, G65816, 1000000) + MCFG_CPU_PROGRAM_MAP(c64_supercpu_map) + + MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, 0, expansion_intf, c64_expansion_cards, NULL, NULL) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor c64_supercpu_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( c64_supercpu ); +} + + +//------------------------------------------------- +// INPUT_PORTS( c64_supercpu ) +//------------------------------------------------- + +INPUT_CHANGED_MEMBER( c64_supercpu_device::reset ) +{ + if (!newval) + { + device_reset(); + } + + m_slot->reset_w(newval ? CLEAR_LINE : ASSERT_LINE); +} + +static INPUT_PORTS_START( c64_supercpu ) + PORT_START("FRONT") + PORT_DIPNAME( 0x01, 0x01, "Unit" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "JiffyDOS" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, "Speed" ) + PORT_DIPSETTING( 0x04, "Normal" ) + PORT_DIPSETTING( 0x00, "Turbo" ) + + PORT_START("RESET") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_CHANGED_MEMBER(DEVICE_SELF, c64_supercpu_device, reset, 0) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor c64_supercpu_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( c64_supercpu ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// c64_supercpu_device - constructor +//------------------------------------------------- + +c64_supercpu_device::c64_supercpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, C64_SUPERCPU, "SuperCPU", tag, owner, clock), + device_c64_expansion_card_interface(mconfig, *this), + m_maincpu(*this, G65816_TAG), + m_exp(*this, C64_EXPANSION_SLOT_TAG), + m_sram(*this, "sram"), + m_dimm(*this, "dimm") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void c64_supercpu_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void c64_supercpu_device::device_reset() +{ +} + + +//------------------------------------------------- +// c64_cd_r - cartridge data read +//------------------------------------------------- + +UINT8 c64_supercpu_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) +{ + data = m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2); + + switch (offset) + { + case 0xd0b0: + data = 0x40; + break; + + case 0xd0b1: + break; + + case 0xd0b2: + break; + + case 0xd0b3: + case 0xd0b4: + break; + + case 0xd0b5: + break; + + case 0xd0b6: + break; + + case 0xd0b7: + break; + + case 0xd0b8: + case 0xd0b9: + break; + + case 0xd0ba: + break; + + case 0xd0bb: + break; + + case 0xd0bc: + case 0xd0bd: + case 0xd0be: + case 0xd0bf: + break; + } + + return data; +} + + +//------------------------------------------------- +// c64_cd_w - cartridge data write +//------------------------------------------------- + +void c64_supercpu_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) +{ + switch (offset) + { + case 0xd071: + break; + + case 0xd072: + break; + + case 0xd073: + break; + + case 0xd074: + case 0xd075: + case 0xd076: + case 0xd077: + break; + + case 0xd078: + break; + + case 0xd07a: + break; + + case 0xd079: + case 0xd07b: + break; + + case 0xd07c: + break; + + case 0xd07d: + case 0xd07f: + break; + + case 0xd0b0: + case 0xd0b1: + break; + + case 0xd0b2: + break; + + case 0xd0b3: + break; + + case 0xd0b4: + break; + + case 0xd0b5: + break; + + case 0xd0b6: + break; + + case 0xd0b7: + break; + + case 0xd0b8: + break; + + case 0xd0b9: + case 0xd0ba: + case 0xd0bb: + break; + + case 0xd0bc: + break; + + case 0xd0be: + break; + + case 0xd0bd: + case 0xd0bf: + break; + } + + m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2); +} + + +//------------------------------------------------- +// c64_game_r - GAME read +//------------------------------------------------- + +int c64_supercpu_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram) +{ + return m_exp->game_r(offset, sphi2, ba, rw, hiram); +} + + +//------------------------------------------------- +// c64_exrom_r - EXROM read +//------------------------------------------------- + +int c64_supercpu_device::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram) +{ + return m_exp->exrom_r(offset, sphi2, ba, rw, hiram); +} diff --git a/src/mess/machine/c64_supercpu.h b/src/mess/machine/c64_supercpu.h new file mode 100644 index 00000000000..94d20f5a242 --- /dev/null +++ b/src/mess/machine/c64_supercpu.h @@ -0,0 +1,75 @@ +/********************************************************************** + + CMD SuperCPU v2 + SuperRAM emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#pragma once + +#ifndef __SUPERCPU__ +#define __SUPERCPU__ + +#include "emu.h" +#include "machine/c64exp.h" +#include "machine/cbmipt.h" +#include "cpu/g65816/g65816.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> c64_supercpu_device + +class c64_supercpu_device : public device_t, + public device_c64_expansion_card_interface +{ +public: + // construction/destruction + c64_supercpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_INPUT_CHANGED_MEMBER( reset ); + + DECLARE_READ8_MEMBER( dma_cd_r ); + DECLARE_WRITE8_MEMBER( dma_cd_w ); + DECLARE_WRITE_LINE_MEMBER( irq_w ); + DECLARE_WRITE_LINE_MEMBER( nmi_w ); + DECLARE_WRITE_LINE_MEMBER( dma_w ); + DECLARE_WRITE_LINE_MEMBER( reset_w ); + +protected: + // device-level overrides + virtual void device_config_complete() { m_shortname = "c64_supercpu"; } + virtual void device_start(); + virtual void device_reset(); + + // device_c64_expansion_card_interface overrides + virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2); + virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2); + virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram); + virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram); + +private: + required_device m_maincpu; + required_device m_exp; + + required_shared_ptr m_sram; + required_shared_ptr m_dimm; +}; + + +// device type definition +extern const device_type C64_SUPERCPU; + + + +#endif diff --git a/src/mess/machine/c64_tdos.c b/src/mess/machine/c64_tdos.c index 15e36405075..f99e8fdfee0 100644 --- a/src/mess/machine/c64_tdos.c +++ b/src/mess/machine/c64_tdos.c @@ -89,24 +89,6 @@ static MC6852_INTERFACE( ssda_intf ) }; -//------------------------------------------------- -// floppy_interface tdos_floppy_interface -//------------------------------------------------- - -static const floppy_interface tdos_floppy_interface = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(default), - "floppy_2_8", - NULL -}; - - //------------------------------------------------- // C64_EXPANSION_INTERFACE( expansion_intf ) //------------------------------------------------- @@ -158,7 +140,6 @@ static C64_EXPANSION_INTERFACE( expansion_intf ) static MACHINE_CONFIG_FRAGMENT( c64_tdos ) MCFG_MC6852_ADD(MC68A52P_TAG, XTAL_6_5MHz, ssda_intf) - MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, tdos_floppy_interface) MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, 0, expansion_intf, c64_expansion_cards, NULL, NULL) MACHINE_CONFIG_END diff --git a/src/mess/machine/c64_tdos.h b/src/mess/machine/c64_tdos.h index 12cd6d0dd21..fecf650cdfe 100644 --- a/src/mess/machine/c64_tdos.h +++ b/src/mess/machine/c64_tdos.h @@ -12,9 +12,7 @@ #ifndef __TDOS__ #define __TDOS__ - #include "emu.h" -#include "imagedev/flopdrv.h" #include "machine/c64exp.h" #include "machine/cbmipt.h" #include "machine/mc6852.h" diff --git a/src/mess/machine/cbmipt.c b/src/mess/machine/cbmipt.c index ce8d2197db0..a080988d79a 100644 --- a/src/mess/machine/cbmipt.c +++ b/src/mess/machine/cbmipt.c @@ -1115,6 +1115,7 @@ SLOT_INTERFACE_START( c64_expansion_cards ) SLOT_INTERFACE("reu1750", C64_REU1750) SLOT_INTERFACE("reu1764", C64_REU1764) SLOT_INTERFACE("sfxse", C64_SFX_SOUND_EXPANDER) + SLOT_INTERFACE("supercpu", C64_SUPERCPU) // the following need ROMs from the software list SLOT_INTERFACE_INTERNAL("standard", C64_STD) diff --git a/src/mess/machine/cbmipt.h b/src/mess/machine/cbmipt.h index df249b45d14..b90df048f29 100644 --- a/src/mess/machine/cbmipt.h +++ b/src/mess/machine/cbmipt.h @@ -52,6 +52,7 @@ #include "machine/c64_structured_basic.h" #include "machine/c64_super_explode.h" #include "machine/c64_super_games.h" +#include "machine/c64_supercpu.h" #include "machine/c64_sw8k.h" #include "machine/c64_system3.h" #include "machine/c64_tdos.h" diff --git a/src/mess/mess.mak b/src/mess/mess.mak index def2c1e2ceb..8fde7b3fae0 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -877,6 +877,7 @@ $(MESSOBJ)/cbm.a: \ $(MESS_MACHINE)/c64_structured_basic.o \ $(MESS_MACHINE)/c64_super_explode.o \ $(MESS_MACHINE)/c64_super_games.o \ + $(MESS_MACHINE)/c64_supercpu.o \ $(MESS_MACHINE)/c64_sw8k.o \ $(MESS_MACHINE)/c64_system3.o \ $(MESS_MACHINE)/c64_tdos.o \