From 726983263b929a6f1f0a131d7b511242b8bf0437 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Sun, 20 Oct 2013 19:43:30 +0000 Subject: (MESS) comx35: Moved expansion port under emu/bus. (nw) --- src/emu/bus/comx35/exp.c | 238 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 src/emu/bus/comx35/exp.c (limited to 'src/emu/bus/comx35/exp.c') diff --git a/src/emu/bus/comx35/exp.c b/src/emu/bus/comx35/exp.c new file mode 100644 index 00000000000..aa117ac8eff --- /dev/null +++ b/src/emu/bus/comx35/exp.c @@ -0,0 +1,238 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + COMX-35 Expansion Slot emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#include "emu.h" +#include "emuopts.h" +#include "exp.h" + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type COMX_EXPANSION_SLOT = &device_creator; + + +//************************************************************************** +// DEVICE COMX_EXPANSION CARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_comx_expansion_card_interface - constructor +//------------------------------------------------- + +device_comx_expansion_card_interface::device_comx_expansion_card_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device), + m_ds(1) +{ + m_slot = dynamic_cast(device.owner()); +} + + +//------------------------------------------------- +// ~device_comx_expansion_card_interface - destructor +//------------------------------------------------- + +device_comx_expansion_card_interface::~device_comx_expansion_card_interface() +{ +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// comx_expansion_slot_device - constructor +//------------------------------------------------- + +comx_expansion_slot_device::comx_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, COMX_EXPANSION_SLOT, "COMX-35 expansion slot", tag, owner, clock, "comx_expansion_slot", __FILE__), + device_slot_interface(mconfig, *this) +{ +} + + +//------------------------------------------------- +// comx_expansion_slot_device - destructor +//------------------------------------------------- + +comx_expansion_slot_device::~comx_expansion_slot_device() +{ +} + + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void comx_expansion_slot_device::device_config_complete() +{ + // inherit a copy of the static data + const comx_expansion_slot_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + { + *static_cast(this) = *intf; + } + + // or initialize to defaults if none provided + else + { + memset(&m_out_int_cb, 0, sizeof(m_out_int_cb)); + memset(&m_out_wait_cb, 0, sizeof(m_out_wait_cb)); + memset(&m_out_clear_cb, 0, sizeof(m_out_clear_cb)); + } +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void comx_expansion_slot_device::device_start() +{ + m_card = dynamic_cast(get_card_device()); + + // resolve callbacks + m_out_int_func.resolve(m_out_int_cb, *this); + m_out_wait_func.resolve(m_out_wait_cb, *this); + m_out_clear_func.resolve(m_out_clear_cb, *this); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void comx_expansion_slot_device::device_reset() +{ +} + + +//------------------------------------------------- +// mrd_r - memory read +//------------------------------------------------- + +UINT8 comx_expansion_slot_device::mrd_r(address_space &space, offs_t offset, int *extrom) +{ + UINT8 data = 0; + + if (m_card != NULL) + { + data = m_card->comx_mrd_r(space, offset, extrom); + } + + return data; +} + + +//------------------------------------------------- +// mwr_w - memory write +//------------------------------------------------- + +void comx_expansion_slot_device::mwr_w(address_space &space, offs_t offset, UINT8 data) +{ + if (m_card != NULL) + { + m_card->comx_mwr_w(space, offset, data); + } +} + + +//------------------------------------------------- +// io_r - I/O read +//------------------------------------------------- + +UINT8 comx_expansion_slot_device::io_r(address_space &space, offs_t offset) +{ + UINT8 data = 0; + + if (m_card != NULL) + { + data = m_card->comx_io_r(space, offset); + } + + return data; +} + + +//------------------------------------------------- +// sout_w - I/O write +//------------------------------------------------- + +void comx_expansion_slot_device::io_w(address_space &space, offs_t offset, UINT8 data) +{ + if (m_card != NULL) + { + m_card->comx_io_w(space, offset, data); + } +} + + +//------------------------------------------------- +// ds_w - device select write +//------------------------------------------------- + +WRITE_LINE_MEMBER( comx_expansion_slot_device::ds_w ) +{ + if (m_card != NULL) + { + m_card->comx_ds_w(state); + } +} + + +//------------------------------------------------- +// q_w - Q write +//------------------------------------------------- + +WRITE_LINE_MEMBER( comx_expansion_slot_device::q_w ) +{ + if (m_card != NULL) + { + m_card->comx_q_w(state); + } +} + +READ_LINE_MEMBER( comx_expansion_slot_device::ef4_r ) +{ + int state = CLEAR_LINE; + + if (m_card != NULL) + { + state = m_card->comx_ef4_r(); + } + + return state; +} + +WRITE_LINE_MEMBER( comx_expansion_slot_device::int_w ) { m_out_int_func(state); } +WRITE_LINE_MEMBER( comx_expansion_slot_device::wait_w ) { m_out_wait_func(state); } +WRITE_LINE_MEMBER( comx_expansion_slot_device::clear_w ) { m_out_clear_func(state); } + + +//------------------------------------------------- +// SLOT_INTERFACE( comx_expansion_cards ) +//------------------------------------------------- + +SLOT_INTERFACE_START( comx_expansion_cards ) + SLOT_INTERFACE("eb", COMX_EB) + SLOT_INTERFACE("fd", COMX_FD) + SLOT_INTERFACE("clm", COMX_CLM) + SLOT_INTERFACE("ram", COMX_RAM) + SLOT_INTERFACE("joy", COMX_JOY) + SLOT_INTERFACE("prn", COMX_PRN) + SLOT_INTERFACE("thm", COMX_THM) + SLOT_INTERFACE("epr", COMX_EPR) +SLOT_INTERFACE_END -- cgit v1.2.3-70-g09d2