mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
(MESS) vidbrain: devcb2. (nw)
This commit is contained in:
parent
f2230d052c
commit
13d9941586
@ -37,24 +37,15 @@ const device_type VIDEOBRAIN_EXPANSION_SLOT = &device_creator<videobrain_expansi
|
||||
// device_videobrain_expansion_card_interface - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
device_videobrain_expansion_card_interface::device_videobrain_expansion_card_interface(const machine_config &mconfig, device_t &device)
|
||||
: device_slot_card_interface(mconfig, device),
|
||||
m_rom_mask(0),
|
||||
m_ram_mask(0)
|
||||
device_videobrain_expansion_card_interface::device_videobrain_expansion_card_interface(const machine_config &mconfig, device_t &device) :
|
||||
device_slot_card_interface(mconfig, device),
|
||||
m_rom_mask(0),
|
||||
m_ram_mask(0)
|
||||
{
|
||||
m_slot = dynamic_cast<videobrain_expansion_slot_device *>(device.owner());
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// ~device_videobrain_expansion_card_interface - destructor
|
||||
//-------------------------------------------------
|
||||
|
||||
device_videobrain_expansion_card_interface::~device_videobrain_expansion_card_interface()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// videobrain_roml_pointer - get low ROM pointer
|
||||
//-------------------------------------------------
|
||||
@ -99,48 +90,14 @@ UINT8* device_videobrain_expansion_card_interface::videobrain_ram_pointer(runnin
|
||||
//-------------------------------------------------
|
||||
|
||||
videobrain_expansion_slot_device::videobrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, VIDEOBRAIN_EXPANSION_SLOT, "VideoBrain expansion port", tag, owner, clock, "videobrain_expansion_slot", __FILE__),
|
||||
device_slot_interface(mconfig, *this),
|
||||
device_image_interface(mconfig, *this)
|
||||
device_t(mconfig, VIDEOBRAIN_EXPANSION_SLOT, "VideoBrain expansion port", tag, owner, clock, "videobrain_expansion_slot", __FILE__),
|
||||
device_slot_interface(mconfig, *this),
|
||||
device_image_interface(mconfig, *this),
|
||||
m_write_extres(*this)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// videobrain_expansion_slot_device - destructor
|
||||
//-------------------------------------------------
|
||||
|
||||
videobrain_expansion_slot_device::~videobrain_expansion_slot_device()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void videobrain_expansion_slot_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const videobrain_expansion_slot_interface *intf = reinterpret_cast<const videobrain_expansion_slot_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
{
|
||||
*static_cast<videobrain_expansion_slot_interface *>(this) = *intf;
|
||||
}
|
||||
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
memset(&m_out_extres_cb, 0, sizeof(m_out_extres_cb));
|
||||
}
|
||||
|
||||
// set brief and instance name
|
||||
update_names();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
@ -150,7 +107,7 @@ void videobrain_expansion_slot_device::device_start()
|
||||
m_cart = dynamic_cast<device_videobrain_expansion_card_interface *>(get_card_device());
|
||||
|
||||
// resolve callbacks
|
||||
m_out_extres_func.resolve(m_out_extres_cb, *this);
|
||||
m_write_extres.resolve_safe();
|
||||
}
|
||||
|
||||
|
||||
@ -236,17 +193,6 @@ void videobrain_expansion_slot_device::bo_w(address_space &space, offs_t offset,
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER( videobrain_expansion_slot_device::cs1_r ) { return bo_r(space, offset + 0x1000, 0, 1); }
|
||||
WRITE8_MEMBER( videobrain_expansion_slot_device::cs1_w ) { bo_w(space, offset + 0x1000, data, 0, 1); }
|
||||
READ8_MEMBER( videobrain_expansion_slot_device::cs2_r ) { return bo_r(space, offset + 0x1800, 1, 0); }
|
||||
WRITE8_MEMBER( videobrain_expansion_slot_device::cs2_w ) { bo_w(space, offset + 0x1800, data, 1, 0); }
|
||||
READ8_MEMBER( videobrain_expansion_slot_device::unmap_r ) { return bo_r(space, offset + 0x3000, 1, 0); }
|
||||
WRITE8_MEMBER( videobrain_expansion_slot_device::unmap_w ) { bo_w(space, offset + 0x3000, data, 1, 0); }
|
||||
|
||||
|
||||
WRITE_LINE_MEMBER( videobrain_expansion_slot_device::extres_w ) { m_out_extres_func(state); }
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// SLOT_INTERFACE_START( vidbrain_expansion_cards )
|
||||
//-------------------------------------------------
|
||||
|
@ -58,85 +58,21 @@
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define VIDEOBRAIN_EXPANSION_INTERFACE(_name) \
|
||||
const videobrain_expansion_slot_interface (_name) =
|
||||
|
||||
|
||||
#define MCFG_VIDEOBRAIN_EXPANSION_SLOT_ADD(_tag, _config, _slot_intf, _def_slot) \
|
||||
#define MCFG_VIDEOBRAIN_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot) \
|
||||
MCFG_DEVICE_ADD(_tag, VIDEOBRAIN_EXPANSION_SLOT, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config) \
|
||||
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
|
||||
|
||||
|
||||
#define MCFG_VIDEOBRAIN_EXPANSION_SLOT_EXTRES_CALLBACK(_write) \
|
||||
devcb = &videobrain_expansion_slot_device::set_extres_wr_callback(*device, DEVCB2_##_write);
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> videobrain_expansion_slot_interface
|
||||
|
||||
struct videobrain_expansion_slot_interface
|
||||
{
|
||||
devcb_write_line m_out_extres_cb;
|
||||
};
|
||||
|
||||
|
||||
// ======================> videobrain_expansion_slot_device
|
||||
|
||||
class device_videobrain_expansion_card_interface;
|
||||
|
||||
class videobrain_expansion_slot_device : public device_t,
|
||||
public videobrain_expansion_slot_interface,
|
||||
public device_slot_interface,
|
||||
public device_image_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
videobrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
virtual ~videobrain_expansion_slot_device();
|
||||
|
||||
// computer interface
|
||||
UINT8 bo_r(address_space &space, offs_t offset, int cs1, int cs2);
|
||||
void bo_w(address_space &space, offs_t offset, UINT8 data, int cs1, int cs2);
|
||||
|
||||
DECLARE_READ8_MEMBER( cs1_r );
|
||||
DECLARE_WRITE8_MEMBER( cs1_w );
|
||||
DECLARE_READ8_MEMBER( cs2_r );
|
||||
DECLARE_WRITE8_MEMBER( cs2_w );
|
||||
DECLARE_READ8_MEMBER( unmap_r );
|
||||
DECLARE_WRITE8_MEMBER( unmap_w );
|
||||
|
||||
// cartridge interface
|
||||
DECLARE_WRITE_LINE_MEMBER( extres_w );
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
|
||||
// image-level overrides
|
||||
virtual bool call_load();
|
||||
virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry);
|
||||
|
||||
virtual iodevice_t image_type() const { return IO_CARTSLOT; }
|
||||
|
||||
virtual bool is_readable() const { return 1; }
|
||||
virtual bool is_writeable() const { return 0; }
|
||||
virtual bool is_creatable() const { return 0; }
|
||||
virtual bool must_be_loaded() const { return 0; }
|
||||
virtual bool is_reset_on_load() const { return 1; }
|
||||
virtual const char *image_interface() const { return "vidbrain_cart"; }
|
||||
virtual const char *file_extensions() const { return "bin"; }
|
||||
virtual const option_guide *create_option_guide() const { return NULL; }
|
||||
|
||||
// slot interface overrides
|
||||
virtual void get_default_card_software(astring &result);
|
||||
|
||||
devcb_resolved_write_line m_out_extres_func;
|
||||
|
||||
device_videobrain_expansion_card_interface *m_cart;
|
||||
};
|
||||
|
||||
class videobrain_expansion_slot_device;
|
||||
|
||||
// ======================> device_videobrain_expansion_card_interface
|
||||
|
||||
@ -147,7 +83,7 @@ class device_videobrain_expansion_card_interface : public device_slot_card_inter
|
||||
public:
|
||||
// construction/destruction
|
||||
device_videobrain_expansion_card_interface(const machine_config &mconfig, device_t &device);
|
||||
virtual ~device_videobrain_expansion_card_interface();
|
||||
virtual ~device_videobrain_expansion_card_interface() { }
|
||||
|
||||
protected:
|
||||
// initialization
|
||||
@ -169,6 +105,62 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
// ======================> videobrain_expansion_slot_device
|
||||
|
||||
class videobrain_expansion_slot_device : public device_t,
|
||||
public device_slot_interface,
|
||||
public device_image_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
videobrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
virtual ~videobrain_expansion_slot_device() { }
|
||||
|
||||
template<class _Object> static devcb2_base &set_extres_wr_callback(device_t &device, _Object object) { return downcast<videobrain_expansion_slot_device &>(device).m_write_extres.set_callback(object); }
|
||||
|
||||
// computer interface
|
||||
UINT8 bo_r(address_space &space, offs_t offset, int cs1, int cs2);
|
||||
void bo_w(address_space &space, offs_t offset, UINT8 data, int cs1, int cs2);
|
||||
|
||||
DECLARE_READ8_MEMBER( cs1_r ) { return bo_r(space, offset + 0x1000, 0, 1); }
|
||||
DECLARE_WRITE8_MEMBER( cs1_w ) { bo_w(space, offset + 0x1000, data, 0, 1); }
|
||||
DECLARE_READ8_MEMBER( cs2_r ) { return bo_r(space, offset + 0x1800, 1, 0); }
|
||||
DECLARE_WRITE8_MEMBER( cs2_w ) { bo_w(space, offset + 0x1800, data, 1, 0); }
|
||||
DECLARE_READ8_MEMBER( unmap_r ) { return bo_r(space, offset + 0x3000, 1, 0); }
|
||||
DECLARE_WRITE8_MEMBER( unmap_w ) { bo_w(space, offset + 0x3000, data, 1, 0); }
|
||||
|
||||
// cartridge interface
|
||||
DECLARE_WRITE_LINE_MEMBER( extres_w ) { m_write_extres(state); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete() { update_names(); }
|
||||
virtual void device_start();
|
||||
|
||||
// image-level overrides
|
||||
virtual bool call_load();
|
||||
virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry);
|
||||
|
||||
virtual iodevice_t image_type() const { return IO_CARTSLOT; }
|
||||
|
||||
virtual bool is_readable() const { return 1; }
|
||||
virtual bool is_writeable() const { return 0; }
|
||||
virtual bool is_creatable() const { return 0; }
|
||||
virtual bool must_be_loaded() const { return 0; }
|
||||
virtual bool is_reset_on_load() const { return 1; }
|
||||
virtual const char *image_interface() const { return "vidbrain_cart"; }
|
||||
virtual const char *file_extensions() const { return "bin"; }
|
||||
virtual const option_guide *create_option_guide() const { return NULL; }
|
||||
|
||||
// slot interface overrides
|
||||
virtual void get_default_card_software(astring &result);
|
||||
|
||||
devcb2_write_line m_write_extres;
|
||||
|
||||
device_videobrain_expansion_card_interface *m_cart;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
extern const device_type VIDEOBRAIN_EXPANSION_SLOT;
|
||||
|
||||
|
@ -466,16 +466,6 @@ static UV201_INTERFACE( uv_intf )
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// VIDEOBRAIN_EXPANSION_INTERFACE( expansion_intf )
|
||||
//-------------------------------------------------
|
||||
|
||||
static VIDEOBRAIN_EXPANSION_INTERFACE( expansion_intf )
|
||||
{
|
||||
DEVCB_NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// MACHINE INITIALIZATION
|
||||
@ -583,7 +573,7 @@ static MACHINE_CONFIG_START( vidbrain, vidbrain_state )
|
||||
MCFG_F3853_ADD(F3853_TAG, XTAL_4MHz/2, smi_intf)
|
||||
|
||||
// cartridge
|
||||
MCFG_VIDEOBRAIN_EXPANSION_SLOT_ADD(VIDEOBRAIN_EXPANSION_SLOT_TAG, expansion_intf, vidbrain_expansion_cards, NULL)
|
||||
MCFG_VIDEOBRAIN_EXPANSION_SLOT_ADD(VIDEOBRAIN_EXPANSION_SLOT_TAG, vidbrain_expansion_cards, NULL)
|
||||
|
||||
// software lists
|
||||
MCFG_SOFTWARE_LIST_ADD("cart_list", "vidbrain")
|
||||
|
Loading…
Reference in New Issue
Block a user