(MESS) ql: Added preliminary CST Q+4 emulation. [Curt Coder]

This commit is contained in:
Curt Coder 2014-06-10 17:21:09 +00:00
parent f2a798abf9
commit b1a96bf2cc
2 changed files with 83 additions and 1 deletions

View File

@ -13,6 +13,14 @@
//**************************************************************************
// MACROS/CONSTANTS
//**************************************************************************
#define MC6821_TAG "mc6821"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
@ -40,6 +48,38 @@ const rom_entry *cst_q_plus4_t::device_rom_region() const
}
//-------------------------------------------------
// MACHINE_CONFIG_FRAGMENT( cst_q_plus4 )
//-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( cst_q_plus4 )
MCFG_DEVICE_ADD(MC6821_TAG, PIA6821, 0)
MCFG_QL_EXPANSION_SLOT_ADD("exp1", ql_expansion_cards, NULL)
MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(WRITELINE(cst_q_plus4_t, exp1_extintl_w))
MCFG_QL_EXPANSION_SLOT_ADD("exp2", ql_expansion_cards, NULL)
MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(WRITELINE(cst_q_plus4_t, exp2_extintl_w))
MCFG_QL_EXPANSION_SLOT_ADD("exp3", ql_expansion_cards, NULL)
MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(WRITELINE(cst_q_plus4_t, exp3_extintl_w))
MCFG_QL_EXPANSION_SLOT_ADD("exp4", ql_expansion_cards, NULL)
MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(WRITELINE(cst_q_plus4_t, exp4_extintl_w))
MACHINE_CONFIG_END
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
//-------------------------------------------------
machine_config_constructor cst_q_plus4_t::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( cst_q_plus4 );
}
//**************************************************************************
// LIVE DEVICE
@ -51,7 +91,16 @@ const rom_entry *cst_q_plus4_t::device_rom_region() const
cst_q_plus4_t::cst_q_plus4_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, CST_Q_PLUS4, "CST Q+4", tag, owner, clock, "ql_qplus4", __FILE__),
device_ql_expansion_card_interface(mconfig, *this)
device_ql_expansion_card_interface(mconfig, *this),
m_exp1(*this, "exp1"),
m_exp2(*this, "exp2"),
m_exp3(*this, "exp3"),
m_exp4(*this, "exp4"),
m_rom(*this, "rom"),
m_exp1_extinl(CLEAR_LINE),
m_exp2_extinl(CLEAR_LINE),
m_exp3_extinl(CLEAR_LINE),
m_exp4_extinl(CLEAR_LINE)
{
}
@ -71,6 +120,16 @@ void cst_q_plus4_t::device_start()
UINT8 cst_q_plus4_t::read(address_space &space, offs_t offset, UINT8 data)
{
if (offset >= 0xc000 && offset < 0xc200)
{
data = m_rom->base()[offset & 0x1fff];
}
data = m_exp1->read(space, offset, data);
data = m_exp2->read(space, offset, data);
data = m_exp3->read(space, offset, data);
data = m_exp4->read(space, offset, data);
return data;
}
@ -81,4 +140,8 @@ UINT8 cst_q_plus4_t::read(address_space &space, offs_t offset, UINT8 data)
void cst_q_plus4_t::write(address_space &space, offs_t offset, UINT8 data)
{
m_exp1->write(space, offset, data);
m_exp2->write(space, offset, data);
m_exp3->write(space, offset, data);
m_exp4->write(space, offset, data);
}

View File

@ -15,6 +15,7 @@
#define __CST_Q_PLUS4__
#include "exp.h"
#include "machine/6821pia.h"
@ -34,6 +35,12 @@ public:
// optional information overrides
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
DECLARE_WRITE_LINE_MEMBER( exp1_extintl_w ) { m_exp1_extinl = state; update_extintl(); }
DECLARE_WRITE_LINE_MEMBER( exp2_extintl_w ) { m_exp2_extinl = state; update_extintl(); }
DECLARE_WRITE_LINE_MEMBER( exp3_extintl_w ) { m_exp3_extinl = state; update_extintl(); }
DECLARE_WRITE_LINE_MEMBER( exp4_extintl_w ) { m_exp4_extinl = state; update_extintl(); }
protected:
// device-level overrides
@ -44,6 +51,18 @@ protected:
virtual void write(address_space &space, offs_t offset, UINT8 data);
private:
void update_extintl() { m_slot->extintl_w(m_exp1_extinl || m_exp2_extinl || m_exp3_extinl || m_exp4_extinl); }
required_device<ql_expansion_slot_t> m_exp1;
required_device<ql_expansion_slot_t> m_exp2;
required_device<ql_expansion_slot_t> m_exp3;
required_device<ql_expansion_slot_t> m_exp4;
required_memory_region m_rom;
int m_exp1_extinl;
int m_exp2_extinl;
int m_exp3_extinl;
int m_exp4_extinl;
};