(MESS) c128: Added skeleton for the MOS8722 MMU. (nw)

This commit is contained in:
Curt Coder 2012-09-09 16:26:08 +00:00
parent 2b0c45d005
commit e310628cb6
4 changed files with 352 additions and 0 deletions

2
.gitattributes vendored
View File

@ -6854,6 +6854,8 @@ src/mess/machine/mm58274c.c svneol=native#text/plain
src/mess/machine/mm58274c.h svneol=native#text/plain
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/mpc105.c svneol=native#text/plain
src/mess/machine/mpc105.h svneol=native#text/plain
src/mess/machine/msx.c svneol=native#text/plain

231
src/mess/machine/mos8722.c Normal file
View File

@ -0,0 +1,231 @@
/**********************************************************************
MOS Technology 8722 Memory Management Unit emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************/
#include "mos8722.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
#define LOG 0
// registers
enum
{
CR = 0,
PCRA, LCRA = PCRA,
PCRB, LCRB = PCRB,
PCRC, LCRC = PCRC,
PCRD, LCRD = PCRD,
MCR,
RCR,
P0L,
P0H,
P1L,
P1H,
VR
};
// configuration register
enum
{
CR_IO_SYSTEM_IO = 0,
CR_IO_HI_ROM
};
enum
{
CR_ROM_SYSTEM_ROM = 0,
CR_ROM_INT_FUNC_ROM,
CR_ROM_EXT_FUNC_ROM,
CR_ROM_RAM
};
#define CR_IO BIT(m_reg[CR], 0)
#define CR_ROM_LO BIT(m_reg[CR], 1)
#define CR_ROM_MID ((m_reg[CR] >> 2) & 0x03)
#define CR_ROM_HI ((m_reg[CR] >> 4) & 0x03)
#define CR_A16 BIT(m_reg[CR], 6)
// mode configuration register
#define MCR_8500 BIT(m_reg[MCR], 0)
#define MCR_FSDIR BIT(m_reg[MCR], 3)
#define MCR_GAME BIT(m_reg[MCR], 4)
#define MCR_EXROM BIT(m_reg[MCR], 5)
#define MCR_C64 BIT(m_reg[MCR], 6)
#define MCR_40_80 BIT(m_reg[MCR], 7)
// RAM configuration register
enum
{
RCR_STATUS_NO = 0,
RCR_STATUS_BOTTOM,
RCR_STATUS_TOP,
RCR_STATUS_BOTH
};
#define RCR_SHARE (m_reg[RCR] & 0x03)
#define RCR_STATUS ((m_reg[RCR] >> 2) & 0x03)
#define RCR_A16 BIT(m_reg[RCR], 6)
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type MOS8722 = &device_creator<mos8722_device>;
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// mos8722_device - constructor
//-------------------------------------------------
mos8722_device::mos8722_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MOS8722, "MOS8722", tag, owner, clock)
{
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void mos8722_device::device_config_complete()
{
// inherit a copy of the static data
const mos8722_interface *intf = reinterpret_cast<const mos8722_interface *>(static_config());
if (intf != NULL)
*static_cast<mos8722_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
memset(&m_out_z80en_cb, 0, sizeof(m_out_z80en_cb));
memset(&m_out_fsdir_cb, 0, sizeof(m_out_fsdir_cb));
memset(&m_in_game_cb, 0, sizeof(m_in_game_cb));
memset(&m_in_exrom_cb, 0, sizeof(m_in_exrom_cb));
memset(&m_in_sense40_cb, 0, sizeof(m_in_sense40_cb));
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void mos8722_device::device_start()
{
// resolve callbacks
m_out_z80en_func.resolve(m_out_z80en_cb, *this);
m_out_fsdir_func.resolve(m_out_fsdir_cb, *this);
m_in_game_func.resolve(m_in_game_cb, *this);
m_in_exrom_func.resolve(m_in_exrom_cb, *this);
m_in_sense40_func.resolve(m_in_sense40_cb, *this);
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void mos8722_device::device_reset()
{
}
//-------------------------------------------------
// read - register read
//-------------------------------------------------
READ8_MEMBER( mos8722_device::read )
{
return 0;
}
//-------------------------------------------------
// write - register write
//-------------------------------------------------
WRITE8_MEMBER( mos8722_device::write )
{
}
//-------------------------------------------------
// fsdir_r - fast serial direction read
//-------------------------------------------------
READ_LINE_MEMBER( mos8722_device::fsdir_r )
{
return 1;
}
//-------------------------------------------------
// ms0_r - memory status 0 read
//-------------------------------------------------
READ_LINE_MEMBER( mos8722_device::ms0_r )
{
return 1;
}
//-------------------------------------------------
// ms1_r - memory status 1 read
//-------------------------------------------------
READ_LINE_MEMBER( mos8722_device::ms1_r )
{
return 1;
}
//-------------------------------------------------
// ms2_r - memory status 2 read
//-------------------------------------------------
READ_LINE_MEMBER( mos8722_device::ms2_r )
{
return 1;
}
//-------------------------------------------------
// ms3_r - memory status 3 read
//-------------------------------------------------
READ_LINE_MEMBER( mos8722_device::ms3_r )
{
return 1;
}
//-------------------------------------------------
// ta_r - translated address read
//-------------------------------------------------
offs_t mos8722_device::ta_r(offs_t offset, int aec)
{
return offset;
}

118
src/mess/machine/mos8722.h Normal file
View File

@ -0,0 +1,118 @@
/**********************************************************************
MOS Technology 8722 Memory Management Unit emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************
_____ _____
Vdd 1 |* \_/ | 48 SENSE40
_RESET 2 | | 47 (MS3) 128/64
TA15 3 | | 46 _EXROM
TA14 4 | | 45 _GAME
TA13 5 | | 44 FSDIR
TA12 6 | | 43 _Z80EN
TA11 7 | | 42 D7
TA10 8 | | 41 D6
TA9 9 | | 40 D5
TA8 10 | | 39 D4
_CAS1 11 | | 38 D3
_CAS0 12 | MOS8722 | 37 D2
I/O SEL (MS2) 13 | | 36 D1
ROMBANK1 (MS1) 14 | | 35 D0
ROMBANK0 (MS0) 15 | | 34 Vss
AEC 16 | | 33 phi0
MUX 17 | | 32 R/_W
A0 18 | | 31 A15
A1 19 | | 30 A14
A2 20 | | 29 A13
A3 21 | | 28 A12
A4/A5 22 | | 27 A11
A6/A7 23 | | 26 A10
A8 24 |_____________| 25 A9
**********************************************************************/
#pragma once
#ifndef __MOS8722__
#define __MOS8722__
#include "emu.h"
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_MOS8722_ADD(_tag, _config) \
MCFG_DEVICE_ADD(_tag, MOS8722, 0) \
MCFG_DEVICE_CONFIG(_config)
#define MOS8722_INTERFACE(name) \
const mos8722_interface (name) =
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> mos8722_interface
struct mos8722_interface
{
devcb_write_line m_out_z80en_cb;
devcb_write_line m_out_fsdir_cb;
devcb_read_line m_in_game_cb;
devcb_read_line m_in_exrom_cb;
devcb_read_line m_in_sense40_cb;
};
// ======================> mos8722_device
class mos8722_device : public device_t,
public mos8722_interface
{
public:
// construction/destruction
mos8722_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ_LINE_MEMBER( fsdir_r );
DECLARE_READ_LINE_MEMBER( ms0_r );
DECLARE_READ_LINE_MEMBER( ms1_r );
DECLARE_READ_LINE_MEMBER( ms2_r );
DECLARE_READ_LINE_MEMBER( ms3_r );
offs_t ta_r(offs_t offset, int aec);
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
devcb_resolved_write_line m_out_z80en_func;
devcb_resolved_write_line m_out_fsdir_func;
devcb_resolved_read_line m_in_game_func;
devcb_resolved_read_line m_in_exrom_func;
devcb_resolved_read_line m_in_sense40_func;
UINT8 m_reg[10];
};
// device type definition
extern const device_type MOS8722;
#endif

View File

@ -913,6 +913,7 @@ $(MESSOBJ)/cbm.a: \
$(MESS_MACHINE)/cbmipt.o \
$(MESS_MACHINE)/64h156.o \
$(MESS_MACHINE)/petcass.o \
$(MESS_MACHINE)/mos8722.o \
$(MESS_MACHINE)/c2n.o \
$(MESS_VIDEO)/vdc8563.o \
$(MESS_VIDEO)/vic6567.o \