(MESS) c64: Added skeleton for REU cartridge. (nw)

This commit is contained in:
Curt Coder 2012-10-11 16:44:50 +00:00
parent 7f831337cd
commit 801c00b931
9 changed files with 498 additions and 7 deletions

4
.gitattributes vendored
View File

@ -6631,6 +6631,8 @@ src/mess/machine/c64_prophet64.c svneol=native#text/plain
src/mess/machine/c64_prophet64.h svneol=native#text/plain
src/mess/machine/c64_ps64.c svneol=native#text/plain
src/mess/machine/c64_ps64.h svneol=native#text/plain
src/mess/machine/c64_reu.c svneol=native#text/plain
src/mess/machine/c64_reu.h svneol=native#text/plain
src/mess/machine/c64_rex.c svneol=native#text/plain
src/mess/machine/c64_rex.h svneol=native#text/plain
src/mess/machine/c64_rex_ep256.c svneol=native#text/plain
@ -6943,6 +6945,8 @@ src/mess/machine/mos6530.c svneol=native#text/plain
src/mess/machine/mos6530.h svneol=native#text/plain
src/mess/machine/mos8722.c svneol=native#text/plain
src/mess/machine/mos8722.h svneol=native#text/plain
src/mess/machine/mos8726.c svneol=native#text/plain
src/mess/machine/mos8726.h svneol=native#text/plain
src/mess/machine/mpc105.c svneol=native#text/plain
src/mess/machine/mpc105.h svneol=native#text/plain
src/mess/machine/msx.c svneol=native#text/plain

View File

@ -64,7 +64,7 @@ UINT8 c128_comal80_cartridge_device::c64_cd_r(address_space &space, offs_t offse
if (!romh)
{
offs_t addr = (m_bank << 14) | (offset & 0x3fff);
data = m_roml[addr];
data = m_romh[addr];
}
return data;

160
src/mess/machine/c64_reu.c Normal file
View File

@ -0,0 +1,160 @@
/**********************************************************************
Commodore 1700/1750/1764 RAM Expansion Unit emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************/
#include "c64_reu.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
#define MOS8726R1_TAG "u1"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type C64_REU1700 = &device_creator<c64_reu1700_cartridge_device>;
const device_type C64_REU1750 = &device_creator<c64_reu1750_cartridge_device>;
const device_type C64_REU1764 = &device_creator<c64_reu1764_cartridge_device>;
//-------------------------------------------------
// ROM( c64_reu )
//-------------------------------------------------
ROM_START( c64_reu )
ROM_REGION( 0x8000, "roml", 0 )
ROM_CART_LOAD( "rom", 0x0000, 0x8000, ROM_MIRROR )
ROM_END
//-------------------------------------------------
// rom_region - device-specific ROM region
//-------------------------------------------------
const rom_entry *c64_reu_cartridge_device::device_rom_region() const
{
return ROM_NAME( c64_reu );
}
//-------------------------------------------------
// MACHINE_CONFIG_FRAGMENT( c64_reu )
//-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( c64_reu )
MCFG_MOS8726_ADD(MOS8726R1_TAG)
MCFG_CARTSLOT_ADD("rom")
MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
MACHINE_CONFIG_END
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
//-------------------------------------------------
machine_config_constructor c64_reu_cartridge_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( c64_reu );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// c64_reu_cartridge_device - constructor
//-------------------------------------------------
c64_reu_cartridge_device::c64_reu_cartridge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, int jp1, size_t ram_size) :
device_t(mconfig, type, name, tag, owner, clock),
device_c64_expansion_card_interface(mconfig, *this),
m_dmac(*this, MOS8726R1_TAG),
m_variant(variant),
m_jp1(jp1),
m_ram_size(ram_size)
{
}
c64_reu1700_cartridge_device::c64_reu1700_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: c64_reu_cartridge_device(mconfig, C64_REU1700, "1700 REU", tag, owner, clock, TYPE_1700, 0, 128 * 1024) { }
c64_reu1750_cartridge_device::c64_reu1750_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: c64_reu_cartridge_device(mconfig, C64_REU1750, "1750 REU", tag, owner, clock, TYPE_1750, 1, 256 * 1024) { }
c64_reu1764_cartridge_device::c64_reu1764_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: c64_reu_cartridge_device(mconfig, C64_REU1764, "1764 REU", tag, owner, clock, TYPE_1764, 1, 512 * 1024) { }
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void c64_reu_cartridge_device::device_start()
{
// find memory region
m_roml = memregion("roml")->base();
// allocate memory
c64_ram_pointer(machine(), m_ram_size);
// setup DMA controller
m_dmac->set_unscaled_clock(m_slot->phi2());
m_dmac->bs_w(m_jp1);
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void c64_reu_cartridge_device::device_reset()
{
m_dmac->reset();
}
//-------------------------------------------------
// c64_cd_r - cartridge data read
//-------------------------------------------------
UINT8 c64_reu_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int ba, int roml, int romh, int io1, int io2)
{
if (!m_dmac->romsel_r(roml, romh))
{
data = m_roml[offset & 0x7fff];
}
else if (!io2)
{
data = m_dmac->read(space, offset);
}
return data;
}
//-------------------------------------------------
// c64_cd_w - cartridge data write
//-------------------------------------------------
void c64_reu_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int ba, int roml, int romh, int io1, int io2)
{
if (!io2)
{
m_dmac->write(space, offset, data);
}
}

101
src/mess/machine/c64_reu.h Normal file
View File

@ -0,0 +1,101 @@
/**********************************************************************
Commodore 1700/1750/1764 RAM Expansion Unit emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************/
#pragma once
#ifndef __REU__
#define __REU__
#include "emu.h"
#include "imagedev/cartslot.h"
#include "machine/c64exp.h"
#include "machine/mos8726.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> c64_reu_cartridge_device
class c64_reu_cartridge_device : public device_t,
public device_c64_expansion_card_interface
{
public:
// construction/destruction
c64_reu_cartridge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, int jp1, size_t ram_size);
// optional information overrides
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
protected:
enum
{
TYPE_1700,
TYPE_1750,
TYPE_1764
};
// device-level overrides
virtual void device_config_complete() { m_shortname = "c64_reu"; }
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 ba, int roml, int romh, int io1, int io2);
virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int ba, int roml, int romh, int io1, int io2);
required_device<mos8726_device> m_dmac;
int m_variant;
int m_jp1;
size_t m_ram_size;
};
// ======================> c64_reu1700_cartridge_device
class c64_reu1700_cartridge_device : public c64_reu_cartridge_device
{
public:
// construction/destruction
c64_reu1700_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
// ======================> c64_reu1750_cartridge_device
class c64_reu1750_cartridge_device : public c64_reu_cartridge_device
{
public:
// construction/destruction
c64_reu1750_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
// ======================> c64_reu1700_cartridge_device
class c64_reu1764_cartridge_device : public c64_reu_cartridge_device
{
public:
// construction/destruction
c64_reu1764_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
// device type definition
extern const device_type C64_REU1700;
extern const device_type C64_REU1750;
extern const device_type C64_REU1764;
#endif

View File

@ -1127,11 +1127,15 @@ SLOT_INTERFACE_START( c64_expansion_cards )
SLOT_INTERFACE("georam", C64_GEORAM)
SLOT_INTERFACE("ide64", C64_IDE64)
SLOT_INTERFACE("neoram", C64_NEORAM)
SLOT_INTERFACE("reu1700", C64_REU1700)
SLOT_INTERFACE("reu1750", C64_REU1750)
SLOT_INTERFACE("reu1764", C64_REU1764)
SLOT_INTERFACE("sfxse", C64_SFX_SOUND_EXPANDER)
// the following need ROMs from the software list
SLOT_INTERFACE_INTERNAL("standard", C64_STD)
SLOT_INTERFACE_INTERNAL("comal80", C64_COMAL80)
SLOT_INTERFACE_INTERNAL("c128_comal80", C128_COMAL80)
SLOT_INTERFACE_INTERNAL("cs64", C64_CURRAH_SPEECH)
SLOT_INTERFACE_INTERNAL("dela_ep256", C64_DELA_EP256)
SLOT_INTERFACE_INTERNAL("ep64", C64_DELA_EP64)
@ -1182,11 +1186,6 @@ SLOT_INTERFACE_START( c64_user_port_cards )
SLOT_INTERFACE("geocable", C64_GEOCABLE)
SLOT_INTERFACE_END
SLOT_INTERFACE_START( c128_expansion_cards )
// the following need ROMs from the software list
SLOT_INTERFACE_INTERNAL("c128_comal80", C128_COMAL80)
SLOT_INTERFACE_END
SLOT_INTERFACE_START( plus4_datassette_devices )
SLOT_INTERFACE("c1531", C1531)
SLOT_INTERFACE("diag264", DIAG264_CASSETTE_LOOPBACK)

View File

@ -40,6 +40,7 @@
#include "machine/c64_pagefox.h"
#include "machine/c64_prophet64.h"
#include "machine/c64_ps64.h"
#include "machine/c64_reu.h"
#include "machine/c64_rex.h"
#include "machine/c64_rex_ep256.h"
#include "machine/c64_ross.h"
@ -164,7 +165,6 @@ SLOT_INTERFACE_EXTERN( vic20_user_port_cards );
SLOT_INTERFACE_EXTERN( vic10_expansion_cards );
SLOT_INTERFACE_EXTERN( c64_expansion_cards );
SLOT_INTERFACE_EXTERN( c64_user_port_cards );
SLOT_INTERFACE_EXTERN( c128_expansion_cards );
SLOT_INTERFACE_EXTERN( plus4_datassette_devices );
SLOT_INTERFACE_EXTERN( plus4_expansion_cards );
SLOT_INTERFACE_EXTERN( plus4_user_port_cards );

126
src/mess/machine/mos8726.c Normal file
View File

@ -0,0 +1,126 @@
/**********************************************************************
MOS 8726R1 DMA Controller emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************/
/*
TODO:
- all
*/
#include "mos8726.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
//**************************************************************************
// DEVICE TYPE DEFINITIONS
//**************************************************************************
const device_type MOS8726 = &device_creator<mos8726_device>;
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// mos8726_device - constructor
//-------------------------------------------------
mos8726_device::mos8726_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MOS8726, "MOS8726", tag, owner, clock),
device_execute_interface(mconfig, *this),
m_icount(0),
m_bs(1)
{ }
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void mos8726_device::device_start()
{
// set our instruction counter
m_icountptr = &m_icount;
// save state
save_item(NAME(m_bs));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void mos8726_device::device_reset()
{
}
//-------------------------------------------------
// execute_run -
//-------------------------------------------------
void mos8726_device::execute_run()
{
do
{
m_icount--;
} while (m_icount > 0);
}
//-------------------------------------------------
// read -
//-------------------------------------------------
READ8_MEMBER( mos8726_device::read )
{
UINT8 data = 0;
return data;
}
//-------------------------------------------------
// write -
//-------------------------------------------------
WRITE8_MEMBER( mos8726_device::write )
{
}
//-------------------------------------------------
// bs_w - bank select write
//-------------------------------------------------
WRITE_LINE_MEMBER( mos8726_device::bs_w )
{
m_bs = state;
}
//-------------------------------------------------
// romsel_r - ROM select read
//-------------------------------------------------
int mos8726_device::romsel_r(int roml, int romh)
{
return roml && romh;
}

View File

@ -0,0 +1,99 @@
/**********************************************************************
MOS 8726R1 DMA Controller emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************
_____ _____
/RESET 1 |* \_/ | 64 Vcc
/IRQ 2 | | 63 BS
DOTCLK 3 | | 62 CAS1
R/W 4 | | 61 CAS0
1 MHz 5 | | 60 RAS1
/CS 6 | | 59 RAS0
/BA 7 | | 58 /DWE
/DMA 8 | | 57 DD0
D7 9 | | 56 DD1
D6 10 | | 55 DD2
D5 11 | | 54 DD3
D4 12 | | 53 DD4
D3 13 | | 52 DD5
D2 14 | | 51 DD6
D1 15 | MOS8726 | 50 DD7
D0 16 | MOS8726R1 | 49 Vss
Vss 17 | | 48 MA8
A15 18 | | 47 MA7
A14 19 | | 46 MA6
A13 20 | | 45 MA5
A12 21 | | 44 MA4
A11 22 | | 43 MA3
A10 23 | | 42 MA2
A9 24 | | 41 MA1
A8 25 | | 40 MA0
A7 26 | | 39 TEST
A6 27 | | 38 Vss
A5 28 | | 37 Vcc
A4 29 | | 36 /ROMSEL
A3 30 | | 35 /ROML
A2 31 | | 34 /ROMH
A1 32 |_____________| 33 A0
**********************************************************************/
#pragma once
#ifndef __MOS8726__
#define __MOS8726__
#include "emu.h"
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_MOS8726_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, MOS8726, 1000000) // dummy clock
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> mos8726_device
class mos8726_device : public device_t,
public device_execute_interface
{
public:
// construction/destruction
mos8726_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( bs_w );
int romsel_r(int roml, int romh);
protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
virtual void execute_run();
int m_icount;
int m_bs;
};
// device type definition
extern const device_type MOS8726;
#endif

View File

@ -842,6 +842,7 @@ $(MESSOBJ)/cbm.a: \
$(MESS_MACHINE)/c64_pagefox.o \
$(MESS_MACHINE)/c64_prophet64.o \
$(MESS_MACHINE)/c64_ps64.o \
$(MESS_MACHINE)/c64_reu.o \
$(MESS_MACHINE)/c64_rex.o \
$(MESS_MACHINE)/c64_rex_ep256.o \
$(MESS_MACHINE)/c64_ross.o \
@ -914,6 +915,7 @@ $(MESSOBJ)/cbm.a: \
$(MESS_MACHINE)/64h156.o \
$(MESS_MACHINE)/petcass.o \
$(MESS_MACHINE)/mos8722.o \
$(MESS_MACHINE)/mos8726.o \
$(MESS_MACHINE)/c2n.o \
$(MESS_VIDEO)/vdc8563.o \
$(MESS_VIDEO)/vic6567.o \