diff options
Diffstat (limited to 'src/devices/bus/oricext/oricext.c')
-rw-r--r-- | src/devices/bus/oricext/oricext.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/devices/bus/oricext/oricext.c b/src/devices/bus/oricext/oricext.c new file mode 100644 index 00000000000..e13b5c5f245 --- /dev/null +++ b/src/devices/bus/oricext/oricext.c @@ -0,0 +1,78 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +#include "oricext.h" +#include "jasmin.h" +#include "microdisc.h" + +const device_type ORICEXT_CONNECTOR = &device_creator<oricext_connector>; + +oricext_connector::oricext_connector(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, ORICEXT_CONNECTOR, "ORIC extension connector", tag, owner, clock, "oricext_connector", __FILE__), + device_slot_interface(mconfig, *this), + irq_handler(*this) +{ +} + +oricext_connector::~oricext_connector() +{ +} + +void oricext_connector::set_cputag(const char *tag) +{ + cputag = tag; +} + +void oricext_connector::device_start() +{ + irq_handler.resolve_safe(); +} + +void oricext_connector::irq_w(int state) +{ + irq_handler(state); +} + +void oricext_connector::device_config_complete() +{ + oricext_device *dev = dynamic_cast<oricext_device *>(get_card_device()); + if(dev) + dev->set_cputag(cputag); +} + +oricext_device::oricext_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_slot_card_interface(mconfig, *this) +{ +} + +void oricext_device::set_cputag(const char *tag) +{ + cputag = tag; +} + +void oricext_device::device_start() +{ + cpu = machine().device<m6502_device>(cputag); + connector = downcast<oricext_connector *>(owner()); + bank_c000_r = membank(":bank_c000_r"); + bank_e000_r = membank(":bank_e000_r"); + bank_f800_r = membank(":bank_f800_r"); + bank_c000_w = membank(":bank_c000_w"); + bank_e000_w = membank(":bank_e000_w"); + bank_f800_w = membank(":bank_f800_w"); + rom = (UINT8 *)machine().root_device().memregion(cputag)->base(); + ram = (UINT8 *)memshare(":ram")->ptr(); + + memset(junk_read, 0xff, sizeof(junk_read)); + memset(junk_write, 0x00, sizeof(junk_write)); +} + +WRITE_LINE_MEMBER(oricext_device::irq_w) +{ + connector->irq_w(state); +} + +SLOT_INTERFACE_START(oricext_intf) + SLOT_INTERFACE("jasmin", JASMIN) + SLOT_INTERFACE("microdisc", MICRODISC) +SLOT_INTERFACE_END |