diff options
Diffstat (limited to 'src/emu/bus/zorro')
-rw-r--r-- | src/emu/bus/zorro/a590.c | 346 | ||||
-rw-r--r-- | src/emu/bus/zorro/a590.h | 135 | ||||
-rw-r--r-- | src/emu/bus/zorro/action_replay.c | 150 | ||||
-rw-r--r-- | src/emu/bus/zorro/action_replay.h | 83 | ||||
-rw-r--r-- | src/emu/bus/zorro/cards.c | 31 | ||||
-rw-r--r-- | src/emu/bus/zorro/cards.h | 38 | ||||
-rw-r--r-- | src/emu/bus/zorro/zorro.c | 358 | ||||
-rw-r--r-- | src/emu/bus/zorro/zorro.h | 443 |
8 files changed, 1584 insertions, 0 deletions
diff --git a/src/emu/bus/zorro/a590.c b/src/emu/bus/zorro/a590.c new file mode 100644 index 00000000000..d6ca7d12b6b --- /dev/null +++ b/src/emu/bus/zorro/a590.c @@ -0,0 +1,346 @@ +/*************************************************************************** + + Commodore A590 / A2091 + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + DMAC based HD controller for the Amiga 500 and Zorro-II + +***************************************************************************/ + +#include "a590.h" +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsihd.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type A590 = &device_creator<a590_device>; +const device_type A2091 = &device_creator<a2091_device>; + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( a590_pcb ) + PORT_START("dips") + PORT_DIPNAME(0x01, 0x01, "A590 Auto-Boot") + PORT_DIPLOCATION("DIP:1") + PORT_DIPSETTING(0x00, "Enabled") + PORT_DIPSETTING(0x01, "Disabled") + PORT_DIPNAME(0x02, 0x00, "A590 LUN") + PORT_DIPLOCATION("DIP:2") + PORT_DIPSETTING(0x00, "Disabled") + PORT_DIPSETTING(0x02, "Enabled") + PORT_DIPNAME(0x04, 0x04, "A590 Wait period") + PORT_DIPLOCATION("DIP:3") + PORT_DIPSETTING(0x00, "Short") + PORT_DIPSETTING(0x04, "Long") + PORT_DIPNAME(0x08, 0x00, "A590 Reserved") + PORT_DIPLOCATION("DIP:4") + PORT_DIPSETTING(0x00, "Enabled") + PORT_DIPSETTING(0x08, "Disabled") + PORT_START("jp1") + PORT_DIPNAME(0x0f, 0x01, "A590 Memory size") + PORT_DIPLOCATION("JP1:1,2,3,4") + PORT_DIPSETTING(0x01, "Amnesia") + PORT_DIPSETTING(0x02, "512K") + PORT_DIPSETTING(0x04, "1MB") + PORT_DIPSETTING(0x08, "2MB") + PORT_START("jp2") + PORT_DIPNAME(0x01, 0x00, "A590 Drive LED") + PORT_DIPLOCATION("JP2:1") + PORT_DIPSETTING(0x00, "XT Drive") + PORT_DIPSETTING(0x01, "SCSI Drive") + PORT_START("jp4") + PORT_DIPNAME(0x01, 0x00, "A590 Interrupt") + PORT_DIPLOCATION("JP4:1") + PORT_DIPSETTING(0x00, "INT 2") + PORT_DIPSETTING(0x01, "INT 6") +INPUT_PORTS_END + +ioport_constructor a590_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( a590_pcb ); +} + +static INPUT_PORTS_START( a2091_pcb ) + PORT_START("jp1") + PORT_DIPNAME(0x0f, 0x01, "A2091 Memory size") + PORT_DIPLOCATION("JP1:1,2,3,4") + PORT_DIPSETTING(0x01, "0K") + PORT_DIPSETTING(0x02, "512K") + PORT_DIPSETTING(0x04, "1MB") + PORT_DIPSETTING(0x08, "2MB") + PORT_START("jp2") + PORT_DIPNAME(0x01, 0x00, "A2091 Auto-Boot") + PORT_DIPLOCATION("JP2:1") + PORT_DIPSETTING(0x00, "Enabled") + PORT_DIPSETTING(0x01, "Disabled") + PORT_START("jp3") + PORT_DIPNAME(0x01, 0x00, "A2091 Interrupt") + PORT_DIPLOCATION("JP3:1") + PORT_DIPSETTING(0x00, "INT 2") + PORT_DIPSETTING(0x01, "INT 6") + PORT_START("jp5") + PORT_DIPNAME(0x01, 0x00, "A2091 LUN") + PORT_DIPLOCATION("JP5:1") + PORT_DIPSETTING(0x00, "Disabled") + PORT_DIPSETTING(0x01, "Enabled") + PORT_DIPNAME(0x02, 0x00, "A2091 Time-Out") + PORT_DIPLOCATION("JP5:2") + PORT_DIPSETTING(0x00, "Short") + PORT_DIPSETTING(0x02, "Long") + PORT_DIPNAME(0x04, 0x00, "A2091 Reserved") + PORT_DIPLOCATION("JP5:3") + PORT_DIPSETTING(0x00, "Disabled") + PORT_DIPSETTING(0x02, "Enabled") + PORT_START("jp201") + PORT_DIPNAME(0x01, 0x00, "A2091 WD33C93 Clock") + PORT_DIPLOCATION("JP201:1") + PORT_DIPSETTING(0x00, "7 MHz") + PORT_DIPSETTING(0x01, "14 MHz") +INPUT_PORTS_END + +ioport_constructor a2091_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( a2091_pcb ); +} + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( dmac_hdc ) + MCFG_DMAC_ADD("dmac", 0) + MCFG_DMAC_SCSI_READ_HANDLER(READ8(dmac_hdc_device, dmac_scsi_r)) + MCFG_DMAC_SCSI_WRITE_HANDLER(WRITE8(dmac_hdc_device, dmac_scsi_w)) + MCFG_DMAC_INT_HANDLER(WRITELINE(dmac_hdc_device, dmac_int_w)) + MCFG_DMAC_CFGOUT_HANDLER(WRITELINE(dmac_hdc_device, dmac_cfgout_w)) + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_1) + MCFG_DEVICE_ADD("scsi:wd33c93", WD33C93, 0) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_WD33C93_IRQ_CB(DEVWRITELINE("^^", dmac_hdc_device, scsi_irq_w)) +MACHINE_CONFIG_END + +machine_config_constructor dmac_hdc_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( dmac_hdc ); +} + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +ROM_START( dmac_hdc ) + ROM_REGION16_BE(0x8000, "bootrom", 0) + ROM_DEFAULT_BIOS("v70") + + ROM_SYSTEM_BIOS(0, "v60", "Version 6.0") + ROMX_LOAD("390388-03.u13", 0x0000, 0x2000, CRC(2e77bbff) SHA1(8a098845068f32cfa4d34a278cd290f61d35a52c), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("390389-03.u12", 0x0001, 0x2000, CRC(b0b8cf24) SHA1(fcf4017505f4d441814b45d559c19eab43816b30), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("390388-03.u13", 0x4000, 0x2000, CRC(2e77bbff) SHA1(8a098845068f32cfa4d34a278cd290f61d35a52c), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("390389-03.u12", 0x4001, 0x2000, CRC(b0b8cf24) SHA1(fcf4017505f4d441814b45d559c19eab43816b30), ROM_SKIP(1) | ROM_BIOS(1)) + + // changelog v6.1: prevent accesses to location 0 by application programs + ROM_SYSTEM_BIOS(1, "v61", "Version 6.1") + ROMX_LOAD("390721-01.u13", 0x0000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390722-01.u12", 0x0001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390721-01.u13", 0x4000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390722-01.u12", 0x4001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) + + // changelog v6.6: fixes dual scsi problems with the wd33c93a controller + ROM_SYSTEM_BIOS(2, "v66", "Version 6.6") + ROMX_LOAD("390721-02.u13", 0x0000, 0x2000, CRC(c0871d25) SHA1(e155f18abb90cf820589c15e70559d3b6b391af8), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("390722-02.u12", 0x0001, 0x2000, CRC(e536bbb2) SHA1(fd7f8a6da18c1b02d07eb990c2467a24183ede12), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("390721-02.u13", 0x4000, 0x2000, CRC(c0871d25) SHA1(e155f18abb90cf820589c15e70559d3b6b391af8), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("390722-02.u12", 0x4001, 0x2000, CRC(e536bbb2) SHA1(fd7f8a6da18c1b02d07eb990c2467a24183ede12), ROM_SKIP(1) | ROM_BIOS(3)) + + // final commodore released version + ROM_SYSTEM_BIOS(3, "v70", "Version 7.0") + ROMX_LOAD("390721-03.u13", 0x0000, 0x2000, CRC(2942747a) SHA1(dbd7648e79c753337ff3e4f491de224bf05e6bb6), ROM_SKIP(1) | ROM_BIOS(4)) + ROMX_LOAD("390722-03.u12", 0x0001, 0x2000, CRC(a9ccffed) SHA1(149f5bd52e2d29904e3de483b9ad772448e9278e), ROM_SKIP(1) | ROM_BIOS(4)) + ROMX_LOAD("390721-03.u13", 0x4000, 0x2000, CRC(2942747a) SHA1(dbd7648e79c753337ff3e4f491de224bf05e6bb6), ROM_SKIP(1) | ROM_BIOS(4)) + ROMX_LOAD("390722-03.u12", 0x4001, 0x2000, CRC(a9ccffed) SHA1(149f5bd52e2d29904e3de483b9ad772448e9278e), ROM_SKIP(1) | ROM_BIOS(4)) + + // third-party upgrade rom, requires a small rom adapter pcb + ROM_SYSTEM_BIOS(4, "g614", "Guru-ROM 6.14") + ROMX_LOAD("gururom_v614.bin", 0x0000, 0x8000, CRC(04e52f93) SHA1(6da21b6f5e8f8837d64507cd8a4d5cdcac4f426b), ROM_GROUPWORD | ROM_BIOS(5)) +ROM_END + +const rom_entry *dmac_hdc_device::device_rom_region() const +{ + return ROM_NAME( dmac_hdc ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// dmac_hdc_device - constructor +//------------------------------------------------- + +dmac_hdc_device::dmac_hdc_device(const machine_config &mconfig, device_type type, const char *tag, + device_t *owner, UINT32 clock, const char *name, const char *shortname) : + device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), + m_int6(false), + m_dmac(*this, "dmac"), + m_wdc(*this, "scsi:wd33c93") +{ +} + +a590_device::a590_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + dmac_hdc_device(mconfig, A590, tag, owner, clock, "CBM A590 HD Controller", "a590"), + device_exp_card_interface(mconfig, *this), + m_dips(*this, "dips"), + m_jp1(*this, "jp1"), + m_jp2(*this, "jp2"), + m_jp4(*this, "jp4") +{ +} + +a2091_device::a2091_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + dmac_hdc_device(mconfig, A2091, tag, owner, clock, "CBM A2091 HD Controller", "a2091"), + device_zorro2_card_interface(mconfig, *this), + m_jp1(*this, "jp1"), + m_jp2(*this, "jp2"), + m_jp3(*this, "jp3"), + m_jp5(*this, "jp5"), + m_jp201(*this, "jp201") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void dmac_hdc_device::device_start() +{ +} + +void a590_device::device_start() +{ + set_zorro_device(); + + // setup dmac + m_dmac->set_address_space(m_slot->m_space); + m_dmac->set_rom(memregion("bootrom")->base()); +} + +void a2091_device::device_start() +{ + set_zorro_device(); + + // setup dmac + m_dmac->set_address_space(m_slot->m_space); + m_dmac->set_rom(memregion("bootrom")->base()); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void dmac_hdc_device::device_reset() +{ +} + +void dmac_hdc_device::resize_ram(int config) +{ + // allocate space for ram + switch (config & 0x0f) + { + case 0x01: + m_ram.resize(0); + m_dmac->ramsz_w(0); + break; + case 0x02: + m_ram.resize(0x080000); + m_dmac->ramsz_w(1); + break; + case 0x04: + m_ram.resize(0x100000); + m_dmac->ramsz_w(2); + break; + case 0x08: + m_ram.resize(0x200000); + m_dmac->ramsz_w(3); + break; + } + + m_dmac->set_ram(m_ram); +} + +void a590_device::device_reset() +{ +} + +void a2091_device::device_reset() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +WRITE_LINE_MEMBER( a590_device::cfgin_w ) +{ + // make sure we configure ourselves first + m_int6 = m_jp4->read() & 0x01; + resize_ram(m_dips->read() & 0x0f); + + // then tell the dmac to start configuring + m_dmac->configin_w(state); +} + +WRITE_LINE_MEMBER( a2091_device::cfgin_w ) +{ + // make sure we configure ourselves first + m_int6 = m_jp3->read() & 0x01; + resize_ram(m_jp1->read() & 0x0f); + + // then tell the dmac to start configuring + m_dmac->configin_w(state); +} + +READ8_MEMBER( dmac_hdc_device::dmac_scsi_r ) +{ + switch (offset) + { + case 0x48: return m_wdc->read(space, 0); + case 0x49: return m_wdc->read(space, 1); + } + + return 0xff; +} + +WRITE8_MEMBER( dmac_hdc_device::dmac_scsi_w ) +{ + switch (offset) + { + case 0x48: m_wdc->write(space, 0, data); break; + case 0x49: m_wdc->write(space, 1, data); break; + } +} + +WRITE_LINE_MEMBER( dmac_hdc_device::dmac_int_w ) +{ + if (m_int6) + int6_w(state); + else + int2_w(state); +} + +WRITE_LINE_MEMBER( dmac_hdc_device::scsi_irq_w ) +{ + // should be or'ed with xt-ide irq + m_dmac->intx_w(state); +} diff --git a/src/emu/bus/zorro/a590.h b/src/emu/bus/zorro/a590.h new file mode 100644 index 00000000000..4682c72903f --- /dev/null +++ b/src/emu/bus/zorro/a590.h @@ -0,0 +1,135 @@ +/*************************************************************************** + + Commodore A590 / A2091 + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + DMAC based SCSI controller for the Amiga 500 and Zorro-II + +***************************************************************************/ + +#pragma once + +#ifndef __A590_H__ +#define __A590_H__ + +#include "emu.h" +#include "zorro.h" +#include "machine/dmac.h" +#include "machine/wd33c93.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> dmac_hdc_device + +class dmac_hdc_device : public device_t +{ +public: + // construction/destruction + dmac_hdc_device(const machine_config &mconfig, device_type type, const char *tag, + device_t *owner, UINT32 clock, const char *name, const char *shortname); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual const rom_entry *device_rom_region() const; + + DECLARE_READ8_MEMBER( dmac_scsi_r ); + DECLARE_WRITE8_MEMBER( dmac_scsi_w ); + DECLARE_WRITE_LINE_MEMBER( dmac_int_w ); + DECLARE_WRITE_LINE_MEMBER( dmac_cfgout_w ) { cfgout_w(state); } + DECLARE_WRITE_LINE_MEMBER( scsi_irq_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // to slot + virtual void cfgout_w(int state) = 0; + virtual void int2_w(int state) = 0; + virtual void int6_w(int state) = 0; + + // should be called when the ram size changes + void resize_ram(int config); + + // amiga interrupt target, int 2 or 6 + bool m_int6; + + // sub-devices + required_device<dmac_device> m_dmac; + required_device<wd33c93_device> m_wdc; + + dynamic_buffer m_ram; +}; + +// ======================> a590_device + +class a590_device : public dmac_hdc_device, public device_exp_card_interface +{ +public: + // construction/destruction + a590_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // optional information overrides + virtual ioport_constructor device_input_ports() const; + + // output to slot + virtual void cfgout_w(int state) { m_slot->cfgout_w(state); } + virtual void int2_w(int state) { m_slot->int2_w(state); } + virtual void int6_w(int state) { m_slot->int6_w(state); } + + // input from slot + virtual DECLARE_WRITE_LINE_MEMBER( cfgin_w ); + +private: + required_ioport m_dips; + required_ioport m_jp1; + required_ioport m_jp2; + required_ioport m_jp4; +}; + +// ======================> a2091_device + +class a2091_device : public dmac_hdc_device, public device_zorro2_card_interface +{ +public: + // construction/destruction + a2091_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // optional information overrides + virtual ioport_constructor device_input_ports() const; + + // output to slot + virtual void cfgout_w(int state) { m_slot->cfgout_w(state); } + virtual void int2_w(int state) { m_slot->int2_w(state); } + virtual void int6_w(int state) { m_slot->int6_w(state); } + + // input from slot + virtual DECLARE_WRITE_LINE_MEMBER( cfgin_w ); + +private: + required_ioport m_jp1; + required_ioport m_jp2; + required_ioport m_jp3; + required_ioport m_jp5; + required_ioport m_jp201; +}; + +// device type definition +extern const device_type A590; +extern const device_type A2091; + +#endif diff --git a/src/emu/bus/zorro/action_replay.c b/src/emu/bus/zorro/action_replay.c new file mode 100644 index 00000000000..890e0081373 --- /dev/null +++ b/src/emu/bus/zorro/action_replay.c @@ -0,0 +1,150 @@ +/*************************************************************************** + + Datel Action Replay + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + Freezer cartridge for Amiga 500 and Amiga 2000 + + Skeleton device, just loads the ROMs and generates the NMI + for now. + + Hardware notes: + - http://www.mways.co.uk/amiga/howtocode/text/actionreplay.php + +***************************************************************************/ + +#include "action_replay.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type ACTION_REPLAY_MK1 = &device_creator<action_replay_mk1_device>; +const device_type ACTION_REPLAY_MK2 = &device_creator<action_replay_mk2_device>; +const device_type ACTION_REPLAY_MK3 = &device_creator<action_replay_mk3_device>; + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( ar_button ) + PORT_START("freeze") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Freeze") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, action_replay_device, freeze, 0) +INPUT_PORTS_END + +ioport_constructor action_replay_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( ar_button ); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +ROM_START( ar_mk1 ) + ROM_REGION(0x10000, "firmware", 0) + ROM_DEFAULT_BIOS("v150") + ROM_SYSTEM_BIOS(0, "v100", "Version 1.00") + ROMX_LOAD("ar1_v100.bin", 0x0000, 0x10000, BAD_DUMP CRC(2d921771) SHA1(1ead9dda2dad29146441f5ef7218375022e01248), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v150", "Version 1.50") + ROMX_LOAD("ar1_v150.bin", 0x0000, 0x10000, BAD_DUMP CRC(f82c4258) SHA1(843b433b2c56640e045d5fdc854dc6b1a4964e7c), ROM_BIOS(2)) +ROM_END + +const rom_entry *action_replay_mk1_device::device_rom_region() const +{ + return ROM_NAME( ar_mk1 ); +} + +ROM_START( ar_mk2 ) + ROM_REGION(0x20000, "firmware", 0) + ROM_DEFAULT_BIOS("v214") + ROM_SYSTEM_BIOS(0, "v205", "Version 2.05") + ROMX_LOAD("ar2_v205.bin", 0x0000, 0x20000, BAD_DUMP CRC(4051eef8) SHA1(9df22b1d3285b522c223697c83d144d04e961a4a), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v212", "Version 2.12") + ROMX_LOAD("ar2_v212.bin", 0x0000, 0x20000, BAD_DUMP CRC(d29bdd86) SHA1(76c2900457badf22b742f0af48b78937e8b67694), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v214", "Version 2.14") + ROMX_LOAD("ar2_v214.bin", 0x0000, 0x20000, BAD_DUMP CRC(1bb3d0a8) SHA1(14b1f5a69efb6f4e2331970e6ca0f33c0f04ac91), ROM_BIOS(3)) +ROM_END + +const rom_entry *action_replay_mk2_device::device_rom_region() const +{ + return ROM_NAME( ar_mk2 ); +} + +ROM_START( ar_mk3 ) + ROM_REGION(0x40000, "firmware", 0) + ROM_DEFAULT_BIOS("v309") + ROM_SYSTEM_BIOS(0, "v309", "Version 3.09") + ROMX_LOAD("ar3_v309.evn", 0x00000, 0x20000, CRC(2b84519f) SHA1(7841873bf009d8341dfa2794b3751bacf86adcc8), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("ar3_v309.odd", 0x00001, 0x20000, CRC(1d35bd56) SHA1(6464be1626b519499e76e4e3409e8016515d48b6), ROM_SKIP(1) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v317", "Version 3.17") + ROMX_LOAD("ar3_v314.bin", 0x0000, 0x40000, BAD_DUMP CRC(009f7768) SHA1(0439d6ccc2a0e5c2e83fcf2389dc4d4a440a4c62), ROM_BIOS(2)) +ROM_END + +const rom_entry *action_replay_mk3_device::device_rom_region() const +{ + return ROM_NAME( ar_mk3 ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// action_replay_device - constructor +//------------------------------------------------- + +action_replay_device::action_replay_device(const machine_config &mconfig, device_type type, const char *tag, + device_t *owner, UINT32 clock, const char *name, const char *shortname) : + device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), + device_exp_card_interface(mconfig, *this), + m_button(*this, "freeze") +{ +} + +action_replay_mk1_device::action_replay_mk1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + action_replay_device(mconfig, ACTION_REPLAY_MK1, tag, owner, clock, "Datel Action Replay MK-I", "amiga_ar1") +{ +} + +action_replay_mk2_device::action_replay_mk2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + action_replay_device(mconfig, ACTION_REPLAY_MK1, tag, owner, clock, "Datel Action Replay MK-II", "amiga_ar2") +{ +} + +action_replay_mk3_device::action_replay_mk3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + action_replay_device(mconfig, ACTION_REPLAY_MK1, tag, owner, clock, "Datel Action Replay MK-III", "amiga_ar3") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void action_replay_device::device_start() +{ + set_zorro_device(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void action_replay_device::device_reset() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +INPUT_CHANGED_MEMBER( action_replay_device::freeze ) +{ + // pushing the freeze button generates an nmi + m_slot->ipl_w(newval == 1 ? 7 : 0); +} diff --git a/src/emu/bus/zorro/action_replay.h b/src/emu/bus/zorro/action_replay.h new file mode 100644 index 00000000000..f2520575fb7 --- /dev/null +++ b/src/emu/bus/zorro/action_replay.h @@ -0,0 +1,83 @@ +/*************************************************************************** + + Datel Action Replay + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + Freezer cartridge for Amiga 500 and Amiga 2000 + +***************************************************************************/ + +#pragma once + +#ifndef __ACTION_REPLAY_H__ +#define __ACTION_REPLAY_H__ + +#include "emu.h" +#include "zorro.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> action_replay_device + +class action_replay_device : public device_t, public device_exp_card_interface +{ +public: + // construction/destruction + action_replay_device(const machine_config &mconfig, device_type type, const char *tag, + device_t *owner, UINT32 clock, const char *name, const char *shortname); + + // optional information overrides + virtual ioport_constructor device_input_ports() const; + + DECLARE_INPUT_CHANGED_MEMBER( freeze ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + required_ioport m_button; +}; + +class action_replay_mk1_device : public action_replay_device +{ +public: + // construction/destruction + action_replay_mk1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; +}; + +class action_replay_mk2_device : public action_replay_device +{ +public: + // construction/destruction + action_replay_mk2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; +}; + +class action_replay_mk3_device : public action_replay_device +{ +public: + // construction/destruction + action_replay_mk3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; +}; + +// device type definition +extern const device_type ACTION_REPLAY_MK1; +extern const device_type ACTION_REPLAY_MK2; +extern const device_type ACTION_REPLAY_MK3; + +#endif diff --git a/src/emu/bus/zorro/cards.c b/src/emu/bus/zorro/cards.c new file mode 100644 index 00000000000..68af08c60a5 --- /dev/null +++ b/src/emu/bus/zorro/cards.c @@ -0,0 +1,31 @@ +/*************************************************************************** + + Amiga Zorro Cards + +***************************************************************************/ + +#include "cards.h" + +SLOT_INTERFACE_START( a1000_expansion_cards ) +SLOT_INTERFACE_END + +SLOT_INTERFACE_START( a500_expansion_cards ) + SLOT_INTERFACE("ar1", ACTION_REPLAY_MK1) + SLOT_INTERFACE("ar2", ACTION_REPLAY_MK2) + SLOT_INTERFACE("ar3", ACTION_REPLAY_MK3) + SLOT_INTERFACE("a590", A590) +SLOT_INTERFACE_END + +SLOT_INTERFACE_START( a2000_expansion_cards ) + SLOT_INTERFACE("ar1", ACTION_REPLAY_MK1) + SLOT_INTERFACE("ar2", ACTION_REPLAY_MK2) + SLOT_INTERFACE("ar3", ACTION_REPLAY_MK3) +SLOT_INTERFACE_END + +SLOT_INTERFACE_START( zorro2_cards ) + SLOT_INTERFACE("a2091", A2091) +SLOT_INTERFACE_END + +SLOT_INTERFACE_START( zorro3_cards ) + SLOT_INTERFACE("a2091", A2091) +SLOT_INTERFACE_END diff --git a/src/emu/bus/zorro/cards.h b/src/emu/bus/zorro/cards.h new file mode 100644 index 00000000000..6c34f9394fb --- /dev/null +++ b/src/emu/bus/zorro/cards.h @@ -0,0 +1,38 @@ +/*************************************************************************** + + Amiga Zorro Cards + + There are different card types and layouts: + + * 86-pin expansion slot + - A1000 + - A500 (rotated slot) + - A2000/B2000 (internal slot) + * Zorro-II + - A2000 + - B2000 + * Zorro-III + - A3000, A4000 + + For details see zorro.h. Zorro-II cards can be inserted into + Zorro-III slots. + +***************************************************************************/ + +#pragma once + +#ifndef __CARDS_H__ +#define __CARDS_H__ + +#include "emu.h" +#include "a590.h" +#include "action_replay.h" + +SLOT_INTERFACE_EXTERN( a1000_expansion_cards ); +SLOT_INTERFACE_EXTERN( a500_expansion_cards ); +SLOT_INTERFACE_EXTERN( a2000_expansion_cards ); + +SLOT_INTERFACE_EXTERN( zorro2_cards ); +SLOT_INTERFACE_EXTERN( zorro3_cards ); + +#endif // __CARDS_H__ diff --git a/src/emu/bus/zorro/zorro.c b/src/emu/bus/zorro/zorro.c new file mode 100644 index 00000000000..91918c2ffea --- /dev/null +++ b/src/emu/bus/zorro/zorro.c @@ -0,0 +1,358 @@ +/*************************************************************************** + + Amiga Zorro Slots + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + 86-pin Expansion Slot (Zorro-I), Zorro-II, Zorro-III + +***************************************************************************/ + +#include "zorro.h" + + +//************************************************************************** +// ZORRO SLOT DEVICE +//************************************************************************** + +const device_type ZORRO_SLOT = &device_creator<zorro_slot_device>; + +//------------------------------------------------- +// zorro_slot_device - constructor +//------------------------------------------------- + +zorro_slot_device::zorro_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, ZORRO_SLOT, "Zorro slot", tag, owner, clock, "zorro_slot", __FILE__), + device_slot_interface(mconfig, *this), + m_zorro_tag(NULL) +{ +} + +zorro_slot_device::zorro_slot_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_interface(mconfig, *this), + m_zorro_tag(NULL) +{ +} + +void zorro_slot_device::set_zorro_slot(device_t &device, device_t *owner, const char *zorro_tag) +{ + zorro_slot_device &zorro_card = dynamic_cast<zorro_slot_device &>(device); + zorro_card.m_owner = owner; + zorro_card.m_zorro_tag = zorro_tag; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void zorro_slot_device::device_start() +{ + device_zorro_card_interface *dev = dynamic_cast<device_zorro_card_interface *>(get_card_device()); + + if (dev) + { + zorro_device *m_zorro_bus = downcast<zorro_device *>(m_owner->subdevice(m_zorro_tag)); + m_zorro_bus->add_card(dev); + } +} + + +//************************************************************************** +// BASE ZORRO BUS DEVICE +//************************************************************************** + +//------------------------------------------------- +// exp_slot_device - constructor +//------------------------------------------------- + +zorro_device::zorro_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), + m_space(NULL), + m_cputag(NULL), + m_ovr_handler(*this), + m_int2_handler(*this), + m_int6_handler(*this) +{ +} + +//------------------------------------------------- +// set_cputag - set cpu we are attached to +//------------------------------------------------- + +void zorro_device::set_cputag(device_t &device, const char *tag) +{ + zorro_device &zorro = downcast<zorro_device &>(device); + zorro.m_cputag = tag; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void zorro_device::device_start() +{ + // get address space + device_t *cpu = machine().device(m_cputag); + m_space = &cpu->memory().space(AS_PROGRAM); + + // resolve callbacks + m_ovr_handler.resolve_safe(); + m_int2_handler.resolve_safe(); + m_int6_handler.resolve_safe(); +} + +// from slot device +WRITE_LINE_MEMBER( zorro_device::ovr_w ) { m_ovr_handler(state); } +WRITE_LINE_MEMBER( zorro_device::int2_w ) { m_int2_handler(state); } +WRITE_LINE_MEMBER( zorro_device::int6_w ) { m_int6_handler(state); } + + +//************************************************************************** +// EXPANSION SLOT DEVICE +//************************************************************************** + +const device_type EXP_SLOT = &device_creator<exp_slot_device>; + +//------------------------------------------------- +// exp_slot_device - constructor +//------------------------------------------------- + +exp_slot_device::exp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + zorro_device(mconfig, EXP_SLOT, "86-pin expansion slot", tag, owner, clock, "exp_slot", __FILE__), + m_ipl_handler(*this), + m_dev(NULL) +{ +} + +exp_slot_device::exp_slot_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) : + zorro_device(mconfig, type, name, tag, owner, clock, shortname, source), + m_ipl_handler(*this), + m_dev(NULL) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void exp_slot_device::device_start() +{ + // resolve callbacks + m_ipl_handler.resolve_safe(); + + // call base device start + zorro_device::device_start(); +} + +//------------------------------------------------- +// add_card - add new card to our bus +//------------------------------------------------- + +void exp_slot_device::add_card(device_zorro_card_interface *card) +{ + m_dev = downcast<device_exp_card_interface *>(card); +} + +// from slot device +void exp_slot_device::ipl_w(int interrupt) { m_ipl_handler(0, interrupt, 0xff); } + +// from host +void exp_slot_device::fc_w(int code) { if (m_dev) m_dev->fc_w(code); } + + +//************************************************************************** +// ZORRO2 DEVICE +//************************************************************************** + +const device_type ZORRO2 = &device_creator<zorro2_device>; + +//------------------------------------------------- +// zorro2_device - constructor +//------------------------------------------------- + +zorro2_device::zorro2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + zorro_device(mconfig, ZORRO2, "Zorro-II bus", tag, owner, clock, "zorro2", __FILE__), + m_eint1_handler(*this), + m_eint4_handler(*this), + m_eint5_handler(*this), + m_eint7_handler(*this), + m_autoconfig_device(NULL) +{ +} + +zorro2_device::zorro2_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) : + zorro_device(mconfig, type, name, tag, owner, clock, shortname, source), + m_eint1_handler(*this), + m_eint4_handler(*this), + m_eint5_handler(*this), + m_eint7_handler(*this), + m_autoconfig_device(NULL) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void zorro2_device::device_start() +{ + // resolve callbacks + m_eint1_handler.resolve_safe(); + m_eint4_handler.resolve_safe(); + m_eint5_handler.resolve_safe(); + m_eint7_handler.resolve_safe(); + + // call base device start + zorro_device::device_start(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void zorro2_device::device_reset() +{ + // initiate autoconfig + m_autoconfig_device = m_dev.first(); + + // if we have a device, start the autoconfig chain + if (m_autoconfig_device) + m_autoconfig_device->cfgin_w(0); +} + +//------------------------------------------------- +// add_card - add new card to our bus +//------------------------------------------------- + +void zorro2_device::add_card(device_zorro_card_interface *card) +{ + device_zorro2_card_interface *zorro2_card = downcast<device_zorro2_card_interface *>(card); + card->set_zorro_bus(this); + m_dev.append(*zorro2_card); +} + +// from slot device +WRITE_LINE_MEMBER( zorro2_device::eint1_w ) { m_eint1_handler(state); } +WRITE_LINE_MEMBER( zorro2_device::eint4_w ) { m_eint4_handler(state); } +WRITE_LINE_MEMBER( zorro2_device::eint5_w ) { m_eint5_handler(state); } +WRITE_LINE_MEMBER( zorro2_device::eint7_w ) { m_eint7_handler(state); } + +WRITE_LINE_MEMBER( zorro2_device::cfgout_w ) +{ + m_autoconfig_device = m_autoconfig_device->next(); + + // if there is still a device in the chain, tell it to configure itself + if (m_autoconfig_device) + m_autoconfig_device->cfgin_w(0); +} + +// from host +void zorro2_device::fc_w(int code) +{ + device_zorro2_card_interface *entry = m_dev.first(); + + while (entry) + { + entry->fc_w(code); + entry = entry->next(); + } +} + + +//************************************************************************** +// ZORRO INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_zorro_card_interface - constructor +//------------------------------------------------- + +device_zorro_card_interface::device_zorro_card_interface(const machine_config &mconfig, device_t &device) : + device_slot_card_interface(mconfig, device), + m_zorro(NULL) +{ +} + +//------------------------------------------------- +// ~device_zorro_card_interface - destructor +//------------------------------------------------- + +device_zorro_card_interface::~device_zorro_card_interface() +{ +} + +void device_zorro_card_interface::set_zorro_bus(zorro_device *device) +{ + m_zorro = device; +} + +void device_zorro_card_interface::fc_w(int code) +{ +} + +WRITE_LINE_MEMBER( device_zorro_card_interface::cfgin_w ) +{ +} + + +//************************************************************************** +// EXPANSION CARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_exp_card_interface - constructor +//------------------------------------------------- + +device_exp_card_interface::device_exp_card_interface(const machine_config &mconfig, device_t &device) : + device_zorro_card_interface(mconfig, device), + m_slot(NULL) +{ +} + +//------------------------------------------------- +// ~device_exp_card_interface - destructor +//------------------------------------------------- + +device_exp_card_interface::~device_exp_card_interface() +{ +} + +void device_exp_card_interface::set_zorro_device() +{ + m_slot = dynamic_cast<exp_slot_device *>(m_zorro); +} + + +//************************************************************************** +// ZORRO-II CARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_zorro2_interface - constructor +//------------------------------------------------- + +device_zorro2_card_interface::device_zorro2_card_interface(const machine_config &mconfig, device_t &device) : + device_zorro_card_interface(mconfig, device), + m_next(NULL), + m_slot(NULL) +{ +} + +//------------------------------------------------- +// ~device_zorro2_interface - destructor +//------------------------------------------------- + +device_zorro2_card_interface::~device_zorro2_card_interface() +{ +} + +void device_zorro2_card_interface::set_zorro_device() +{ + m_slot = dynamic_cast<zorro2_device *>(m_zorro); +} diff --git a/src/emu/bus/zorro/zorro.h b/src/emu/bus/zorro/zorro.h new file mode 100644 index 00000000000..d018b217374 --- /dev/null +++ b/src/emu/bus/zorro/zorro.h @@ -0,0 +1,443 @@ +/*************************************************************************** + + Amiga Zorro Slots + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + 86-pin Expansion Slot (Zorro-I), Zorro-II, Zorro-III + + 86-pin Expansion Slot + + 2 Ground 1 Ground + 4 Ground 3 Ground + 6 +5VDC 5 +5VDC + 8 -5VDC 7 N/C + 10 +12VDC 9 N/C *1 + 12 CFGIN 11 N/C *2 + 14 /C3 Clock 13 Ground + 16 /C1 Clock 15 CDAC + 18 XRDY 17 /OVR + 20 N/C *3 19 /INT2 + 22 /INT6 21 A5 + 24 A4 23 A6 + 26 A3 25 Ground + 28 A7 27 A2 + 30 A8 29 A1 + 32 A9 31 FC0 + 34 A10 33 FC1 + 36 A11 35 FC2 + 38 A12 37 Ground + 40 /IPL0 39 A13 + 42 /IPL1 41 A14 + 44 /IPL2 43 A15 + 46 /BEER 45 A16 + 48 /VPA 47 A17 + 50 E Clock 49 Ground + 52 A18 51 /VMA + 54 A19 53 /RST + 56 A20 55 /HLT + 58 A21 57 A22 + 60 /BR *4 59 A23 + 62 /BGACK 61 Ground + 64 /BG *5 63 D15 + 66 /DTACK 65 D14 + 68 R/W 67 D13 + 70 /LDS 69 D12 + 72 /UDS 71 D11 + 74 /AS 73 Ground + 76 D10 75 D0 + 78 D9 77 D1 + 80 D8 79 D2 + 82 D7 81 D3 + 84 D6 83 D4 + 86 D5 85 Ground + + *1 28 MHz Clock on A2000 and B2000 + *2 /COPCFG on B2000 + *3 /PALOPE on A1000, /BOSS on B2000 + *4 /CBR on B2000 + *5 /CBG on B2000 + + Zorro-II (differences only) + + 7 /OWN + 9 /SLAVEn + 11 /CFGOUTn + 12 /CFGINn + 20 -12VDC + 40 /EINT7 + 42 /EINT5 + 44 /EINT4 + 60 /BRn + 64 /BGn + + 88 Ground 87 Ground + 90 Ground 89 Ground + 92 7 MHz 91 Ground + 94 /BURST 93 DOE + 96 /EINT1 95 /BG *5 + 98 N/C 97 N/C + 100 Ground 99 Ground + + *6 /GBG on B2000 + + Zorro-III + + The Zorro-III is a multiplexed Zorro-II bus with address- and + data phases. Signals changes as follows: + + 17 /CINH + 18 /MTCR + 29 /LOCK + 30 AD8 (D0) + 32 AD9 (D1) + 34 AD10 (D2) + 36 AD11 (D3) + 38 AD12 (D4) + 39 AD13 (D5) + 40 Reserved + 41 AD14 (D6) + 42 Reserved + 43 AD15 (D7) + 44 Reserved + 45 AD16 (D8) + 47 AD17 (D9) + 48 /MTACK + 51 /DS0 + 52 AD18 (D10) + 54 AD19 (D11) + 56 AD20 (D12) + 57 AD22 (D14) + 58 AD21 (D13) + 59 AD23 (D15) + 63 AD31 + 65 AD30 + 67 AD29 + 69 AD28 + 70 /DS2 + 71 AD27 + 72 /DS3 + 74 /CCS + 75 SD0 (D16) + 76 AD26 + 77 SD1 (D17) + 78 AD25 + 79 SD2 (D18) + 80 AD24 + 81 SD3 (D19) + 82 SD7 (D23) + 83 SD4 (D20) + 84 SD6 (D22) + 86 SD5 (D21) + 91 Sense Z3 + 94 /IORST + 95 /BCLR + 97 /FCS + 98 /DS1 + + +***************************************************************************/ + +#pragma once + +#ifndef __ZORRO_H__ +#define __ZORRO_H__ + +#include "emu.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_ZORRO_SLOT_ADD(_zorrotag, _tag, _slot_intf, _def_slot) \ + MCFG_DEVICE_ADD(_tag, ZORRO_SLOT, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ + zorro_slot_device::set_zorro_slot(*device, owner, _zorrotag); + +// ======================> expansion slot + +#define MCFG_EXPANSION_SLOT_ADD(_cputag, _slot_intf, _def_slot) \ + MCFG_DEVICE_ADD("exp", EXP_SLOT, 0) \ + zorro_device::set_cputag(*device, _cputag); \ + MCFG_ZORRO_SLOT_ADD("exp", "slot", _slot_intf, _def_slot) + +// callbacks +#define MCFG_EXPANSION_SLOT_OVR_HANDLER(_devcb) \ + devcb = &zorro_device::set_ovr_handler(*device, DEVCB2_##_devcb); + +#define MCFG_EXPANSION_SLOT_INT2_HANDLER(_devcb) \ + devcb = &zorro_device::set_int2_handler(*device, DEVCB2_##_devcb); + +#define MCFG_EXPANSION_SLOT_INT6_HANDLER(_devcb) \ + devcb = &zorro_device::set_int6_handler(*device, DEVCB2_##_devcb); + +#define MCFG_EXPANSION_SLOT_IPL_HANDLER(_devcb) \ + devcb = &exp_slot_device::set_ipl_handler(*device, DEVCB2_##_devcb); + +// ======================> zorro 2 bus + +#define MCFG_ZORRO2_ADD(_cputag) \ + MCFG_DEVICE_ADD("zorrobus", ZORRO2, 0) \ + zorro_device::set_cputag(*device, _cputag); + +#define MCFG_ZORRO2_SLOT_ADD(_tag, _slot_intf, _def_slot) \ + MCFG_ZORRO_SLOT_ADD("zorrobus", _tag, _slot_intf, _def_slot) + +#define MCFG_ZORRO2_OVR_HANDLER(_devcb) \ + devcb = &zorro_device::set_ovr_handler(*device, DEVCB2_##_devcb); + +#define MCFG_ZORRO2_INT2_HANDLER(_devcb) \ + devcb = &zorro_device::set_int2_handler(*device, DEVCB2_##_devcb); + +#define MCFG_ZORRO2_INT6_HANDLER(_devcb) \ + devcb = &zorro_device::set_int6_handler(*device, DEVCB2_##_devcb); + +#define MCFG_ZORRO2_EINT1_HANDLER(_devcb) \ + devcb = &zorro2_device::set_eint1_handler(*device, DEVCB2_##_devcb); + +#define MCFG_ZORRO2_EINT4_HANDLER(_devcb) \ + devcb = &zorro2_device::set_eint4_handler(*device, DEVCB2_##_devcb); + +#define MCFG_ZORRO2_EINT5_HANDLER(_devcb) \ + devcb = &zorro2_device::set_eint5_handler(*device, DEVCB2_##_devcb); + +#define MCFG_ZORRO2_EINT7_HANDLER(_devcb) \ + devcb = &zorro2_device::set_eint7_handler(*device, DEVCB2_##_devcb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// forward declaration of card interfaces +class device_zorro_card_interface; +class device_exp_card_interface; +class device_zorro2_card_interface; + +// ======================> zorro slot device + +class zorro_slot_device : public device_t, public device_slot_interface +{ +public: + // construction/destruction + zorro_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + zorro_slot_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-level overrides + virtual void device_start(); + + // inline configuration + static void set_zorro_slot(device_t &device, device_t *owner, const char *zorro_tag); + +protected: + // configuration + const char *m_zorro_tag; +}; + +// device type definition +extern const device_type ZORRO_SLOT; + +// ======================> base zorro bus device + +class zorro_device : public device_t +{ +public: + // construction/destruction + zorro_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); + + // static configuration helpers + static void set_cputag(device_t &device, const char *tag); + + template<class _Object> static devcb2_base &set_int2_handler(device_t &device, _Object object) + { return downcast<zorro_device &>(device).m_int2_handler.set_callback(object); } + template<class _Object> static devcb2_base &set_int6_handler(device_t &device, _Object object) + { return downcast<zorro_device &>(device).m_int6_handler.set_callback(object); } + template<class _Object> static devcb2_base &set_ovr_handler(device_t &device, _Object object) + { return downcast<zorro_device &>(device).m_ovr_handler.set_callback(object); } + + virtual void add_card(device_zorro_card_interface *card) = 0; + + // interface (from slot device) + virtual DECLARE_WRITE_LINE_MEMBER( cfgout_w ) {}; + + DECLARE_WRITE_LINE_MEMBER( int2_w ); + DECLARE_WRITE_LINE_MEMBER( int6_w ); + DECLARE_WRITE_LINE_MEMBER( ovr_w ); + + // interface (from host) + virtual void fc_w(int code) = 0; + + // access to the host space + address_space *m_space; + +protected: + // device-level overrides + virtual void device_start(); + +private: + const char *m_cputag; + + devcb2_write_line m_ovr_handler; + devcb2_write_line m_int2_handler; + devcb2_write_line m_int6_handler; +}; + +// ======================> expansion slot device + +class exp_slot_device : public zorro_device +{ +public: + // construction/destruction + exp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + exp_slot_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); + + template<class _Object> static devcb2_base &set_ipl_handler(device_t &device, _Object object) + { return downcast<exp_slot_device &>(device).m_ipl_handler.set_callback(object); } + + // the expansion slot can only have a single card + virtual void add_card(device_zorro_card_interface *card); + + // interface (from slot device) + void ipl_w(int interrupt); + + // interface (from host) + virtual void fc_w(int code); + +protected: + // device-level overrides + virtual void device_start(); + +private: + devcb2_write8 m_ipl_handler; + + device_exp_card_interface *m_dev; +}; + +// device type definition +extern const device_type EXP_SLOT; + +// ======================> zorro2 slot device + +class zorro2_device : public zorro_device +{ +public: + // construction/destruction + zorro2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + zorro2_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); + + template<class _Object> static devcb2_base &set_eint1_handler(device_t &device, _Object object) + { return downcast<zorro2_device &>(device).m_eint1_handler.set_callback(object); } + template<class _Object> static devcb2_base &set_eint4_handler(device_t &device, _Object object) + { return downcast<zorro2_device &>(device).m_eint4_handler.set_callback(object); } + template<class _Object> static devcb2_base &set_eint5_handler(device_t &device, _Object object) + { return downcast<zorro2_device &>(device).m_eint5_handler.set_callback(object); } + template<class _Object> static devcb2_base &set_eint7_handler(device_t &device, _Object object) + { return downcast<zorro2_device &>(device).m_eint7_handler.set_callback(object); } + + // device-level overrides + virtual void device_reset(); + + // the zorro2 bus supports multiple cards + virtual void add_card(device_zorro_card_interface *card); + + // interface (from slot device) + virtual DECLARE_WRITE_LINE_MEMBER( cfgout_w ); + + DECLARE_WRITE_LINE_MEMBER( eint1_w ); + DECLARE_WRITE_LINE_MEMBER( eint4_w ); + DECLARE_WRITE_LINE_MEMBER( eint5_w ); + DECLARE_WRITE_LINE_MEMBER( eint7_w ); + + // interface (from host) + virtual void fc_w(int code); + +protected: + // device-level overrides + virtual void device_start(); + +private: + devcb2_write_line m_eint1_handler; + devcb2_write_line m_eint4_handler; + devcb2_write_line m_eint5_handler; + devcb2_write_line m_eint7_handler; + + simple_list<device_zorro2_card_interface> m_dev; + + // the device which is currently configuring + device_zorro2_card_interface *m_autoconfig_device; +}; + +// device type definition +extern const device_type ZORRO2; + + +// ======================> base zorro card interface + +class device_zorro_card_interface : public device_slot_card_interface +{ +public: + // construction/destruction + device_zorro_card_interface(const machine_config &mconfig, device_t &device); + virtual ~device_zorro_card_interface(); + + virtual void set_zorro_device() = 0; + + void set_zorro_bus(zorro_device *device); + + // interface (from device) + void cfgout_w(int state) { m_zorro->cfgout_w(state); } + + // interface (from host) + virtual void fc_w(int code); + virtual DECLARE_WRITE_LINE_MEMBER( cfgin_w ); + +protected: + zorro_device *m_zorro; +}; + +// ======================> expansion slot card interface + +class device_exp_card_interface : public device_zorro_card_interface +{ +public: + // construction/destruction + device_exp_card_interface(const machine_config &mconfig, device_t &device); + virtual ~device_exp_card_interface(); + + virtual void set_zorro_device(); + +protected: + exp_slot_device *m_slot; +}; + +// ======================> zorro2 card interface + +class device_zorro2_card_interface : public device_zorro_card_interface +{ +public: + // construction/destruction + device_zorro2_card_interface(const machine_config &mconfig, device_t &device); + virtual ~device_zorro2_card_interface(); + + virtual void set_zorro_device(); + + device_zorro2_card_interface *next() const { return m_next; } + device_zorro2_card_interface *m_next; + +protected: + zorro2_device *m_slot; +}; + + +// include this here so that you don't need to include it into every +// driver that uses zorro slots +#include "cards.h" + + +#endif // __ZORRO_H__ |