diff options
45 files changed, 2517 insertions, 1961 deletions
diff --git a/hash/amiga_hardware.xml b/hash/amiga_hardware.xml index 7d08fb3c08b..7123a9d4386 100644 --- a/hash/amiga_hardware.xml +++ b/hash/amiga_hardware.xml @@ -18,41 +18,65 @@ license:CC0-1.0 </part> </software> - <software name="a590"> - <!-- For Epson SCSI (P/N: 312711-01) --> - <description>A590 Setup Disk 1.1 (SCSI Harddisk)</description> + <!-- For use with Epson XT drives --> + <software name="a590_epson"> + <description>A590 Setup Disk 1.1 (Epson Hard Disk)</description> <year>1989</year> <publisher>Commodore</publisher> <part name="flop1" interface="floppy_3_5"> - <feature name="part_id" value="A590 Setup Disk 1.1 (SCSI Harddisk)" /> <dataarea name="flop" size="901120"> - <rom name="317734-01_a590_scsi.adf" size="901120" crc="a560a938" sha1="9c6136c6580779a948cd1c0b50cb229512af415c"/> + <rom name="317734-01_a590_epson.adf" size="901120" crc="a560a938" sha1="9c6136c6580779a948cd1c0b50cb229512af415c" /> </dataarea> </part> </software> - <software name="a590_wd" cloneof="a590"> - <!-- Earlier version P/N: 317734-02? --> - <!-- For WD93028-X-A (P/N: 312711-03) --> - <!-- Cylinders 782 (615), Heads 2 (4), Sectors/Track 27, Precomp 784, LZone 781, Bytes/Sector 512 --> - <description>A590 Setup Disk 1.23 (Western Digital Harddisk)</description> + <!-- For use with Western Digital XT drives --> + <!-- Modified "Drive definitions" file --> + <software name="a590_wd17" cloneof="a590_epson"> + <description>A590 Setup Disk 1.7 (Western Digital Hard Disk)</description> + <year>1989</year> + <publisher>Commodore</publisher> + <part name="flop1" interface="floppy_3_5"> + <dataarea name="flop" size="901120"> + <rom name="317734-02_a590_wd.adf" size="901120" crc="8337cc98" sha1="fd9f80cf6f18bc97161e867bde55724193cd2802" status="baddump" /> + </dataarea> + </part> + </software> + + <!-- For use with Western Digital XT drives --> + <software name="a590_wd123" cloneof="a590_epson"> + <description>A590 Setup Disk 1.23 (Western Digital Hard Disk)</description> <year>1990</year> <publisher>Commodore</publisher> <part name="flop1" interface="floppy_3_5"> - <feature name="part_id" value="A590 Setup Disk 1.23 (Western Digital Harddisk)" /> <dataarea name="flop" size="901120"> - <rom name="317734-03_a590_wd.adf" size="901120" crc="a88fda41" sha1="7424f8645e1903e3e4ec8bb824186868319be1f3"/> + <rom name="317734-03_a590_wd.adf" size="901120" crc="a88fda41" sha1="7424f8645e1903e3e4ec8bb824186868319be1f3" /> </dataarea> </part> </software> - <software name="a590_seagate" cloneof="a590"> - <description>A590 Setup Disk 1.23 (Seagate Harddisk)</description> - <year>1988</year> + <!-- For use with Seagate XT drives --> + <software name="a590_seagate" cloneof="a590_epson"> + <description>A590 Setup Disk 1.23 (Seagate Hard Disk)</description> + <year>1990</year> <publisher>Commodore</publisher> <part name="flop1" interface="floppy_3_5"> <dataarea name="flop" size="901120"> - <rom name="317734-04.adf" size="901120" crc="7f1623a7" sha1="1f3e20206eb83f60745e19538de3123089c8da24"/> + <rom name="317734-04_a590_seagate.adf" size="901120" crc="7f1623a7" sha1="1f3e20206eb83f60745e19538de3123089c8da24" /> + </dataarea> + </part> + </software> + + <!-- Missing: 317734-05 A590 Setup Disk (Western Digital Hard Disk) --> + + <!-- For use with SCSI drives --> + <software name="a590_scsi"> + <description>A590 Setup Disk (SCSI Hard Disk)</description> + <year>1991</year> + <publisher>Commodore</publisher> + <part name="flop1" interface="floppy_3_5"> + <dataarea name="flop" size="901120"> + <rom name="317734-06_a590_scsi.adf" size="901120" status="nodump" /> </dataarea> </part> </software> @@ -62,9 +86,8 @@ license:CC0-1.0 <year>1990</year> <publisher>Commodore</publisher> <part name="flop1" interface="floppy_3_5"> - <feature name="part_id" value="A590 RAM Test Software" /> <dataarea name="flop" size="901120"> - <rom name="317830-01_a590_ram_test.adf" size="901120" crc="6583d1d0" sha1="7779b825b8555956d341ff7e909ab71d89e2321c"/> + <rom name="317830-01_a590_ram_test.adf" size="901120" crc="6583d1d0" sha1="7779b825b8555956d341ff7e909ab71d89e2321c" /> </dataarea> </part> </software> @@ -74,35 +97,47 @@ license:CC0-1.0 <year>1988</year> <publisher>Commodore</publisher> <part name="flop1" interface="floppy_3_5"> - <feature name="part_id" value="A2024 JumpStart" /> <dataarea name="flop" size="901120"> - <rom name="317809-01_a2024_jumpstart.adf" size="901120" crc="dad46588" sha1="30c2c1f1d98bd008b2c67f3b23480181935d4b01"/> + <rom name="317809-01_a2024_jumpstart.adf" size="901120" crc="dad46588" sha1="30c2c1f1d98bd008b2c67f3b23480181935d4b01" /> + </dataarea> + </part> + </software> + + <!-- Missing: 317806-01 A2091 Setup Disk (referenced in the service manual) --> + <!-- Missing: 317806-02 A2091 Setup Disk (if it exists) --> + + <!-- Modified "Drive definitions" file --> + <software name="a2091_127"> + <description>A2091 Setup Disk 1.27</description> + <year>1990</year> + <publisher>Commodore</publisher> + <part name="flop1" interface="floppy_3_5"> + <dataarea name="flop" size="901120"> + <rom name="317806-03_a2091_setup.adf" size="901120" crc="1ec584cf" sha1="d3de14c860d56679e645d28ef5b30d54ec95cc07" status="baddump" /> </dataarea> </part> </software> - <software name="a2091"> - <!-- From service manual: Install (US): 317806-01, Install (De): 317807-01 (earlier versions?) --> - <!-- Harddisk: 313440-01 SCSI Quantum --> + <software name="a2091_130" cloneof="a2091_127"> <description>A2091 Setup Disk 1.30</description> <year>1991</year> <publisher>Commodore</publisher> <part name="flop1" interface="floppy_3_5"> - <feature name="part_id" value="A2091 Setup Disk 1.30" /> <dataarea name="flop" size="901120"> - <rom name="317806-04_a2091_setup.adf" size="901120" crc="122c8f93" sha1="603e106c1a44a209171610af8d48bc35ad31c9bc"/> + <rom name="317806-04_a2091_setup.adf" size="901120" crc="122c8f93" sha1="603e106c1a44a209171610af8d48bc35ad31c9bc" /> </dataarea> </part> </software> + <!-- Missing: 317807-01 A2091 Setup Disk (De) (referenced in the service manual) --> + <software name="a2058"> <description>A2058 RAM Test Disk</description> <year>1988</year> <publisher>Commodore</publisher> <part name="flop1" interface="floppy_3_5"> - <feature name="part_id" value="A2058 RAM Test Disk" /> <dataarea name="flop" size="901120"> - <rom name="317719-01_a2058_ram_test.adf" size="901120" crc="5dba7fc3" sha1="76fbce4bef7df0f6042c85376d9bdfd4d4911e74"/> + <rom name="317719-01_a2058_ram_test.adf" size="901120" crc="5dba7fc3" sha1="76fbce4bef7df0f6042c85376d9bdfd4d4911e74" /> </dataarea> </part> </software> @@ -112,9 +147,8 @@ license:CC0-1.0 <year>1990</year> <publisher>Commodore</publisher> <part name="flop1" interface="floppy_3_5"> - <feature name="part_id" value="A2232 Install" /> <dataarea name="flop" size="901120"> - <rom name="317769-01_a2232_install.adf" size="901120" crc="3caa21b7" sha1="24f47f6f88712f046303b8812a598043440a5e6d"/> + <rom name="317769-01_a2232_install.adf" size="901120" crc="3caa21b7" sha1="24f47f6f88712f046303b8812a598043440a5e6d" /> </dataarea> </part> </software> @@ -124,9 +158,8 @@ license:CC0-1.0 <year>1990</year> <publisher>Commodore</publisher> <part name="flop1" interface="floppy_3_5"> - <feature name="part_id" value="A2300 Genlock Demo" /> <dataarea name="flop" size="901120"> - <rom name="317718-02_a2300_genlock_demo.adf" size="901120" crc="464ff0f6" sha1="26b94e8d52d35e2746b74610bb9b65eb2f899297"/> + <rom name="317718-02_a2300_genlock_demo.adf" size="901120" crc="464ff0f6" sha1="26b94e8d52d35e2746b74610bb9b65eb2f899297" /> </dataarea> </part> </software> @@ -136,9 +169,8 @@ license:CC0-1.0 <year>1990</year> <publisher>Commodore</publisher> <part name="flop1" interface="floppy_3_5"> - <feature name="part_id" value="A2232 Test / Demo" /> <dataarea name="flop" size="901120"> - <rom name="317210-01_a2320_test_demo.adf" size="901120" crc="cff98aae" sha1="f46f7de0d908ed68abfd784d84b964cbce7dc503"/> + <rom name="317210-01_a2320_test_demo.adf" size="901120" crc="cff98aae" sha1="f46f7de0d908ed68abfd784d84b964cbce7dc503" /> </dataarea> </part> </software> @@ -150,7 +182,7 @@ license:CC0-1.0 <info name="usage" value="Requires FrameMaster Zorro card and FPU" /> <part name="flop1" interface="floppy_3_5"> <dataarea name="flop" size="901120"> - <rom name="rainbow2_diashow.adf" size="901120" crc="201b34eb" sha1="7d8d4e4b58f438d25b32f78106c944f7d264de17"/> + <rom name="rainbow2_diashow.adf" size="901120" crc="201b34eb" sha1="7d8d4e4b58f438d25b32f78106c944f7d264de17" /> </dataarea> </part> </software> @@ -162,7 +194,7 @@ license:CC0-1.0 <info name="usage" value="Requires FrameMaster Zorro card and FPU" /> <part name="flop1" interface="floppy_3_5"> <dataarea name="flop" size="901120"> - <rom name="rainbowpainter.adf" size="901120" crc="bda4991f" sha1="4b8d73487fcc92a2f8d21bf24c42ad373c28bc5f"/> + <rom name="rainbowpainter.adf" size="901120" crc="bda4991f" sha1="4b8d73487fcc92a2f8d21bf24c42ad373c28bc5f" /> </dataarea> </part> </software> diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 3b1a1560b25..9e67d97003f 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -4692,12 +4692,10 @@ if (BUSES["ZORRO"]~=null) then MAME_DIR .. "src/devices/bus/amiga/zorro/a2058.h", MAME_DIR .. "src/devices/bus/amiga/zorro/a2065.cpp", MAME_DIR .. "src/devices/bus/amiga/zorro/a2065.h", + MAME_DIR .. "src/devices/bus/amiga/zorro/a2091.cpp", + MAME_DIR .. "src/devices/bus/amiga/zorro/a2091.h", MAME_DIR .. "src/devices/bus/amiga/zorro/a2232.cpp", MAME_DIR .. "src/devices/bus/amiga/zorro/a2232.h", - MAME_DIR .. "src/devices/bus/amiga/zorro/a590.cpp", - MAME_DIR .. "src/devices/bus/amiga/zorro/a590.h", - MAME_DIR .. "src/devices/bus/amiga/zorro/action_replay.cpp", - MAME_DIR .. "src/devices/bus/amiga/zorro/action_replay.h", MAME_DIR .. "src/devices/bus/amiga/zorro/buddha.cpp", MAME_DIR .. "src/devices/bus/amiga/zorro/buddha.h", MAME_DIR .. "src/devices/bus/amiga/zorro/merlin.cpp", @@ -5821,3 +5819,23 @@ if (BUSES["HEATH_TLB_CONNECTOR"]~=null) then MAME_DIR .. "src/devices/bus/heathzenith/h19/tlb.h", } end + +--------------------------------------------------- +-- +--@src/devices/bus/amiga/cpuslot/cpuslot.h,BUSES["AMIGA_CPUSLOT"] = true +--------------------------------------------------- + +if (BUSES["AMIGA_CPUSLOT"]~=null) then + files { + MAME_DIR .. "src/devices/bus/amiga/cpuslot/cpuslot.cpp", + MAME_DIR .. "src/devices/bus/amiga/cpuslot/cpuslot.h", + MAME_DIR .. "src/devices/bus/amiga/cpuslot/cards.cpp", + MAME_DIR .. "src/devices/bus/amiga/cpuslot/cards.h", + MAME_DIR .. "src/devices/bus/amiga/cpuslot/a590.cpp", + MAME_DIR .. "src/devices/bus/amiga/cpuslot/a590.h", + MAME_DIR .. "src/devices/bus/amiga/cpuslot/action_replay.cpp", + MAME_DIR .. "src/devices/bus/amiga/cpuslot/action_replay.h", + MAME_DIR .. "src/devices/bus/amiga/cpuslot/megamix500.cpp", + MAME_DIR .. "src/devices/bus/amiga/cpuslot/megamix500.h", + } +end diff --git a/src/devices/bus/amiga/cpuslot/a590.cpp b/src/devices/bus/amiga/cpuslot/a590.cpp new file mode 100644 index 00000000000..39147b96cbc --- /dev/null +++ b/src/devices/bus/amiga/cpuslot/a590.cpp @@ -0,0 +1,267 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + Commodore A590 + + DMAC based SCSI controller for the A500 + + Notes: + - Hardware is almost identical to the A2091 controller for the A2000 + - Commodore supplied XT drives: Epson HMD-755 or WD WD93028-X-A + + TODO: + - DIP switch order/polarity + - JP3/JP4 switches (not really needed) + - Bootrom disable + - SCSI drives (fatalerrors early if you enable a drive) + - The XT drive should be a slot option + - Data corruption when installing WB31 (DMAC issue?) + +***************************************************************************/ + +#include "emu.h" +#include "a590.h" +#include "machine/nscsi_bus.h" +#include "bus/nscsi/devices.h" + +#define LOG_XT (1U << 1) + +#define VERBOSE (LOG_GENERAL) + +#include "logmacro.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AMIGA_CPUSLOT_A590, bus::amiga::cpuslot::a590_device, "amiga_a590", "Commodore A590") + +namespace bus::amiga::cpuslot { + +a590_device::a590_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, AMIGA_CPUSLOT_A590, tag, owner, clock), + device_amiga_cpuslot_interface(mconfig, *this), + m_irq(*this, "irq"), + m_dmac(*this, "dmac"), + m_wdc(*this, "scsi:7:wdc"), + m_xt(*this, "xt"), + m_jp1(*this, "jp1"), + m_dip(*this, "dip"), + m_ram_size(0) +{ +} + + +//************************************************************************** +// INPUT DEFINITIONS +//************************************************************************** + +static INPUT_PORTS_START( a590 ) + PORT_START("jp1") + PORT_CONFNAME(0x03, 0x03, "Installed RAM") + PORT_CONFSETTING(0x00, "None") + PORT_CONFSETTING(0x01, "512K") + PORT_CONFSETTING(0x02, "1MB") + PORT_CONFSETTING(0x03, "2MB") + + // JP3 (Switch HDD LED between XT and SCSI) + + // JP4 (Switch between generating INT2 or INT6) + + PORT_START("dip") + PORT_DIPNAME(0x01, 0x01, "Autoboot ROMs") + PORT_DIPLOCATION("DIP:1") + PORT_DIPSETTING(0x00, "Disabled") + PORT_DIPSETTING(0x01, "Enabled") + PORT_DIPNAME(0x02, 0x02, "LUN") + PORT_DIPLOCATION("DIP:2") + PORT_DIPSETTING(0x00, "Disabled") + PORT_DIPSETTING(0x02, "Enabled") + PORT_DIPNAME(0x04, 0x04, "Time-out") + PORT_DIPLOCATION("DIP:3") + PORT_DIPSETTING(0x00, "Short") + PORT_DIPSETTING(0x04, "Long") + PORT_DIPNAME(0x08, 0x08, "Reserved") + PORT_DIPLOCATION("DIP:4") + PORT_DIPSETTING(0x00, "Disabled") + PORT_DIPSETTING(0x08, "Enabled") +INPUT_PORTS_END + +ioport_constructor a590_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( a590 ); +} + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +ROM_START( firmware ) + ROM_REGION16_BE(0x8000, "bootrom", 0) + ROM_DEFAULT_BIOS("v70") + + ROM_SYSTEM_BIOS(0, "v44", "Version 4.4") + ROMX_LOAD("390389-01.u13", 0x0000, 0x2000, CRC(0dbc6d28) SHA1(79378b8693b334fe12ee8d393235e3b571bfb55b), ROM_SKIP(1) | ROM_BIOS(0)) + ROMX_LOAD("390388-01.u12", 0x0001, 0x2000, CRC(4d1b9757) SHA1(43ff80f7c5770566012d87118552842bb01010f5), ROM_SKIP(1) | ROM_BIOS(0)) + ROMX_LOAD("390389-01.u13", 0x4000, 0x2000, CRC(0dbc6d28) SHA1(79378b8693b334fe12ee8d393235e3b571bfb55b), ROM_SKIP(1) | ROM_BIOS(0)) + ROMX_LOAD("390388-01.u12", 0x4001, 0x2000, CRC(4d1b9757) SHA1(43ff80f7c5770566012d87118552842bb01010f5), ROM_SKIP(1) | ROM_BIOS(0)) + + ROM_SYSTEM_BIOS(1, "v46", "Version 4.6") + ROMX_LOAD("390389-02.u13", 0x0000, 0x2000, CRC(26013266) SHA1(60dedda8d406b2762ad1504a88a4d6e29c0fb10d), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("390388-02.u12", 0x0001, 0x2000, CRC(6c9cb089) SHA1(bd8c6bb79ae91a4d1b9ee76fdd11aaf97ca4358b), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("390389-02.u13", 0x4000, 0x2000, CRC(26013266) SHA1(60dedda8d406b2762ad1504a88a4d6e29c0fb10d), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("390388-02.u12", 0x4001, 0x2000, CRC(6c9cb089) SHA1(bd8c6bb79ae91a4d1b9ee76fdd11aaf97ca4358b), ROM_SKIP(1) | ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(2, "v60", "Version 6.0") + ROMX_LOAD("390389-03.u13", 0x0000, 0x2000, CRC(2e77bbff) SHA1(8a098845068f32cfa4d34a278cd290f61d35a52c), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390388-03.u12", 0x0001, 0x2000, CRC(b0b8cf24) SHA1(fcf4017505f4d441814b45d559c19eab43816b30), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390389-03.u13", 0x4000, 0x2000, CRC(2e77bbff) SHA1(8a098845068f32cfa4d34a278cd290f61d35a52c), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390388-03.u12", 0x4001, 0x2000, CRC(b0b8cf24) SHA1(fcf4017505f4d441814b45d559c19eab43816b30), ROM_SKIP(1) | ROM_BIOS(2)) + + ROM_SYSTEM_BIOS(3, "v61", "Version 6.1") + ROMX_LOAD("390721-01.u13", 0x0000, 0x2000, CRC(00dbf615) SHA1(503940d04fb3b49eaa61100fd3a487018b35e25a), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("390722-01.u12", 0x0001, 0x2000, CRC(c460cfdb) SHA1(0de457daec3b84f75e8fb344defe24ce56cda3e0), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("390721-01.u13", 0x4000, 0x2000, CRC(00dbf615) SHA1(503940d04fb3b49eaa61100fd3a487018b35e25a), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("390722-01.u12", 0x4001, 0x2000, CRC(c460cfdb) SHA1(0de457daec3b84f75e8fb344defe24ce56cda3e0), ROM_SKIP(1) | ROM_BIOS(3)) + + ROM_SYSTEM_BIOS(4, "v66", "Version 6.6") + // COPYRIGHT ©1991 CBM ALL RIGHTS RESERVED 390721-02V6.6 D464 + ROMX_LOAD("390721-02.u13", 0x0000, 0x2000, CRC(c0871d25) SHA1(e155f18abb90cf820589c15e70559d3b6b391af8), ROM_SKIP(1) | ROM_BIOS(4)) + // COPYRIGHT ©1991 CBM ALL RIGHTS RESERVED 390722-02V6.6 F929 + ROMX_LOAD("390722-02.u12", 0x0001, 0x2000, CRC(e536bbb2) SHA1(fd7f8a6da18c1b02d07eb990c2467a24183ede12), ROM_SKIP(1) | ROM_BIOS(4)) + ROMX_LOAD("390721-02.u13", 0x4000, 0x2000, CRC(c0871d25) SHA1(e155f18abb90cf820589c15e70559d3b6b391af8), ROM_SKIP(1) | ROM_BIOS(4)) + ROMX_LOAD("390722-02.u12", 0x4001, 0x2000, CRC(e536bbb2) SHA1(fd7f8a6da18c1b02d07eb990c2467a24183ede12), ROM_SKIP(1) | ROM_BIOS(4)) + + ROM_SYSTEM_BIOS(5, "v70", "Version 7.0") // also seen with -07 + ROMX_LOAD("390721-04.u13", 0x0000, 0x2000, CRC(2942747a) SHA1(dbd7648e79c753337ff3e4f491de224bf05e6bb6), ROM_SKIP(1) | ROM_BIOS(5)) + ROMX_LOAD("390722-04.u12", 0x0001, 0x2000, CRC(a9ccffed) SHA1(149f5bd52e2d29904e3de483b9ad772448e9278e), ROM_SKIP(1) | ROM_BIOS(5)) + ROMX_LOAD("390721-04.u13", 0x4000, 0x2000, CRC(2942747a) SHA1(dbd7648e79c753337ff3e4f491de224bf05e6bb6), ROM_SKIP(1) | ROM_BIOS(5)) + ROMX_LOAD("390722-04.u12", 0x4001, 0x2000, CRC(a9ccffed) SHA1(149f5bd52e2d29904e3de483b9ad772448e9278e), ROM_SKIP(1) | ROM_BIOS(5)) + + // third-party upgrade ROM, requires a small ROM adapter pcb + ROM_SYSTEM_BIOS(6, "g614", "Guru-ROM 6.14") + ROMX_LOAD("gururom_v614.bin", 0x0000, 0x8000, CRC(04e52f93) SHA1(6da21b6f5e8f8837d64507cd8a4d5cdcac4f426b), ROM_GROUPWORD | ROM_BIOS(6)) + + // pal16l8a + ROM_REGION(0x104, "ram_controller", 0) + ROM_LOAD("390333-03.u5", 0x000, 0x104, CRC(dc4a8d9b) SHA1(761a1318106e49057f95258699076ec1079967ad)) +ROM_END + +const tiny_rom_entry *a590_device::device_rom_region() const +{ + return ROM_NAME( firmware ); +} + + +//************************************************************************** +// MACHINE DEFINITIONS +//************************************************************************** + +void a590_device::wd33c93_config(device_t *device) +{ + device->set_clock(28.37516_MHz_XTAL / 4); // 7M + downcast<wd33c93a_device *>(device)->irq_cb().set(m_irq, FUNC(input_merger_any_high_device::in_w<0>)); + downcast<wd33c93a_device *>(device)->drq_cb().set(m_dmac, FUNC(amiga_dmac_device::sdreq_w)); +} + +void a590_device::device_add_mconfig(machine_config &config) +{ + AMIGA_DMAC(config, m_dmac, 28.37516_MHz_XTAL / 4); // 7M + m_dmac->set_rom("bootrom"); + m_dmac->cfgout_cb().set([this] (int state) { m_host->cfgout_w(state); }); + m_dmac->int_cb().set([this] (int state) { m_host->int2_w(state); }); + m_dmac->css_read_cb().set(m_wdc, FUNC(wd33c93a_device::indir_r)); + m_dmac->css_write_cb().set(m_wdc, FUNC(wd33c93a_device::indir_w)); + m_dmac->csx0_read_cb().set(FUNC(a590_device::xt_r)); + m_dmac->csx0_write_cb().set(FUNC(a590_device::xt_w)); + m_dmac->csx1_read_cb().set(FUNC(a590_device::dip_r)); + m_dmac->xdack_read_cb().set(m_xt, FUNC(xt_hdc_device::dack_r)); + m_dmac->xdack_write_cb().set(m_xt, FUNC(xt_hdc_device::dack_w)); + + INPUT_MERGER_ANY_HIGH(config, m_irq); + m_irq->output_handler().set(m_dmac, FUNC(amiga_dmac_device::intx_w)); + + NSCSI_BUS(config, "scsi", 0); + NSCSI_CONNECTOR(config, "scsi:0", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "scsi:1", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "scsi:3", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "scsi:4", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "scsi:5", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "scsi:6", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "scsi:7").option_set("wdc", WD33C93A).machine_config([this] (device_t *device) { wd33c93_config(device); }); + + XT_HDC(config, m_xt, 0); + m_xt->irq_handler().set(m_irq, FUNC(input_merger_any_high_device::in_w<1>)); + m_xt->drq_handler().set(m_dmac, FUNC(amiga_dmac_device::xdreq_w)); + + HARDDISK(config, "xt:primary"); +} + + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +void a590_device::device_start() +{ + // setup ram + m_ram = make_unique_clear<uint16_t[]>(0x200000/2); + + // setup dmac + m_dmac->set_address_space(&m_host->space()); + m_dmac->set_ram(m_ram.get()); + + // register for save states + save_pointer(NAME(m_ram), 0x200000/2); + save_item(NAME(m_ram_size)); +} + +// the dmac handles this +void a590_device::cfgin_w(int state) { m_dmac->configin_w(state); } + +void a590_device::rst_w(int state) +{ + // call rst first as it will unmap memory + m_dmac->rst_w(state); + + if (state == 0) + m_dmac->ramsz_w(m_jp1->read() & 0x03); +} + +uint8_t a590_device::xt_r(offs_t offset) +{ + LOGMASKED(LOG_XT, "xt_r(%02x)\n", offset); + + switch (offset) + { + case 0: return m_xt->data_r(); + case 1: return m_xt->status_r(); + case 2: return 0x02; // jumper: 20/40 MB + } + + return 0xff; +} + +void a590_device::xt_w(offs_t offset, uint8_t data) +{ + LOGMASKED(LOG_XT, "xt_w(%02x): %02x\n", offset, data); + + switch (offset) + { + case 0: m_xt->data_w(data); break; + case 1: m_xt->reset_w(data); break; + case 2: m_xt->select_w(data); break; + case 3: m_xt->control_w(data); break; + } +} + +uint8_t a590_device::dip_r(offs_t offset) +{ + // TODO: order to be verified + return m_dip->read() >> 1; +} + +} // namespace bus::amiga::cpuslot diff --git a/src/devices/bus/amiga/cpuslot/a590.h b/src/devices/bus/amiga/cpuslot/a590.h new file mode 100644 index 00000000000..f374d1b0169 --- /dev/null +++ b/src/devices/bus/amiga/cpuslot/a590.h @@ -0,0 +1,65 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + Commodore A590 + + DMAC based SCSI controller for the A500 + +***************************************************************************/ + +#ifndef MAME_BUS_AMIGA_CPUSLOT_A590_H +#define MAME_BUS_AMIGA_CPUSLOT_A590_H + +#pragma once + +#include "cpuslot.h" +#include "bus/isa/hdc.h" +#include "machine/autoconfig.h" +#include "machine/dmac.h" +#include "machine/input_merger.h" +#include "machine/wd33c9x.h" + + +namespace bus::amiga::cpuslot { + +class a590_device : public device_t, public device_amiga_cpuslot_interface +{ +public: + a590_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual ioport_constructor device_input_ports() const override ATTR_COLD; + virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; + virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; + + virtual void device_start() override ATTR_COLD; + + // device_cpuslot_interface overrides + virtual void cfgin_w(int state) override; + virtual void rst_w(int state) override; + +private: + void wd33c93_config(device_t *device); + + uint8_t xt_r(offs_t offset); + void xt_w(offs_t offset, uint8_t data); + uint8_t dip_r(offs_t offset); + + required_device<input_merger_any_high_device> m_irq; + required_device<amiga_dmac_device> m_dmac; + required_device<wd33c93a_device> m_wdc; + required_device<xt_hdc_device> m_xt; + required_ioport m_jp1; + required_ioport m_dip; + + std::unique_ptr<uint16_t[]> m_ram; + uint8_t m_ram_size; +}; + +} // namespace bus::amiga::cpuslot + +// device type declaration +DECLARE_DEVICE_TYPE_NS(AMIGA_CPUSLOT_A590, bus::amiga::cpuslot, a590_device) + +#endif // MAME_BUS_AMIGA_CPUSLOT_A590_H diff --git a/src/devices/bus/amiga/cpuslot/action_replay.cpp b/src/devices/bus/amiga/cpuslot/action_replay.cpp new file mode 100644 index 00000000000..4fe7f18a0ef --- /dev/null +++ b/src/devices/bus/amiga/cpuslot/action_replay.cpp @@ -0,0 +1,293 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + Datel Electronics Action Replay + + Freezer cartridge for the A500 and A2000 + + Notes: + - The first four bytes cannot be read if you read the ROM using + the cartridge. This the reason for the BAD_DUMP flags. + + TODO: + - MK1: Unimplemented (ROM: 0xf00000-0xf0ffff, RAM: 0x9fc000-0x9fffff) + - MK2: Partially works, but entering/exiting from cartridge isn't stable + - MK3: Not working (needs different reset handling) + - Unmapping ROM/RAM + - Reset behaviour: Real cartridge measures reset pulse length to + differentiate between keyboard reset and CPU RESET instruction + - Breakpoints + - A2000 version + +***************************************************************************/ + +#include "emu.h" +#include "action_replay.h" + +#define VERBOSE (LOG_GENERAL) + +#include "logmacro.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AMIGA_CPUSLOT_ACTION_REPLAY_MK1, bus::amiga::cpuslot::action_replay_mk1_device, "amiga_ar1", "Action Replay") +DEFINE_DEVICE_TYPE(AMIGA_CPUSLOT_ACTION_REPLAY_MK2, bus::amiga::cpuslot::action_replay_mk2_device, "amiga_ar2", "Action Replay MK II") +DEFINE_DEVICE_TYPE(AMIGA_CPUSLOT_ACTION_REPLAY_MK3, bus::amiga::cpuslot::action_replay_mk3_device, "amiga_ar3", "Action Replay MK III") + +namespace bus::amiga::cpuslot { + +action_replay_device_base::action_replay_device_base(const machine_config &mconfig, device_type type, size_t ram_size, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, type, tag, owner, clock), + device_amiga_cpuslot_interface(mconfig, *this), + m_rom(*this, "rom"), + m_ram(*this, "ram", ram_size, ENDIANNESS_BIG) +{ +} + +action_replay_mk1_device::action_replay_mk1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + action_replay_device_base(mconfig, AMIGA_CPUSLOT_ACTION_REPLAY_MK1, 0x4000, tag, owner, clock) +{ +} + +action_replay_mk2_device::action_replay_mk2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + action_replay_device_base(mconfig, AMIGA_CPUSLOT_ACTION_REPLAY_MK2, 0x10000, tag, owner, clock) +{ +} + +action_replay_mk2_device::action_replay_mk2_device(const machine_config &mconfig, device_type type, size_t ram_size, const char *tag, device_t *owner, uint32_t clock) : + action_replay_device_base(mconfig, type, ram_size, tag, owner, clock) +{ +} + +action_replay_mk3_device::action_replay_mk3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + action_replay_mk2_device(mconfig, AMIGA_CPUSLOT_ACTION_REPLAY_MK3, 0x10000, tag, owner, clock) +{ +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +void action_replay_mk2_device::regs_map(address_map &map) +{ + // base address 0x400000 + map(0x000000, 0x03ffff).rom().region("rom", 0); + map(0x000000, 0x000001).w(FUNC(action_replay_mk2_device::mode_w)); + map(0x000000, 0x000001).mirror(0x02).r(FUNC(action_replay_mk2_device::status_r)); + map(0x000006, 0x000007).w(FUNC(action_replay_mk2_device::restore_w)); + map(0x040000, 0x04ffff).mirror(0x30000).ram().share(m_ram); +} + + +//************************************************************************** +// INPUT DEFINITIONS +//************************************************************************** + +static INPUT_PORTS_START( action_replay ) + PORT_START("button") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Freeze") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(action_replay_device_base::freeze), 0) +INPUT_PORTS_END + +ioport_constructor action_replay_device_base::device_input_ports() const +{ + return INPUT_PORTS_NAME( action_replay ); +} + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +ROM_START( rom_mk1 ) + ROM_REGION(0x10000, "rom", 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(0)) + ROM_SYSTEM_BIOS(1, "v150", "Version 1.50") + ROMX_LOAD("ar1_v150.bin", 0x0000, 0x10000, BAD_DUMP CRC(f82c4258) SHA1(843b433b2c56640e045d5fdc854dc6b1a4964e7c), ROM_BIOS(1)) +ROM_END + +const tiny_rom_entry *action_replay_mk1_device::device_rom_region() const +{ + return ROM_NAME( rom_mk1 ); +} + +ROM_START( rom_mk2 ) + ROM_REGION16_BE(0x40000, "rom", 0) + ROM_DEFAULT_BIOS("v214") + ROM_SYSTEM_BIOS(0, "v205", "Version 2.05") + ROMX_LOAD("ar2_v205.bin", 0x00000, 0x20000, BAD_DUMP CRC(4051eef8) SHA1(9df22b1d3285b522c223697c83d144d04e961a4a), ROM_BIOS(0)) + ROM_RELOAD( 0x20000, 0x20000) + ROM_SYSTEM_BIOS(1, "v212", "Version 2.12") + ROMX_LOAD("ar2_v212.bin", 0x00000, 0x20000, BAD_DUMP CRC(d29bdd86) SHA1(76c2900457badf22b742f0af48b78937e8b67694), ROM_BIOS(1)) + ROM_RELOAD( 0x20000, 0x20000) + ROM_SYSTEM_BIOS(2, "v214", "Version 2.14") + ROMX_LOAD("ar2_v214.bin", 0x00000, 0x20000, BAD_DUMP CRC(1bb3d0a8) SHA1(14b1f5a69efb6f4e2331970e6ca0f33c0f04ac91), ROM_BIOS(2)) + ROM_RELOAD( 0x20000, 0x20000) +ROM_END + +const tiny_rom_entry *action_replay_mk2_device::device_rom_region() const +{ + return ROM_NAME( rom_mk2 ); +} + +ROM_START( rom_mk3 ) + ROM_REGION16_BE(0x40000, "rom", 0) + ROM_DEFAULT_BIOS("v317") + ROM_SYSTEM_BIOS(0, "v309", "Version 3.09") + ROMX_LOAD("ar3_v309.evn", 0x00000, 0x20000, CRC(2b84519f) SHA1(7841873bf009d8341dfa2794b3751bacf86adcc8), ROM_SKIP(1) | ROM_BIOS(0)) + ROMX_LOAD("ar3_v309.odd", 0x00001, 0x20000, CRC(1d35bd56) SHA1(6464be1626b519499e76e4e3409e8016515d48b6), ROM_SKIP(1) | ROM_BIOS(0)) + ROM_SYSTEM_BIOS(1, "v317", "Version 3.17") + ROMX_LOAD("ar3_v317.evn", 0x00000, 0x20000, CRC(5fb69a10) SHA1(2ce641d1e2e254769be7d1ba41aace079cb04e27), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("ar3_v317.odd", 0x00001, 0x20000, CRC(f767d072) SHA1(a7431d22bfdb746a8bb6073c9edf7a2b65c6d307), ROM_SKIP(1) | ROM_BIOS(1)) +ROM_END + +const tiny_rom_entry *action_replay_mk3_device::device_rom_region() const +{ + return ROM_NAME( rom_mk3 ); +} + + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +void action_replay_mk1_device::device_start() +{ +} + +void action_replay_mk1_device::freeze_w(int state) +{ + LOG("freeze_w: %d\n", state); +} + +void action_replay_mk2_device::install_chipmem_taps() +{ + m_chipmem_read_tap = m_host->space().install_read_tap + ( + 0x000000, 0x1fffff, + "chipmem_r", + [this] (offs_t offset, uint16_t &data, uint16_t mem_mask) + { + if (m_nmi_active) + { + // disable chip memory + m_host->ovr_w(0); + + // map action replay + m_host->space().install_rom(0x000000, 0x03ffff, 0x040000, m_rom); + m_host->space().install_device(0x400000, 0x47ffff, *this, &action_replay_mk2_device::regs_map); + + // the rom is mapped too late for this read, so adjust it with the data that would have been read + data = m_rom[offset >> 1]; + + m_nmi_active = false; + } + }, + &m_chipmem_read_tap + ); + + m_chipmem_write_tap = m_host->space().install_write_tap + ( + 0x000000, 0x1fffff, + "chipmem_w", + [this] (offs_t offset, uint16_t &data, uint16_t mem_mask) + { + if (m_reset) + { + // trigger nmi + LOG("trigger nmi\n"); + + m_nmi_active = true; + m_host->ipl7_w(1); + m_host->ipl7_w(0); + + m_reset = false; + } + }, + &m_chipmem_write_tap + ); +} + +void action_replay_mk2_device::device_start() +{ + m_status = STATUS_RESET; + m_reset = true; + + install_chipmem_taps(); + + // custom chip writes (by the cpu) get mirrored to internal ram + // TODO: exact range (probably supports mirrors) + m_custom_chip_tap = m_host->space().install_write_tap + ( + 0xdff000, 0xdff1ff, + "custom_chip_w", + [this] (offs_t offset, uint16_t &data, uint16_t mem_mask) + { + m_ram[(0xf000 | (offset & 0x1ff)) >> 1] = data; + }, + &m_custom_chip_tap + ); + +} + +void action_replay_mk2_device::freeze_w(int state) +{ + LOG("freeze_w: %d\n", state); + + if (state) + { + m_status = STATUS_BUTTON; + + m_nmi_active = true; + m_host->ipl7_w(1); + m_host->ipl7_w(0); + } +} + +void action_replay_mk2_device::rst_w(int state) +{ + LOG("rst_w: %d\n", state); + + if (state == 0) + { + m_status = STATUS_RESET; + m_reset = true; + } +} + +uint16_t action_replay_mk2_device::status_r(offs_t offset, uint16_t mem_mask) +{ + if (!machine().side_effects_disabled()) + LOG("status_r: %04x & %04x\n", m_status, mem_mask); + + return m_status; +} + +void action_replay_mk2_device::mode_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + // 1- enable freeze on read of 0xbfe001 + // -0 enable freeze on write of 0xbfd100 + + LOG("mode_w: %04x & %04x\n", data, mem_mask); + + m_mode = data & 0x03; +} + +void action_replay_mk2_device::restore_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + LOG("restore_w: %04x & %04x\n", data, mem_mask); + + // map chip memory again + m_host->ovr_w(1); + + // remapping chip memory has wiped out our tap, reinstall it + install_chipmem_taps(); +} + +} // namespace bus::amiga::cpuslot diff --git a/src/devices/bus/amiga/cpuslot/action_replay.h b/src/devices/bus/amiga/cpuslot/action_replay.h new file mode 100644 index 00000000000..21be7d7af2e --- /dev/null +++ b/src/devices/bus/amiga/cpuslot/action_replay.h @@ -0,0 +1,106 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + Datel Electronics Action Replay + + Freezer cartridge for the A500 and A2000 + +***************************************************************************/ + +#ifndef MAME_BUS_AMIGA_CPUSLOT_ACTION_REPLAY_H +#define MAME_BUS_AMIGA_CPUSLOT_ACTION_REPLAY_H + +#pragma once + +#include "cpuslot.h" + + +namespace bus::amiga::cpuslot { + +class action_replay_device_base : public device_t, public device_amiga_cpuslot_interface +{ +public: + DECLARE_INPUT_CHANGED_MEMBER( freeze ) { freeze_w(newval); }; + virtual void freeze_w(int state) = 0; + +protected: + action_replay_device_base(const machine_config &mconfig, device_type type, size_t ram_size, const char *tag, device_t *owner, uint32_t clock); + + virtual ioport_constructor device_input_ports() const override ATTR_COLD; + + required_region_ptr<uint16_t> m_rom; + memory_share_creator<uint16_t> m_ram; +}; + +class action_replay_mk1_device : public action_replay_device_base +{ +public: + action_replay_mk1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; + virtual void device_start() override ATTR_COLD; + + // action_replay_device_base overrides + virtual void freeze_w(int state) override; +}; + +class action_replay_mk2_device : public action_replay_device_base +{ +public: + action_replay_mk2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + action_replay_mk2_device(const machine_config &mconfig, device_type type, size_t ram_size, const char *tag, device_t *owner, uint32_t clock); + + virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; + virtual void device_start() override ATTR_COLD; + + // device_cpuslot_interface overrides + virtual void rst_w(int state) override; + + // action_replay_device_base overrides + virtual void freeze_w(int state) override; + +private: + void regs_map(address_map &map) ATTR_COLD; + void install_chipmem_taps(); + + uint16_t status_r(offs_t offset, uint16_t mem_mask); + void mode_w(offs_t offset, uint16_t data, uint16_t mem_mask); + void restore_w(offs_t offset, uint16_t data, uint16_t mem_mask); + + static constexpr uint8_t STATUS_BUTTON = 0x00; + static constexpr uint8_t STATUS_READ = 0x01; // 0xbfe001 + static constexpr uint8_t STATUS_WRITE = 0x02; // 0xbfd100 + static constexpr uint8_t STATUS_RESET = 0x03; + + memory_passthrough_handler m_custom_chip_tap; + memory_passthrough_handler m_chipmem_read_tap; + memory_passthrough_handler m_chipmem_write_tap; + + uint8_t m_status; + uint8_t m_mode; + + bool m_nmi_active; + bool m_reset; +}; + +class action_replay_mk3_device : public action_replay_mk2_device +{ +public: + action_replay_mk3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; +}; + +} // namespace bus::amiga::cpuslot + +// device type declaration +DECLARE_DEVICE_TYPE_NS(AMIGA_CPUSLOT_ACTION_REPLAY_MK1, bus::amiga::cpuslot, action_replay_mk1_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_CPUSLOT_ACTION_REPLAY_MK2, bus::amiga::cpuslot, action_replay_mk2_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_CPUSLOT_ACTION_REPLAY_MK3, bus::amiga::cpuslot, action_replay_mk3_device) + +#endif // MAME_BUS_AMIGA_CPUSLOT_ACTION_REPLAY_H diff --git a/src/devices/bus/amiga/cpuslot/cards.cpp b/src/devices/bus/amiga/cpuslot/cards.cpp new file mode 100644 index 00000000000..ec520bbec8d --- /dev/null +++ b/src/devices/bus/amiga/cpuslot/cards.cpp @@ -0,0 +1,35 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + 86-pin expansion slot (A500, A1000) + Coprocessor slot (A2000, B2000) + + Card options + +***************************************************************************/ + +#include "emu.h" +#include "cards.h" + +#include "a590.h" +#include "action_replay.h" +#include "megamix500.h" + + +void a1000_cpuslot_cards(device_slot_interface &device) +{ +} + +void a500_cpuslot_cards(device_slot_interface &device) +{ + device.option_add("a590", AMIGA_CPUSLOT_A590); + device.option_add("ar", AMIGA_CPUSLOT_ACTION_REPLAY_MK1); + device.option_add("ar2", AMIGA_CPUSLOT_ACTION_REPLAY_MK2); + device.option_add("ar3", AMIGA_CPUSLOT_ACTION_REPLAY_MK3); + device.option_add("megamix500", AMIGA_CPUSLOT_MEGAMIX500); +} + +void a2000_cpuslot_cards(device_slot_interface &device) +{ +} diff --git a/src/devices/bus/amiga/cpuslot/cards.h b/src/devices/bus/amiga/cpuslot/cards.h new file mode 100644 index 00000000000..e857f580697 --- /dev/null +++ b/src/devices/bus/amiga/cpuslot/cards.h @@ -0,0 +1,22 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + 86-pin expansion slot (A500, A1000) + Coprocessor slot (A2000, B2000) + + Card options + +***************************************************************************/ + +#ifndef MAME_BUS_AMIGA_CPUSLOT_CARDS_H +#define MAME_BUS_AMIGA_CPUSLOT_CARDS_H + +#pragma once + + +void a1000_cpuslot_cards(device_slot_interface &device) ATTR_COLD; +void a500_cpuslot_cards(device_slot_interface &device) ATTR_COLD; +void a2000_cpuslot_cards(device_slot_interface &device) ATTR_COLD; + +#endif // MAME_BUS_AMIGA_CPUSLOT_CARDS_H diff --git a/src/devices/bus/amiga/cpuslot/cpuslot.cpp b/src/devices/bus/amiga/cpuslot/cpuslot.cpp new file mode 100644 index 00000000000..d0731a9e751 --- /dev/null +++ b/src/devices/bus/amiga/cpuslot/cpuslot.cpp @@ -0,0 +1,60 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + 86-pin expansion slot (A500, A1000) + Coprocessor slot (A2000, B2000) + +***************************************************************************/ + +#include "emu.h" +#include "cpuslot.h" + + +// type definitions +DEFINE_DEVICE_TYPE(AMIGA_CPUSLOT, amiga_cpuslot_device, "amiga_cpuslot", "Amiga CPU Expansion Slot") + + +//************************************************************************** +// SLOT DEVICE +//************************************************************************** + +amiga_cpuslot_device::amiga_cpuslot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, AMIGA_CPUSLOT, tag, owner, clock), + device_single_card_slot_interface<device_amiga_cpuslot_interface>(mconfig, *this), + m_space(*this, finder_base::DUMMY_TAG, -1), + m_cfgout_cb(*this), + m_ovr_cb(*this), + m_int2_cb(*this), + m_int6_cb(*this), + m_ipl7_cb(*this) +{ +} + +void amiga_cpuslot_device::device_start() +{ + m_card = get_card_device(); +} + +void amiga_cpuslot_device::cfgin_w(int state) +{ + if (m_card) + m_card->cfgin_w(state); +} + +void amiga_cpuslot_device::rst_w(int state) +{ + if (m_card) + m_card->rst_w(state); +} + + +//************************************************************************** +// CARD INTERFACE +//************************************************************************** + +device_amiga_cpuslot_interface::device_amiga_cpuslot_interface(const machine_config &mconfig, device_t &device) : + device_interface(device, "amiga_cpuslot") +{ + m_host = dynamic_cast<amiga_cpuslot_device *>(device.owner()); +} diff --git a/src/devices/bus/amiga/cpuslot/cpuslot.h b/src/devices/bus/amiga/cpuslot/cpuslot.h new file mode 100644 index 00000000000..f4184506fe9 --- /dev/null +++ b/src/devices/bus/amiga/cpuslot/cpuslot.h @@ -0,0 +1,154 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + 86-pin expansion slot (A500, A1000) + Coprocessor slot (A2000, B2000) + + 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 RDY 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 /BERR 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 + +***************************************************************************/ + +#ifndef MAME_BUS_AMIGA_CPUSLOT_CPUSLOT_H +#define MAME_BUS_AMIGA_CPUSLOT_CPUSLOT_H + +#pragma once + + +// forward declaration +class device_amiga_cpuslot_interface; + + +//************************************************************************** +// DEVICE +//************************************************************************** + +class amiga_cpuslot_device : public device_t, public device_single_card_slot_interface<device_amiga_cpuslot_interface> +{ +public: + template <typename T> + amiga_cpuslot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) : + amiga_cpuslot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + + amiga_cpuslot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + + // configuration helpers + template <class T> + void set_space(T &&tag, int spacenum) { m_space.set_tag(std::forward<T>(tag), spacenum); } + + auto cfgout_cb() { return m_cfgout_cb.bind(); } + auto ovr_cb() { return m_ovr_cb.bind(); } + auto int2_cb() { return m_int2_cb.bind(); } + auto int6_cb() { return m_int6_cb.bind(); } + auto ipl7_cb() { return m_ipl7_cb.bind(); } + + // from host + void cfgin_w(int state); + void rst_w(int state); + + // from slot device + void int2_w(int state) { m_int2_cb(state); } + void int6_w(int state) { m_int6_cb(state); } + void ovr_w(int state) { m_ovr_cb(state); } + void cfgout_w(int state) { m_cfgout_cb(state); } + void ipl7_w(int state) { m_ipl7_cb(state); } + + address_space &space() const { return *m_space; } + +protected: + virtual void device_start() override ATTR_COLD; + +private: + device_amiga_cpuslot_interface *m_card; + + required_address_space m_space; + + devcb_write_line m_cfgout_cb; + devcb_write_line m_ovr_cb; + devcb_write_line m_int2_cb; + devcb_write_line m_int6_cb; + devcb_write_line m_ipl7_cb; +}; + + +//************************************************************************** +// INTERFACE +//************************************************************************** + +class device_amiga_cpuslot_interface : public device_interface +{ +public: + // interface (from host) + virtual void cfgin_w(int state) { } + virtual void rst_w(int state) { } + +protected: + device_amiga_cpuslot_interface(const machine_config &mconfig, device_t &device); + + amiga_cpuslot_device *m_host; +}; + + +// device type declarations +DECLARE_DEVICE_TYPE(AMIGA_CPUSLOT, amiga_cpuslot_device) + + +// include this here so that you don't need to include it into every driver that uses zorro slots +#include "cards.h" + + +#endif // MAME_BUS_AMIGA_CPUSLOT_CPUSLOT_H diff --git a/src/devices/bus/amiga/cpuslot/megamix500.cpp b/src/devices/bus/amiga/cpuslot/megamix500.cpp new file mode 100644 index 00000000000..57d6b6f0212 --- /dev/null +++ b/src/devices/bus/amiga/cpuslot/megamix500.cpp @@ -0,0 +1,150 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + 3-State MegaMix 500 + + External RAM expansion for the A500 + + TODO: Passthrough + +***************************************************************************/ + +#include "emu.h" +#include "megamix500.h" + +#define VERBOSE (LOG_GENERAL) + +#include "logmacro.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AMIGA_CPUSLOT_MEGAMIX500, bus::amiga::cpuslot::megamix500_device, "amiga_megamix500", "3-State MegaMix 500") + +namespace bus::amiga::cpuslot { + +megamix500_device::megamix500_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, AMIGA_CPUSLOT_MEGAMIX500, tag, owner, clock), + device_amiga_cpuslot_interface(mconfig, *this), + m_config(*this, "config"), + m_ram_size(0) +{ +} + + +//************************************************************************** +// INPUT DEFINITIONS +//************************************************************************** + +static INPUT_PORTS_START( megamix500 ) + PORT_START("config") + PORT_CONFNAME(0x03, 0x03, "Installed RAM") + PORT_CONFSETTING(0x00, "Disabled") + PORT_CONFSETTING(0x01, "2 MB") + PORT_CONFSETTING(0x02, "4 MB") + PORT_CONFSETTING(0x03, "8 MB") +INPUT_PORTS_END + +ioport_constructor megamix500_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( megamix500 ); +} + + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +void megamix500_device::device_start() +{ + // setup ram + m_ram = make_unique_clear<uint16_t[]>(0x800000/2); + + // register for save states + save_pointer(NAME(m_ram), 0x800000/2); + save_item(NAME(m_ram_size)); + save_item(NAME(m_base_address)); +} + +void megamix500_device::rst_w(int state) +{ + if (state == 0) + { + // on reset, remove ram + if (m_ram_size > 0) + { + LOG("unmapping ram, base = %06x\n", m_base_address); + m_host->space().unmap_readwrite(m_base_address, m_base_address + (m_ram_size << 20) - 1); + } + + m_ram_size = 0; + } +} + + +//************************************************************************** +// AUTOCONFIG +//************************************************************************** + +void megamix500_device::autoconfig_base_address(offs_t address) +{ + LOG("autoconfig_base_address received: 0x%06x\n", address); + LOG("-> installing megamix500\n"); + + m_base_address = address; + + m_host->space().unmap_readwrite(0xe80000, 0xe8007f); + m_host->space().install_ram(address, address + (m_ram_size << 20) - 1, m_ram.get()); + + m_host->cfgout_w(0); +} + +void megamix500_device::cfgin_w(int state) +{ + LOG("cfgin_w: %d\n", state); + + uint8_t cfg = m_config->read(); + + if (state == 0 && cfg) + { + // setup autoconfig + autoconfig_board_type(BOARD_TYPE_ZORRO2); + + // setup ram + switch (cfg) + { + case 1: + autoconfig_board_size(BOARD_SIZE_2M); + m_ram_size = 0x200000 >> 20; + break; + case 2: + autoconfig_board_size(BOARD_SIZE_4M); + m_ram_size = 0x400000 >> 20; + break; + case 3: + autoconfig_board_size(BOARD_SIZE_8M); + m_ram_size = 0x800000 >> 20; + break; + } + + autoconfig_product(2); + autoconfig_manufacturer(512); + autoconfig_serial(0x00000000); + + autoconfig_link_into_memory(true); + autoconfig_rom_vector_valid(false); + autoconfig_multi_device(false); + autoconfig_8meg_preferred(false); + autoconfig_can_shutup(true); // ? + + // install autoconfig handler + m_host->space().install_readwrite_handler(0xe80000, 0xe8007f, + read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); + } +} + +} // namespace bus::amiga::cpuslot diff --git a/src/devices/bus/amiga/cpuslot/megamix500.h b/src/devices/bus/amiga/cpuslot/megamix500.h new file mode 100644 index 00000000000..c54e2c83659 --- /dev/null +++ b/src/devices/bus/amiga/cpuslot/megamix500.h @@ -0,0 +1,51 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + 3-State MegaMix 500 + + External RAM expansion for the A500 + +***************************************************************************/ + +#ifndef MAME_BUS_AMIGA_CPUSLOT_MEGAMIX500_H +#define MAME_BUS_AMIGA_CPUSLOT_MEGAMIX500_H + +#pragma once + +#include "cpuslot.h" +#include "machine/autoconfig.h" + + +namespace bus::amiga::cpuslot { + +class megamix500_device : public device_t, public device_amiga_cpuslot_interface, public amiga_autoconfig +{ +public: + megamix500_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual ioport_constructor device_input_ports() const override ATTR_COLD; + virtual void device_start() override ATTR_COLD; + + // device_cpuslot_interface overrides + virtual void cfgin_w(int state) override; + virtual void rst_w(int state) override; + + // amiga_autoconfig overrides + virtual void autoconfig_base_address(offs_t address) override; + +private: + required_ioport m_config; + + std::unique_ptr<uint16_t[]> m_ram; + uint8_t m_ram_size; + offs_t m_base_address; +}; + +} // namespace bus::amiga::cpuslot + +// device type declaration +DECLARE_DEVICE_TYPE_NS(AMIGA_CPUSLOT_MEGAMIX500, bus::amiga::cpuslot, megamix500_device) + +#endif // MAME_BUS_AMIGA_CPUSLOT_MEGAMIX500_H diff --git a/src/devices/bus/amiga/zorro/a2052.cpp b/src/devices/bus/amiga/zorro/a2052.cpp index a342e4eb267..2fd7f1a09ea 100644 --- a/src/devices/bus/amiga/zorro/a2052.cpp +++ b/src/devices/bus/amiga/zorro/a2052.cpp @@ -19,12 +19,12 @@ // DEVICE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(ZORRO_A2052, bus::amiga::zorro::a2052_device, "zorro_a2052", "CBM A2052 Fast Memory") +DEFINE_DEVICE_TYPE(AMIGA_A2052, bus::amiga::zorro::a2052_device, "amiga_a2052", "Commodore A2052 RAM Expansion Card") namespace bus::amiga::zorro { a2052_device::a2052_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, ZORRO_A2052, tag, owner, clock), + device_t(mconfig, AMIGA_A2052, tag, owner, clock), device_zorro2_card_interface(mconfig, *this), m_config(*this, "config"), m_ram_size(0) @@ -74,18 +74,18 @@ void a2052_device::autoconfig_base_address(offs_t address) LOG("-> installing a2052\n"); // stop responding to default autoconfig - m_slot->space().unmap_readwrite(0xe80000, 0xe8007f); + m_zorro->space().unmap_readwrite(0xe80000, 0xe8007f); // install access to the rom space - m_slot->space().install_ram(address, address + (m_ram_size << 20) - 1, m_ram.get()); + m_zorro->space().install_ram(address, address + (m_ram_size << 20) - 1, m_ram.get()); // we're done - m_slot->cfgout_w(0); + m_zorro->cfgout_w(0); } void a2052_device::cfgin_w(int state) { - LOG("%s: configin_w (%d)\n", shortname(), state); + LOG("%s: cfgin_w (%d)\n", shortname(), state); if (state == 0) { @@ -120,9 +120,9 @@ void a2052_device::cfgin_w(int state) autoconfig_can_shutup(true); // ? // install autoconfig handler - m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f, + m_zorro->space().install_readwrite_handler(0xe80000, 0xe8007f, read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffffffff); + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); } } diff --git a/src/devices/bus/amiga/zorro/a2052.h b/src/devices/bus/amiga/zorro/a2052.h index 6bea75b19a5..516babf079a 100644 --- a/src/devices/bus/amiga/zorro/a2052.h +++ b/src/devices/bus/amiga/zorro/a2052.h @@ -47,6 +47,6 @@ private: } // namespace bus::amiga::zorro // device type declaration -DECLARE_DEVICE_TYPE_NS(ZORRO_A2052, bus::amiga::zorro, a2052_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_A2052, bus::amiga::zorro, a2052_device) #endif // MAME_BUS_AMIGA_ZORRO_A2052_H diff --git a/src/devices/bus/amiga/zorro/a2058.cpp b/src/devices/bus/amiga/zorro/a2058.cpp index 905334ed1bb..fffead2d2d2 100644 --- a/src/devices/bus/amiga/zorro/a2058.cpp +++ b/src/devices/bus/amiga/zorro/a2058.cpp @@ -19,12 +19,12 @@ // DEVICE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(ZORRO_A2058, bus::amiga::zorro::a2058_device, "zorro_a2058", "CBM A2058 Fast Memory") +DEFINE_DEVICE_TYPE(AMIGA_A2058, bus::amiga::zorro::a2058_device, "amiga_a2058", "Commodore A2058 RAM Expansion Card") namespace bus::amiga::zorro { a2058_device::a2058_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, ZORRO_A2058, tag, owner, clock), + device_t(mconfig, AMIGA_A2058, tag, owner, clock), device_zorro2_card_interface(mconfig, *this), m_config(*this, "config"), m_ram_size(0) @@ -75,18 +75,18 @@ void a2058_device::autoconfig_base_address(offs_t address) LOG("-> installing a2058\n"); // stop responding to default autoconfig - m_slot->space().unmap_readwrite(0xe80000, 0xe8007f); + m_zorro->space().unmap_readwrite(0xe80000, 0xe8007f); // install access to the rom space - m_slot->space().install_ram(address, address + (m_ram_size << 20) - 1, m_ram.get()); + m_zorro->space().install_ram(address, address + (m_ram_size << 20) - 1, m_ram.get()); // we're done - m_slot->cfgout_w(0); + m_zorro->cfgout_w(0); } void a2058_device::cfgin_w(int state) { - LOG("%s: configin_w (%d)\n", shortname(), state); + LOG("%s: cfgin_w (%d)\n", shortname(), state); if (state == 0) { @@ -125,9 +125,9 @@ void a2058_device::cfgin_w(int state) autoconfig_can_shutup(true); // ? // install autoconfig handler - m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f, + m_zorro->space().install_readwrite_handler(0xe80000, 0xe8007f, read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffffffff); + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); } } diff --git a/src/devices/bus/amiga/zorro/a2058.h b/src/devices/bus/amiga/zorro/a2058.h index aeecdbc0702..f8ad5c2a33e 100644 --- a/src/devices/bus/amiga/zorro/a2058.h +++ b/src/devices/bus/amiga/zorro/a2058.h @@ -47,6 +47,6 @@ private: } // namespace bus::amiga::zorro // device type declaration -DECLARE_DEVICE_TYPE_NS(ZORRO_A2058, bus::amiga::zorro, a2058_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_A2058, bus::amiga::zorro, a2058_device) #endif // MAME_BUS_AMIGA_ZORRO_A2058_H diff --git a/src/devices/bus/amiga/zorro/a2065.cpp b/src/devices/bus/amiga/zorro/a2065.cpp index 819bc10da78..3fd1b2a5acf 100644 --- a/src/devices/bus/amiga/zorro/a2065.cpp +++ b/src/devices/bus/amiga/zorro/a2065.cpp @@ -19,12 +19,12 @@ // TYPE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(ZORRO_A2065, bus::amiga::zorro::a2065_device, "zorro_a2065", "CBM A2065 Ethernet Card") +DEFINE_DEVICE_TYPE(AMIGA_A2065, bus::amiga::zorro::a2065_device, "amiga_a2065", "Commodore A2065 Ethernet Card") namespace bus::amiga::zorro { a2065_device::a2065_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, ZORRO_A2065, tag, owner, clock), + device_t(mconfig, AMIGA_A2065, tag, owner, clock), device_zorro2_card_interface(mconfig, *this), m_lance(*this, "lance") { @@ -87,7 +87,7 @@ void a2065_device::lance_ram_w(offs_t offset, uint16_t data, uint16_t mem_mask) void a2065_device::lance_irq_w(int state) { // default is irq 2, can be changed via jumper - m_slot->int2_w(!state); + m_zorro->int2_w(!state); } @@ -101,32 +101,32 @@ void a2065_device::autoconfig_base_address(offs_t address) LOG("-> installing a2065\n"); // stop responding to default autoconfig - m_slot->space().unmap_readwrite(0xe80000, 0xe8007f); + m_zorro->space().unmap_readwrite(0xe80000, 0xe8007f); // install autoconfig handler to new location - m_slot->space().install_readwrite_handler(address, address + 0x7f, + m_zorro->space().install_readwrite_handler(address, address + 0x7f, read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffffffff); + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); // install access to lance registers - m_slot->space().install_read_handler(address + 0x4000, address + 0x4003, - read16m_delegate(*m_lance, FUNC(am7990_device::regs_r)), 0xffffffff); - m_slot->space().install_write_handler(address + 0x4000, address + 0x4003, - write16sm_delegate(*m_lance, FUNC(am7990_device::regs_w)), 0xffffffff); + m_zorro->space().install_read_handler(address + 0x4000, address + 0x4003, + read16m_delegate(*m_lance, FUNC(am7990_device::regs_r)), 0xffff); + m_zorro->space().install_write_handler(address + 0x4000, address + 0x4003, + write16sm_delegate(*m_lance, FUNC(am7990_device::regs_w)), 0xffff); // install access to onboard ram (32k) - m_slot->space().install_read_handler(address + 0x8000, address + 0x8000 + 0x7fff, - read16sm_delegate(*this, FUNC(a2065_device::host_ram_r)), 0xffffffff); - m_slot->space().install_write_handler(address + 0x8000, address + 0x8000 + 0x7fff, - write16s_delegate(*this, FUNC(a2065_device::host_ram_w)), 0xffffffff); + m_zorro->space().install_read_handler(address + 0x8000, address + 0x8000 + 0x7fff, + read16sm_delegate(*this, FUNC(a2065_device::host_ram_r)), 0xffff); + m_zorro->space().install_write_handler(address + 0x8000, address + 0x8000 + 0x7fff, + write16s_delegate(*this, FUNC(a2065_device::host_ram_w)), 0xffff); // we're done - m_slot->cfgout_w(0); + m_zorro->cfgout_w(0); } void a2065_device::cfgin_w(int state) { - LOG("%s: configin_w (%d)\n", shortname(), state); + LOG("%s: cfgin_w (%d)\n", shortname(), state); if (state == 0) { @@ -145,9 +145,9 @@ void a2065_device::cfgin_w(int state) autoconfig_can_shutup(true); // ? // install autoconfig handler - m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f, - read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffffffff); + m_zorro->space().install_readwrite_handler(0xe80000, 0xe8007f, + read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); } } diff --git a/src/devices/bus/amiga/zorro/a2065.h b/src/devices/bus/amiga/zorro/a2065.h index 3e638d84585..6a617db8fb1 100644 --- a/src/devices/bus/amiga/zorro/a2065.h +++ b/src/devices/bus/amiga/zorro/a2065.h @@ -55,6 +55,6 @@ private: } // namespace bus::amiga::zorro // device type declaration -DECLARE_DEVICE_TYPE_NS(ZORRO_A2065, bus::amiga::zorro, a2065_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_A2065, bus::amiga::zorro, a2065_device) #endif // MAME_BUS_AMIGA_ZORRO_A2065_H diff --git a/src/devices/bus/amiga/zorro/a2091.cpp b/src/devices/bus/amiga/zorro/a2091.cpp new file mode 100644 index 00000000000..dba5c745c3b --- /dev/null +++ b/src/devices/bus/amiga/zorro/a2091.cpp @@ -0,0 +1,248 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + Commodore A2091 + + DMAC based SCSI controller for the A2000 + + Notes: + - Hardware is almost identical to the A590 controller for the A500 + - Sold as "A2091-40" it was bundled with 40 MB Quantum ProDrive 40S + - A2000 + A2091-40 = A2000HD + - XT drives aren't usually supported, but a header to connect one + can be soldered to the board (unknown how well this really works) + + TODO: + - JP5 switch order/polarity + - JP3/JP201 switches + - Bootrom disable + - SCSI drives (fatalerrors early if you enable a drive) + - The XT drive should be a slot option (or removed once SCSI works) + +***************************************************************************/ + +#include "emu.h" +#include "a2091.h" +#include "machine/nscsi_bus.h" +#include "bus/nscsi/devices.h" + +#define LOG_XT (1U << 1) + +#define VERBOSE (LOG_GENERAL) + +#include "logmacro.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AMIGA_A2091, bus::amiga::zorro::a2091_device, "amiga_a2091", "Commodore A2091 Hard Disk/SCSI Controller") + +namespace bus::amiga::zorro { + +a2091_device::a2091_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, AMIGA_A2091, tag, owner, clock), + device_zorro2_card_interface(mconfig, *this), + m_irq(*this, "irq"), + m_dmac(*this, "dmac"), + m_wdc(*this, "scsi:7:wdc"), + m_xt(*this, "xt"), + m_jp1(*this, "jp1"), + m_ram_size(0) +{ +} + + +//************************************************************************** +// INPUT DEFINITIONS +//************************************************************************** + +static INPUT_PORTS_START( a2091 ) + PORT_START("jp1") + PORT_CONFNAME(0x03, 0x03, "Installed RAM") + PORT_CONFSETTING(0x00, "None") + PORT_CONFSETTING(0x01, "512K") + PORT_CONFSETTING(0x02, "1MB") + PORT_CONFSETTING(0x03, "2MB") + + PORT_START("jp2") + PORT_CONFNAME(0x01, 0x01, "Autoboot") + PORT_CONFSETTING(0x00, "Disabled") + PORT_CONFSETTING(0x01, "Enabled") + + // JP3 (would switch between generating INT2 or INT6) + + PORT_START("jp5") + PORT_CONFNAME(0x01, 0x01, "LUN") + PORT_CONFSETTING(0x00, "Disabled") + PORT_CONFSETTING(0x01, "Enabled") + PORT_CONFNAME(0x02, 0x02, "Time-out") + PORT_CONFSETTING(0x00, "Short") + PORT_CONFSETTING(0x02, "Long") + PORT_CONFNAME(0x04, 0x04, "Reserved") + PORT_CONFSETTING(0x00, "Disabled") + PORT_CONFSETTING(0x04, "Enabled") + + // JP201 +INPUT_PORTS_END + +ioport_constructor a2091_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( a2091 ); +} + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +ROM_START( firmware ) + ROM_REGION16_BE(0x8000, "bootrom", 0) + ROM_DEFAULT_BIOS("v70") + + ROM_SYSTEM_BIOS(0, "v592", "Version 5.92") + ROMX_LOAD("390508-02.u13", 0x0000, 0x2000, CRC(f99e3934) SHA1(1aa7f789db48ad0b75f8bb6b3e5532fbf30f5766), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390509-02.u12", 0x0001, 0x2000, CRC(8f9dd6f8) SHA1(3a8a4639a498bf9a95cb11c45c13687efa714942), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390508-02.u13", 0x4000, 0x2000, CRC(f99e3934) SHA1(1aa7f789db48ad0b75f8bb6b3e5532fbf30f5766), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390509-02.u12", 0x4001, 0x2000, CRC(8f9dd6f8) SHA1(3a8a4639a498bf9a95cb11c45c13687efa714942), ROM_SKIP(1) | ROM_BIOS(2)) + + ROM_SYSTEM_BIOS(1, "v61", "Version 6.1") + ROMX_LOAD("390721-01.u13", 0x0000, 0x2000, CRC(00dbf615) SHA1(503940d04fb3b49eaa61100fd3a487018b35e25a), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("390722-01.u12", 0x0001, 0x2000, CRC(c460cfdb) SHA1(0de457daec3b84f75e8fb344defe24ce56cda3e0), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("390721-01.u13", 0x4000, 0x2000, CRC(00dbf615) SHA1(503940d04fb3b49eaa61100fd3a487018b35e25a), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("390722-01.u12", 0x4001, 0x2000, CRC(c460cfdb) SHA1(0de457daec3b84f75e8fb344defe24ce56cda3e0), ROM_SKIP(1) | ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(2, "v66", "Version 6.6") + // COPYRIGHT ©1991 CBM ALL RIGHTS RESERVED 390721-02V6.6 D464 + ROMX_LOAD("390721-02.u13", 0x0000, 0x2000, CRC(c0871d25) SHA1(e155f18abb90cf820589c15e70559d3b6b391af8), ROM_SKIP(1) | ROM_BIOS(2)) + // COPYRIGHT ©1991 CBM ALL RIGHTS RESERVED 390722-02V6.6 F929 + ROMX_LOAD("390722-02.u12", 0x0001, 0x2000, CRC(e536bbb2) SHA1(fd7f8a6da18c1b02d07eb990c2467a24183ede12), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390721-02.u13", 0x4000, 0x2000, CRC(c0871d25) SHA1(e155f18abb90cf820589c15e70559d3b6b391af8), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390722-02.u12", 0x4001, 0x2000, CRC(e536bbb2) SHA1(fd7f8a6da18c1b02d07eb990c2467a24183ede12), ROM_SKIP(1) | ROM_BIOS(2)) + + ROM_SYSTEM_BIOS(3, "v70", "Version 7.0") // also seen with -07 + ROMX_LOAD("390721-04.u13", 0x0000, 0x2000, CRC(2942747a) SHA1(dbd7648e79c753337ff3e4f491de224bf05e6bb6), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("390722-04.u12", 0x0001, 0x2000, CRC(a9ccffed) SHA1(149f5bd52e2d29904e3de483b9ad772448e9278e), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("390721-04.u13", 0x4000, 0x2000, CRC(2942747a) SHA1(dbd7648e79c753337ff3e4f491de224bf05e6bb6), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("390722-04.u12", 0x4001, 0x2000, CRC(a9ccffed) SHA1(149f5bd52e2d29904e3de483b9ad772448e9278e), ROM_SKIP(1) | ROM_BIOS(3)) + + // 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(4)) + + // pal16l8a + ROM_REGION(0x104, "ram_controller", 0) + ROM_LOAD("390333-03.u5", 0x000, 0x104, CRC(dc4a8d9b) SHA1(761a1318106e49057f95258699076ec1079967ad)) +ROM_END + +const tiny_rom_entry *a2091_device::device_rom_region() const +{ + return ROM_NAME( firmware ); +} + + +//************************************************************************** +// MACHINE DEFINITIONS +//************************************************************************** + +void a2091_device::wd33c93_config(device_t *device) +{ + device->set_clock(28.37516_MHz_XTAL / 4); // 7M + downcast<wd33c93a_device *>(device)->irq_cb().set(m_irq, FUNC(input_merger_any_high_device::in_w<0>)); + downcast<wd33c93a_device *>(device)->drq_cb().set(m_dmac, FUNC(amiga_dmac_device::sdreq_w)); +} + +void a2091_device::device_add_mconfig(machine_config &config) +{ + AMIGA_DMAC(config, m_dmac, 28.37516_MHz_XTAL / 4); // 7M + m_dmac->set_rom("bootrom"); + m_dmac->cfgout_cb().set([this] (int state) { m_zorro->cfgout_w(state); }); + m_dmac->int_cb().set([this] (int state) { m_zorro->int2_w(state); }); + m_dmac->css_read_cb().set(m_wdc, FUNC(wd33c93a_device::indir_r)); + m_dmac->css_write_cb().set(m_wdc, FUNC(wd33c93a_device::indir_w)); + m_dmac->csx0_read_cb().set(FUNC(a2091_device::xt_r)); + m_dmac->csx0_write_cb().set(FUNC(a2091_device::xt_w)); + m_dmac->csx1_read_cb().set_ioport("jp5"); + m_dmac->xdack_read_cb().set(m_xt, FUNC(xt_hdc_device::dack_r)); + m_dmac->xdack_write_cb().set(m_xt, FUNC(xt_hdc_device::dack_w)); + + INPUT_MERGER_ANY_HIGH(config, m_irq); + m_irq->output_handler().set(m_dmac, FUNC(amiga_dmac_device::intx_w)); + + NSCSI_BUS(config, "scsi", 0); + NSCSI_CONNECTOR(config, "scsi:0", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "scsi:1", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "scsi:3", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "scsi:4", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "scsi:5", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "scsi:6", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "scsi:7").option_set("wdc", WD33C93A).machine_config([this] (device_t *device) { wd33c93_config(device); }); + + XT_HDC(config, m_xt, 0); + m_xt->irq_handler().set(m_irq, FUNC(input_merger_any_high_device::in_w<1>)); + m_xt->drq_handler().set(m_dmac, FUNC(amiga_dmac_device::xdreq_w)); + + HARDDISK(config, "xt:primary"); +} + + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +void a2091_device::device_start() +{ + // setup ram + m_ram = make_unique_clear<uint16_t[]>(0x200000/2); + + // setup dmac + m_dmac->set_address_space(&m_zorro->space()); + m_dmac->set_ram(m_ram.get()); + + // register for save states + save_pointer(NAME(m_ram), 0x200000/2); + save_item(NAME(m_ram_size)); +} + +// the dmac handles this +void a2091_device::cfgin_w(int state) { m_dmac->configin_w(state); } + +void a2091_device::busrst_w(int state) +{ + // call rst first as it will unmap memory + m_dmac->rst_w(state); + + if (state == 0) + m_dmac->ramsz_w(m_jp1->read() & 0x03); +} + +uint8_t a2091_device::xt_r(offs_t offset) +{ + LOGMASKED(LOG_XT, "xt_r(%02x)\n", offset); + + switch (offset) + { + case 0: return m_xt->data_r(); + case 1: return m_xt->status_r(); + case 2: return 0x02; // jumper: 20/40 MB + } + + return 0xff; +} + +void a2091_device::xt_w(offs_t offset, uint8_t data) +{ + LOGMASKED(LOG_XT, "xt_w(%02x): %02x\n", offset, data); + + switch (offset) + { + case 0: m_xt->data_w(data); break; + case 1: m_xt->reset_w(data); break; + case 2: m_xt->select_w(data); break; + case 3: m_xt->control_w(data); break; + } +} + +} // namespace bus::amiga::zorro diff --git a/src/devices/bus/amiga/zorro/a2091.h b/src/devices/bus/amiga/zorro/a2091.h new file mode 100644 index 00000000000..586766fad52 --- /dev/null +++ b/src/devices/bus/amiga/zorro/a2091.h @@ -0,0 +1,63 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + Commodore A2091 + + DMAC based SCSI controller for the A2000 + +***************************************************************************/ + +#ifndef MAME_BUS_AMIGA_ZORRO_A2091_H +#define MAME_BUS_AMIGA_ZORRO_A2091_H + +#pragma once + +#include "zorro.h" +#include "bus/isa/hdc.h" +#include "machine/autoconfig.h" +#include "machine/dmac.h" +#include "machine/input_merger.h" +#include "machine/wd33c9x.h" + + +namespace bus::amiga::zorro { + +class a2091_device : public device_t, public device_zorro2_card_interface +{ +public: + a2091_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual ioport_constructor device_input_ports() const override ATTR_COLD; + virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; + virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; + + virtual void device_start() override ATTR_COLD; + + // device_zorro2_card_interface overrides + virtual void cfgin_w(int state) override; + virtual void busrst_w(int state) override; + +private: + void wd33c93_config(device_t *device); + + uint8_t xt_r(offs_t offset); + void xt_w(offs_t offset, uint8_t data); + + required_device<input_merger_any_high_device> m_irq; + required_device<amiga_dmac_device> m_dmac; + required_device<wd33c93a_device> m_wdc; + required_device<xt_hdc_device> m_xt; + required_ioport m_jp1; + + std::unique_ptr<uint16_t[]> m_ram; + uint8_t m_ram_size; +}; + +} // namespace bus::amiga::zorro + +// device type declaration +DECLARE_DEVICE_TYPE_NS(AMIGA_A2091, bus::amiga::zorro, a2091_device) + +#endif // MAME_BUS_AMIGA_ZORRO_A2091_H diff --git a/src/devices/bus/amiga/zorro/a2232.cpp b/src/devices/bus/amiga/zorro/a2232.cpp index af33b31a99f..0c573311176 100644 --- a/src/devices/bus/amiga/zorro/a2232.cpp +++ b/src/devices/bus/amiga/zorro/a2232.cpp @@ -12,7 +12,9 @@ #include "a2232.h" #define LOG_DATA (1U << 1) + //#define VERBOSE (LOG_GENERAL | LOG_DATA) + #include "logmacro.h" @@ -20,7 +22,7 @@ // DEVICE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(ZORRO_A2232, bus::amiga::zorro::a2232_device, "zorro_a2232", "CBM A2232 Serial Card") +DEFINE_DEVICE_TYPE(AMIGA_A2232, bus::amiga::zorro::a2232_device, "amiga_a2232", "Commodore A2232 Serial Card") namespace bus::amiga::zorro { @@ -117,7 +119,7 @@ void a2232_device::device_add_mconfig(machine_config &config) //------------------------------------------------- a2232_device::a2232_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, ZORRO_A2232, tag, owner, clock), + device_t(mconfig, AMIGA_A2232, tag, owner, clock), device_zorro2_card_interface(mconfig, *this), m_iocpu(*this, "iocpu"), m_ioirq(*this, "ioirq"), @@ -160,7 +162,7 @@ void a2232_device::int2_w(uint8_t data) { LOG("%s: int2_w %04x\n", shortname(), data); - m_slot->int2_w(1); + m_zorro->int2_w(1); } void a2232_device::irq_ack8_w(uint8_t data) @@ -181,35 +183,35 @@ void a2232_device::autoconfig_base_address(offs_t address) LOG("-> installing a2232\n"); // stop responding to default autoconfig - m_slot->space().unmap_readwrite(0xe80000, 0xe8007f); + m_zorro->space().unmap_readwrite(0xe80000, 0xe8007f); - m_slot->space().install_readwrite_handler(address, address + 0x3fff, - read16s_delegate(*this, FUNC(a2232_device::shared_ram_r)), - write16s_delegate(*this, FUNC(a2232_device::shared_ram_w)), 0xffff); + m_zorro->space().install_readwrite_handler(address, address + 0x3fff, + read16s_delegate(*this, FUNC(a2232_device::shared_ram_r)), + write16s_delegate(*this, FUNC(a2232_device::shared_ram_w)), 0xffff); - m_slot->space().install_readwrite_handler(address + 0x4000, address + 0x4001, - read16smo_delegate(*this, FUNC(a2232_device::irq_ack_r)), - write16smo_delegate(*this, FUNC(a2232_device::irq_ack_w)), 0xffff); + m_zorro->space().install_readwrite_handler(address + 0x4000, address + 0x4001, + read16smo_delegate(*this, FUNC(a2232_device::irq_ack_r)), + write16smo_delegate(*this, FUNC(a2232_device::irq_ack_w)), 0xffff); - m_slot->space().install_readwrite_handler(address + 0x8000, address + 0x8001, - read16smo_delegate(*this, FUNC(a2232_device::reset_low_r)), - write16smo_delegate(*this, FUNC(a2232_device::reset_low_w)), 0xffff); + m_zorro->space().install_readwrite_handler(address + 0x8000, address + 0x8001, + read16smo_delegate(*this, FUNC(a2232_device::reset_low_r)), + write16smo_delegate(*this, FUNC(a2232_device::reset_low_w)), 0xffff); - m_slot->space().install_readwrite_handler(address + 0xa000, address + 0xa001, - read16smo_delegate(*this, FUNC(a2232_device::irq_r)), - write16smo_delegate(*this, FUNC(a2232_device::irq_w)), 0xffff); + m_zorro->space().install_readwrite_handler(address + 0xa000, address + 0xa001, + read16smo_delegate(*this, FUNC(a2232_device::irq_r)), + write16smo_delegate(*this, FUNC(a2232_device::irq_w)), 0xffff); - m_slot->space().install_readwrite_handler(address + 0xc000, address + 0xc001, - read16s_delegate(*this, FUNC(a2232_device::reset_high_r)), - write16s_delegate(*this, FUNC(a2232_device::reset_high_w)), 0xffff); + m_zorro->space().install_readwrite_handler(address + 0xc000, address + 0xc001, + read16s_delegate(*this, FUNC(a2232_device::reset_high_r)), + write16s_delegate(*this, FUNC(a2232_device::reset_high_w)), 0xffff); // we're done - m_slot->cfgout_w(0); + m_zorro->cfgout_w(0); } void a2232_device::cfgin_w(int state) { - LOG("%s: configin_w (%d)\n", shortname(), state); + LOG("%s: cfgin_w (%d)\n", shortname(), state); if (state == 0) { @@ -228,9 +230,9 @@ void a2232_device::cfgin_w(int state) autoconfig_can_shutup(true); // ? // install autoconfig handler - m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f, - read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); + m_zorro->space().install_readwrite_handler(0xe80000, 0xe8007f, + read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); } } @@ -271,14 +273,14 @@ void a2232_device::shared_ram_w(offs_t offset, uint16_t data, uint16_t mem_mask) uint16_t a2232_device::irq_ack_r() { - m_slot->int2_w(0); + m_zorro->int2_w(0); return 0xffff; } void a2232_device::irq_ack_w(uint16_t data) { - m_slot->int2_w(0); + m_zorro->int2_w(0); } uint16_t a2232_device::reset_low_r() diff --git a/src/devices/bus/amiga/zorro/a2232.h b/src/devices/bus/amiga/zorro/a2232.h index 84da4e8e189..13062db8ba6 100644 --- a/src/devices/bus/amiga/zorro/a2232.h +++ b/src/devices/bus/amiga/zorro/a2232.h @@ -107,6 +107,6 @@ private: } // namespace bus::amiga::zorro // device type declaration -DECLARE_DEVICE_TYPE_NS(ZORRO_A2232, bus::amiga::zorro, a2232_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_A2232, bus::amiga::zorro, a2232_device) #endif // MAME_BUS_AMIGA_ZORRO_A2232_H diff --git a/src/devices/bus/amiga/zorro/a590.cpp b/src/devices/bus/amiga/zorro/a590.cpp deleted file mode 100644 index 65ec7b19ec8..00000000000 --- a/src/devices/bus/amiga/zorro/a590.cpp +++ /dev/null @@ -1,362 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Commodore A590 / A2091 - - DMAC based HD controller for the Amiga 500 and Zorro-II - -***************************************************************************/ - -#include "emu.h" -#include "a590.h" -#include "machine/nscsi_bus.h" -#include "bus/nscsi/devices.h" - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -DEFINE_DEVICE_TYPE(ZORRO_A590, bus::amiga::zorro::a590_device, "zorro_a590", "CBM A590 HD Controller") -DEFINE_DEVICE_TYPE(ZORRO_A2091, bus::amiga::zorro::a2091_device, "zorro_a2091", "CBM A2091 HD Controller") - - -namespace bus::amiga::zorro { - -//------------------------------------------------- -// 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 ); -} - -//------------------------------------------------- -// device_add_mconfig - add device configuration -//------------------------------------------------- - -void dmac_hdc_device_base::wd33c93(device_t *device) -{ - device->set_clock(10000000); - downcast<wd33c93a_device *>(device)->irq_cb().set(*this, FUNC(dmac_hdc_device_base::scsi_irq_w)); - downcast<wd33c93a_device *>(device)->drq_cb().set(*this, FUNC(dmac_hdc_device_base::scsi_drq_w)); -} - -void dmac_hdc_device_base::device_add_mconfig(machine_config &config) -{ - amiga_dmac_device &dmac(AMIGA_DMAC(config, "dmac", 0)); - dmac.scsi_read_handler().set(FUNC(dmac_hdc_device_base::dmac_scsi_r)); - dmac.scsi_write_handler().set(FUNC(dmac_hdc_device_base::dmac_scsi_w)); - dmac.int_handler().set(FUNC(dmac_hdc_device_base::dmac_int_w)); - dmac.cfgout_handler().set(FUNC(dmac_hdc_device_base::dmac_cfgout_w)); - - NSCSI_BUS(config, "scsi", 0); - NSCSI_CONNECTOR(config, "scsi:0", default_scsi_devices, nullptr, false); - NSCSI_CONNECTOR(config, "scsi:1", default_scsi_devices, "harddisk", false); - NSCSI_CONNECTOR(config, "scsi:3", default_scsi_devices, nullptr, false); - NSCSI_CONNECTOR(config, "scsi:4", default_scsi_devices, nullptr, false); - NSCSI_CONNECTOR(config, "scsi:5", default_scsi_devices, nullptr, false); - NSCSI_CONNECTOR(config, "scsi:6", default_scsi_devices, nullptr, false); - NSCSI_CONNECTOR(config, "scsi:7").option_set("wd33c93", WD33C93A) - .machine_config([this] (device_t *device) { wd33c93(device); }); -} - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -ROM_START( dmac_hdc ) - ROM_REGION16_BE(0x8000, "bootrom", 0) - ROM_DEFAULT_BIOS("v70") - - ROM_SYSTEM_BIOS(0, "v46", "Version 4.6") // a590 only? - ROMX_LOAD("390389-02.u13", 0x0000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(0)) // checksum-16: d703 - ROMX_LOAD("390388-02.u12", 0x0001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(0)) // checksum-16: e7e4 - ROMX_LOAD("390389-02.u13", 0x4000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(0)) - ROMX_LOAD("390388-02.u12", 0x4001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(0)) - - ROM_SYSTEM_BIOS(1, "v592", "Version 5.92") // a2091 only? - ROMX_LOAD("390508-02_a2091_low_byte_u13_v5.92.u13", 0x0000, 0x2000, CRC(4bedbcb1) SHA1(0b97991d7058a8d0c8d000409b4b82bb96ca1dc9), ROM_SKIP(1) | ROM_BIOS(1)) // checksum-16: 23d8 (?) - ROMX_LOAD("390509-02_a2091_high_byte_u12_v5.92.u12", 0x0001, 0x2000, CRC(8f9dd6f8) SHA1(3a8a4639a498bf9a95cb11c45c13687efa714942), ROM_SKIP(1) | ROM_BIOS(1)) // checksum-16: 288c (ok) - ROMX_LOAD("390508-02_a2091_low_byte_u13_v5.92.u13", 0x4000, 0x2000, CRC(4bedbcb1) SHA1(0b97991d7058a8d0c8d000409b4b82bb96ca1dc9), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD("390509-02_a2091_high_byte_u12_v5.92.u12", 0x4001, 0x2000, CRC(8f9dd6f8) SHA1(3a8a4639a498bf9a95cb11c45c13687efa714942), ROM_SKIP(1) | ROM_BIOS(1)) - - ROM_SYSTEM_BIOS(2, "v60", "Version 6.0") // a590 only? - ROMX_LOAD("390389-03.u13", 0x0000, 0x2000, CRC(2e77bbff) SHA1(8a098845068f32cfa4d34a278cd290f61d35a52c), ROM_SKIP(1) | ROM_BIOS(2)) // checksum-16: cbe8 (ok) - ROMX_LOAD("390388-03.u12", 0x0001, 0x2000, CRC(b0b8cf24) SHA1(fcf4017505f4d441814b45d559c19eab43816b30), ROM_SKIP(1) | ROM_BIOS(2)) // checksum-16: dfa0 (ok) - ROMX_LOAD("390389-03.u13", 0x4000, 0x2000, CRC(2e77bbff) SHA1(8a098845068f32cfa4d34a278cd290f61d35a52c), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("390388-03.u12", 0x4001, 0x2000, CRC(b0b8cf24) SHA1(fcf4017505f4d441814b45d559c19eab43816b30), ROM_SKIP(1) | ROM_BIOS(2)) - - // changelog v6.1: prevent accesses to location 0 by application programs - ROM_SYSTEM_BIOS(3, "v61", "Version 6.1") - ROMX_LOAD("390721-01.u13", 0x0000, 0x2000, CRC(00dbf615) SHA1(503940d04fb3b49eaa61100fd3a487018b35e25a), ROM_SKIP(1) | ROM_BIOS(3)) // checksum-16: f4b8 (ok) - ROMX_LOAD("390722-01.u12", 0x0001, 0x2000, CRC(c460cfdb) SHA1(0de457daec3b84f75e8fb344defe24ce56cda3e0), ROM_SKIP(1) | ROM_BIOS(3)) // checksum-16: 088b (ok) - ROMX_LOAD("390721-01.u13", 0x4000, 0x2000, CRC(00dbf615) SHA1(503940d04fb3b49eaa61100fd3a487018b35e25a), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD("390722-01.u12", 0x4001, 0x2000, CRC(c460cfdb) SHA1(0de457daec3b84f75e8fb344defe24ce56cda3e0), ROM_SKIP(1) | ROM_BIOS(3)) - - // changelog v6.6: fixes dual SCSI problems with the wd33c93a controller - ROM_SYSTEM_BIOS(4, "v66", "Version 6.6") - ROMX_LOAD("390721-02.u13", 0x0000, 0x2000, CRC(c0871d25) SHA1(e155f18abb90cf820589c15e70559d3b6b391af8), ROM_SKIP(1) | ROM_BIOS(4)) // checksum-16: d464 (ok) - ROMX_LOAD("390722-02.u12", 0x0001, 0x2000, CRC(e536bbb2) SHA1(fd7f8a6da18c1b02d07eb990c2467a24183ede12), ROM_SKIP(1) | ROM_BIOS(4)) // checksum-16: f929 (ok) - ROMX_LOAD("390721-02.u13", 0x4000, 0x2000, CRC(c0871d25) SHA1(e155f18abb90cf820589c15e70559d3b6b391af8), ROM_SKIP(1) | ROM_BIOS(4)) - ROMX_LOAD("390722-02.u12", 0x4001, 0x2000, CRC(e536bbb2) SHA1(fd7f8a6da18c1b02d07eb990c2467a24183ede12), ROM_SKIP(1) | ROM_BIOS(4)) - - // final Commodore released version - ROM_SYSTEM_BIOS(5, "v70", "Version 7.0") // also seen with -07 - ROMX_LOAD("390721-04.u13", 0x0000, 0x2000, CRC(2942747a) SHA1(dbd7648e79c753337ff3e4f491de224bf05e6bb6), ROM_SKIP(1) | ROM_BIOS(5)) // checksum-16: 081c (ok) - ROMX_LOAD("390722-04.u12", 0x0001, 0x2000, CRC(a9ccffed) SHA1(149f5bd52e2d29904e3de483b9ad772448e9278e), ROM_SKIP(1) | ROM_BIOS(5)) // checksum-16: 3ef2 (ok) - ROMX_LOAD("390721-04.u13", 0x4000, 0x2000, CRC(2942747a) SHA1(dbd7648e79c753337ff3e4f491de224bf05e6bb6), ROM_SKIP(1) | ROM_BIOS(5)) - ROMX_LOAD("390722-04.u12", 0x4001, 0x2000, CRC(a9ccffed) SHA1(149f5bd52e2d29904e3de483b9ad772448e9278e), ROM_SKIP(1) | ROM_BIOS(5)) - - // third-party upgrade ROM, requires a small ROM adapter pcb - ROM_SYSTEM_BIOS(6, "g614", "Guru-ROM 6.14") - ROMX_LOAD("gururom_v614.bin", 0x0000, 0x8000, CRC(04e52f93) SHA1(6da21b6f5e8f8837d64507cd8a4d5cdcac4f426b), ROM_GROUPWORD | ROM_BIOS(6)) - - // pal16l8a - ROM_REGION(0x104, "ram_controller", 0) - ROM_LOAD("390333-03.u5", 0x000, 0x104, CRC(dc4a8d9b) SHA1(761a1318106e49057f95258699076ec1079967ad)) -ROM_END - -const tiny_rom_entry *dmac_hdc_device_base::device_rom_region() const -{ - return ROM_NAME( dmac_hdc ); -} - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// dmac_hdc_device_base - constructor -//------------------------------------------------- - -dmac_hdc_device_base::dmac_hdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, type, tag, owner, clock), - m_int6(false), - m_dmac(*this, "dmac"), - m_wdc(*this, "scsi:7:wd33c93") -{ -} - -a590_device::a590_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - dmac_hdc_device_base(mconfig, ZORRO_A590, tag, owner, clock), - 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_t clock) : - dmac_hdc_device_base(mconfig, ZORRO_A2091, tag, owner, clock), - 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_base::device_start() -{ -} - -void a590_device::device_start() -{ - dmac_hdc_device_base::device_start(); - - // setup DMAC - m_dmac->set_address_space(&m_slot->space()); - m_dmac->set_rom(memregion("bootrom")->base()); -} - -void a2091_device::device_start() -{ - dmac_hdc_device_base::device_start(); - - // setup DMAC - m_dmac->set_address_space(&m_slot->space()); - m_dmac->set_rom(memregion("bootrom")->base()); -} - -void dmac_hdc_device_base::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[0]); -} - - -//************************************************************************** -// IMPLEMENTATION -//************************************************************************** - -void a590_device::cfgin_w(int state) -{ - // 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); -} - -void a2091_device::cfgin_w(int state) -{ - // 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); -} - -uint8_t dmac_hdc_device_base::dmac_scsi_r(offs_t offset) -{ - switch (offset) - { - case 0x48: return m_wdc->indir_addr_r(); - case 0x49: return m_wdc->indir_reg_r(); - } - - return 0xff; -} - -void dmac_hdc_device_base::dmac_scsi_w(offs_t offset, uint8_t data) -{ - switch (offset) - { - case 0x48: m_wdc->indir_addr_w(data); break; - case 0x49: m_wdc->indir_reg_w(data); break; - } -} - -void dmac_hdc_device_base::dmac_int_w(int state) -{ - if (m_int6) - int6_w(state); - else - int2_w(state); -} - -void dmac_hdc_device_base::scsi_irq_w(int state) -{ - // should be or'ed with xt-ide IRQ - m_dmac->intx_w(state); -} - -void dmac_hdc_device_base::scsi_drq_w(int state) -{ - m_dmac->xdreq_w(state); -} - -} // namespace bus::amiga::zorro diff --git a/src/devices/bus/amiga/zorro/a590.h b/src/devices/bus/amiga/zorro/a590.h deleted file mode 100644 index f40e3d42c15..00000000000 --- a/src/devices/bus/amiga/zorro/a590.h +++ /dev/null @@ -1,126 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Commodore A590 / A2091 - - DMAC based SCSI controller for the Amiga 500 and Zorro-II - -***************************************************************************/ - -#ifndef MAME_BUS_AMIGA_ZORRO_A590_H -#define MAME_BUS_AMIGA_ZORRO_A590_H - -#pragma once - -#include "zorro.h" -#include "machine/dmac.h" -#include "machine/wd33c9x.h" - - -namespace bus::amiga::zorro { - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class dmac_hdc_device_base : public device_t -{ -protected: - dmac_hdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - - virtual void device_start() override ATTR_COLD; - - // optional information overrides - virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; - virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; - - // 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<amiga_dmac_device> m_dmac; - required_device<wd33c93a_device> m_wdc; - - std::vector<uint8_t> m_ram; - -private: - uint8_t dmac_scsi_r(offs_t offset); - void dmac_scsi_w(offs_t offset, uint8_t data); - void dmac_int_w(int state); - void dmac_cfgout_w(int state) { cfgout_w(state); } - void scsi_irq_w(int state); - void scsi_drq_w(int state); - - static void scsi_devices(device_slot_interface &device) ATTR_COLD; - void wd33c93(device_t *device); -}; - -class a590_device : public dmac_hdc_device_base, public device_exp_card_interface -{ -public: - a590_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - -protected: - virtual void device_start() override ATTR_COLD; - - // optional information overrides - virtual ioport_constructor device_input_ports() const override ATTR_COLD; - - // output to slot - virtual void cfgout_w(int state) override { m_slot->cfgout_w(state); } - virtual void int2_w(int state) override { m_slot->int2_w(state); } - virtual void int6_w(int state) override { m_slot->int6_w(state); } - - // input from slot - virtual void cfgin_w(int state) override; - -private: - required_ioport m_dips; - required_ioport m_jp1; - required_ioport m_jp2; - required_ioport m_jp4; -}; - -class a2091_device : public dmac_hdc_device_base, public device_zorro2_card_interface -{ -public: - a2091_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - -protected: - virtual void device_start() override ATTR_COLD; - - // optional information overrides - virtual ioport_constructor device_input_ports() const override ATTR_COLD; - - // output to slot - virtual void cfgout_w(int state) override { m_slot->cfgout_w(state); } - virtual void int2_w(int state) override { m_slot->int2_w(state); } - virtual void int6_w(int state) override { m_slot->int6_w(state); } - - // input from slot - virtual void cfgin_w(int state) override; - -private: - required_ioport m_jp1; - required_ioport m_jp2; - required_ioport m_jp3; - required_ioport m_jp5; - required_ioport m_jp201; -}; - -} // namespace bus::amiga::zorro - -// device type declaration -DECLARE_DEVICE_TYPE_NS(ZORRO_A590, bus::amiga::zorro, a590_device) -DECLARE_DEVICE_TYPE_NS(ZORRO_A2091, bus::amiga::zorro, a2091_device) - -#endif // MAME_BUS_AMIGA_ZORRO_A590_H diff --git a/src/devices/bus/amiga/zorro/action_replay.cpp b/src/devices/bus/amiga/zorro/action_replay.cpp deleted file mode 100644 index 421ea96c77a..00000000000 --- a/src/devices/bus/amiga/zorro/action_replay.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Datel Action Replay - - 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 "emu.h" -#include "action_replay.h" - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -DEFINE_DEVICE_TYPE(ZORRO_ACTION_REPLAY_MK1, bus::amiga::zorro::action_replay_mk1_device, "zorro_ar1", "Datel Action Replay MK-I") -DEFINE_DEVICE_TYPE(ZORRO_ACTION_REPLAY_MK2, bus::amiga::zorro::action_replay_mk2_device, "zorro_ar2", "Datel Action Replay MK-II") -DEFINE_DEVICE_TYPE(ZORRO_ACTION_REPLAY_MK3, bus::amiga::zorro::action_replay_mk3_device, "zorro_ar3", "Datel Action Replay MK-III") - - -namespace bus::amiga::zorro { - -//------------------------------------------------- -// 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, FUNC(action_replay_device_base::freeze), 0) -INPUT_PORTS_END - -ioport_constructor action_replay_device_base::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(0)) - ROM_SYSTEM_BIOS(1, "v150", "Version 1.50") - ROMX_LOAD("ar1_v150.bin", 0x0000, 0x10000, BAD_DUMP CRC(f82c4258) SHA1(843b433b2c56640e045d5fdc854dc6b1a4964e7c), ROM_BIOS(1)) -ROM_END - -const tiny_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(0)) - ROM_SYSTEM_BIOS(1, "v212", "Version 2.12") - ROMX_LOAD("ar2_v212.bin", 0x0000, 0x20000, BAD_DUMP CRC(d29bdd86) SHA1(76c2900457badf22b742f0af48b78937e8b67694), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(2, "v214", "Version 2.14") - ROMX_LOAD("ar2_v214.bin", 0x0000, 0x20000, BAD_DUMP CRC(1bb3d0a8) SHA1(14b1f5a69efb6f4e2331970e6ca0f33c0f04ac91), ROM_BIOS(2)) -ROM_END - -const tiny_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(0)) - ROMX_LOAD("ar3_v309.odd", 0x00001, 0x20000, CRC(1d35bd56) SHA1(6464be1626b519499e76e4e3409e8016515d48b6), ROM_SKIP(1) | ROM_BIOS(0)) - ROM_SYSTEM_BIOS(1, "v317", "Version 3.17") - ROMX_LOAD("ar3_v314.bin", 0x0000, 0x40000, BAD_DUMP CRC(009f7768) SHA1(0439d6ccc2a0e5c2e83fcf2389dc4d4a440a4c62), ROM_BIOS(1)) -ROM_END - -const tiny_rom_entry *action_replay_mk3_device::device_rom_region() const -{ - return ROM_NAME( ar_mk3 ); -} - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// action_replay_device_base - constructor -//------------------------------------------------- - -action_replay_device_base::action_replay_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, type, tag, owner, clock), - 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_t clock) : - action_replay_device_base(mconfig, ZORRO_ACTION_REPLAY_MK1, tag, owner, clock) -{ -} - -action_replay_mk2_device::action_replay_mk2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - action_replay_device_base(mconfig, ZORRO_ACTION_REPLAY_MK2, tag, owner, clock) -{ -} - -action_replay_mk3_device::action_replay_mk3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - action_replay_device_base(mconfig, ZORRO_ACTION_REPLAY_MK3, tag, owner, clock) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void action_replay_device_base::device_start() -{ -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void action_replay_device_base::device_reset() -{ -} - - -//************************************************************************** -// IMPLEMENTATION -//************************************************************************** - -INPUT_CHANGED_MEMBER( action_replay_device_base::freeze ) -{ - // pushing the freeze button generates an nmi - m_slot->ipl_w(newval == 1 ? 7 : 0); -} - -} // namespace bus::amiga::zorro diff --git a/src/devices/bus/amiga/zorro/action_replay.h b/src/devices/bus/amiga/zorro/action_replay.h deleted file mode 100644 index 59951de6ab6..00000000000 --- a/src/devices/bus/amiga/zorro/action_replay.h +++ /dev/null @@ -1,87 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Datel Action Replay - - Freezer cartridge for Amiga 500 and Amiga 2000 - -***************************************************************************/ - -#ifndef MAME_BUS_AMIGA_ZORRO_ACTION_REPLAY_H -#define MAME_BUS_AMIGA_ZORRO_ACTION_REPLAY_H - -#pragma once - -#include "zorro.h" - - -namespace bus::amiga::zorro { - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> action_replay_device_base - -class action_replay_device_base : public device_t, public device_exp_card_interface -{ -public: - DECLARE_INPUT_CHANGED_MEMBER( freeze ); - -protected: - // construction/destruction - action_replay_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - - // optional information overrides - virtual ioport_constructor device_input_ports() const override ATTR_COLD; - - // device-level overrides - virtual void device_start() override ATTR_COLD; - virtual void device_reset() override ATTR_COLD; - -private: - required_ioport m_button; -}; - -class action_replay_mk1_device : public action_replay_device_base -{ -public: - // construction/destruction - action_replay_mk1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - -protected: - // optional information overrides - virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; -}; - -class action_replay_mk2_device : public action_replay_device_base -{ -public: - // construction/destruction - action_replay_mk2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - -protected: - // optional information overrides - virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; -}; - -class action_replay_mk3_device : public action_replay_device_base -{ -public: - // construction/destruction - action_replay_mk3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - -protected: - // optional information overrides - virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; -}; - -} // namespace bus::amiga::zorro - -// device type definition -DECLARE_DEVICE_TYPE_NS(ZORRO_ACTION_REPLAY_MK1, bus::amiga::zorro, action_replay_mk1_device) -DECLARE_DEVICE_TYPE_NS(ZORRO_ACTION_REPLAY_MK2, bus::amiga::zorro, action_replay_mk2_device) -DECLARE_DEVICE_TYPE_NS(ZORRO_ACTION_REPLAY_MK3, bus::amiga::zorro, action_replay_mk3_device) - -#endif // MAME_BUS_AMIGA_ZORRO_ACTION_REPLAY_H diff --git a/src/devices/bus/amiga/zorro/buddha.cpp b/src/devices/bus/amiga/zorro/buddha.cpp index 5ffb4c9992e..e76d6a0640d 100644 --- a/src/devices/bus/amiga/zorro/buddha.cpp +++ b/src/devices/bus/amiga/zorro/buddha.cpp @@ -33,12 +33,12 @@ // DEVICE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(ZORRO_BUDDHA, bus::amiga::zorro::buddha_device, "zorro_buddha", "Buddha IDE controller") +DEFINE_DEVICE_TYPE(AMIGA_BUDDHA, bus::amiga::zorro::buddha_device, "amiga_buddha", "Buddha IDE controller") namespace bus::amiga::zorro { buddha_device::buddha_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, ZORRO_BUDDHA, tag, owner, clock), + device_t(mconfig, AMIGA_BUDDHA, tag, owner, clock), device_zorro2_card_interface(mconfig, *this), m_ata_0(*this, "ata_0"), m_ata_1(*this, "ata_1"), @@ -150,7 +150,7 @@ void buddha_device::ide_0_interrupt_w(int state) m_ide_0_interrupt = state; if (m_ide_interrupts_enabled) - m_slot->int2_w(state); + m_zorro->int2_w(state); } void buddha_device::ide_1_interrupt_w(int state) @@ -160,7 +160,7 @@ void buddha_device::ide_1_interrupt_w(int state) m_ide_1_interrupt = state; if (m_ide_interrupts_enabled) - m_slot->int2_w(state); + m_zorro->int2_w(state); } uint16_t buddha_device::ide_0_interrupt_r(offs_t offset, uint16_t mem_mask) @@ -234,28 +234,28 @@ void buddha_device::autoconfig_base_address(offs_t address) LOG("-> installing buddha\n"); // stop responding to initial location - m_slot->space().unmap_readwrite(0xe80000, 0xe8ffff); + m_zorro->space().unmap_readwrite(0xe80000, 0xe8ffff); // install buddha memory access to final location - m_slot->space().install_device(address, address + 0xffff, *this, &buddha_device::mmio_map); + m_zorro->space().install_device(address, address + 0xffff, *this, &buddha_device::mmio_map); // install autoconfig handler to new location - m_slot->space().install_readwrite_handler(address, address + 0x7f, + m_zorro->space().install_readwrite_handler(address, address + 0x7f, read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffffffff); + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); // we're done - m_slot->cfgout_w(0); + m_zorro->cfgout_w(0); } void buddha_device::cfgin_w(int state) { - LOG("configin_w (%d)\n", state); + LOG("cfgin_w (%d)\n", state); if (state == 0) { // buddha memory is also active at this point - m_slot->space().install_device(0xe80000, 0xe8ffff, *this, &buddha_device::mmio_map); + m_zorro->space().install_device(0xe80000, 0xe8ffff, *this, &buddha_device::mmio_map); // setup autoconfig autoconfig_board_type(BOARD_TYPE_ZORRO2); @@ -271,9 +271,9 @@ void buddha_device::cfgin_w(int state) autoconfig_rom_vector(0x1000); // install autoconfig handler - m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f, + m_zorro->space().install_readwrite_handler(0xe80000, 0xe8007f, read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffffffff); + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); } } diff --git a/src/devices/bus/amiga/zorro/buddha.h b/src/devices/bus/amiga/zorro/buddha.h index 2f3600348c6..09b0a39b4f7 100644 --- a/src/devices/bus/amiga/zorro/buddha.h +++ b/src/devices/bus/amiga/zorro/buddha.h @@ -81,6 +81,6 @@ private: } // namespace bus::amiga::zorro // device type declaration -DECLARE_DEVICE_TYPE_NS(ZORRO_BUDDHA, bus::amiga::zorro, buddha_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_BUDDHA, bus::amiga::zorro, buddha_device) #endif // MAME_BUS_AMIGA_ZORRO_BUDDHA_H diff --git a/src/devices/bus/amiga/zorro/cards.cpp b/src/devices/bus/amiga/zorro/cards.cpp index 31f07fe1218..5ef21b72c11 100644 --- a/src/devices/bus/amiga/zorro/cards.cpp +++ b/src/devices/bus/amiga/zorro/cards.cpp @@ -1,8 +1,8 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best +// license: GPL-2.0+ +// copyright-holders: Dirk Best /*************************************************************************** - Amiga Zorro Cards + Amiga Zorro-II Cards ***************************************************************************/ @@ -12,9 +12,8 @@ #include "a2052.h" #include "a2058.h" #include "a2065.h" +#include "a2091.h" #include "a2232.h" -#include "a590.h" -#include "action_replay.h" #include "buddha.h" #include "merlin.h" #include "picasso2.h" @@ -23,53 +22,18 @@ #include "toccata.h" -void a1000_expansion_cards(device_slot_interface &device) -{ -} - -void a500_expansion_cards(device_slot_interface &device) -{ - device.option_add("ar1", ZORRO_ACTION_REPLAY_MK1); - device.option_add("ar2", ZORRO_ACTION_REPLAY_MK2); - device.option_add("ar3", ZORRO_ACTION_REPLAY_MK3); - device.option_add("a590", ZORRO_A590); -} - -void a2000_expansion_cards(device_slot_interface &device) -{ - device.option_add("ar1", ZORRO_ACTION_REPLAY_MK1); - device.option_add("ar2", ZORRO_ACTION_REPLAY_MK2); - device.option_add("ar3", ZORRO_ACTION_REPLAY_MK3); -} - void zorro2_cards(device_slot_interface &device) { - device.option_add("a2052", ZORRO_A2052); - device.option_add("a2058", ZORRO_A2058); - device.option_add("a2065", ZORRO_A2065); - device.option_add("a2091", ZORRO_A2091); - device.option_add("a2232", ZORRO_A2232); - device.option_add("buddha", ZORRO_BUDDHA); - device.option_add("merlin", ZORRO_MERLIN); - device.option_add("picasso2p", ZORRO_PICASSO2P); - device.option_add("rainbow2", ZORRO_RAINBOW2); - device.option_add("framemaster", ZORRO_FRAMEMASTER); - device.option_add("ripple", ZORRO_RIPPLE); - device.option_add("toccata", ZORRO_TOCCATA); -} - -void zorro3_cards(device_slot_interface &device) -{ - device.option_add("a2052", ZORRO_A2052); - device.option_add("a2058", ZORRO_A2058); - device.option_add("a2065", ZORRO_A2065); - device.option_add("a2091", ZORRO_A2091); - device.option_add("a2232", ZORRO_A2232); - device.option_add("buddha", ZORRO_BUDDHA); - device.option_add("merlin", ZORRO_MERLIN); - device.option_add("picasso2p", ZORRO_PICASSO2P); - device.option_add("rainbow2", ZORRO_RAINBOW2); - device.option_add("framemaster", ZORRO_FRAMEMASTER); - device.option_add("ripple", ZORRO_RIPPLE); - device.option_add("toccata", ZORRO_TOCCATA); + device.option_add("a2052", AMIGA_A2052); + device.option_add("a2058", AMIGA_A2058); + device.option_add("a2065", AMIGA_A2065); + device.option_add("a2091", AMIGA_A2091); + device.option_add("a2232", AMIGA_A2232); + device.option_add("buddha", AMIGA_BUDDHA); + device.option_add("merlin", AMIGA_MERLIN); + device.option_add("picasso2p", AMIGA_PICASSO2P); + device.option_add("rainbow2", AMIGA_RAINBOW2); + device.option_add("framemaster", AMIGA_FRAMEMASTER); + device.option_add("ripple", AMIGA_RIPPLE); + device.option_add("toccata", AMIGA_TOCCATA); } diff --git a/src/devices/bus/amiga/zorro/cards.h b/src/devices/bus/amiga/zorro/cards.h index bcfaba5f8fd..103c68dbd51 100644 --- a/src/devices/bus/amiga/zorro/cards.h +++ b/src/devices/bus/amiga/zorro/cards.h @@ -1,23 +1,8 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best +// license: GPL-2.0+ +// copyright-holders: Dirk Best /*************************************************************************** - 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. + Amiga Zorro-II Cards ***************************************************************************/ @@ -27,11 +12,6 @@ #pragma once -void a1000_expansion_cards(device_slot_interface &device) ATTR_COLD; -void a500_expansion_cards(device_slot_interface &device) ATTR_COLD; -void a2000_expansion_cards(device_slot_interface &device) ATTR_COLD; - void zorro2_cards(device_slot_interface &device) ATTR_COLD; -void zorro3_cards(device_slot_interface &device) ATTR_COLD; #endif // MAME_BUS_AMIGA_ZORRO_CARDS_H diff --git a/src/devices/bus/amiga/zorro/merlin.cpp b/src/devices/bus/amiga/zorro/merlin.cpp index 49917d8e9a3..a55497ab23b 100644 --- a/src/devices/bus/amiga/zorro/merlin.cpp +++ b/src/devices/bus/amiga/zorro/merlin.cpp @@ -33,12 +33,12 @@ // TYPE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(ZORRO_MERLIN, bus::amiga::zorro::merlin_device, "zorro_merlin", "Merlin RTG") +DEFINE_DEVICE_TYPE(AMIGA_MERLIN, bus::amiga::zorro::merlin_device, "amiga_merlin", "Merlin RTG") namespace bus::amiga::zorro { merlin_device::merlin_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, ZORRO_MERLIN, tag, owner, clock), + device_t(mconfig, AMIGA_MERLIN, tag, owner, clock), device_zorro2_card_interface(mconfig, *this), m_vga(*this, "vga"), m_ramdac(*this, "ramdac"), @@ -75,7 +75,7 @@ void merlin_device::device_add_mconfig(machine_config &config) ET4KW32I_VGA(config, m_vga, 0); // should be ET4000W32 m_vga->set_screen("screen"); m_vga->set_vram_size(0x200000); - m_vga->vsync_cb().set([this](int state) { m_slot->int6_w(state); }); + m_vga->vsync_cb().set([this](int state) { m_zorro->int6_w(state); }); BT482(config, m_ramdac, 0); } @@ -116,9 +116,9 @@ void merlin_device::autoconfig_base_address(offs_t address) { LOG("-> installing merlin memory\n"); - m_slot->space().install_readwrite_handler(address, address + 0x1fffff, + m_zorro->space().install_readwrite_handler(address, address + 0x1fffff, emu::rw_delegate(m_vga, FUNC(et4kw32i_vga_device::mem_r)), - emu::rw_delegate(m_vga, FUNC(et4kw32i_vga_device::mem_w)), 0xffffffff); + emu::rw_delegate(m_vga, FUNC(et4kw32i_vga_device::mem_w)), 0xffff); m_autoconfig_memory_done = true; @@ -130,19 +130,19 @@ void merlin_device::autoconfig_base_address(offs_t address) LOG("-> installing merlin registers\n"); // install merlin registers - m_slot->space().install_device(address, address + 0x0ffff, *this, &merlin_device::mmio_map); + m_zorro->space().install_device(address, address + 0x0ffff, *this, &merlin_device::mmio_map); // stop responding to default autoconfig - m_slot->space().unmap_readwrite(0xe80000, 0xe8007f); + m_zorro->space().unmap_readwrite(0xe80000, 0xe8007f); // we're done - m_slot->cfgout_w(0); + m_zorro->cfgout_w(0); } } void merlin_device::cfgin_w(int state) { - LOG("configin_w (%d)\n", state); + LOG("cfgin_w (%d)\n", state); if (state != 0) return; @@ -165,9 +165,9 @@ void merlin_device::cfgin_w(int state) autoconfig_rom_vector(0x0000); // install autoconfig handler - m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f, + m_zorro->space().install_readwrite_handler(0xe80000, 0xe8007f, read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffffffff); + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); } else { diff --git a/src/devices/bus/amiga/zorro/merlin.h b/src/devices/bus/amiga/zorro/merlin.h index f369628aaee..4a7a06bdcf8 100644 --- a/src/devices/bus/amiga/zorro/merlin.h +++ b/src/devices/bus/amiga/zorro/merlin.h @@ -51,6 +51,6 @@ private: } // namespace bus::amiga::zorro // device type declaration -DECLARE_DEVICE_TYPE_NS(ZORRO_MERLIN, bus::amiga::zorro, merlin_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_MERLIN, bus::amiga::zorro, merlin_device) #endif // MAME_BUS_AMIGA_ZORRO_MERLIN_H diff --git a/src/devices/bus/amiga/zorro/picasso2.cpp b/src/devices/bus/amiga/zorro/picasso2.cpp index 35799c1ded1..9c4f4baa47f 100644 --- a/src/devices/bus/amiga/zorro/picasso2.cpp +++ b/src/devices/bus/amiga/zorro/picasso2.cpp @@ -31,12 +31,12 @@ // TYPE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(ZORRO_PICASSO2P, bus::amiga::zorro::picasso2p_device, "zorro_picasso2p", "Picasso II+ RTG") +DEFINE_DEVICE_TYPE(AMIGA_PICASSO2P, bus::amiga::zorro::picasso2p_device, "amiga_picasso2p", "Picasso II+ RTG") namespace bus::amiga::zorro { picasso2p_device::picasso2p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, ZORRO_PICASSO2P, tag, owner, clock), + device_t(mconfig, AMIGA_PICASSO2P, tag, owner, clock), device_memory_interface(mconfig, *this), device_zorro2_card_interface(mconfig, *this), m_vga(*this, "vga"), @@ -138,9 +138,9 @@ void picasso2p_device::autoconfig_base_address(offs_t address) { LOG("-> installing picasso2p memory\n"); - m_slot->space().install_readwrite_handler(address, address + 0x1fffff, + m_zorro->space().install_readwrite_handler(address, address + 0x1fffff, emu::rw_delegate(m_vga, FUNC(cirrus_gd5428_vga_device::mem_r)), - emu::rw_delegate(m_vga, FUNC(cirrus_gd5428_vga_device::mem_w)), 0xffffffff); + emu::rw_delegate(m_vga, FUNC(cirrus_gd5428_vga_device::mem_w)), 0xffff); m_autoconfig_memory_done = true; @@ -152,19 +152,19 @@ void picasso2p_device::autoconfig_base_address(offs_t address) LOG("-> installing picasso2p registers\n"); // install picasso registers - m_slot->space().install_device(address, address + 0x0ffff, *this, &picasso2p_device::mmio_map); + m_zorro->space().install_device(address, address + 0x0ffff, *this, &picasso2p_device::mmio_map); // stop responding to default autoconfig - m_slot->space().unmap_readwrite(0xe80000, 0xe8007f); + m_zorro->space().unmap_readwrite(0xe80000, 0xe8007f); // we're done - m_slot->cfgout_w(0); + m_zorro->cfgout_w(0); } } void picasso2p_device::cfgin_w(int state) { - LOG("configin_w (%d)\n", state); + LOG("cfgin_w (%d)\n", state); if (state != 0) return; @@ -187,9 +187,9 @@ void picasso2p_device::cfgin_w(int state) autoconfig_rom_vector(0x0000); // install autoconfig handler - m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f, + m_zorro->space().install_readwrite_handler(0xe80000, 0xe8007f, read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffffffff); + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); } else { diff --git a/src/devices/bus/amiga/zorro/picasso2.h b/src/devices/bus/amiga/zorro/picasso2.h index 82a779f2874..1804c1a22eb 100644 --- a/src/devices/bus/amiga/zorro/picasso2.h +++ b/src/devices/bus/amiga/zorro/picasso2.h @@ -58,6 +58,6 @@ private: } // namespace bus::amiga::zorro // device type declaration -DECLARE_DEVICE_TYPE_NS(ZORRO_PICASSO2P, bus::amiga::zorro, picasso2p_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_PICASSO2P, bus::amiga::zorro, picasso2p_device) #endif // MAME_BUS_AMIGA_ZORRO_PICASSO2_H diff --git a/src/devices/bus/amiga/zorro/rainbow2.cpp b/src/devices/bus/amiga/zorro/rainbow2.cpp index bd2c0632978..1cd8b38ac09 100644 --- a/src/devices/bus/amiga/zorro/rainbow2.cpp +++ b/src/devices/bus/amiga/zorro/rainbow2.cpp @@ -36,8 +36,8 @@ // TYPE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(ZORRO_RAINBOW2, bus::amiga::zorro::rainbow2_device, "zorro_rainbow2", "Rainbow II Framebuffer") -DEFINE_DEVICE_TYPE(ZORRO_FRAMEMASTER, bus::amiga::zorro::framemaster_device, "zorro_framemaster", "FrameMaster Framebuffer") +DEFINE_DEVICE_TYPE(AMIGA_RAINBOW2, bus::amiga::zorro::rainbow2_device, "amiga_rainbow2", "Rainbow II Framebuffer") +DEFINE_DEVICE_TYPE(AMIGA_FRAMEMASTER, bus::amiga::zorro::framemaster_device, "amiga_framemaster", "FrameMaster Framebuffer") namespace bus::amiga::zorro { @@ -51,12 +51,12 @@ rainbow2_device::rainbow2_device(const machine_config &mconfig, const char *tag, } rainbow2_device::rainbow2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - rainbow2_device(mconfig, tag, owner, clock, ZORRO_RAINBOW2, 2145) + rainbow2_device(mconfig, tag, owner, clock, AMIGA_RAINBOW2, 2145) { } framemaster_device::framemaster_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - rainbow2_device(mconfig, tag, owner, clock, ZORRO_FRAMEMASTER, 2092) + rainbow2_device(mconfig, tag, owner, clock, AMIGA_FRAMEMASTER, 2092) { } @@ -180,22 +180,22 @@ void rainbow2_device::autoconfig_base_address(offs_t address) LOG("-> installing rainbow2\n"); // stop responding to default autoconfig - m_slot->space().unmap_readwrite(0xe80000, 0xe8007f); + m_zorro->space().unmap_readwrite(0xe80000, 0xe8007f); // video memory - m_slot->space().install_ram(address, address + 0x1fffff, m_vram.get()); + m_zorro->space().install_ram(address, address + 0x1fffff, m_vram.get()); // control register - m_slot->space().install_write_handler(address + 0x1ffff8, address + 0x1ffff8, + m_zorro->space().install_write_handler(address + 0x1ffff8, address + 0x1ffff8, emu::rw_delegate(*this, FUNC(rainbow2_device::control_w))); // we're done - m_slot->cfgout_w(0); + m_zorro->cfgout_w(0); } void rainbow2_device::cfgin_w(int state) { - LOG("configin_w (%d)\n", state); + LOG("cfgin_w (%d)\n", state); if (state == 0) { @@ -213,9 +213,9 @@ void rainbow2_device::cfgin_w(int state) autoconfig_rom_vector(0x0000); // install autoconfig handler - m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f, + m_zorro->space().install_readwrite_handler(0xe80000, 0xe8007f, read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffffffff); + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); } } diff --git a/src/devices/bus/amiga/zorro/rainbow2.h b/src/devices/bus/amiga/zorro/rainbow2.h index dc870ddd779..0905785b99b 100644 --- a/src/devices/bus/amiga/zorro/rainbow2.h +++ b/src/devices/bus/amiga/zorro/rainbow2.h @@ -62,7 +62,7 @@ public: } // namespace bus::amiga::zorro // device type declaration -DECLARE_DEVICE_TYPE_NS(ZORRO_RAINBOW2, bus::amiga::zorro, rainbow2_device) -DECLARE_DEVICE_TYPE_NS(ZORRO_FRAMEMASTER, bus::amiga::zorro, framemaster_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_RAINBOW2, bus::amiga::zorro, rainbow2_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_FRAMEMASTER, bus::amiga::zorro, framemaster_device) #endif // MAME_BUS_AMIGA_ZORRO_RAINBOW2_H diff --git a/src/devices/bus/amiga/zorro/ripple.cpp b/src/devices/bus/amiga/zorro/ripple.cpp index 6cc9679cf2f..f2d50da629b 100644 --- a/src/devices/bus/amiga/zorro/ripple.cpp +++ b/src/devices/bus/amiga/zorro/ripple.cpp @@ -29,12 +29,12 @@ // TYPE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(ZORRO_RIPPLE, bus::amiga::zorro::ripple_ide_device, "zorro_ripple", "RIPPLE IDE Interface") +DEFINE_DEVICE_TYPE(AMIGA_RIPPLE, bus::amiga::zorro::ripple_ide_device, "amiga_ripple", "RIPPLE IDE Interface") namespace bus::amiga::zorro { ripple_ide_device::ripple_ide_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, ZORRO_RIPPLE, tag, owner, clock), + device_t(mconfig, AMIGA_RIPPLE, tag, owner, clock), device_zorro2_card_interface(mconfig, *this), m_ata_0(*this, "ata_0"), m_ata_1(*this, "ata_1"), @@ -175,62 +175,39 @@ void ripple_ide_device::autoconfig_base_address(offs_t address) m_base_address = address; // stop responding to default autoconfig - m_slot->space().unmap_readwrite(0xe80000, 0xe8007f); + m_zorro->space().unmap_readwrite(0xe80000, 0xe8007f); // flash occupies our space until the ide registers are switched in - m_slot->space().install_readwrite_handler(address, address + 0x1ffff, + m_zorro->space().install_readwrite_handler(address, address + 0x1ffff, emu::rw_delegate(m_flash, FUNC(intelfsh8_device::read)), - emu::rw_delegate(m_flash, FUNC(intelfsh8_device::write)), 0xff00ff00); + emu::rw_delegate(m_flash, FUNC(intelfsh8_device::write)), 0xff00); // install write tap to handle switching in ide registers m_write_tap.remove(); - - if (m_slot->space().data_width() == 16) - { - m_write_tap = m_slot->space().install_write_tap( - address, address + 0x1ffff, - "flash_disable_w", - [this] (offs_t offset, uint16_t &data, uint16_t mem_mask) - { - m_write_tap.remove(); - - // ripple registers are now available - m_slot->space().install_device(m_base_address, m_base_address + 0x1ffff, *this, &ripple_ide_device::mmio_map); - - // we need to repeat the write here as this tap won't hit it yet - // the initial write will instead hit the flash, but it's harmless - m_slot->space().write_word(offset, data, mem_mask); - }, - &m_write_tap - ); - } - else - { - m_write_tap = m_slot->space().install_write_tap( - address, address + 0x1ffff, - "flash_disable_w", - [this] (offs_t offset, uint32_t &data, uint32_t mem_mask) - { - m_write_tap.remove(); - - // ripple registers are now available - m_slot->space().install_device(m_base_address, m_base_address + 0x1ffff, *this, &ripple_ide_device::mmio_map); - - // we need to repeat the write here as this tap won't hit it yet - // the initial write will instead hit the flash, but it's harmless - m_slot->space().write_dword(offset, data, mem_mask); - }, - &m_write_tap - ); - } + m_write_tap = m_zorro->space().install_write_tap( + address, address + 0x1ffff, + "flash_disable_w", + [this] (offs_t offset, uint16_t &data, uint16_t mem_mask) + { + m_write_tap.remove(); + + // ripple registers are now available + m_zorro->space().install_device(m_base_address, m_base_address + 0x1ffff, *this, &ripple_ide_device::mmio_map); + + // we need to repeat the write here as this tap won't hit it yet + // the initial write will instead hit the flash, but it's harmless + m_zorro->space().write_word(offset, data, mem_mask); + }, + &m_write_tap + ); // we're done - m_slot->cfgout_w(0); + m_zorro->cfgout_w(0); } void ripple_ide_device::cfgin_w(int state) { - LOG("configin_w (%d)\n", state); + LOG("cfgin_w (%d)\n", state); if (state == 0) { @@ -248,9 +225,9 @@ void ripple_ide_device::cfgin_w(int state) autoconfig_rom_vector(0x0008); // install autoconfig handler - m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f, + m_zorro->space().install_readwrite_handler(0xe80000, 0xe8007f, read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffffffff); + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); } } diff --git a/src/devices/bus/amiga/zorro/ripple.h b/src/devices/bus/amiga/zorro/ripple.h index 4d203bd6e5e..e8dae6fc36e 100644 --- a/src/devices/bus/amiga/zorro/ripple.h +++ b/src/devices/bus/amiga/zorro/ripple.h @@ -69,6 +69,6 @@ private: } // namespace bus::amiga::zorro // device type declaration -DECLARE_DEVICE_TYPE_NS(ZORRO_RIPPLE, bus::amiga::zorro, ripple_ide_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_RIPPLE, bus::amiga::zorro, ripple_ide_device) #endif // MAME_BUS_AMIGA_ZORRO_RIPPLE_H diff --git a/src/devices/bus/amiga/zorro/toccata.cpp b/src/devices/bus/amiga/zorro/toccata.cpp index 6c5c2cf81ca..6aebd2defbc 100644 --- a/src/devices/bus/amiga/zorro/toccata.cpp +++ b/src/devices/bus/amiga/zorro/toccata.cpp @@ -40,12 +40,12 @@ // TYPE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(ZORRO_TOCCATA, bus::amiga::zorro::toccata_device, "zorro_toccata", "Toccata SoundCard") +DEFINE_DEVICE_TYPE(AMIGA_TOCCATA, bus::amiga::zorro::toccata_device, "amiga_toccata", "Toccata SoundCard") namespace bus::amiga::zorro { toccata_device::toccata_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, ZORRO_TOCCATA, tag, owner, clock), + device_t(mconfig, AMIGA_TOCCATA, tag, owner, clock), device_zorro2_card_interface(mconfig, *this), m_ad1848(*this, "ad1848"), m_fifo(*this, "fifo%u", 0U) @@ -101,7 +101,7 @@ void toccata_device::update_interrupts() LOGMASKED(LOG_IRQ, "generating interrupt, control = %02x, status = %02x\n", m_control, m_status); m_status &= ~(1 << 7); - m_slot->int6_w(1); + m_zorro->int6_w(1); } } @@ -171,7 +171,7 @@ uint8_t toccata_device::status_r(offs_t offset) // reading the status clears the interrupt m_status = 0x80; - m_slot->int6_w(0); + m_zorro->int6_w(0); } return data; @@ -280,18 +280,18 @@ void toccata_device::autoconfig_base_address(offs_t address) LOG("-> installing toccata\n"); // stop responding to default autoconfig - m_slot->space().unmap_readwrite(0xe80000, 0xe8007f); + m_zorro->space().unmap_readwrite(0xe80000, 0xe8007f); // toccata registers - m_slot->space().install_device(address, address + 0x0ffff, *this, &toccata_device::mmio_map); + m_zorro->space().install_device(address, address + 0x0ffff, *this, &toccata_device::mmio_map); // we're done - m_slot->cfgout_w(0); + m_zorro->cfgout_w(0); } void toccata_device::cfgin_w(int state) { - LOG("configin_w (%d)\n", state); + LOG("cfgin_w (%d)\n", state); if (state == 0) { @@ -309,9 +309,9 @@ void toccata_device::cfgin_w(int state) autoconfig_rom_vector(0x0000); // install autoconfig handler - m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f, + m_zorro->space().install_readwrite_handler(0xe80000, 0xe8007f, read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffffffff); + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); } } diff --git a/src/devices/bus/amiga/zorro/toccata.h b/src/devices/bus/amiga/zorro/toccata.h index d1e44433406..f065c2f8179 100644 --- a/src/devices/bus/amiga/zorro/toccata.h +++ b/src/devices/bus/amiga/zorro/toccata.h @@ -67,6 +67,6 @@ private: } // namespace bus::amiga::zorro // device type declaration -DECLARE_DEVICE_TYPE_NS(ZORRO_TOCCATA, bus::amiga::zorro, toccata_device) +DECLARE_DEVICE_TYPE_NS(AMIGA_TOCCATA, bus::amiga::zorro, toccata_device) #endif // MAME_BUS_AMIGA_ZORRO_TOCCATA_H diff --git a/src/devices/bus/amiga/zorro/zorro.cpp b/src/devices/bus/amiga/zorro/zorro.cpp index 78f208886f9..14e13c76617 100644 --- a/src/devices/bus/amiga/zorro/zorro.cpp +++ b/src/devices/bus/amiga/zorro/zorro.cpp @@ -1,10 +1,8 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best +// license: GPL-2.0+ +// copyright-holders: Dirk Best /*************************************************************************** - Amiga Zorro Slots - - 86-pin Expansion Slot (Zorro-I), Zorro-II, Zorro-III + Amiga Zorro-II Slot ***************************************************************************/ @@ -13,233 +11,91 @@ //************************************************************************** -// ZORRO SLOT DEVICE -//************************************************************************** - -DEFINE_DEVICE_TYPE(ZORRO_SLOT, zorro_slot_device, "zorro_slot", "Zorro slot") - -//------------------------------------------------- -// zorro_slot_device - constructor -//------------------------------------------------- - -zorro_slot_device::zorro_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - zorro_slot_device(mconfig, ZORRO_SLOT, tag, owner, clock) -{ -} - -zorro_slot_device::zorro_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, type, tag, owner, clock), - device_slot_interface(mconfig, *this), - m_zorro_bus(*this, finder_base::DUMMY_TAG) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void zorro_slot_device::device_start() -{ - device_t *const card(get_card_device()); - device_zorro_card_interface *const dev(dynamic_cast<device_zorro_card_interface *>(card)); - - if (dev) - { - m_zorro_bus->add_card(*dev); - } - else if (card) - { - throw emu_fatalerror( - "zorro slot '%s' card device %s (%s) does not implement device_zorro_card_interface\n", - tag(), card->tag(), card->name()); - } -} - - -//************************************************************************** -// BASE ZORRO BUS DEVICE +// BUS DEVICE //************************************************************************** -//------------------------------------------------- -// exp_slot_device - constructor -//------------------------------------------------- +DEFINE_DEVICE_TYPE(ZORRO2_BUS, zorro2_bus_device, "zorro2", "Zorro-II Bus") -zorro_bus_device_base::zorro_bus_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, type, tag, owner, clock), - m_space(*this, finder_base::DUMMY_TAG, -1), - m_ovr_handler(*this), +zorro2_bus_device::zorro2_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, ZORRO2_BUS, tag, owner, clock), + device_memory_interface(mconfig, *this), + m_zorro_space_config("zorro", ENDIANNESS_BIG, 16, 24, 0, address_map_constructor()), + m_eint1_handler(*this), + m_eint4_handler(*this), + m_eint5_handler(*this), + m_eint7_handler(*this), m_int2_handler(*this), - m_int6_handler(*this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void zorro_bus_device_base::device_start() -{ -} - -// from slot device -void zorro_bus_device_base::ovr_w(int state) { m_ovr_handler(state); } -void zorro_bus_device_base::int2_w(int state) { m_int2_handler(state); } -void zorro_bus_device_base::int6_w(int state) { m_int6_handler(state); } - - -//************************************************************************** -// EXPANSION SLOT DEVICE -//************************************************************************** - -DEFINE_DEVICE_TYPE(EXP_SLOT, exp_slot_device, "exp_slot", "86-pin expansion slot") - -//------------------------------------------------- -// exp_slot_device - constructor -//------------------------------------------------- - -exp_slot_device::exp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - exp_slot_device(mconfig, EXP_SLOT, tag, owner, clock) + m_int6_handler(*this), + m_ovr_handler(*this), + m_autoconfig_device(0) { } -exp_slot_device::exp_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : - zorro_bus_device_base(mconfig, type, tag, owner, clock), - m_ipl_handler(*this), - m_dev(nullptr) +void zorro2_bus_device::device_start() { + // register for save states + save_item(NAME(m_autoconfig_device)); } -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void exp_slot_device::device_reset() +device_memory_interface::space_config_vector zorro2_bus_device::memory_space_config() const { - // call base device - zorro_bus_device_base::device_reset(); - - // if we have a device, start the autoconfig chain - if (m_dev) - m_dev->cfgin_w(0); + return space_config_vector{ + std::make_pair(AS_PROGRAM, &m_zorro_space_config) + }; } -//------------------------------------------------- -// add_card - add new card to our bus -//------------------------------------------------- - -void exp_slot_device::add_card(device_zorro_card_interface &card) +void zorro2_bus_device::add_card(device_zorro2_card_interface &card) { - m_dev = dynamic_cast<device_exp_card_interface *>(&card); - if (!m_dev) - { - throw emu_fatalerror( - "exp slot '%s' card device %s (%s) does not implement device_exp_card_interface\n", - tag(), card.device().tag(), card.device().name()); - } - card.set_zorro_bus(*this); + card.set_bus(*this); + m_cards.emplace_back(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 -//************************************************************************** - -DEFINE_DEVICE_TYPE(ZORRO2, zorro2_bus_device, "zorro2", "Zorro-II bus") - -//------------------------------------------------- -// zorro2_bus_device - constructor -//------------------------------------------------- - -zorro2_bus_device::zorro2_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - zorro2_bus_device(mconfig, ZORRO2, tag, owner, clock) -{ -} - -zorro2_bus_device::zorro2_bus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : - zorro_bus_device_base(mconfig, type, tag, owner, clock), - m_eint1_handler(*this), - m_eint4_handler(*this), - m_eint5_handler(*this), - m_eint7_handler(*this), - m_autoconfig_device(0) -{ -} - -//------------------------------------------------- -// zorro2_bus_device - destructor -//------------------------------------------------- - -zorro2_bus_device::~zorro2_bus_device() +void zorro2_bus_device::cfgout_w(int state) { + // if there is still a device in the chain, tell it to configure itself + if (m_cards.size() > ++m_autoconfig_device) + m_cards[m_autoconfig_device].get().cfgin_w(0); } -//------------------------------------------------- -// device_start - device-specific start -//------------------------------------------------- +void zorro2_bus_device::eint1_w(int state) { m_eint1_handler(state); } +void zorro2_bus_device::eint4_w(int state) { m_eint4_handler(state); } +void zorro2_bus_device::eint5_w(int state) { m_eint5_handler(state); } +void zorro2_bus_device::eint7_w(int state) { m_eint7_handler(state); } +void zorro2_bus_device::int2_w(int state) { m_int2_handler(state); } +void zorro2_bus_device::int6_w(int state) { m_int6_handler(state); } +void zorro2_bus_device::ovr_w(int state) { m_ovr_handler(state); } -void zorro2_bus_device::device_start() +// from host +uint16_t zorro2_bus_device::mem_r(offs_t offset, uint16_t mem_mask) { - zorro_bus_device_base::device_start(); - - save_item(NAME(m_autoconfig_device)); + return space().read_word(0x200000 + (offset << 1), mem_mask); } -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void zorro2_bus_device::device_reset() +void zorro2_bus_device::mem_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - // call base device - zorro_bus_device_base::device_reset(); + space().write_word(0x200000 + (offset << 1), data, mem_mask); } -//------------------------------------------------- -// add_card - add new card to our bus -//------------------------------------------------- - -void zorro2_bus_device::add_card(device_zorro_card_interface &card) +uint16_t zorro2_bus_device::io_r(offs_t offset, uint16_t mem_mask) { - device_zorro2_card_interface *const zorro2_card(dynamic_cast<device_zorro2_card_interface *>(&card)); - if (!zorro2_card) - { - throw emu_fatalerror( - "zorro2 slot '%s' card device %s (%s) does not implement device_zorro2_card_interface\n", - tag(), card.device().tag(), card.device().name()); - } - card.set_zorro_bus(*this); - m_dev.emplace_back(*zorro2_card); + return space().read_word(0xe80000 + (offset << 1), mem_mask); } -// from slot device -void zorro2_bus_device::eint1_w(int state) { m_eint1_handler(state); } -void zorro2_bus_device::eint4_w(int state) { m_eint4_handler(state); } -void zorro2_bus_device::eint5_w(int state) { m_eint5_handler(state); } -void zorro2_bus_device::eint7_w(int state) { m_eint7_handler(state); } - -void zorro2_bus_device::cfgout_w(int state) +void zorro2_bus_device::io_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - // if there is still a device in the chain, tell it to configure itself - if (m_dev.size() > ++m_autoconfig_device) - m_dev[m_autoconfig_device].get().cfgin_w(0); + space().write_word(0xe80000 + (offset << 1), data, mem_mask); } -// from host void zorro2_bus_device::fc_w(int code) { - for (device_zorro2_card_interface &entry : m_dev) + for (device_zorro2_card_interface &entry : m_cards) entry.fc_w(code); } void zorro2_bus_device::busrst_w(int state) { - for (device_zorro2_card_interface &card : m_dev) + for (device_zorro2_card_interface &card : m_cards) card.busrst_w(state); if (state == 0) @@ -248,126 +104,73 @@ void zorro2_bus_device::busrst_w(int state) m_autoconfig_device = 0; // if we have a device, start the autoconfig chain - if (m_dev.size() > m_autoconfig_device) - m_dev[m_autoconfig_device].get().cfgin_w(0); + if (m_cards.size() > m_autoconfig_device) + m_cards[m_autoconfig_device].get().cfgin_w(0); } } //************************************************************************** -// ZORRO INTERFACE +// SLOT DEVICE //************************************************************************** -//------------------------------------------------- -// device_zorro_card_interface - constructor -//------------------------------------------------- - -device_zorro_card_interface::device_zorro_card_interface(const machine_config &mconfig, device_t &device) : - device_interface(device, "zorro"), - m_zorro(nullptr) -{ -} - -//------------------------------------------------- -// ~device_zorro_card_interface - destructor -//------------------------------------------------- +DEFINE_DEVICE_TYPE(ZORRO2_SLOT, zorro2_slot_device, "zorro2_slot", "Zorro-II slot") -device_zorro_card_interface::~device_zorro_card_interface() +zorro2_slot_device::zorro2_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + zorro2_slot_device(mconfig, ZORRO2_SLOT, tag, owner, clock) { } -void device_zorro_card_interface::set_zorro_bus(zorro_bus_device_base &device) +zorro2_slot_device::zorro2_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, type, tag, owner, clock), + device_single_card_slot_interface(mconfig, *this) { - assert(!m_zorro); - m_zorro = &device; } -void device_zorro_card_interface::fc_w(int code) +void zorro2_slot_device::device_resolve_objects() { -} + device_zorro2_card_interface *dev = get_card_device(); -void device_zorro_card_interface::cfgin_w(int state) -{ + if (dev) + { + zorro2_bus_device *bus = downcast<zorro2_bus_device *>(m_owner); + bus->add_card(*dev); + } } -void device_zorro_card_interface::busrst_w(int state) +void zorro2_slot_device::device_start() { } //************************************************************************** -// EXPANSION CARD INTERFACE +// 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(nullptr) +device_zorro2_card_interface::device_zorro2_card_interface(const machine_config &mconfig, device_t &device) : + device_interface(device, "zorro2"), + m_zorro(nullptr) { } -//------------------------------------------------- -// ~device_exp_card_interface - destructor -//------------------------------------------------- - -device_exp_card_interface::~device_exp_card_interface() +device_zorro2_card_interface::~device_zorro2_card_interface() { } -void device_exp_card_interface::interface_pre_start() +void device_zorro2_card_interface::set_bus(zorro2_bus_device &device) { - device_zorro_card_interface::interface_pre_start(); - - if (!m_zorro) - throw device_missing_dependencies(); - - m_slot = dynamic_cast<exp_slot_device *>(m_zorro); - if (!m_slot) - { - throw emu_fatalerror( - "exp card '%s' zorro device %s (%s) does not derive from exp_slot_device\n", - device().tag(), m_zorro->tag(), m_zorro->name()); - } + assert(!m_zorro); + m_zorro = &device; } - -//************************************************************************** -// 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_slot(nullptr) +void device_zorro2_card_interface::fc_w(int code) { } -//------------------------------------------------- -// ~device_zorro2_interface - destructor -//------------------------------------------------- - -device_zorro2_card_interface::~device_zorro2_card_interface() +void device_zorro2_card_interface::cfgin_w(int state) { } -void device_zorro2_card_interface::interface_pre_start() +void device_zorro2_card_interface::busrst_w(int state) { - device_zorro_card_interface::interface_pre_start(); - - if (!m_zorro) - throw device_missing_dependencies(); - - m_slot = dynamic_cast<zorro2_bus_device *>(m_zorro); - if (!m_slot) - { - throw emu_fatalerror( - "zorro2 card '%s' zorro device %s (%s) does not derive from zorro2_bus_device\n", - device().tag(), m_zorro->tag(), m_zorro->name()); - } } diff --git a/src/devices/bus/amiga/zorro/zorro.h b/src/devices/bus/amiga/zorro/zorro.h index 236cb192710..2662a3e9356 100644 --- a/src/devices/bus/amiga/zorro/zorro.h +++ b/src/devices/bus/amiga/zorro/zorro.h @@ -1,23 +1,19 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best +// license: GPL-2.0+ +// copyright-holders: Dirk Best /*************************************************************************** - Amiga Zorro Slots - - 86-pin Expansion Slot (Zorro-I), Zorro-II, Zorro-III - - 86-pin Expansion Slot + Amiga Zorro-II 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 + 8 -5VDC 7 /OWN + 10 +12VDC 9 /SLAVEn + 12 CFGINn 11 CFGOUTn 14 /C3 Clock 13 Ground 16 /C1 Clock 15 CDAC 18 XRDY 17 /OVR - 20 N/C *3 19 /INT2 + 20 -12V 19 /INT2 22 /INT6 21 A5 24 A4 23 A6 26 A3 25 Ground @@ -27,21 +23,21 @@ 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 + 40 /EINT7 39 A13 + 42 /EINT5 41 A14 + 44 /EINT4 43 A15 + 46 /BERR 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 + 60 /BRn 59 A23 62 /BGACK 61 Ground - 64 /BG *5 63 D15 + 64 /BGn 63 D15 66 /DTACK 65 D14 - 68 R/W 67 D13 + 68 READ 67 D13 70 /LDS 69 D12 72 /UDS 71 D11 74 /AS 73 Ground @@ -51,91 +47,14 @@ 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 + 87 Ground 88 Ground 90 Ground 89 Ground - 92 7 MHz 91 Ground + 92 7MHz 91 Ground 94 /BUSRST 93 DOE - 96 /EINT1 95 /BG *5 + 96 /EINT1 95 /(C)BG 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 - - ***************************************************************************/ #ifndef MAME_BUS_AMIGA_ZORRO_ZORRO_H @@ -148,234 +67,131 @@ #include <vector> -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - // forward declaration of card interfaces -class device_zorro_card_interface; -class device_exp_card_interface; class device_zorro2_card_interface; -class zorro_bus_device_base; - -// ======================> 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_t clock); - template <typename T, typename O> - zorro_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&zorrotag, O &&opts, const char *dflt) - : zorro_slot_device(mconfig, tag, owner, 0) - { - set_zorro_slot(std::forward<T>(zorrotag)); - option_reset(); - opts(*this); - set_default_option(dflt); - set_fixed(false); - } - - // inline configuration - template <class T> void set_zorro_slot(T &&zorro_tag) { m_zorro_bus.set_tag(zorro_tag); } - -protected: - zorro_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - - // device_t implementation - virtual void device_start() override ATTR_COLD; - - // configuration - required_device<zorro_bus_device_base> m_zorro_bus; -}; - -// device type definition -DECLARE_DEVICE_TYPE(ZORRO_SLOT, zorro_slot_device) - -// ======================> base zorro bus device - -class zorro_bus_device_base : public device_t -{ -public: - // configuration helpers - template <class T> void set_space(T &&tag, int spacenum) { m_space.set_tag(std::forward<T>(tag), spacenum); } - - auto int2_handler() { return m_int2_handler.bind(); } - auto int6_handler() { return m_int6_handler.bind(); } - auto ovr_handler() { return m_ovr_handler.bind(); } - - virtual void add_card(device_zorro_card_interface &card) ATTR_COLD = 0; - - // interface (from slot device) - virtual void cfgout_w(int state) { } - - void int2_w(int state); - void int6_w(int state); - void ovr_w(int state); - - // interface (from host) - virtual void fc_w(int code) = 0; - - // access to the host space - address_space &space() const { return *m_space; } - -protected: - // construction/destruction - zorro_bus_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - - // device_t implementation - virtual void device_start() override ATTR_COLD; -private: - required_address_space m_space; - - devcb_write_line m_ovr_handler; - devcb_write_line m_int2_handler; - devcb_write_line m_int6_handler; -}; - -// ======================> expansion slot device - -class exp_slot_device : public zorro_bus_device_base -{ -public: - // construction/destruction - exp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - auto ipl_handler() { return m_ipl_handler.bind(); } - - // the expansion slot can only have a single card - virtual void add_card(device_zorro_card_interface &card) override ATTR_COLD; - - // interface (from slot device) - void ipl_w(int interrupt); - - // interface (from host) - virtual void fc_w(int code) override; -protected: - exp_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - - // device_t implementation - virtual void device_reset() override ATTR_COLD; - -private: - devcb_write8 m_ipl_handler; - - device_exp_card_interface *m_dev; -}; - -// device type definition -DECLARE_DEVICE_TYPE(EXP_SLOT, exp_slot_device) - -// ======================> zorro2 slot device +//************************************************************************** +// BUS DEVICE +//************************************************************************** -class zorro2_bus_device : public zorro_bus_device_base +class zorro2_bus_device : public device_t, public device_memory_interface { public: - // construction/destruction zorro2_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - ~zorro2_bus_device(); auto eint1_handler() { return m_eint1_handler.bind(); } auto eint4_handler() { return m_eint4_handler.bind(); } auto eint5_handler() { return m_eint5_handler.bind(); } auto eint7_handler() { return m_eint7_handler.bind(); } + auto int2_handler() { return m_int2_handler.bind(); } + auto int6_handler() { return m_int6_handler.bind(); } + auto ovr_handler() { return m_ovr_handler.bind(); } - // the zorro2 bus supports multiple cards - virtual void add_card(device_zorro_card_interface &card) override ATTR_COLD; + // device_memory_interface + virtual space_config_vector memory_space_config() const override; - // interface (from slot device) - virtual void cfgout_w(int state) override; + virtual void add_card(device_zorro2_card_interface &card) ATTR_COLD; + // interface (from slot device) + void cfgout_w(int state); void eint1_w(int state); void eint4_w(int state); void eint5_w(int state); void eint7_w(int state); + void int2_w(int state); + void int6_w(int state); + void ovr_w(int state); // interface (from host) - virtual void fc_w(int code) override; + uint16_t mem_r(offs_t offset, uint16_t mem_mask); + void mem_w(offs_t offset, uint16_t data, uint16_t mem_mask); + uint16_t io_r(offs_t offset, uint16_t mem_mask); + void io_w(offs_t offset, uint16_t data, uint16_t mem_mask); + + void fc_w(int code); void busrst_w(int state); -protected: - zorro2_bus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + // access to the zorro2 space + address_space &space() const { return device_memory_interface::space(AS_PROGRAM); } - // device_t implementation +protected: virtual void device_start() override ATTR_COLD; - virtual void device_reset() override ATTR_COLD; private: - using card_vector = std::vector<std::reference_wrapper<device_zorro2_card_interface> >; + using card_vector = std::vector<std::reference_wrapper<device_zorro2_card_interface>>; + card_vector m_cards; + + address_space_config m_zorro_space_config; devcb_write_line m_eint1_handler; devcb_write_line m_eint4_handler; devcb_write_line m_eint5_handler; devcb_write_line m_eint7_handler; - - card_vector m_dev; + devcb_write_line m_int2_handler; + devcb_write_line m_int6_handler; + devcb_write_line m_ovr_handler; // the device which is currently configuring uint8_t m_autoconfig_device; }; -// device type definition -DECLARE_DEVICE_TYPE(ZORRO2, zorro2_bus_device) +// device type declaration +DECLARE_DEVICE_TYPE(ZORRO2_BUS, zorro2_bus_device) -// ======================> base zorro card interface +//************************************************************************** +// SLOT DEVICE +//************************************************************************** -class device_zorro_card_interface : public device_interface +class zorro2_slot_device : public device_t, public device_single_card_slot_interface<device_zorro2_card_interface> { public: - // construction/destruction - virtual ~device_zorro_card_interface(); - - void set_zorro_bus(zorro_bus_device_base &device) ATTR_COLD; - - // interface (from device) - void cfgout_w(int state) { m_zorro->cfgout_w(state); } + zorro2_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // interface (from host) - virtual void fc_w(int code); - virtual void cfgin_w(int state); - virtual void busrst_w(int state); + template <typename T> + zorro2_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt) : + zorro2_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } protected: - device_zorro_card_interface(const machine_config &mconfig, device_t &device); + zorro2_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - zorro_bus_device_base *m_zorro; + virtual void device_resolve_objects() override ATTR_COLD; + virtual void device_start() override ATTR_COLD; }; -// ======================> expansion slot card interface - -class device_exp_card_interface : public device_zorro_card_interface -{ -public: - // construction/destruction - virtual ~device_exp_card_interface(); - -protected: - device_exp_card_interface(const machine_config &mconfig, device_t &device); +// device type declaration +DECLARE_DEVICE_TYPE(ZORRO2_SLOT, zorro2_slot_device) - virtual void interface_pre_start() override ATTR_COLD; - exp_slot_device *m_slot; -}; - -// ======================> zorro2 card interface +//************************************************************************** +// INTERFACE +//************************************************************************** -class device_zorro2_card_interface : public device_zorro_card_interface +class device_zorro2_card_interface : public device_interface { public: - // construction/destruction + device_zorro2_card_interface(const machine_config &mconfig, device_t &device); virtual ~device_zorro2_card_interface(); -protected: - device_zorro2_card_interface(const machine_config &mconfig, device_t &device); + void set_bus(zorro2_bus_device &device) ATTR_COLD; - virtual void interface_pre_start() override ATTR_COLD; + // interface (from device) + void cfgout_w(int state) { m_zorro->cfgout_w(state); } - zorro2_bus_device *m_slot; + // interface (from host) + virtual void fc_w(int code); + virtual void cfgin_w(int state); + virtual void busrst_w(int state); + +protected: + zorro2_bus_device *m_zorro; }; diff --git a/src/devices/machine/dmac.cpp b/src/devices/machine/dmac.cpp index fd939c981c4..06574584585 100644 --- a/src/devices/machine/dmac.cpp +++ b/src/devices/machine/dmac.cpp @@ -1,428 +1,498 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best +// license: GPL-2.0+ +// copyright-holders: Dirk Best /*************************************************************************** DMAC DMA controller used in Amiga systems -BOARDS: - CBM A590/A2091 HD controller: Prod=514/3($202/$3) (@$e90000 64K) - CBM A2052/58. RAM I 590/2091.RAM Prod=514/10($202/$a) (@$200000 2meg mem) + Notes: + - Part numbers: 390563-01 and 390563-02 + - Emulated is the old variant + + TODO: + - SCSI + - Support newer variant + - DAWR + - Data corruption when installing WB31 + - FIFO? ***************************************************************************/ #include "emu.h" #include "dmac.h" -#define VERBOSE 1 -#include "logmacro.h" - +#define LOG_REGS (1 << 1) +#define LOG_INT (1 << 2) +#define LOG_DMA (1 << 3) -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** +#define VERBOSE (LOG_GENERAL | LOG_REGS | LOG_INT) -DEFINE_DEVICE_TYPE(AMIGA_DMAC, amiga_dmac_device, "amiga_dmac", "Amiga DMAC DMA Controller") +#include "logmacro.h" //************************************************************************** -// LIVE DEVICE +// TYPE DEFINITIONS //************************************************************************** -//------------------------------------------------- -// amiga_dmac_device - constructor -//------------------------------------------------- +DEFINE_DEVICE_TYPE(AMIGA_DMAC, amiga_dmac_device, "amiga_dmac", "Amiga DMAC DMA Controller") amiga_dmac_device::amiga_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, AMIGA_DMAC, tag, owner, clock), amiga_autoconfig(), - m_cfgout_handler(*this), - m_int_handler(*this), - m_xdack_handler(*this), - m_scsi_read_handler(*this, 0), - m_scsi_write_handler(*this), - m_io_read_handler(*this, 0), - m_io_write_handler(*this), + m_cfgout_cb(*this), + m_int_cb(*this), + m_css_read_cb(*this, 0), + m_css_write_cb(*this), + m_csx0_read_cb(*this, 0), + m_csx0_write_cb(*this), + m_csx1_read_cb(*this, 0), + m_csx1_write_cb(*this), + m_sdack_read_cb(*this, 0), + m_sdack_write_cb(*this), + m_xdack_read_cb(*this, 0), + m_xdack_write_cb(*this), + m_rom(*this, finder_base::DUMMY_TAG), m_space(nullptr), - m_rom(nullptr), m_ram(nullptr), m_ram_size(-1), - m_configured(false), - m_rst(-1), m_cntr(0), m_istr(0), m_wtc(0), m_acr(0), - m_dma_active(false) + m_intx(false), + m_sdreq(false), + m_xdreq(false), + m_autoconfig_dmac_done(false), + m_autoconfig_ram_done(false), + m_dmac_address(0), + m_ram_address(0) { } -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- -void amiga_dmac_device::device_start() +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +void amiga_dmac_device::map(address_map &map) { + map(0x0000, 0x003f).rw(FUNC(amiga_dmac_device::autoconfig_r), FUNC(amiga_dmac_device::autoconfig_w)); + map(0x0040, 0x0041).r(FUNC(amiga_dmac_device::istr_r)); + map(0x0042, 0x0043).rw(FUNC(amiga_dmac_device::cntr_r), FUNC(amiga_dmac_device::cntr_w)); + map(0x0080, 0x0081).w(FUNC(amiga_dmac_device::wtc_hi_w)); + map(0x0082, 0x0083).w(FUNC(amiga_dmac_device::wtc_lo_w)); + map(0x0084, 0x0085).w(FUNC(amiga_dmac_device::acr_hi_w)); + map(0x0086, 0x0087).w(FUNC(amiga_dmac_device::acr_lo_w)); + map(0x008e, 0x008f).w(FUNC(amiga_dmac_device::dawr_w)); + map(0x0090, 0x0093).rw(FUNC(amiga_dmac_device::css_r), FUNC(amiga_dmac_device::css_w)).umask16(0x00ff); + map(0x00a0, 0x00a7).rw(FUNC(amiga_dmac_device::csx0_r), FUNC(amiga_dmac_device::csx0_w)).umask16(0x00ff); + map(0x00c0, 0x00c7).rw(FUNC(amiga_dmac_device::csx1_r), FUNC(amiga_dmac_device::csx1_w)).umask16(0x00ff); + map(0x00e0, 0x00e1).rw(FUNC(amiga_dmac_device::st_dma_r), FUNC(amiga_dmac_device::st_dma_w)); + map(0x00e2, 0x00e3).rw(FUNC(amiga_dmac_device::sp_dma_r), FUNC(amiga_dmac_device::sp_dma_w)); + map(0x00e4, 0x00e5).rw(FUNC(amiga_dmac_device::cint_r), FUNC(amiga_dmac_device::cint_w)); + map(0x00e8, 0x00e9).rw(FUNC(amiga_dmac_device::flush_r), FUNC(amiga_dmac_device::flush_w)); } -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- -void amiga_dmac_device::device_reset() +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +void amiga_dmac_device::device_start() { - // fifo empty - m_istr |= ISTR_FE_FLG; + m_dma_timer = timer_alloc(FUNC(amiga_dmac_device::update_dma), this); + + // register for save states + save_item(NAME(m_ram_size)); + save_item(NAME(m_cntr)); + save_item(NAME(m_istr)); + save_item(NAME(m_wtc)); + save_item(NAME(m_acr)); + save_item(NAME(m_intx)); + save_item(NAME(m_sdreq)); + save_item(NAME(m_xdreq)); + save_item(NAME(m_autoconfig_dmac_done)); + save_item(NAME(m_autoconfig_ram_done)); + save_item(NAME(m_dmac_address)); + save_item(NAME(m_ram_address)); } -void amiga_dmac_device::autoconfig_base_address(offs_t address) +void amiga_dmac_device::update_interrupts() { - LOG("%s('%s'): autoconfig_base_address received: 0x%06x\n", shortname(), basetag(), address); + // check external interrupt line + if (m_intx) + m_istr |= ISTR_INTS; + else + m_istr &= ~ISTR_INTS; - if (!m_configured && m_ram_size > 0) + if (m_istr & ISTR_INT_MASK) { - LOG("-> installing ram (%d bytes)\n", m_ram_size); - - // install access to the ram space - if (address) - m_space->install_ram(address, address + (m_ram_size - 1), m_ram); - - // prepare autoconfig for main device - autoconfig_board_size(BOARD_SIZE_64K); - autoconfig_product(0x03); // or 0x02 for rev 1 - autoconfig_rom_vector(0x2000); - autoconfig_rom_vector_valid(true); - autoconfig_link_into_memory(false); - autoconfig_multi_device(false); + LOGMASKED(LOG_INT, "Found active interrupt: %02x\n", m_istr); - // first device configured - m_configured = true; + m_istr |= ISTR_INT_F; + m_istr |= ISTR_INT_P; } else { - LOG("-> installing dmac\n"); + LOGMASKED(LOG_INT, "No active interrupt\n"); - // internal dmac registers - m_space->install_read_handler(address, address + 0xff, - read16_delegate(*this, FUNC(amiga_dmac_device::register_read)), 0xffff); - m_space->install_write_handler(address, address + 0xff, - write16s_delegate(*this, FUNC(amiga_dmac_device::register_write)), 0xffff); - - // install access to the rom space - if (m_rom) - { - m_space->install_rom(address + 0x2000, address + 0x7fff, m_rom + 0x2000); - m_space->install_rom(address + 0x8000, address + 0xffff, m_rom); - } + m_istr &= ~ISTR_INT_F; + m_istr &= ~ISTR_INT_P; + } - // stop responding to autoconfig - m_space->unmap_readwrite(0xe80000, 0xe8007f); + // clear pending if interrupts disabled + if (!(m_cntr & CNTR_INTEN)) + { + LOGMASKED(LOG_INT, "Interrupts are disabled\n"); - // we're done - m_cfgout_handler(0); + m_istr &= ~ISTR_INT_P; } + + // finally update interrupt line + m_int_cb((m_istr & ISTR_INT_P) ? 1 : 0); } -void amiga_dmac_device::check_interrupts() +TIMER_CALLBACK_MEMBER(amiga_dmac_device::update_dma) { - // interrupts enabled? - if (m_cntr & CNTR_INTEN) + if (m_sdreq && (m_cntr & CNTR_PDMD)) { - // any interrupts pending? - if (m_istr & ISTR_INT_MASK) - m_istr |= ISTR_INT_P; - else - m_istr &= ~ISTR_INT_P; + LOGMASKED(LOG_DMA, "scsi dma, acr=%08x, wtc=%08x\n", m_acr, m_wtc); } - else - m_istr &= ~ISTR_INT_P; + else if (m_xdreq && !(m_cntr & CNTR_PDMD)) + { + LOGMASKED(LOG_DMA, "xt dma, acr=%08x, wtc=%08x\n", m_acr, m_wtc); - // finally update interrupt line - m_int_handler((m_istr & ISTR_INT_P) ? 1 : 0); + if (m_cntr & CNTR_DDIR) + { + // host -> peripheral + uint8_t data = m_space->read_byte(m_acr); + LOGMASKED(LOG_DMA, "Write to device: %02x\n", data); + m_xdack_write_cb(data); + } + else + { + // peripheral -> host + uint8_t data = m_xdack_read_cb(); + LOGMASKED(LOG_DMA, "Read from device: %02x\n", data); + m_space->write_byte(m_acr, data); + } + + m_acr++; + + if (m_cntr & CNTR_TCEN) + { + // we count words + if ((m_acr & 1) == 0) + { + if (--m_wtc == 0) + { + LOGMASKED(LOG_DMA, "Terminal count\n"); + + m_istr |= ISTR_E_INT; + update_interrupts(); + } + } + } + } } void amiga_dmac_device::stop_dma() { - m_dma_active = false; + m_dma_timer->adjust(attotime::never); + m_istr &= ~ISTR_E_INT; - check_interrupts(); + update_interrupts(); } void amiga_dmac_device::start_dma() { - m_dma_active = true; + m_dma_timer->adjust(attotime::zero, 0, clocks_to_attotime(1)); } - -//************************************************************************** -// IMPLEMENTATION -//************************************************************************** - -uint16_t amiga_dmac_device::register_read(address_space &space, offs_t offset, uint16_t mem_mask) +uint16_t amiga_dmac_device::autoconfig_r(offs_t offset, uint16_t mem_mask) { - uint16_t data = 0xffff; + return autoconfig_read(*m_space, offset, mem_mask); +} - // autoconfig handles this - if (offset < 0x20) - return autoconfig_read(space, offset, mem_mask); +void amiga_dmac_device::autoconfig_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + autoconfig_write(*m_space, data, mem_mask); +} - switch (offset) - { - case 0x20: - data = m_istr; +uint16_t amiga_dmac_device::istr_r(offs_t offset, uint16_t mem_mask) +{ + return m_istr; +} - // reading clears fifo status (?) - m_istr &= ~0x0f; - check_interrupts(); +uint16_t amiga_dmac_device::cntr_r(offs_t offset, uint16_t mem_mask) +{ + return m_cntr; +} - LOG("%s('%s'): read istr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); +void amiga_dmac_device::cntr_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + LOGMASKED(LOG_REGS, "cntr_w: %04x & %04x\n", data, mem_mask); - break; + COMBINE_DATA(&m_cntr); + update_interrupts(); +} - case 0x21: - data = m_cntr; +void amiga_dmac_device::wtc_hi_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + LOGMASKED(LOG_REGS, "wtc_hi_w: %04x & %04x\n", data, mem_mask); - LOG("%s('%s'): read cntr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + m_wtc &= (~(uint32_t) mem_mask) << 16 | 0x0000ffff; + m_wtc |= ((uint32_t) data & mem_mask) << 16; +} - break; +void amiga_dmac_device::wtc_lo_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + LOGMASKED(LOG_REGS, "wtc_lo_w: %04x & %04x\n", data, mem_mask); - case 0x48: - case 0x49: - data = m_scsi_read_handler(offset); + m_wtc &= 0xffff0000 & (~mem_mask); + m_wtc |= data & mem_mask; +} - LOG("%s('%s'): read scsi register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask); +void amiga_dmac_device::acr_hi_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + LOGMASKED(LOG_REGS, "acr_hi_w: %04x & %04x\n", data, mem_mask); - break; + m_acr &= (~(uint32_t) mem_mask) << 16 | 0x0000ffff; + m_acr |= ((uint32_t) data & mem_mask) << 16; +} - case 0x50: - case 0x51: - case 0x52: - case 0x53: - LOG("%s('%s'): read xt register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask); +void amiga_dmac_device::acr_lo_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + LOGMASKED(LOG_REGS, "acr_lo_w: %04x & %04x\n", data, mem_mask); - break; + m_acr &= 0xffff0000 & (~mem_mask); + m_acr |= (data & mem_mask) & 0xfffc; // 0xfffe for rev 2 +} - case 0x70: - LOG("%s('%s'): read dma start strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); +void amiga_dmac_device::dawr_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + LOGMASKED(LOG_REGS, "dawr_w: %04x & %04x\n", data, mem_mask); +} - start_dma(); - break; +// chip select lines +uint8_t amiga_dmac_device::css_r(offs_t offset) { return m_css_read_cb(offset); } +void amiga_dmac_device::css_w(offs_t offset, uint8_t data) { m_css_write_cb(offset, data); } +uint8_t amiga_dmac_device::csx0_r(offs_t offset) { return m_csx0_read_cb(offset); } +void amiga_dmac_device::csx0_w(offs_t offset, uint8_t data) { m_csx0_write_cb(offset, data); } +uint8_t amiga_dmac_device::csx1_r(offs_t offset) { return m_csx1_read_cb(offset); } +void amiga_dmac_device::csx1_w(offs_t offset, uint8_t data) { m_csx1_write_cb(offset, data); } - case 0x71: - LOG("%s('%s'): read dma stop strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); +uint16_t amiga_dmac_device::st_dma_r(offs_t offset, uint16_t mem_mask) +{ + LOGMASKED(LOG_DMA, "st_dma_r\n"); - stop_dma(); - break; + start_dma(); + return 0; +} - case 0x72: - LOG("%s('%s'): read clear irq strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); +void amiga_dmac_device::st_dma_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + LOGMASKED(LOG_DMA, "st_dma_w\n"); - // clear all interrupts - m_istr &= ~ISTR_INT_MASK; - check_interrupts(); - break; + start_dma(); +} - case 0x74: - LOG("%s('%s'): read flush fifo strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); +uint16_t amiga_dmac_device::sp_dma_r(offs_t offset, uint16_t mem_mask) +{ + LOGMASKED(LOG_DMA, "sp_dma_r\n"); - m_istr |= ISTR_FE_FLG; - break; + stop_dma(); + return 0; +} - default: - LOG("%s('%s'): register_read %04x @ %02x [mask = %04x]\n", shortname(), basetag(), data, offset, mem_mask); - } +void amiga_dmac_device::sp_dma_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + LOGMASKED(LOG_REGS, "sp_dma_w\n"); - return data; + stop_dma(); } -void amiga_dmac_device::register_write(offs_t offset, uint16_t data, uint16_t mem_mask) +uint16_t amiga_dmac_device::cint_r(offs_t offset, uint16_t mem_mask) { - switch (offset) - { - case 0x21: - LOG("%s('%s'): write cntr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + LOGMASKED(LOG_INT, "cint_r\n"); - m_cntr = data; - check_interrupts(); - break; + m_istr = 0; + update_interrupts(); - case 0x40: - LOG("%s('%s'): write wtc hi %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + return 0; +} - m_wtc &= 0x0000ffff; - m_wtc |= ((uint32_t) data) << 16; - break; +void amiga_dmac_device::cint_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + LOGMASKED(LOG_INT, "cint_w\n"); - case 0x41: - LOG("%s('%s'): write wtc lo %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + m_istr = 0; + update_interrupts(); +} - m_wtc &= 0xffff0000; - m_wtc |= data; - break; +uint16_t amiga_dmac_device::flush_r(offs_t offset, uint16_t mem_mask) +{ + LOGMASKED(LOG_REGS, "flush_r\n"); - case 0x42: - LOG("%s('%s'): write acr hi %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + return 0; +} - m_acr &= 0x0000ffff; - m_acr |= ((uint32_t) data) << 16; - break; +void amiga_dmac_device::flush_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + LOGMASKED(LOG_REGS, "flush_w\n"); +} - case 0x43: - LOG("%s('%s'): write acr lo %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); +void amiga_dmac_device::ramsz_w(int state) +{ + LOG("ramsz_w: %d\n", state); - m_acr &= 0xffff0000; - m_acr |= data; - break; + switch (state) + { + case 0: m_ram_size = 0x000000; break; + case 1: m_ram_size = 0x080000; break; + case 2: m_ram_size = 0x100000; break; + case 3: m_ram_size = 0x200000; break; + } +} - case 0x47: - LOG("%s('%s'): write dawr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); - break; +void amiga_dmac_device::rst_w(int state) +{ + if (state == 0) + { + if (m_autoconfig_dmac_done) + { + LOG("unmapping dmac, base = %06x\n", m_dmac_address); + m_space->unmap_readwrite(m_dmac_address, m_dmac_address + 0xffff); - case 0x48: - case 0x49: - LOG("%s('%s'): write scsi register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask); + m_autoconfig_dmac_done = false; + } - m_scsi_write_handler(offset, data, 0xff); - break; + if (m_autoconfig_ram_done) + { + LOG("unmapping ram, base = %06x, size = %06x\n", m_ram_address, m_ram_size); + m_space->unmap_readwrite(m_ram_address, m_ram_address + m_ram_size - 1); - case 0x50: - case 0x51: - case 0x52: - case 0x53: - LOG("%s('%s'): write xt register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask); - break; + m_ram_size = 0; + m_autoconfig_ram_done = false; + } - case 0x70: - LOG("%s('%s'): write dma start strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + m_istr = 0; + m_istr |= ISTR_FE_FLG; // fifo empty + m_cntr = 0; + } +} - start_dma(); - break; +void amiga_dmac_device::intx_w(int state) +{ + LOGMASKED(LOG_INT, "intx_w: %d\n", state); - case 0x71: - LOG("%s('%s'): write dma stop strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + m_intx = bool(state); + update_interrupts(); +} - stop_dma(); - break; +void amiga_dmac_device::sdreq_w(int state) +{ + LOGMASKED(LOG_DMA, "sdreq_w: %d\n", state); - case 0x72: - LOG("%s('%s'): write clear irq strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + m_sdreq = bool(state); +} - // clear all interrupts - m_istr &= ~ISTR_INT_MASK; - check_interrupts(); - break; +void amiga_dmac_device::xdreq_w(int state) +{ + LOGMASKED(LOG_DMA, "xdreq_w: %d\n", state); - case 0x74: - LOG("%s('%s'): write flush fifo strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + m_xdreq = bool(state); +} - m_istr |= ISTR_FE_FLG; - break; - default: - LOG("%s('%s'): write %04x @ %02x [mask = %04x]\n", shortname(), basetag(), data, offset, mem_mask); - } -} +//************************************************************************** +// AUTOCONFIG +//************************************************************************** -// this signal tells us to expose our autoconfig values -void amiga_dmac_device::configin_w(int state) +void amiga_dmac_device::autoconfig_base_address(offs_t address) { - LOG("%s('%s'): configin_w (%d)\n", shortname(), basetag(), state); + LOG("autoconfig_base_address received: 0x%06x\n", address); - if (state == 0 && !m_configured) + if (!m_autoconfig_ram_done && m_ram_size > 0) { - // common autoconfig values - autoconfig_board_type(BOARD_TYPE_ZORRO2); - autoconfig_manufacturer(0x0202); - autoconfig_serial(0x00000000); - autoconfig_8meg_preferred(false); - autoconfig_can_shutup(true); + LOG("-> installing dmac memory, size = %06x\n", m_ram_size); - // if we have ram, configure it first - if (m_ram_size > 0) - { - // product id 10 - autoconfig_product(0x0a); + m_space->install_ram(address, address + m_ram_size - 1, m_ram); - // board size - switch (m_ram_size) - { - case 0x080000: autoconfig_board_size(BOARD_SIZE_512K); break; - case 0x100000: autoconfig_board_size(BOARD_SIZE_1M); break; - case 0x200000: autoconfig_board_size(BOARD_SIZE_2M); break; - } + m_ram_address = address; + m_autoconfig_ram_done = true; - // no rom and link into free memory - autoconfig_rom_vector_valid(false); - autoconfig_link_into_memory(true); + // configure next + configin_w(0); + } + else + { + LOG("-> installing dmac registers\n"); - // the main device follows - autoconfig_multi_device(true); - } - else + m_space->install_device(address, address + 0x7fff, *this, &amiga_dmac_device::map); + + if (m_rom) { - // just setup autoconfig for the main device - autoconfig_board_size(BOARD_SIZE_64K); - autoconfig_product(0x03); // or 0x02 for rev 1 - autoconfig_rom_vector(0x2000); - autoconfig_rom_vector_valid(true); - autoconfig_link_into_memory(false); - - // no more devices after this - autoconfig_multi_device(false); + m_space->install_rom(address + 0x2000, address + 0x7fff, m_rom->base() + 0x2000); + m_space->install_rom(address + 0x8000, address + 0xffff, m_rom->base()); } - // install autoconfig handler - m_space->install_readwrite_handler(0xe80000, 0xe8007f, - read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), - write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); - } -} + m_space->unmap_readwrite(0xe80000, 0xe8007f); -// this sets the ram size depending on the line voltage -void amiga_dmac_device::ramsz_w(int state) -{ - LOG("%s('%s'): ramsz_w (%d)\n", shortname(), basetag(), state); + m_dmac_address = address; + m_autoconfig_dmac_done = true; - switch (state) - { - case 0: m_ram_size = 0x000000; break; - case 1: m_ram_size = 0x080000; break; - case 2: m_ram_size = 0x100000; break; - case 3: m_ram_size = 0x200000; break; + // we're done + m_cfgout_cb(0); } } -// reset the device -void amiga_dmac_device::rst_w(int state) +void amiga_dmac_device::configin_w(int state) { - LOG("%s('%s'): rst_w (%d)\n", shortname(), basetag(), state); + if (state != 0) + return; - if (m_rst == 1 && state == 0) - device_reset(); - - m_rst = state; -} - -// external interrupt -void amiga_dmac_device::intx_w(int state) -{ - LOG("%s('%s'): intx_w (%d)\n", shortname(), basetag(), state); + if (!m_autoconfig_ram_done && m_ram_size > 0) + { + LOG("autoconfig for memory\n"); - if (state) - m_istr |= ISTR_INTS; + // setup autoconfig for memory + autoconfig_board_type(BOARD_TYPE_ZORRO2); + switch (m_ram_size) + { + case 0x080000: autoconfig_board_size(BOARD_SIZE_512K); break; + case 0x100000: autoconfig_board_size(BOARD_SIZE_1M); break; + case 0x200000: autoconfig_board_size(BOARD_SIZE_2M); break; + } + autoconfig_link_into_memory(true); + autoconfig_rom_vector_valid(false); + autoconfig_multi_device(true); + autoconfig_8meg_preferred(false); + autoconfig_can_shutup(true); + autoconfig_product(10); + autoconfig_manufacturer(514); + autoconfig_serial(0x00000000); + } else - m_istr &= ~ISTR_INTS; - - check_interrupts(); -} - -// data request -void amiga_dmac_device::xdreq_w(int state) -{ - LOG("%s('%s'): xdreq_w (%d)\n", shortname(), basetag(), state); - - if (m_dma_active) { + LOG("autoconfig for registers\n"); + + autoconfig_board_type(BOARD_TYPE_ZORRO2); + autoconfig_board_size(BOARD_SIZE_64K); + autoconfig_link_into_memory(false); + autoconfig_rom_vector(0x2000); + autoconfig_rom_vector_valid(true); + autoconfig_multi_device(false); + autoconfig_8meg_preferred(false); + autoconfig_can_shutup(true); + autoconfig_product(2); // or 3 for rev 2 + autoconfig_manufacturer(514); + autoconfig_serial(0x00000000); } + + // install autoconfig handler + m_space->install_readwrite_handler(0xe80000, 0xe8007f, + read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffff); } diff --git a/src/devices/machine/dmac.h b/src/devices/machine/dmac.h index 9a57bb60089..f77af9037ee 100644 --- a/src/devices/machine/dmac.h +++ b/src/devices/machine/dmac.h @@ -1,5 +1,5 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best +// license: GPL-2.0+ +// copyright-holders: Dirk Best /*************************************************************************** DMAC @@ -16,109 +16,138 @@ #include "autoconfig.h" -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - class amiga_dmac_device : public device_t, public amiga_autoconfig { public: - // construction/destruction amiga_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // callbacks - auto cfgout_handler() { return m_cfgout_handler.bind(); } - auto int_handler() { return m_int_handler.bind(); } - auto xdack_handler() { return m_xdack_handler.bind(); } - auto scsi_read_handler() { return m_scsi_read_handler.bind(); } - auto scsi_write_handler() { return m_scsi_write_handler.bind(); } - auto io_read_handler() { return m_io_read_handler.bind(); } - auto io_write_handler() { return m_io_write_handler.bind(); } + auto cfgout_cb() { return m_cfgout_cb.bind(); } + auto int_cb() { return m_int_cb.bind(); } + auto css_read_cb() { return m_css_read_cb.bind(); } + auto css_write_cb() { return m_css_write_cb.bind(); } + auto csx0_read_cb() { return m_csx0_read_cb.bind(); } + auto csx0_write_cb() { return m_csx0_write_cb.bind(); } + auto csx1_read_cb() { return m_csx1_read_cb.bind(); } + auto csx1_write_cb() { return m_csx1_write_cb.bind(); } + auto sdack_read_cb() { return m_sdack_read_cb.bind(); } + auto sdack_write_cb() { return m_sdack_write_cb.bind(); } + auto xdack_read_cb() { return m_xdack_read_cb.bind(); } + auto xdack_write_cb() { return m_xdack_write_cb.bind(); } void set_address_space(address_space *space) { m_space = space; } - void set_rom(uint8_t *rom) { m_rom = rom; } - void set_ram(uint8_t *ram) { m_ram = ram; } + void set_rom(const char *region) { m_rom.set_tag(region); } + void set_ram(uint16_t *ram) { m_ram = ram; } // input lines void configin_w(int state); void ramsz_w(int state); void rst_w(int state); void intx_w(int state); + void sdreq_w(int state); void xdreq_w(int state); - // dmac register access - uint16_t register_read(address_space &space, offs_t offset, uint16_t mem_mask = ~0); - void register_write(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - protected: - // device-level overrides virtual void device_start() override ATTR_COLD; - virtual void device_reset() override ATTR_COLD; // amiga_autoconfig overrides virtual void autoconfig_base_address(offs_t address) override; private: - // control register flags - enum - { - CNTR_TCEN = 0x80, // terminal count enable - CNTR_PREST = 0x40, // peripheral reset - CNTR_PDMD = 0x20, // peripheral device mode select (1=scsi, 0=xt) - CNTR_INTEN = 0x10, // interrupt enable - CNTR_DDIR = 0x08 // device direction (1=rd host, wr to peripheral) - }; - - // interrupt status register - enum - { - ISTR_INTX = 0x100, // xt interrupt pending - ISTR_INT_F = 0x080, // interrupt follow - ISTR_INTS = 0x040, // scsi peripheral interrupt - ISTR_E_INT = 0x020, // end-of-process interrupt - ISTR_INT_P = 0x010, // interrupt pending - ISTR_UE_INT = 0x008, // under-run fifo error interrupt - ISTR_OE_INT = 0x004, // over-run fifo error interrupt - ISTR_FF_FLG = 0x002, // fifo-full flag - ISTR_FE_FLG = 0x001 // fifo-empty flag - }; - - static constexpr int ISTR_INT_MASK = 0x1ec; + void map(address_map &map) ATTR_COLD; - // callbacks - devcb_write_line m_cfgout_handler; - devcb_write_line m_int_handler; - devcb_write_line m_xdack_handler; - devcb_read8 m_scsi_read_handler; - devcb_write8 m_scsi_write_handler; - devcb_read8 m_io_read_handler; - devcb_write8 m_io_write_handler; + TIMER_CALLBACK_MEMBER(update_dma); + void update_interrupts(); + void start_dma(); + void stop_dma(); + + uint16_t autoconfig_r(offs_t offset, uint16_t mem_mask); + void autoconfig_w(offs_t offset, uint16_t data, uint16_t mem_mask); + + uint16_t istr_r(offs_t offset, uint16_t mem_mask); + uint16_t cntr_r(offs_t offset, uint16_t mem_mask); + void cntr_w(offs_t offset, uint16_t data,uint16_t mem_mask); + void wtc_hi_w(offs_t offset, uint16_t data,uint16_t mem_mask); + void wtc_lo_w(offs_t offset, uint16_t data,uint16_t mem_mask); + void acr_hi_w(offs_t offset, uint16_t data,uint16_t mem_mask); + void acr_lo_w(offs_t offset, uint16_t data,uint16_t mem_mask); + void dawr_w(offs_t offset, uint16_t data,uint16_t mem_mask); + + uint8_t css_r(offs_t offset); + void css_w(offs_t offset, uint8_t data); + uint8_t csx0_r(offs_t offset); + void csx0_w(offs_t offset, uint8_t data); + uint8_t csx1_r(offs_t offset); + void csx1_w(offs_t offset, uint8_t data); + + // strobe register + uint16_t st_dma_r(offs_t offset, uint16_t mem_mask); + void st_dma_w(offs_t offset, uint16_t data, uint16_t mem_mask); + uint16_t sp_dma_r(offs_t offset, uint16_t mem_mask); + void sp_dma_w(offs_t offset, uint16_t data, uint16_t mem_mask); + uint16_t cint_r(offs_t offset, uint16_t mem_mask); + void cint_w(offs_t offset, uint16_t data, uint16_t mem_mask); + uint16_t flush_r(offs_t offset, uint16_t mem_mask); + void flush_w(offs_t offset, uint16_t data, uint16_t mem_mask); + + // control register definitions + static constexpr uint16_t CNTR_TCEN = 0x80; // terminal count enable + static constexpr uint16_t CNTR_PREST = 0x40; // peripheral reset + static constexpr uint16_t CNTR_PDMD = 0x20; // peripheral device mode select (1=scsi/0=xt) + static constexpr uint16_t CNTR_INTEN = 0x10; // interrupt enable + static constexpr uint16_t CNTR_DDIR = 0x08; // device direction (1=from host to peripheral) + + // interrupt status register definitions + static constexpr uint16_t ISTR_INT_F = 0x80; // interrupt follow + static constexpr uint16_t ISTR_INTS = 0x40; // scsi peripheral interrupt + static constexpr uint16_t ISTR_E_INT = 0x20; // end-of-process interrupt + static constexpr uint16_t ISTR_INT_P = 0x10; // interrupt pending + static constexpr uint16_t ISTR_UE_INT = 0x08; // fifo underrun interrupt + static constexpr uint16_t ISTR_OE_INT = 0x04; // fifo overflow interrupt + static constexpr uint16_t ISTR_FF_FLG = 0x02; // fifo full flag + static constexpr uint16_t ISTR_FE_FLG = 0x01; // fifo empty flag + + static constexpr uint16_t ISTR_INT_MASK = 0x6c; + // callbacks + devcb_write_line m_cfgout_cb; + devcb_write_line m_int_cb; + devcb_read8 m_css_read_cb; + devcb_write8 m_css_write_cb; + devcb_read8 m_csx0_read_cb; + devcb_write8 m_csx0_write_cb; + devcb_read8 m_csx1_read_cb; + devcb_write8 m_csx1_write_cb; + devcb_read8 m_sdack_read_cb; + devcb_write8 m_sdack_write_cb; + devcb_read8 m_xdack_read_cb; + devcb_write8 m_xdack_write_cb; + + optional_memory_region m_rom; address_space *m_space; - uint8_t *m_rom; - uint8_t *m_ram; + uint16_t *m_ram; int m_ram_size; - // autoconfig state - bool m_configured; - - // state of lines - int m_rst; + // internal registers + uint16_t m_cntr; // control register + uint16_t m_istr; // interrupt status register + uint32_t m_wtc; // word transfer count + uint32_t m_acr; // address control register - // register - uint16_t m_cntr; // control register - uint16_t m_istr; // interrupt status register - uint32_t m_wtc; // word transfer count - uint32_t m_acr; // address control register + // state of input lines + bool m_intx; + bool m_sdreq; + bool m_xdreq; - bool m_dma_active; + emu_timer *m_dma_timer; - void check_interrupts(); - void start_dma(); - void stop_dma(); + // autoconfig state + bool m_autoconfig_dmac_done; + bool m_autoconfig_ram_done; + offs_t m_dmac_address; + offs_t m_ram_address; }; - // device type definition DECLARE_DEVICE_TYPE(AMIGA_DMAC, amiga_dmac_device) diff --git a/src/mame/amiga/amiga.cpp b/src/mame/amiga/amiga.cpp index 806015f13fe..f9cfe680382 100644 --- a/src/mame/amiga/amiga.cpp +++ b/src/mame/amiga/amiga.cpp @@ -17,6 +17,7 @@ #include "amiga.h" #include "gayle.h" +#include "bus/amiga/cpuslot/cpuslot.h" #include "bus/amiga/keyboard/keyboard.h" #include "bus/amiga/zorro/zorro.h" #include "bus/ata/ataintf.h" @@ -36,13 +37,6 @@ //************************************************************************** -// CONSTANTS / MACROS -//************************************************************************** - -#define EXP_SLOT_TAG "exp" - - -//************************************************************************** // PRIVATE DEVICES //************************************************************************** @@ -262,7 +256,8 @@ public: a2000_state(const machine_config &mconfig, device_type type, const char *tag) : amiga_state(mconfig, type, tag) , m_rtc(*this, "u65") - , m_zorro(*this, "zorrobus") + , m_cpuslot(*this, "cpuslot") + , m_zorro(*this, "zorro2") , m_zorro2_int2(0) , m_zorro2_int6(0) { } @@ -270,6 +265,9 @@ public: void init_pal(); void init_ntsc(); + void cpuslot_ovr_w(int state); + void cpuslot_int2_w(int state); + void cpuslot_int6_w(int state); void zorro2_int2_w(int state); void zorro2_int6_w(int state); @@ -290,9 +288,12 @@ protected: private: // devices required_device<msm6242_device> m_rtc; + required_device<amiga_cpuslot_device> m_cpuslot; required_device<zorro2_bus_device> m_zorro; // internal state + int m_cpuslot_int2; + int m_cpuslot_int6; int m_zorro2_int2; int m_zorro2_int6; }; @@ -302,7 +303,7 @@ class a500_state : public amiga_state public: a500_state(const machine_config &mconfig, device_type type, const char *tag) : amiga_state(mconfig, type, tag) - , m_side(*this, EXP_SLOT_TAG) + , m_side(*this, "side") , m_side_int2(0) , m_side_int6(0) { } @@ -310,6 +311,7 @@ public: void init_pal(); void init_ntsc(); + void side_ovr_w(int state); void side_int2_w(int state); void side_int6_w(int state); @@ -326,7 +328,7 @@ protected: private: // devices - required_device<exp_slot_device> m_side; + required_device<amiga_cpuslot_device> m_side; // internal state int m_side_int2; @@ -413,8 +415,8 @@ class a500p_state : public amiga_state public: a500p_state(const machine_config &mconfig, device_type type, const char *tag) : amiga_state(mconfig, type, tag) + , m_side(*this, "side") , m_rtc(*this, "u9") - , m_side(*this, EXP_SLOT_TAG) , m_side_int2(0) , m_side_int6(0) { } @@ -425,6 +427,10 @@ public: void init_pal(); void init_ntsc(); + void side_ovr_w(int state); + void side_int2_w(int state); + void side_int6_w(int state); + void a500pn(machine_config &config); void a500p(machine_config &config); void a500p_mem(address_map &map) ATTR_COLD; @@ -438,8 +444,8 @@ protected: private: // devices + required_device<amiga_cpuslot_device> m_side; required_device<msm6242_device> m_rtc; - required_device<exp_slot_device> m_side; // internal state int m_side_int2; @@ -838,11 +844,35 @@ void a2000_state::machine_reset() // base reset amiga_state::machine_reset(); + // reset cpuslot + m_cpuslot->rst_w(0); + m_cpuslot->rst_w(1); + // reset zorro devices m_zorro->busrst_w(0); m_zorro->busrst_w(1); } +void a2000_state::cpuslot_ovr_w(int state) +{ + if (state == 0) + m_maincpu->space(AS_PROGRAM).unmap_readwrite(0x000000, 0x1fffff); + else + m_maincpu->space(AS_PROGRAM).install_device(0x000000, 0x1fffff, *m_overlay, &address_map_bank_device::amap16); +} + +void a2000_state::cpuslot_int2_w(int state) +{ + m_cpuslot_int2 = state; + update_int2(); +} + +void a2000_state::cpuslot_int6_w(int state) +{ + m_cpuslot_int6 = state; + update_int6(); +} + void a2000_state::zorro2_int2_w(int state) { m_zorro2_int2 = state; @@ -857,12 +887,12 @@ void a2000_state::zorro2_int6_w(int state) bool a2000_state::int2_pending() { - return m_cia_0_irq || m_zorro2_int2; + return m_cia_0_irq || m_cpuslot_int2 || m_zorro2_int2; } bool a2000_state::int6_pending() { - return m_cia_1_irq || m_zorro2_int6; + return m_cia_1_irq || m_cpuslot_int6 || m_zorro2_int6; } void a500_state::machine_reset() @@ -870,8 +900,21 @@ void a500_state::machine_reset() // base reset amiga_state::machine_reset(); - // reset side expansion slot device - m_side->reset(); + // reset side expansion + m_side->rst_w(0); + m_side->rst_w(1); + + // start autoconfig + m_side->cfgin_w(0); + m_side->cfgin_w(1); +} + +void a500_state::side_ovr_w(int state) +{ + if (state == 0) + m_maincpu->space(AS_PROGRAM).unmap_readwrite(0x000000, 0x1fffff); + else + m_maincpu->space(AS_PROGRAM).install_device(0x000000, 0x1fffff, *m_overlay, &address_map_bank_device::amap16); } void a500_state::side_int2_w(int state) @@ -945,8 +988,33 @@ void a500p_state::machine_reset() // base reset amiga_state::machine_reset(); - // reset side expansion slot device - m_side->reset(); + // reset side expansion + m_side->rst_w(0); + m_side->rst_w(1); + + // start autoconfig + m_side->cfgin_w(0); + m_side->cfgin_w(1); +} + +void a500p_state::side_ovr_w(int state) +{ + if (state == 0) + m_maincpu->space(AS_PROGRAM).unmap_readwrite(0x000000, 0x1fffff); + else + m_maincpu->space(AS_PROGRAM).install_device(0x000000, 0x1fffff, *m_overlay, &address_map_bank_device::amap16); +} + +void a500p_state::side_int2_w(int state) +{ + m_side_int2 = state; + update_int2(); +} + +void a500p_state::side_int6_w(int state) +{ + m_side_int6 = state; + update_int6(); } bool a500p_state::int2_pending() @@ -1262,7 +1330,7 @@ void amiga_state::overlay_1mb_map32(address_map &map) map(0x200000, 0x27ffff).rom().region("kickstart", 0); } -// Gary/Super Gary/Gayle with 2MB chip RAM (32 bit system) +// Gary/Super Gary/Gayle with 2MB chip RAM (16 bit system) void amiga_state::overlay_2mb_map16(address_map &map) { map.unmap_value_high(); @@ -1283,6 +1351,7 @@ void a2000_state::a2000_mem(address_map &map) { map.unmap_value_high(); map(0x000000, 0x1fffff).m(m_overlay, FUNC(address_map_bank_device::amap16)); + map(0x200000, 0x9fffff).rw(m_zorro, FUNC(zorro2_bus_device::mem_r), FUNC(zorro2_bus_device::mem_w)); map(0xa00000, 0xbfffff).rw(FUNC(a2000_state::cia_r), FUNC(a2000_state::cia_w)); map(0xc00000, 0xc7ffff).ram(); map(0xc80000, 0xd7ffff).m(m_chipset, FUNC(address_map_bank_device::amap16)); @@ -1292,7 +1361,7 @@ void a2000_state::a2000_mem(address_map &map) map(0xde0000, 0xdeffff).m(m_chipset, FUNC(address_map_bank_device::amap16)); map(0xdf0000, 0xdfffff).m(m_chipset, FUNC(address_map_bank_device::amap16)); map(0xe00000, 0xe7ffff).nopw().r(FUNC(a2000_state::rom_mirror_r)); - map(0xe80000, 0xefffff).noprw(); // autoconfig space (installed by devices) + map(0xe80000, 0xefffff).rw(m_zorro, FUNC(zorro2_bus_device::io_r), FUNC(zorro2_bus_device::io_w)); map(0xf00000, 0xf7ffff).noprw(); // cartridge space map(0xf80000, 0xffffff).rom().region("kickstart", 0); } @@ -1775,19 +1844,22 @@ void a2000_state::a2000(machine_config &config) MSM6242(config, m_rtc, XTAL(32'768)); // cpu slot - EXP_SLOT(config, EXP_SLOT_TAG, 0).set_space(m_maincpu, AS_PROGRAM); - ZORRO_SLOT(config, "slot", EXP_SLOT_TAG, a2000_expansion_cards, nullptr); - - // zorro slots - ZORRO2(config, m_zorro, 0); - m_zorro->set_space(m_maincpu, AS_PROGRAM); + AMIGA_CPUSLOT(config, m_cpuslot, a2000_cpuslot_cards, nullptr); + m_cpuslot->set_space(m_maincpu, AS_PROGRAM); + m_cpuslot->ovr_cb().set(FUNC(a2000_state::cpuslot_ovr_w)); + m_cpuslot->int2_cb().set(FUNC(a2000_state::cpuslot_int2_w)); + m_cpuslot->int6_cb().set(FUNC(a2000_state::cpuslot_int6_w)); + m_cpuslot->ipl7_cb().set([this](int state) { m_maincpu->set_input_line(7, state); }); + + // zorro2 slots + ZORRO2_BUS(config, m_zorro, 0); m_zorro->int2_handler().set(FUNC(a2000_state::zorro2_int2_w)); m_zorro->int6_handler().set(FUNC(a2000_state::zorro2_int6_w)); - ZORRO_SLOT(config, "zorro1", m_zorro, zorro2_cards, nullptr); - ZORRO_SLOT(config, "zorro2", m_zorro, zorro2_cards, nullptr); - ZORRO_SLOT(config, "zorro3", m_zorro, zorro2_cards, nullptr); - ZORRO_SLOT(config, "zorro4", m_zorro, zorro2_cards, nullptr); - ZORRO_SLOT(config, "zorro5", m_zorro, zorro2_cards, nullptr); + ZORRO2_SLOT(config, "zorro2:1", zorro2_cards, nullptr); + ZORRO2_SLOT(config, "zorro2:2", zorro2_cards, nullptr); + ZORRO2_SLOT(config, "zorro2:3", zorro2_cards, nullptr); + ZORRO2_SLOT(config, "zorro2:4", zorro2_cards, nullptr); + ZORRO2_SLOT(config, "zorro2:5", zorro2_cards, nullptr); } void a2000_state::a2000n(machine_config &config) @@ -1822,16 +1894,19 @@ void a500_state::a500(machine_config &config) ADDRESS_MAP_BANK(config, m_overlay).set_map(&a500_state::overlay_1mb_map).set_options(ENDIANNESS_BIG, 16, 22, 0x200000); ADDRESS_MAP_BANK(config, m_chipset).set_map(&a500_state::ocs_map).set_options(ENDIANNESS_BIG, 16, 9, 0x200); - // cpu slot - EXP_SLOT(config, m_side, 0).set_space(m_maincpu, AS_PROGRAM); - m_side->int2_handler().set(FUNC(a500_state::side_int2_w)); - m_side->int6_handler().set(FUNC(a500_state::side_int6_w)); - ZORRO_SLOT(config, "slot", m_side, a500_expansion_cards, nullptr); + // left side cpu slot + AMIGA_CPUSLOT(config, m_side, a500_cpuslot_cards, nullptr); + m_side->set_space(m_maincpu, AS_PROGRAM); + m_side->ovr_cb().set(FUNC(a500_state::side_ovr_w)); + m_side->int2_cb().set(FUNC(a500_state::side_int2_w)); + m_side->int6_cb().set(FUNC(a500_state::side_int6_w)); + m_side->ipl7_cb().set([this](int state) { m_maincpu->set_input_line(7, state); }); } void a500_state::a500n(machine_config &config) { a500(config); + m_maincpu->set_clock(amiga_state::CLK_7M_NTSC); config.device_remove("screen"); ntsc_video(config); @@ -1887,11 +1962,11 @@ void cdtv_state::cdtv(machine_config &config) // cd-rom controller AMIGA_DMAC(config, m_dmac, amiga_state::CLK_7M_PAL); - m_dmac->scsi_read_handler().set(FUNC(cdtv_state::dmac_scsi_data_read)); - m_dmac->scsi_write_handler().set(FUNC(cdtv_state::dmac_scsi_data_write)); - m_dmac->io_read_handler().set(m_cdrom, FUNC(cr511b_device::read)); - m_dmac->io_write_handler().set(m_cdrom, FUNC(cr511b_device::write)); - m_dmac->int_handler().set(FUNC(cdtv_state::dmac_int_w)); + m_dmac->css_read_cb().set(FUNC(cdtv_state::dmac_scsi_data_read)); + m_dmac->css_write_cb().set(FUNC(cdtv_state::dmac_scsi_data_write)); + m_dmac->csx0_read_cb().set(m_cdrom, FUNC(cr511b_device::read)); + m_dmac->csx0_write_cb().set(m_cdrom, FUNC(cr511b_device::write)); + m_dmac->int_cb().set(FUNC(cdtv_state::dmac_int_w)); TPI6525(config, m_tpi, 0); m_tpi->out_irq_cb().set(FUNC(cdtv_state::tpi_int_w)); @@ -1985,9 +2060,13 @@ void a500p_state::a500p(machine_config &config) // real-time clock MSM6242(config, m_rtc, XTAL(32'768)); - // cpu slot - EXP_SLOT(config, m_side, 0).set_space(m_maincpu, AS_PROGRAM); - ZORRO_SLOT(config, "slot", m_side, a500_expansion_cards, nullptr); + // left side cpu slot + AMIGA_CPUSLOT(config, m_side, a500_cpuslot_cards, nullptr); + m_side->set_space(m_maincpu, AS_PROGRAM); + m_side->ovr_cb().set(FUNC(a500p_state::side_ovr_w)); + m_side->int2_cb().set(FUNC(a500p_state::side_int2_w)); + m_side->int6_cb().set(FUNC(a500p_state::side_int6_w)); + m_side->ipl7_cb().set([this](int state) { m_maincpu->set_input_line(7, state); }); // software SOFTWARE_LIST(config, "ecs_list").set_original("amigaecs_flop"); |