diff options
author | 2014-05-13 11:46:02 +0000 | |
---|---|---|
committer | 2014-05-13 11:46:02 +0000 | |
commit | 640354ad9efa2b8c0027c0bce444e652cb593333 (patch) | |
tree | 9b96640848e9599d569e8c9a683acf3417406d60 | |
parent | 4997e59478dc1d5c0b60c4125e609c3c271a85f7 (diff) |
Big Amiga cleanup and reorganizaton. CDTV temporarily broken. Lots of
work still to do. All basic Amiga models are now supported to varying
degrees.
44 files changed, 6392 insertions, 4217 deletions
diff --git a/.gitattributes b/.gitattributes index f31fd81c35f..306d6986395 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1423,6 +1423,14 @@ src/emu/bus/z88/rom.c svneol=native#text/plain src/emu/bus/z88/rom.h svneol=native#text/plain src/emu/bus/z88/z88.c svneol=native#text/plain src/emu/bus/z88/z88.h svneol=native#text/plain +src/emu/bus/zorro/a590.c svneol=native#text/plain +src/emu/bus/zorro/a590.h svneol=native#text/plain +src/emu/bus/zorro/action_replay.c svneol=native#text/plain +src/emu/bus/zorro/action_replay.h svneol=native#text/plain +src/emu/bus/zorro/cards.c svneol=native#text/plain +src/emu/bus/zorro/cards.h svneol=native#text/plain +src/emu/bus/zorro/zorro.c svneol=native#text/plain +src/emu/bus/zorro/zorro.h svneol=native#text/plain src/emu/cheat.c svneol=native#text/plain src/emu/cheat.h svneol=native#text/plain src/emu/clifront.c svneol=native#text/plain @@ -2348,6 +2356,8 @@ src/emu/machine/adc1213x.c svneol=native#text/plain src/emu/machine/adc1213x.h svneol=native#text/plain src/emu/machine/aicartc.c svneol=native#text/plain src/emu/machine/aicartc.h svneol=native#text/plain +src/emu/machine/akiko.c svneol=native#text/plain +src/emu/machine/akiko.h svneol=native#text/plain src/emu/machine/am53cf96.c svneol=native#text/plain src/emu/machine/am53cf96.h svneol=native#text/plain src/emu/machine/am9517a.c svneol=native#text/plain @@ -2374,6 +2384,8 @@ src/emu/machine/atapicdr.c svneol=native#text/plain src/emu/machine/atapicdr.h svneol=native#text/plain src/emu/machine/atapihle.c svneol=native#text/plain src/emu/machine/atapihle.h svneol=native#text/plain +src/emu/machine/autoconfig.c svneol=native#text/plain +src/emu/machine/autoconfig.h svneol=native#text/plain src/emu/machine/ay31015.c svneol=native#text/plain src/emu/machine/ay31015.h svneol=native#text/plain src/emu/machine/bankdev.c svneol=native#text/plain @@ -2392,6 +2404,8 @@ src/emu/machine/com8116.c svneol=native#text/plain src/emu/machine/com8116.h svneol=native#text/plain src/emu/machine/corvushd.c svneol=native#text/plain src/emu/machine/corvushd.h svneol=native#text/plain +src/emu/machine/cr511b.c svneol=native#text/plain +src/emu/machine/cr511b.h svneol=native#text/plain src/emu/machine/cr589.c svneol=native#text/plain src/emu/machine/cr589.h svneol=native#text/plain src/emu/machine/cs4031.c svneol=native#text/plain @@ -2400,6 +2414,8 @@ src/emu/machine/cs8221.c svneol=native#text/plain src/emu/machine/cs8221.h svneol=native#text/plain src/emu/machine/diablo_hd.c svneol=native#text/plain src/emu/machine/diablo_hd.h svneol=native#text/plain +src/emu/machine/dmac.c svneol=native#text/plain +src/emu/machine/dmac.h svneol=native#text/plain src/emu/machine/dp8390.c svneol=native#text/plain src/emu/machine/dp8390.h svneol=native#text/plain src/emu/machine/ds1204.c svneol=native#text/plain @@ -2897,6 +2913,8 @@ src/emu/sound/aica.c svneol=native#text/plain src/emu/sound/aica.h svneol=native#text/plain src/emu/sound/aicadsp.c svneol=native#text/plain src/emu/sound/aicadsp.h svneol=native#text/plain +src/emu/sound/amiga.c svneol=native#text/plain +src/emu/sound/amiga.h svneol=native#text/plain src/emu/sound/asc.c svneol=native#text/plain src/emu/sound/asc.h svneol=native#text/plain src/emu/sound/astrocde.c svneol=native#text/plain @@ -3998,7 +4016,6 @@ src/lib/zlib/zlib.h svneol=native#text/plain src/lib/zlib/zutil.c svneol=native#text/plain src/lib/zlib/zutil.h svneol=native#text/plain src/mame/audio/8080bw.c svneol=native#text/plain -src/mame/audio/amiga.c svneol=native#text/plain src/mame/audio/asteroid.c svneol=native#text/plain src/mame/audio/astrof.c svneol=native#text/plain src/mame/audio/atarifb.c svneol=native#text/plain @@ -4343,7 +4360,6 @@ src/mame/drivers/ccastles.c svneol=native#text/plain src/mame/drivers/cchance.c svneol=native#text/plain src/mame/drivers/cchasm.c svneol=native#text/plain src/mame/drivers/cclimber.c svneol=native#text/plain -src/mame/drivers/cd32.c svneol=native#text/plain src/mame/drivers/cdi.c svneol=native#text/plain src/mame/drivers/centiped.c svneol=native#text/plain src/mame/drivers/cesclass.c svneol=native#text/plain @@ -4404,6 +4420,7 @@ src/mame/drivers/cshooter.c svneol=native#text/plain src/mame/drivers/csplayh5.c svneol=native#text/plain src/mame/drivers/cswat.c svneol=native#text/plain src/mame/drivers/cubeqst.c svneol=native#text/plain +src/mame/drivers/cubo.c svneol=native#text/plain src/mame/drivers/cultures.c svneol=native#text/plain src/mame/drivers/cupidon.c svneol=native#text/plain src/mame/drivers/cv1k.c svneol=native#text/plain @@ -6470,7 +6487,6 @@ src/mame/machine/carpolo.c svneol=native#text/plain src/mame/machine/cchasm.c svneol=native#text/plain src/mame/machine/cchip.c svneol=native#text/plain src/mame/machine/cclimber.c svneol=native#text/plain -src/mame/machine/cd32.c svneol=native#text/plain src/mame/machine/cdi070.c svneol=native#text/plain src/mame/machine/cdi070.h svneol=native#text/plain src/mame/machine/cdicdic.c svneol=native#text/plain @@ -8503,10 +8519,6 @@ src/mess/machine/abc80kb.h svneol=native#text/plain src/mess/machine/ac1.c svneol=native#text/plain src/mess/machine/advision.c svneol=native#text/plain src/mess/machine/aim65.c svneol=native#text/plain -src/mess/machine/amigacd.c svneol=native#text/plain -src/mess/machine/amigacd.h svneol=native#text/plain -src/mess/machine/amigacrt.c svneol=native#text/plain -src/mess/machine/amigacrt.h svneol=native#text/plain src/mess/machine/amigakbd.c svneol=native#text/plain src/mess/machine/amigakbd.h svneol=native#text/plain src/mess/machine/amstrad.c svneol=native#text/plain diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index e47605433d8..9067f5bca1d 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -1082,3 +1082,15 @@ BUSOBJS += $(BUSOBJ)/a1bus/a1cassette.o BUSOBJS += $(BUSOBJ)/a1bus/a1cffa.o endif +#------------------------------------------------- +# +#@src/emu/bus/zorro/zorro.h,BUSES += ZORRO +#------------------------------------------------- + +ifneq ($(filter ZORRO,$(BUSES)),) +OBJDIRS += $(BUSOBJ)/zorro +BUSOBJS += $(BUSOBJ)/zorro/zorro.o +BUSOBJS += $(BUSOBJ)/zorro/cards.o +BUSOBJS += $(BUSOBJ)/zorro/a590.o +BUSOBJS += $(BUSOBJ)/zorro/action_replay.o +endif diff --git a/src/emu/bus/zorro/a590.c b/src/emu/bus/zorro/a590.c new file mode 100644 index 00000000000..d6ca7d12b6b --- /dev/null +++ b/src/emu/bus/zorro/a590.c @@ -0,0 +1,346 @@ +/*************************************************************************** + + Commodore A590 / A2091 + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + DMAC based HD controller for the Amiga 500 and Zorro-II + +***************************************************************************/ + +#include "a590.h" +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsihd.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type A590 = &device_creator<a590_device>; +const device_type A2091 = &device_creator<a2091_device>; + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( a590_pcb ) + PORT_START("dips") + PORT_DIPNAME(0x01, 0x01, "A590 Auto-Boot") + PORT_DIPLOCATION("DIP:1") + PORT_DIPSETTING(0x00, "Enabled") + PORT_DIPSETTING(0x01, "Disabled") + PORT_DIPNAME(0x02, 0x00, "A590 LUN") + PORT_DIPLOCATION("DIP:2") + PORT_DIPSETTING(0x00, "Disabled") + PORT_DIPSETTING(0x02, "Enabled") + PORT_DIPNAME(0x04, 0x04, "A590 Wait period") + PORT_DIPLOCATION("DIP:3") + PORT_DIPSETTING(0x00, "Short") + PORT_DIPSETTING(0x04, "Long") + PORT_DIPNAME(0x08, 0x00, "A590 Reserved") + PORT_DIPLOCATION("DIP:4") + PORT_DIPSETTING(0x00, "Enabled") + PORT_DIPSETTING(0x08, "Disabled") + PORT_START("jp1") + PORT_DIPNAME(0x0f, 0x01, "A590 Memory size") + PORT_DIPLOCATION("JP1:1,2,3,4") + PORT_DIPSETTING(0x01, "Amnesia") + PORT_DIPSETTING(0x02, "512K") + PORT_DIPSETTING(0x04, "1MB") + PORT_DIPSETTING(0x08, "2MB") + PORT_START("jp2") + PORT_DIPNAME(0x01, 0x00, "A590 Drive LED") + PORT_DIPLOCATION("JP2:1") + PORT_DIPSETTING(0x00, "XT Drive") + PORT_DIPSETTING(0x01, "SCSI Drive") + PORT_START("jp4") + PORT_DIPNAME(0x01, 0x00, "A590 Interrupt") + PORT_DIPLOCATION("JP4:1") + PORT_DIPSETTING(0x00, "INT 2") + PORT_DIPSETTING(0x01, "INT 6") +INPUT_PORTS_END + +ioport_constructor a590_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( a590_pcb ); +} + +static INPUT_PORTS_START( a2091_pcb ) + PORT_START("jp1") + PORT_DIPNAME(0x0f, 0x01, "A2091 Memory size") + PORT_DIPLOCATION("JP1:1,2,3,4") + PORT_DIPSETTING(0x01, "0K") + PORT_DIPSETTING(0x02, "512K") + PORT_DIPSETTING(0x04, "1MB") + PORT_DIPSETTING(0x08, "2MB") + PORT_START("jp2") + PORT_DIPNAME(0x01, 0x00, "A2091 Auto-Boot") + PORT_DIPLOCATION("JP2:1") + PORT_DIPSETTING(0x00, "Enabled") + PORT_DIPSETTING(0x01, "Disabled") + PORT_START("jp3") + PORT_DIPNAME(0x01, 0x00, "A2091 Interrupt") + PORT_DIPLOCATION("JP3:1") + PORT_DIPSETTING(0x00, "INT 2") + PORT_DIPSETTING(0x01, "INT 6") + PORT_START("jp5") + PORT_DIPNAME(0x01, 0x00, "A2091 LUN") + PORT_DIPLOCATION("JP5:1") + PORT_DIPSETTING(0x00, "Disabled") + PORT_DIPSETTING(0x01, "Enabled") + PORT_DIPNAME(0x02, 0x00, "A2091 Time-Out") + PORT_DIPLOCATION("JP5:2") + PORT_DIPSETTING(0x00, "Short") + PORT_DIPSETTING(0x02, "Long") + PORT_DIPNAME(0x04, 0x00, "A2091 Reserved") + PORT_DIPLOCATION("JP5:3") + PORT_DIPSETTING(0x00, "Disabled") + PORT_DIPSETTING(0x02, "Enabled") + PORT_START("jp201") + PORT_DIPNAME(0x01, 0x00, "A2091 WD33C93 Clock") + PORT_DIPLOCATION("JP201:1") + PORT_DIPSETTING(0x00, "7 MHz") + PORT_DIPSETTING(0x01, "14 MHz") +INPUT_PORTS_END + +ioport_constructor a2091_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( a2091_pcb ); +} + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( dmac_hdc ) + MCFG_DMAC_ADD("dmac", 0) + MCFG_DMAC_SCSI_READ_HANDLER(READ8(dmac_hdc_device, dmac_scsi_r)) + MCFG_DMAC_SCSI_WRITE_HANDLER(WRITE8(dmac_hdc_device, dmac_scsi_w)) + MCFG_DMAC_INT_HANDLER(WRITELINE(dmac_hdc_device, dmac_int_w)) + MCFG_DMAC_CFGOUT_HANDLER(WRITELINE(dmac_hdc_device, dmac_cfgout_w)) + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_1) + MCFG_DEVICE_ADD("scsi:wd33c93", WD33C93, 0) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_WD33C93_IRQ_CB(DEVWRITELINE("^^", dmac_hdc_device, scsi_irq_w)) +MACHINE_CONFIG_END + +machine_config_constructor dmac_hdc_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( dmac_hdc ); +} + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +ROM_START( dmac_hdc ) + ROM_REGION16_BE(0x8000, "bootrom", 0) + ROM_DEFAULT_BIOS("v70") + + ROM_SYSTEM_BIOS(0, "v60", "Version 6.0") + ROMX_LOAD("390388-03.u13", 0x0000, 0x2000, CRC(2e77bbff) SHA1(8a098845068f32cfa4d34a278cd290f61d35a52c), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("390389-03.u12", 0x0001, 0x2000, CRC(b0b8cf24) SHA1(fcf4017505f4d441814b45d559c19eab43816b30), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("390388-03.u13", 0x4000, 0x2000, CRC(2e77bbff) SHA1(8a098845068f32cfa4d34a278cd290f61d35a52c), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("390389-03.u12", 0x4001, 0x2000, CRC(b0b8cf24) SHA1(fcf4017505f4d441814b45d559c19eab43816b30), ROM_SKIP(1) | ROM_BIOS(1)) + + // changelog v6.1: prevent accesses to location 0 by application programs + ROM_SYSTEM_BIOS(1, "v61", "Version 6.1") + ROMX_LOAD("390721-01.u13", 0x0000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390722-01.u12", 0x0001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390721-01.u13", 0x4000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("390722-01.u12", 0x4001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) + + // changelog v6.6: fixes dual scsi problems with the wd33c93a controller + ROM_SYSTEM_BIOS(2, "v66", "Version 6.6") + ROMX_LOAD("390721-02.u13", 0x0000, 0x2000, CRC(c0871d25) SHA1(e155f18abb90cf820589c15e70559d3b6b391af8), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("390722-02.u12", 0x0001, 0x2000, CRC(e536bbb2) SHA1(fd7f8a6da18c1b02d07eb990c2467a24183ede12), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("390721-02.u13", 0x4000, 0x2000, CRC(c0871d25) SHA1(e155f18abb90cf820589c15e70559d3b6b391af8), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("390722-02.u12", 0x4001, 0x2000, CRC(e536bbb2) SHA1(fd7f8a6da18c1b02d07eb990c2467a24183ede12), ROM_SKIP(1) | ROM_BIOS(3)) + + // final commodore released version + ROM_SYSTEM_BIOS(3, "v70", "Version 7.0") + ROMX_LOAD("390721-03.u13", 0x0000, 0x2000, CRC(2942747a) SHA1(dbd7648e79c753337ff3e4f491de224bf05e6bb6), ROM_SKIP(1) | ROM_BIOS(4)) + ROMX_LOAD("390722-03.u12", 0x0001, 0x2000, CRC(a9ccffed) SHA1(149f5bd52e2d29904e3de483b9ad772448e9278e), ROM_SKIP(1) | ROM_BIOS(4)) + ROMX_LOAD("390721-03.u13", 0x4000, 0x2000, CRC(2942747a) SHA1(dbd7648e79c753337ff3e4f491de224bf05e6bb6), ROM_SKIP(1) | ROM_BIOS(4)) + ROMX_LOAD("390722-03.u12", 0x4001, 0x2000, CRC(a9ccffed) SHA1(149f5bd52e2d29904e3de483b9ad772448e9278e), ROM_SKIP(1) | ROM_BIOS(4)) + + // third-party upgrade rom, requires a small rom adapter pcb + ROM_SYSTEM_BIOS(4, "g614", "Guru-ROM 6.14") + ROMX_LOAD("gururom_v614.bin", 0x0000, 0x8000, CRC(04e52f93) SHA1(6da21b6f5e8f8837d64507cd8a4d5cdcac4f426b), ROM_GROUPWORD | ROM_BIOS(5)) +ROM_END + +const rom_entry *dmac_hdc_device::device_rom_region() const +{ + return ROM_NAME( dmac_hdc ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// dmac_hdc_device - constructor +//------------------------------------------------- + +dmac_hdc_device::dmac_hdc_device(const machine_config &mconfig, device_type type, const char *tag, + device_t *owner, UINT32 clock, const char *name, const char *shortname) : + device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), + m_int6(false), + m_dmac(*this, "dmac"), + m_wdc(*this, "scsi:wd33c93") +{ +} + +a590_device::a590_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + dmac_hdc_device(mconfig, A590, tag, owner, clock, "CBM A590 HD Controller", "a590"), + device_exp_card_interface(mconfig, *this), + m_dips(*this, "dips"), + m_jp1(*this, "jp1"), + m_jp2(*this, "jp2"), + m_jp4(*this, "jp4") +{ +} + +a2091_device::a2091_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + dmac_hdc_device(mconfig, A2091, tag, owner, clock, "CBM A2091 HD Controller", "a2091"), + device_zorro2_card_interface(mconfig, *this), + m_jp1(*this, "jp1"), + m_jp2(*this, "jp2"), + m_jp3(*this, "jp3"), + m_jp5(*this, "jp5"), + m_jp201(*this, "jp201") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void dmac_hdc_device::device_start() +{ +} + +void a590_device::device_start() +{ + set_zorro_device(); + + // setup dmac + m_dmac->set_address_space(m_slot->m_space); + m_dmac->set_rom(memregion("bootrom")->base()); +} + +void a2091_device::device_start() +{ + set_zorro_device(); + + // setup dmac + m_dmac->set_address_space(m_slot->m_space); + m_dmac->set_rom(memregion("bootrom")->base()); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void dmac_hdc_device::device_reset() +{ +} + +void dmac_hdc_device::resize_ram(int config) +{ + // allocate space for ram + switch (config & 0x0f) + { + case 0x01: + m_ram.resize(0); + m_dmac->ramsz_w(0); + break; + case 0x02: + m_ram.resize(0x080000); + m_dmac->ramsz_w(1); + break; + case 0x04: + m_ram.resize(0x100000); + m_dmac->ramsz_w(2); + break; + case 0x08: + m_ram.resize(0x200000); + m_dmac->ramsz_w(3); + break; + } + + m_dmac->set_ram(m_ram); +} + +void a590_device::device_reset() +{ +} + +void a2091_device::device_reset() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +WRITE_LINE_MEMBER( a590_device::cfgin_w ) +{ + // make sure we configure ourselves first + m_int6 = m_jp4->read() & 0x01; + resize_ram(m_dips->read() & 0x0f); + + // then tell the dmac to start configuring + m_dmac->configin_w(state); +} + +WRITE_LINE_MEMBER( a2091_device::cfgin_w ) +{ + // make sure we configure ourselves first + m_int6 = m_jp3->read() & 0x01; + resize_ram(m_jp1->read() & 0x0f); + + // then tell the dmac to start configuring + m_dmac->configin_w(state); +} + +READ8_MEMBER( dmac_hdc_device::dmac_scsi_r ) +{ + switch (offset) + { + case 0x48: return m_wdc->read(space, 0); + case 0x49: return m_wdc->read(space, 1); + } + + return 0xff; +} + +WRITE8_MEMBER( dmac_hdc_device::dmac_scsi_w ) +{ + switch (offset) + { + case 0x48: m_wdc->write(space, 0, data); break; + case 0x49: m_wdc->write(space, 1, data); break; + } +} + +WRITE_LINE_MEMBER( dmac_hdc_device::dmac_int_w ) +{ + if (m_int6) + int6_w(state); + else + int2_w(state); +} + +WRITE_LINE_MEMBER( dmac_hdc_device::scsi_irq_w ) +{ + // should be or'ed with xt-ide irq + m_dmac->intx_w(state); +} diff --git a/src/emu/bus/zorro/a590.h b/src/emu/bus/zorro/a590.h new file mode 100644 index 00000000000..4682c72903f --- /dev/null +++ b/src/emu/bus/zorro/a590.h @@ -0,0 +1,135 @@ +/*************************************************************************** + + Commodore A590 / A2091 + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + DMAC based SCSI controller for the Amiga 500 and Zorro-II + +***************************************************************************/ + +#pragma once + +#ifndef __A590_H__ +#define __A590_H__ + +#include "emu.h" +#include "zorro.h" +#include "machine/dmac.h" +#include "machine/wd33c93.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> dmac_hdc_device + +class dmac_hdc_device : public device_t +{ +public: + // construction/destruction + dmac_hdc_device(const machine_config &mconfig, device_type type, const char *tag, + device_t *owner, UINT32 clock, const char *name, const char *shortname); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual const rom_entry *device_rom_region() const; + + DECLARE_READ8_MEMBER( dmac_scsi_r ); + DECLARE_WRITE8_MEMBER( dmac_scsi_w ); + DECLARE_WRITE_LINE_MEMBER( dmac_int_w ); + DECLARE_WRITE_LINE_MEMBER( dmac_cfgout_w ) { cfgout_w(state); } + DECLARE_WRITE_LINE_MEMBER( scsi_irq_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // to slot + virtual void cfgout_w(int state) = 0; + virtual void int2_w(int state) = 0; + virtual void int6_w(int state) = 0; + + // should be called when the ram size changes + void resize_ram(int config); + + // amiga interrupt target, int 2 or 6 + bool m_int6; + + // sub-devices + required_device<dmac_device> m_dmac; + required_device<wd33c93_device> m_wdc; + + dynamic_buffer m_ram; +}; + +// ======================> a590_device + +class a590_device : public dmac_hdc_device, public device_exp_card_interface +{ +public: + // construction/destruction + a590_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // optional information overrides + virtual ioport_constructor device_input_ports() const; + + // output to slot + virtual void cfgout_w(int state) { m_slot->cfgout_w(state); } + virtual void int2_w(int state) { m_slot->int2_w(state); } + virtual void int6_w(int state) { m_slot->int6_w(state); } + + // input from slot + virtual DECLARE_WRITE_LINE_MEMBER( cfgin_w ); + +private: + required_ioport m_dips; + required_ioport m_jp1; + required_ioport m_jp2; + required_ioport m_jp4; +}; + +// ======================> a2091_device + +class a2091_device : public dmac_hdc_device, public device_zorro2_card_interface +{ +public: + // construction/destruction + a2091_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // optional information overrides + virtual ioport_constructor device_input_ports() const; + + // output to slot + virtual void cfgout_w(int state) { m_slot->cfgout_w(state); } + virtual void int2_w(int state) { m_slot->int2_w(state); } + virtual void int6_w(int state) { m_slot->int6_w(state); } + + // input from slot + virtual DECLARE_WRITE_LINE_MEMBER( cfgin_w ); + +private: + required_ioport m_jp1; + required_ioport m_jp2; + required_ioport m_jp3; + required_ioport m_jp5; + required_ioport m_jp201; +}; + +// device type definition +extern const device_type A590; +extern const device_type A2091; + +#endif diff --git a/src/emu/bus/zorro/action_replay.c b/src/emu/bus/zorro/action_replay.c new file mode 100644 index 00000000000..890e0081373 --- /dev/null +++ b/src/emu/bus/zorro/action_replay.c @@ -0,0 +1,150 @@ +/*************************************************************************** + + Datel Action Replay + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + Freezer cartridge for Amiga 500 and Amiga 2000 + + Skeleton device, just loads the ROMs and generates the NMI + for now. + + Hardware notes: + - http://www.mways.co.uk/amiga/howtocode/text/actionreplay.php + +***************************************************************************/ + +#include "action_replay.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type ACTION_REPLAY_MK1 = &device_creator<action_replay_mk1_device>; +const device_type ACTION_REPLAY_MK2 = &device_creator<action_replay_mk2_device>; +const device_type ACTION_REPLAY_MK3 = &device_creator<action_replay_mk3_device>; + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( ar_button ) + PORT_START("freeze") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Freeze") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, action_replay_device, freeze, 0) +INPUT_PORTS_END + +ioport_constructor action_replay_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( ar_button ); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +ROM_START( ar_mk1 ) + ROM_REGION(0x10000, "firmware", 0) + ROM_DEFAULT_BIOS("v150") + ROM_SYSTEM_BIOS(0, "v100", "Version 1.00") + ROMX_LOAD("ar1_v100.bin", 0x0000, 0x10000, BAD_DUMP CRC(2d921771) SHA1(1ead9dda2dad29146441f5ef7218375022e01248), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v150", "Version 1.50") + ROMX_LOAD("ar1_v150.bin", 0x0000, 0x10000, BAD_DUMP CRC(f82c4258) SHA1(843b433b2c56640e045d5fdc854dc6b1a4964e7c), ROM_BIOS(2)) +ROM_END + +const rom_entry *action_replay_mk1_device::device_rom_region() const +{ + return ROM_NAME( ar_mk1 ); +} + +ROM_START( ar_mk2 ) + ROM_REGION(0x20000, "firmware", 0) + ROM_DEFAULT_BIOS("v214") + ROM_SYSTEM_BIOS(0, "v205", "Version 2.05") + ROMX_LOAD("ar2_v205.bin", 0x0000, 0x20000, BAD_DUMP CRC(4051eef8) SHA1(9df22b1d3285b522c223697c83d144d04e961a4a), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v212", "Version 2.12") + ROMX_LOAD("ar2_v212.bin", 0x0000, 0x20000, BAD_DUMP CRC(d29bdd86) SHA1(76c2900457badf22b742f0af48b78937e8b67694), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v214", "Version 2.14") + ROMX_LOAD("ar2_v214.bin", 0x0000, 0x20000, BAD_DUMP CRC(1bb3d0a8) SHA1(14b1f5a69efb6f4e2331970e6ca0f33c0f04ac91), ROM_BIOS(3)) +ROM_END + +const rom_entry *action_replay_mk2_device::device_rom_region() const +{ + return ROM_NAME( ar_mk2 ); +} + +ROM_START( ar_mk3 ) + ROM_REGION(0x40000, "firmware", 0) + ROM_DEFAULT_BIOS("v309") + ROM_SYSTEM_BIOS(0, "v309", "Version 3.09") + ROMX_LOAD("ar3_v309.evn", 0x00000, 0x20000, CRC(2b84519f) SHA1(7841873bf009d8341dfa2794b3751bacf86adcc8), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("ar3_v309.odd", 0x00001, 0x20000, CRC(1d35bd56) SHA1(6464be1626b519499e76e4e3409e8016515d48b6), ROM_SKIP(1) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v317", "Version 3.17") + ROMX_LOAD("ar3_v314.bin", 0x0000, 0x40000, BAD_DUMP CRC(009f7768) SHA1(0439d6ccc2a0e5c2e83fcf2389dc4d4a440a4c62), ROM_BIOS(2)) +ROM_END + +const rom_entry *action_replay_mk3_device::device_rom_region() const +{ + return ROM_NAME( ar_mk3 ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// action_replay_device - constructor +//------------------------------------------------- + +action_replay_device::action_replay_device(const machine_config &mconfig, device_type type, const char *tag, + device_t *owner, UINT32 clock, const char *name, const char *shortname) : + device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), + device_exp_card_interface(mconfig, *this), + m_button(*this, "freeze") +{ +} + +action_replay_mk1_device::action_replay_mk1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + action_replay_device(mconfig, ACTION_REPLAY_MK1, tag, owner, clock, "Datel Action Replay MK-I", "amiga_ar1") +{ +} + +action_replay_mk2_device::action_replay_mk2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + action_replay_device(mconfig, ACTION_REPLAY_MK1, tag, owner, clock, "Datel Action Replay MK-II", "amiga_ar2") +{ +} + +action_replay_mk3_device::action_replay_mk3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + action_replay_device(mconfig, ACTION_REPLAY_MK1, tag, owner, clock, "Datel Action Replay MK-III", "amiga_ar3") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void action_replay_device::device_start() +{ + set_zorro_device(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void action_replay_device::device_reset() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +INPUT_CHANGED_MEMBER( action_replay_device::freeze ) +{ + // pushing the freeze button generates an nmi + m_slot->ipl_w(newval == 1 ? 7 : 0); +} diff --git a/src/emu/bus/zorro/action_replay.h b/src/emu/bus/zorro/action_replay.h new file mode 100644 index 00000000000..f2520575fb7 --- /dev/null +++ b/src/emu/bus/zorro/action_replay.h @@ -0,0 +1,83 @@ +/*************************************************************************** + + Datel Action Replay + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + Freezer cartridge for Amiga 500 and Amiga 2000 + +***************************************************************************/ + +#pragma once + +#ifndef __ACTION_REPLAY_H__ +#define __ACTION_REPLAY_H__ + +#include "emu.h" +#include "zorro.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> action_replay_device + +class action_replay_device : public device_t, public device_exp_card_interface +{ +public: + // construction/destruction + action_replay_device(const machine_config &mconfig, device_type type, const char *tag, + device_t *owner, UINT32 clock, const char *name, const char *shortname); + + // optional information overrides + virtual ioport_constructor device_input_ports() const; + + DECLARE_INPUT_CHANGED_MEMBER( freeze ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + required_ioport m_button; +}; + +class action_replay_mk1_device : public action_replay_device +{ +public: + // construction/destruction + action_replay_mk1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; +}; + +class action_replay_mk2_device : public action_replay_device +{ +public: + // construction/destruction + action_replay_mk2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; +}; + +class action_replay_mk3_device : public action_replay_device +{ +public: + // construction/destruction + action_replay_mk3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; +}; + +// device type definition +extern const device_type ACTION_REPLAY_MK1; +extern const device_type ACTION_REPLAY_MK2; +extern const device_type ACTION_REPLAY_MK3; + +#endif diff --git a/src/emu/bus/zorro/cards.c b/src/emu/bus/zorro/cards.c new file mode 100644 index 00000000000..68af08c60a5 --- /dev/null +++ b/src/emu/bus/zorro/cards.c @@ -0,0 +1,31 @@ +/*************************************************************************** + + Amiga Zorro Cards + +***************************************************************************/ + +#include "cards.h" + +SLOT_INTERFACE_START( a1000_expansion_cards ) +SLOT_INTERFACE_END + +SLOT_INTERFACE_START( a500_expansion_cards ) + SLOT_INTERFACE("ar1", ACTION_REPLAY_MK1) + SLOT_INTERFACE("ar2", ACTION_REPLAY_MK2) + SLOT_INTERFACE("ar3", ACTION_REPLAY_MK3) + SLOT_INTERFACE("a590", A590) +SLOT_INTERFACE_END + +SLOT_INTERFACE_START( a2000_expansion_cards ) + SLOT_INTERFACE("ar1", ACTION_REPLAY_MK1) + SLOT_INTERFACE("ar2", ACTION_REPLAY_MK2) + SLOT_INTERFACE("ar3", ACTION_REPLAY_MK3) +SLOT_INTERFACE_END + +SLOT_INTERFACE_START( zorro2_cards ) + SLOT_INTERFACE("a2091", A2091) +SLOT_INTERFACE_END + +SLOT_INTERFACE_START( zorro3_cards ) + SLOT_INTERFACE("a2091", A2091) +SLOT_INTERFACE_END diff --git a/src/emu/bus/zorro/cards.h b/src/emu/bus/zorro/cards.h new file mode 100644 index 00000000000..6c34f9394fb --- /dev/null +++ b/src/emu/bus/zorro/cards.h @@ -0,0 +1,38 @@ +/*************************************************************************** + + Amiga Zorro Cards + + There are different card types and layouts: + + * 86-pin expansion slot + - A1000 + - A500 (rotated slot) + - A2000/B2000 (internal slot) + * Zorro-II + - A2000 + - B2000 + * Zorro-III + - A3000, A4000 + + For details see zorro.h. Zorro-II cards can be inserted into + Zorro-III slots. + +***************************************************************************/ + +#pragma once + +#ifndef __CARDS_H__ +#define __CARDS_H__ + +#include "emu.h" +#include "a590.h" +#include "action_replay.h" + +SLOT_INTERFACE_EXTERN( a1000_expansion_cards ); +SLOT_INTERFACE_EXTERN( a500_expansion_cards ); +SLOT_INTERFACE_EXTERN( a2000_expansion_cards ); + +SLOT_INTERFACE_EXTERN( zorro2_cards ); +SLOT_INTERFACE_EXTERN( zorro3_cards ); + +#endif // __CARDS_H__ diff --git a/src/emu/bus/zorro/zorro.c b/src/emu/bus/zorro/zorro.c new file mode 100644 index 00000000000..91918c2ffea --- /dev/null +++ b/src/emu/bus/zorro/zorro.c @@ -0,0 +1,358 @@ +/*************************************************************************** + + Amiga Zorro Slots + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + 86-pin Expansion Slot (Zorro-I), Zorro-II, Zorro-III + +***************************************************************************/ + +#include "zorro.h" + + +//************************************************************************** +// ZORRO SLOT DEVICE +//************************************************************************** + +const device_type ZORRO_SLOT = &device_creator<zorro_slot_device>; + +//------------------------------------------------- +// zorro_slot_device - constructor +//------------------------------------------------- + +zorro_slot_device::zorro_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, ZORRO_SLOT, "Zorro slot", tag, owner, clock, "zorro_slot", __FILE__), + device_slot_interface(mconfig, *this), + m_zorro_tag(NULL) +{ +} + +zorro_slot_device::zorro_slot_device(const machine_config &mconfig, device_type type, const char *name, + const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_slot_interface(mconfig, *this), + m_zorro_tag(NULL) +{ +} + +void zorro_slot_device::set_zorro_slot(device_t &device, device_t *owner, const char *zorro_tag) +{ + zorro_slot_device &zorro_card = dynamic_cast<zorro_slot_device &>(device); + zorro_card.m_owner = owner; + zorro_card.m_zorro_tag = zorro_tag; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void zorro_slot_device::device_start() +{ + device_zorro_card_interface *dev = dynamic_cast<device_zorro_card_interface *>(get_card_device()); + + if (dev) + { + zorro_device *m_zorro_bus = downcast<zorro_device *>(m_owner->subdevice(m_zorro_tag)); + m_zorro_bus->add_card(dev); + } +} + + +//************************************************************************** +// BASE ZORRO BUS DEVICE +//************************************************************************** + +//------------------------------------------------- +// exp_slot_device - constructor +//------------------------------------------------- + +zorro_device::zorro_device(const machine_config &mconfig, device_type type, const char *name, + const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source), + m_space(NULL), + m_cputag(NULL), + m_ovr_handler(*this), + m_int2_handler(*this), + m_int6_handler(*this) +{ +} + +//------------------------------------------------- +// set_cputag - set cpu we are attached to +//------------------------------------------------- + +void zorro_device::set_cputag(device_t &device, const char *tag) +{ + zorro_device &zorro = downcast<zorro_device &>(device); + zorro.m_cputag = tag; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void zorro_device::device_start() +{ + // get address space + device_t *cpu = machine().device(m_cputag); + m_space = &cpu->memory().space(AS_PROGRAM); + + // resolve callbacks + m_ovr_handler.resolve_safe(); + m_int2_handler.resolve_safe(); + m_int6_handler.resolve_safe(); +} + +// from slot device +WRITE_LINE_MEMBER( zorro_device::ovr_w ) { m_ovr_handler(state); } +WRITE_LINE_MEMBER( zorro_device::int2_w ) { m_int2_handler(state); } +WRITE_LINE_MEMBER( zorro_device::int6_w ) { m_int6_handler(state); } + + +//************************************************************************** +// EXPANSION SLOT DEVICE +//************************************************************************** + +const device_type EXP_SLOT = &device_creator<exp_slot_device>; + +//------------------------------------------------- +// exp_slot_device - constructor +//------------------------------------------------- + +exp_slot_device::exp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + zorro_device(mconfig, EXP_SLOT, "86-pin expansion slot", tag, owner, clock, "exp_slot", __FILE__), + m_ipl_handler(*this), + m_dev(NULL) +{ +} + +exp_slot_device::exp_slot_device(const machine_config &mconfig, device_type type, const char *name, + const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + zorro_device(mconfig, type, name, tag, owner, clock, shortname, source), + m_ipl_handler(*this), + m_dev(NULL) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void exp_slot_device::device_start() +{ + // resolve callbacks + m_ipl_handler.resolve_safe(); + + // call base device start + zorro_device::device_start(); +} + +//------------------------------------------------- +// add_card - add new card to our bus +//------------------------------------------------- + +void exp_slot_device::add_card(device_zorro_card_interface *card) +{ + m_dev = downcast<device_exp_card_interface *>(card); +} + +// from slot device +void exp_slot_device::ipl_w(int interrupt) { m_ipl_handler(0, interrupt, 0xff); } + +// from host +void exp_slot_device::fc_w(int code) { if (m_dev) m_dev->fc_w(code); } + + +//************************************************************************** +// ZORRO2 DEVICE +//************************************************************************** + +const device_type ZORRO2 = &device_creator<zorro2_device>; + +//------------------------------------------------- +// zorro2_device - constructor +//------------------------------------------------- + +zorro2_device::zorro2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + zorro_device(mconfig, ZORRO2, "Zorro-II bus", tag, owner, clock, "zorro2", __FILE__), + m_eint1_handler(*this), + m_eint4_handler(*this), + m_eint5_handler(*this), + m_eint7_handler(*this), + m_autoconfig_device(NULL) +{ +} + +zorro2_device::zorro2_device(const machine_config &mconfig, device_type type, const char *name, + const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + zorro_device(mconfig, type, name, tag, owner, clock, shortname, source), + m_eint1_handler(*this), + m_eint4_handler(*this), + m_eint5_handler(*this), + m_eint7_handler(*this), + m_autoconfig_device(NULL) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void zorro2_device::device_start() +{ + // resolve callbacks + m_eint1_handler.resolve_safe(); + m_eint4_handler.resolve_safe(); + m_eint5_handler.resolve_safe(); + m_eint7_handler.resolve_safe(); + + // call base device start + zorro_device::device_start(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void zorro2_device::device_reset() +{ + // initiate autoconfig + m_autoconfig_device = m_dev.first(); + + // if we have a device, start the autoconfig chain + if (m_autoconfig_device) + m_autoconfig_device->cfgin_w(0); +} + +//------------------------------------------------- +// add_card - add new card to our bus +//------------------------------------------------- + +void zorro2_device::add_card(device_zorro_card_interface *card) +{ + device_zorro2_card_interface *zorro2_card = downcast<device_zorro2_card_interface *>(card); + card->set_zorro_bus(this); + m_dev.append(*zorro2_card); +} + +// from slot device +WRITE_LINE_MEMBER( zorro2_device::eint1_w ) { m_eint1_handler(state); } +WRITE_LINE_MEMBER( zorro2_device::eint4_w ) { m_eint4_handler(state); } +WRITE_LINE_MEMBER( zorro2_device::eint5_w ) { m_eint5_handler(state); } +WRITE_LINE_MEMBER( zorro2_device::eint7_w ) { m_eint7_handler(state); } + +WRITE_LINE_MEMBER( zorro2_device::cfgout_w ) +{ + m_autoconfig_device = m_autoconfig_device->next(); + + // if there is still a device in the chain, tell it to configure itself + if (m_autoconfig_device) + m_autoconfig_device->cfgin_w(0); +} + +// from host +void zorro2_device::fc_w(int code) +{ + device_zorro2_card_interface *entry = m_dev.first(); + + while (entry) + { + entry->fc_w(code); + entry = entry->next(); + } +} + + +//************************************************************************** +// ZORRO INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_zorro_card_interface - constructor +//------------------------------------------------- + +device_zorro_card_interface::device_zorro_card_interface(const machine_config &mconfig, device_t &device) : + device_slot_card_interface(mconfig, device), + m_zorro(NULL) +{ +} + +//------------------------------------------------- +// ~device_zorro_card_interface - destructor +//------------------------------------------------- + +device_zorro_card_interface::~device_zorro_card_interface() +{ +} + +void device_zorro_card_interface::set_zorro_bus(zorro_device *device) +{ + m_zorro = device; +} + +void device_zorro_card_interface::fc_w(int code) +{ +} + +WRITE_LINE_MEMBER( device_zorro_card_interface::cfgin_w ) +{ +} + + +//************************************************************************** +// EXPANSION CARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_exp_card_interface - constructor +//------------------------------------------------- + +device_exp_card_interface::device_exp_card_interface(const machine_config &mconfig, device_t &device) : + device_zorro_card_interface(mconfig, device), + m_slot(NULL) +{ +} + +//------------------------------------------------- +// ~device_exp_card_interface - destructor +//------------------------------------------------- + +device_exp_card_interface::~device_exp_card_interface() +{ +} + +void device_exp_card_interface::set_zorro_device() +{ + m_slot = dynamic_cast<exp_slot_device *>(m_zorro); +} + + +//************************************************************************** +// ZORRO-II CARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_zorro2_interface - constructor +//------------------------------------------------- + +device_zorro2_card_interface::device_zorro2_card_interface(const machine_config &mconfig, device_t &device) : + device_zorro_card_interface(mconfig, device), + m_next(NULL), + m_slot(NULL) +{ +} + +//------------------------------------------------- +// ~device_zorro2_interface - destructor +//------------------------------------------------- + +device_zorro2_card_interface::~device_zorro2_card_interface() +{ +} + +void device_zorro2_card_interface::set_zorro_device() +{ + m_slot = dynamic_cast<zorro2_device *>(m_zorro); +} diff --git a/src/emu/bus/zorro/zorro.h b/src/emu/bus/zorro/zorro.h new file mode 100644 index 00000000000..d018b217374 --- /dev/null +++ b/src/emu/bus/zorro/zorro.h @@ -0,0 +1,443 @@ +/*************************************************************************** + + Amiga Zorro Slots + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + 86-pin Expansion Slot (Zorro-I), Zorro-II, Zorro-III + + 86-pin Expansion Slot + + 2 Ground 1 Ground + 4 Ground 3 Ground + 6 +5VDC 5 +5VDC + 8 -5VDC 7 N/C + 10 +12VDC 9 N/C *1 + 12 CFGIN 11 N/C *2 + 14 /C3 Clock 13 Ground + 16 /C1 Clock 15 CDAC + 18 XRDY 17 /OVR + 20 N/C *3 19 /INT2 + 22 /INT6 21 A5 + 24 A4 23 A6 + 26 A3 25 Ground + 28 A7 27 A2 + 30 A8 29 A1 + 32 A9 31 FC0 + 34 A10 33 FC1 + 36 A11 35 FC2 + 38 A12 37 Ground + 40 /IPL0 39 A13 + 42 /IPL1 41 A14 + 44 /IPL2 43 A15 + 46 /BEER 45 A16 + 48 /VPA 47 A17 + 50 E Clock 49 Ground + 52 A18 51 /VMA + 54 A19 53 /RST + 56 A20 55 /HLT + 58 A21 57 A22 + 60 /BR *4 59 A23 + 62 /BGACK 61 Ground + 64 /BG *5 63 D15 + 66 /DTACK 65 D14 + 68 R/W 67 D13 + 70 /LDS 69 D12 + 72 /UDS 71 D11 + 74 /AS 73 Ground + 76 D10 75 D0 + 78 D9 77 D1 + 80 D8 79 D2 + 82 D7 81 D3 + 84 D6 83 D4 + 86 D5 85 Ground + + *1 28 MHz Clock on A2000 and B2000 + *2 /COPCFG on B2000 + *3 /PALOPE on A1000, /BOSS on B2000 + *4 /CBR on B2000 + *5 /CBG on B2000 + + Zorro-II (differences only) + + 7 /OWN + 9 /SLAVEn + 11 /CFGOUTn + 12 /CFGINn + 20 -12VDC + 40 /EINT7 + 42 /EINT5 + 44 /EINT4 + 60 /BRn + 64 /BGn + + 88 Ground 87 Ground + 90 Ground 89 Ground + 92 7 MHz 91 Ground + 94 /BURST 93 DOE + 96 /EINT1 95 /BG *5 + 98 N/C 97 N/C + 100 Ground 99 Ground + + *6 /GBG on B2000 + + Zorro-III + + The Zorro-III is a multiplexed Zorro-II bus with address- and + data phases. Signals changes as follows: + + 17 /CINH + 18 /MTCR + 29 /LOCK + 30 AD8 (D0) + 32 AD9 (D1) + 34 AD10 (D2) + 36 AD11 (D3) + 38 AD12 (D4) + 39 AD13 (D5) + 40 Reserved + 41 AD14 (D6) + 42 Reserved + 43 AD15 (D7) + 44 Reserved + 45 AD16 (D8) + 47 AD17 (D9) + 48 /MTACK + 51 /DS0 + 52 AD18 (D10) + 54 AD19 (D11) + 56 AD20 (D12) + 57 AD22 (D14) + 58 AD21 (D13) + 59 AD23 (D15) + 63 AD31 + 65 AD30 + 67 AD29 + 69 AD28 + 70 /DS2 + 71 AD27 + 72 /DS3 + 74 /CCS + 75 SD0 (D16) + 76 AD26 + 77 SD1 (D17) + 78 AD25 + 79 SD2 (D18) + 80 AD24 + 81 SD3 (D19) + 82 SD7 (D23) + 83 SD4 (D20) + 84 SD6 (D22) + 86 SD5 (D21) + 91 Sense Z3 + 94 /IORST + 95 /BCLR + 97 /FCS + 98 /DS1 + + +***************************************************************************/ + +#pragma once + +#ifndef __ZORRO_H__ +#define __ZORRO_H__ + +#include "emu.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_ZORRO_SLOT_ADD(_zorrotag, _tag, _slot_intf, _def_slot) \ + MCFG_DEVICE_ADD(_tag, ZORRO_SLOT, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ + zorro_slot_device::set_zorro_slot(*device, owner, _zorrotag); + +// ======================> expansion slot + +#define MCFG_EXPANSION_SLOT_ADD(_cputag, _slot_intf, _def_slot) \ + MCFG_DEVICE_ADD("exp", EXP_SLOT, 0) \ + zorro_device::set_cputag(*device, _cputag); \ + MCFG_ZORRO_SLOT_ADD("exp", "slot", _slot_intf, _def_slot) + +// callbacks +#define MCFG_EXPANSION_SLOT_OVR_HANDLER(_devcb) \ + devcb = &zorro_device::set_ovr_handler(*device, DEVCB2_##_devcb); + +#define MCFG_EXPANSION_SLOT_INT2_HANDLER(_devcb) \ + devcb = &zorro_device::set_int2_handler(*device, DEVCB2_##_devcb); + +#define MCFG_EXPANSION_SLOT_INT6_HANDLER(_devcb) \ + devcb = &zorro_device::set_int6_handler(*device, DEVCB2_##_devcb); + +#define MCFG_EXPANSION_SLOT_IPL_HANDLER(_devcb) \ + devcb = &exp_slot_device::set_ipl_handler(*device, DEVCB2_##_devcb); + +// ======================> zorro 2 bus + +#define MCFG_ZORRO2_ADD(_cputag) \ + MCFG_DEVICE_ADD("zorrobus", ZORRO2, 0) \ + zorro_device::set_cputag(*device, _cputag); + +#define MCFG_ZORRO2_SLOT_ADD(_tag, _slot_intf, _def_slot) \ + MCFG_ZORRO_SLOT_ADD("zorrobus", _tag, _slot_intf, _def_slot) + +#define MCFG_ZORRO2_OVR_HANDLER(_devcb) \ + devcb = &zorro_device::set_ovr_handler(*device, DEVCB2_##_devcb); + +#define MCFG_ZORRO2_INT2_HANDLER(_devcb) \ + devcb = &zorro_device::set_int2_handler(*device, DEVCB2_##_devcb); + +#define MCFG_ZORRO2_INT6_HANDLER(_devcb) \ + devcb = &zorro_device::set_int6_handler(*device, DEVCB2_##_devcb); + +#define MCFG_ZORRO2_EINT1_HANDLER(_devcb) \ + devcb = &zorro2_device::set_eint1_handler(*device, DEVCB2_##_devcb); + +#define MCFG_ZORRO2_EINT4_HANDLER(_devcb) \ + devcb = &zorro2_device::set_eint4_handler(*device, DEVCB2_##_devcb); + +#define MCFG_ZORRO2_EINT5_HANDLER(_devcb) \ + devcb = &zorro2_device::set_eint5_handler(*device, DEVCB2_##_devcb); + +#define MCFG_ZORRO2_EINT7_HANDLER(_devcb) \ + devcb = &zorro2_device::set_eint7_handler(*device, DEVCB2_##_devcb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// forward declaration of card interfaces +class device_zorro_card_interface; +class device_exp_card_interface; +class device_zorro2_card_interface; + +// ======================> zorro slot device + +class zorro_slot_device : public device_t, public device_slot_interface +{ +public: + // construction/destruction + zorro_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + zorro_slot_device(const machine_config &mconfig, device_type type, const char *name, + const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + // device-level overrides + virtual void device_start(); + + // inline configuration + static void set_zorro_slot(device_t &device, device_t *owner, const char *zorro_tag); + +protected: + // configuration + const char *m_zorro_tag; +}; + +// device type definition +extern const device_type ZORRO_SLOT; + +// ======================> base zorro bus device + +class zorro_device : public device_t +{ +public: + // construction/destruction + zorro_device(const machine_config &mconfig, device_type type, const char *name, + const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + // static configuration helpers + static void set_cputag(device_t &device, const char *tag); + + template<class _Object> static devcb2_base &set_int2_handler(device_t &device, _Object object) + { return downcast<zorro_device &>(device).m_int2_handler.set_callback(object); } + template<class _Object> static devcb2_base &set_int6_handler(device_t &device, _Object object) + { return downcast<zorro_device &>(device).m_int6_handler.set_callback(object); } + template<class _Object> static devcb2_base &set_ovr_handler(device_t &device, _Object object) + { return downcast<zorro_device &>(device).m_ovr_handler.set_callback(object); } + + virtual void add_card(device_zorro_card_interface *card) = 0; + + // interface (from slot device) + virtual DECLARE_WRITE_LINE_MEMBER( cfgout_w ) {}; + + DECLARE_WRITE_LINE_MEMBER( int2_w ); + DECLARE_WRITE_LINE_MEMBER( int6_w ); + DECLARE_WRITE_LINE_MEMBER( ovr_w ); + + // interface (from host) + virtual void fc_w(int code) = 0; + + // access to the host space + address_space *m_space; + +protected: + // device-level overrides + virtual void device_start(); + +private: + const char *m_cputag; + + devcb2_write_line m_ovr_handler; + devcb2_write_line m_int2_handler; + devcb2_write_line m_int6_handler; +}; + +// ======================> expansion slot device + +class exp_slot_device : public zorro_device +{ +public: + // construction/destruction + exp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + exp_slot_device(const machine_config &mconfig, device_type type, const char *name, + const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + template<class _Object> static devcb2_base &set_ipl_handler(device_t &device, _Object object) + { return downcast<exp_slot_device &>(device).m_ipl_handler.set_callback(object); } + + // the expansion slot can only have a single card + virtual void add_card(device_zorro_card_interface *card); + + // interface (from slot device) + void ipl_w(int interrupt); + + // interface (from host) + virtual void fc_w(int code); + +protected: + // device-level overrides + virtual void device_start(); + +private: + devcb2_write8 m_ipl_handler; + + device_exp_card_interface *m_dev; +}; + +// device type definition +extern const device_type EXP_SLOT; + +// ======================> zorro2 slot device + +class zorro2_device : public zorro_device +{ +public: + // construction/destruction + zorro2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + zorro2_device(const machine_config &mconfig, device_type type, const char *name, + const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + template<class _Object> static devcb2_base &set_eint1_handler(device_t &device, _Object object) + { return downcast<zorro2_device &>(device).m_eint1_handler.set_callback(object); } + template<class _Object> static devcb2_base &set_eint4_handler(device_t &device, _Object object) + { return downcast<zorro2_device &>(device).m_eint4_handler.set_callback(object); } + template<class _Object> static devcb2_base &set_eint5_handler(device_t &device, _Object object) + { return downcast<zorro2_device &>(device).m_eint5_handler.set_callback(object); } + template<class _Object> static devcb2_base &set_eint7_handler(device_t &device, _Object object) + { return downcast<zorro2_device &>(device).m_eint7_handler.set_callback(object); } + + // device-level overrides + virtual void device_reset(); + + // the zorro2 bus supports multiple cards + virtual void add_card(device_zorro_card_interface *card); + + // interface (from slot device) + virtual DECLARE_WRITE_LINE_MEMBER( cfgout_w ); + + DECLARE_WRITE_LINE_MEMBER( eint1_w ); + DECLARE_WRITE_LINE_MEMBER( eint4_w ); + DECLARE_WRITE_LINE_MEMBER( eint5_w ); + DECLARE_WRITE_LINE_MEMBER( eint7_w ); + + // interface (from host) + virtual void fc_w(int code); + +protected: + // device-level overrides + virtual void device_start(); + +private: + devcb2_write_line m_eint1_handler; + devcb2_write_line m_eint4_handler; + devcb2_write_line m_eint5_handler; + devcb2_write_line m_eint7_handler; + + simple_list<device_zorro2_card_interface> m_dev; + + // the device which is currently configuring + device_zorro2_card_interface *m_autoconfig_device; +}; + +// device type definition +extern const device_type ZORRO2; + + +// ======================> base zorro card interface + +class device_zorro_card_interface : public device_slot_card_interface +{ +public: + // construction/destruction + device_zorro_card_interface(const machine_config &mconfig, device_t &device); + virtual ~device_zorro_card_interface(); + + virtual void set_zorro_device() = 0; + + void set_zorro_bus(zorro_device *device); + + // interface (from device) + void cfgout_w(int state) { m_zorro->cfgout_w(state); } + + // interface (from host) + virtual void fc_w(int code); + virtual DECLARE_WRITE_LINE_MEMBER( cfgin_w ); + +protected: + zorro_device *m_zorro; +}; + +// ======================> expansion slot card interface + +class device_exp_card_interface : public device_zorro_card_interface +{ +public: + // construction/destruction + device_exp_card_interface(const machine_config &mconfig, device_t &device); + virtual ~device_exp_card_interface(); + + virtual void set_zorro_device(); + +protected: + exp_slot_device *m_slot; +}; + +// ======================> zorro2 card interface + +class device_zorro2_card_interface : public device_zorro_card_interface +{ +public: + // construction/destruction + device_zorro2_card_interface(const machine_config &mconfig, device_t &device); + virtual ~device_zorro2_card_interface(); + + virtual void set_zorro_device(); + + device_zorro2_card_interface *next() const { return m_next; } + device_zorro2_card_interface *m_next; + +protected: + zorro2_device *m_slot; +}; + + +// include this here so that you don't need to include it into every +// driver that uses zorro slots +#include "cards.h" + + +#endif // __ZORRO_H__ diff --git a/src/emu/machine/6525tpi.c b/src/emu/machine/6525tpi.c index 2d83a49527b..4589ff23ea7 100644 --- a/src/emu/machine/6525tpi.c +++ b/src/emu/machine/6525tpi.c @@ -535,6 +535,12 @@ WRITE8_MEMBER( tpi6525_device::write ) } } +void tpi6525_device::port_line_w(UINT8 &port, int line, int state) +{ + port &= ~(1 << line); + port |= state << line; +} + /* this should probably be done better, needed for amigacd.c */ UINT8 tpi6525_device::get_ddr_a() diff --git a/src/emu/machine/6525tpi.h b/src/emu/machine/6525tpi.h index 6132fa45c18..a6bcea1f3c1 100644 --- a/src/emu/machine/6525tpi.h +++ b/src/emu/machine/6525tpi.h @@ -66,6 +66,15 @@ public: DECLARE_WRITE8_MEMBER( pb_w ); DECLARE_WRITE8_MEMBER( pc_w ); + WRITE_LINE_MEMBER( pb0_w ) { port_line_w(m_in_b, 0, state); } + WRITE_LINE_MEMBER( pb1_w ) { port_line_w(m_in_b, 1, state); } + WRITE_LINE_MEMBER( pb2_w ) { port_line_w(m_in_b, 2, state); } + WRITE_LINE_MEMBER( pb3_w ) { port_line_w(m_in_b, 3, state); } + WRITE_LINE_MEMBER( pb4_w ) { port_line_w(m_in_b, 4, state); } + WRITE_LINE_MEMBER( pb5_w ) { port_line_w(m_in_b, 5, state); } + WRITE_LINE_MEMBER( pb6_w ) { port_line_w(m_in_b, 6, state); } + WRITE_LINE_MEMBER( pb7_w ) { port_line_w(m_in_b, 7, state); } + UINT8 get_ddr_a(); UINT8 get_ddr_b(); UINT8 get_ddr_c(); @@ -104,6 +113,9 @@ private: void set_interrupt(); void clear_interrupt(); + + // helper function to write a single line + static void port_line_w(UINT8 &port, int line, int state); }; extern const device_type TPI6525; diff --git a/src/mame/machine/cd32.c b/src/emu/machine/akiko.c index 8061ff64522..c9eb0a30114 100644 --- a/src/mame/machine/cd32.c +++ b/src/emu/machine/akiko.c @@ -1,32 +1,58 @@ -#include "emu.h" -#include "cdrom.h" -#include "coreutil.h" -#include "sound/cdda.h" -#include "imagedev/chd_cd.h" -#include "includes/cd32.h" +/*************************************************************************** + + Akiko + ASIC used in the Amiga CD32. Commodore Part number 391563-01. -/********************************************************************************* + - CD-ROM controller + - Builtin 1KB NVRAM + - Chunky to planar converter + - 2x CIA chips - Akiko custom chip emulation +***************************************************************************/ -The Akiko chip has: -- built in 1KB NVRAM -- chunky to planar converter -- custom CDROM controller +#include "akiko.h" +#include "includes/amiga.h" +#include "imagedev/chd_cd.h" +#include "coreutil.h" -TODO: Add CDDA support -*********************************************************************************/ +//************************************************************************** +// CONSTANTS / MACROS +//************************************************************************** #define LOG_AKIKO 0 #define LOG_AKIKO_CD 0 -#define CD_SECTOR_TIME (1000/((150*1024)/2048)) /* 1X CDROM sector time in msec (300KBps) */ +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** const device_type AKIKO = &device_creator<akiko_device>; +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( akiko ) +MACHINE_CONFIG_END + +machine_config_constructor akiko_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( akiko ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// akiko_device - constructor +//------------------------------------------------- + akiko_device::akiko_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, AKIKO, "CBM AKIKO", tag, owner, clock, "akiko", __FILE__), m_c2p_input_index(0), @@ -52,8 +78,10 @@ akiko_device::akiko_device(const machine_config &mconfig, const char *tag, devic m_cdrom_toc(NULL), m_dma_timer(NULL), m_frame_timer(NULL), - m_i2cmem(NULL), - m_cdrom_is_device(0) + m_cdrom_is_device(0), + m_scl_w(*this), + m_sda_r(*this), + m_sda_w(*this) { for (int i = 0; i < 8; i++) { @@ -68,22 +96,29 @@ akiko_device::akiko_device(const machine_config &mconfig, const char *tag, devic } } + //------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete +// set_cputag - set cpu tag for cpu we working on //------------------------------------------------- -void akiko_device::device_config_complete() +void akiko_device::set_cputag(device_t &device, const char *tag) { + akiko_device &akiko = downcast<akiko_device &>(device); + akiko.m_cputag = tag; } + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- void akiko_device::device_start() { + // resolve callbacks + m_scl_w.resolve_safe(); + m_sda_r.resolve_safe(1); + m_sda_w.resolve_safe(); + m_c2p_input_index = 0; m_c2p_output_index = 0; @@ -107,10 +142,12 @@ void akiko_device::device_start() m_cdrom_cmd_end = 0; m_cdrom_cmd_resp = 0; + device_t *cpu = machine().device(m_cputag); + m_space = &cpu->memory().space(AS_PROGRAM); + m_cdrom_toc = NULL; m_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(akiko_device::dma_proc), this)); m_frame_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(akiko_device::frame_proc), this)); - m_i2cmem = machine().device<i2cmem_device>("i2cmem"); m_cdda = machine().device<cdda_device>("cdda"); } @@ -120,11 +157,9 @@ void akiko_device::device_start() void akiko_device::device_reset() { - amiga_state *amiga = machine().driver_data<amiga_state>(); - m_space = amiga->m_maincpu_program_space; - cdrom_image_device *cddevice = machine().device<cdrom_image_device>("cdrom"); - if (cddevice!=NULL) + + if (cddevice != NULL) { // MESS case m_cdrom = cddevice->get_cdrom_file(); @@ -137,7 +172,6 @@ void akiko_device::device_reset() m_cdrom_is_device = 0; } - /* create the TOC table */ if ( m_cdrom != NULL && cdrom_get_last_track(m_cdrom) ) { @@ -207,36 +241,26 @@ void akiko_device::device_stop() void akiko_device::nvram_write(UINT32 data) { - m_i2c_scl_out = BIT(data,31); - m_i2c_sda_out = BIT(data,30); - m_i2c_scl_dir = BIT(data,15); - m_i2c_sda_dir = BIT(data,14); + m_i2c_scl_out = BIT(data, 31); + m_i2c_sda_out = BIT(data, 30); + m_i2c_scl_dir = BIT(data, 15); + m_i2c_sda_dir = BIT(data, 14); - m_i2cmem->write_scl( m_i2c_scl_out ); - m_i2cmem->write_sda( m_i2c_sda_out ); + m_scl_w(m_i2c_scl_out); + m_sda_w(m_i2c_sda_out); } UINT32 akiko_device::nvram_read() { - UINT32 v = 0; + UINT32 v = 0; - if ( m_i2c_scl_dir ) - { + if (m_i2c_scl_dir) v |= m_i2c_scl_out << 31; - } - else - { - v |= 0 << 31; - } - if ( m_i2c_sda_dir ) - { + if (m_i2c_sda_dir) v |= m_i2c_sda_out << 30; - } else - { - v |= m_i2cmem->read_sda() << 30; - } + v |= m_sda_r() << 30; v |= m_i2c_scl_dir << 15; v |= m_i2c_sda_dir << 14; @@ -393,8 +417,10 @@ void akiko_device::set_cd_status(UINT32 status) if ( m_cdrom_status[0] & m_cdrom_status[1] ) { - if (LOG_AKIKO_CD) logerror( "Akiko CD IRQ\n" ); - amiga->amiga_custom_w(*m_space, REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff); + if (LOG_AKIKO_CD) + logerror("Akiko CD IRQ\n"); + + amiga->custom_chip_w(REG_INTREQ, INTENA_SETCLR | INTENA_PORTS); } } diff --git a/src/emu/machine/akiko.h b/src/emu/machine/akiko.h new file mode 100644 index 00000000000..47fa22fee19 --- /dev/null +++ b/src/emu/machine/akiko.h @@ -0,0 +1,153 @@ +/*************************************************************************** + + Akiko + + Used in the Amiga CD32 + + - CD-ROM controller + - Builtin 1KB NVRAM + - Chunky to planar converter + +***************************************************************************/ + +#pragma once + +#ifndef __AKIKO_H__ +#define __AKIKO_H__ + +#include "emu.h" +#include "cdrom.h" +#include "sound/cdda.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_AKIKO_ADD(_tag, _cputag) \ + MCFG_DEVICE_ADD(_tag, AKIKO, 0) \ + akiko_device::set_cputag(*device, _cputag); + +#define MCFG_AKIKO_SCL_HANDLER(_devcb) \ + devcb = &akiko_device::set_scl_handler(*device, DEVCB2_##_devcb); + +#define MCFG_AKIKO_SDA_READ_HANDLER(_devcb) \ + devcb = &akiko_device::set_sda_read_handler(*device, DEVCB2_##_devcb); + +#define MCFG_AKIKO_SDA_WRITE_HANDLER(_devcb) \ + devcb = &akiko_device::set_sda_write_handler(*device, DEVCB2_##_devcb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> akiko_device + +class akiko_device : public device_t +{ +public: + akiko_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~akiko_device() {} + + // callbacks + template<class _Object> static devcb2_base &set_scl_handler(device_t &device, _Object object) + { return downcast<akiko_device &>(device).m_scl_w.set_callback(object); } + + template<class _Object> static devcb2_base &set_sda_read_handler(device_t &device, _Object object) + { return downcast<akiko_device &>(device).m_sda_r.set_callback(object); } + + template<class _Object> static devcb2_base &set_sda_write_handler(device_t &device, _Object object) + { return downcast<akiko_device &>(device).m_sda_w.set_callback(object); } + + DECLARE_READ32_MEMBER( read ); + DECLARE_WRITE32_MEMBER( write ); + + // inline configuration + static void set_cputag(device_t &device, const char *tag); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; + +private: + // 1X CDROM sector time in msec (300KBps) + static const int CD_SECTOR_TIME = (1000/((150*1024)/2048)); + + // internal state + address_space *m_space; + + // chunky to planar converter + UINT32 m_c2p_input_buffer[8]; + UINT32 m_c2p_output_buffer[8]; + UINT32 m_c2p_input_index; + UINT32 m_c2p_output_index; + + // i2c bus + int m_i2c_scl_out; + int m_i2c_scl_dir; + int m_i2c_sda_out; + int m_i2c_sda_dir; + + // cdrom + UINT32 m_cdrom_status[2]; + UINT32 m_cdrom_address[2]; + UINT32 m_cdrom_track_index; + UINT32 m_cdrom_lba_start; + UINT32 m_cdrom_lba_end; + UINT32 m_cdrom_lba_cur; + UINT16 m_cdrom_readmask; + UINT16 m_cdrom_readreqmask; + UINT32 m_cdrom_dmacontrol; + UINT32 m_cdrom_numtracks; + UINT8 m_cdrom_speed; + UINT8 m_cdrom_cmd_start; + UINT8 m_cdrom_cmd_end; + UINT8 m_cdrom_cmd_resp; + + cdda_device *m_cdda; + cdrom_file *m_cdrom; + + UINT8 *m_cdrom_toc; + + emu_timer *m_dma_timer; + emu_timer *m_frame_timer; + + int m_cdrom_is_device; + + void nvram_write(UINT32 data); + UINT32 nvram_read(); + + void c2p_write(UINT32 data); + UINT32 c2p_read(); + + void cdda_stop(); + void cdda_play(UINT32 lba, UINT32 num_blocks); + void cdda_pause(int pause); + UINT8 cdda_getstatus(UINT32 *lba); + void set_cd_status(UINT32 status); + + TIMER_CALLBACK_MEMBER( frame_proc ); + TIMER_CALLBACK_MEMBER( dma_proc ); + + void start_dma(); + void setup_response( int len, UINT8 *r1 ); + + TIMER_CALLBACK_MEMBER( cd_delayed_cmd ); + void update_cdrom(); + + // i2c interface + devcb2_write_line m_scl_w; + devcb2_read_line m_sda_r; + devcb2_write_line m_sda_w; + + const char *m_cputag; +}; + +// device type definition +extern const device_type AKIKO; + +#endif diff --git a/src/emu/machine/amigafdc.c b/src/emu/machine/amigafdc.c index 2349a3b7ce0..334c2032a11 100644 --- a/src/emu/machine/amigafdc.c +++ b/src/emu/machine/amigafdc.c @@ -63,8 +63,7 @@ void amiga_fdc::dma_done() { amiga_state *state = machine().driver_data<amiga_state>(); dma_state = DMA_IDLE; - address_space &space = *state->m_maincpu_program_space; - state->amiga_custom_w(space, REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0xffff); + state->custom_chip_w(REG_INTREQ, INTENA_SETCLR | INTENA_DSKBLK); } void amiga_fdc::dma_write(UINT16 value) @@ -202,8 +201,7 @@ void amiga_fdc::live_run(attotime limit) cur_live.bit_counter = 0; } dskbyt |= 0x1000; - address_space &space = *state->m_maincpu_program_space; - state->amiga_custom_w(space, REG_INTREQ, 0x8000 | INTENA_DSKSYN, 0xffff); + state->custom_chip_w(REG_INTREQ, INTENA_SETCLR | INTENA_DSKSYN); } else dskbyt &= ~0x1000; @@ -412,6 +410,7 @@ UINT8 amiga_fdc::ciaapra_r() if(!floppy->dskchg_r()) ret &= ~0x04; } + return ret; } diff --git a/src/emu/machine/autoconfig.c b/src/emu/machine/autoconfig.c new file mode 100644 index 00000000000..3c93efa6cff --- /dev/null +++ b/src/emu/machine/autoconfig.c @@ -0,0 +1,167 @@ +/*************************************************************************** + + Amiga Autoconfig + +***************************************************************************/ + +#include "autoconfig.h" + + +//************************************************************************** +// CONSTANTS & MACROS +//************************************************************************** + +#define VERBOSE 1 + + +//************************************************************************** +// CONSTRUCTOR +//************************************************************************** + +amiga_autoconfig::amiga_autoconfig() +{ + memset(m_cfg, 0xff, sizeof(m_cfg)); + + // interrupt status register, not inverted + m_cfg[0x20] = 0; + m_cfg[0x21] = 0; +} + +amiga_autoconfig::~amiga_autoconfig() +{ +} + + +//************************************************************************** +// AUTOCONFIG INFO SETTERS +//************************************************************************** + +void amiga_autoconfig::autoconfig_board_type(board_type type) +{ + m_cfg[0x00] &= 0x3000; + m_cfg[0x00] |= (type << 2) << 12; +} + +void amiga_autoconfig::autoconfig_board_size(board_size size) +{ + m_cfg[0x01] &= 0x8000; + m_cfg[0x01] |= (size << 0) << 12; +} + +void amiga_autoconfig::autoconfig_rom_vector_valid(bool state) +{ + m_cfg[0x00] &= 0xe000; + m_cfg[0x00] |= (state ? 0x01 : 0x00) << 12; +} + +void amiga_autoconfig::autoconfig_link_into_memory(bool state) +{ + m_cfg[0x00] &= 0xd000; + m_cfg[0x00] |= (state ? 0x02 : 0x00) << 12; +} + +void amiga_autoconfig::autoconfig_multi_device(bool state) +{ + m_cfg[0x01] &= 0x7000; + m_cfg[0x01] |= (state ? 0x08 : 0x00) << 12; +} + +void amiga_autoconfig::autoconfig_8meg_preferred(bool state) +{ + m_cfg[0x04] &= 0x7000; + m_cfg[0x04] |= (state ? 0x08 : 0x00) << 12; +} + +void amiga_autoconfig::autoconfig_can_shutup(bool state) +{ + m_cfg[0x04] &= 0xb000; + m_cfg[0x04] |= (state ? 0x04 : 0x00) << 12; +} + +void amiga_autoconfig::autoconfig_product(UINT8 data) +{ + m_cfg[0x02] = ~((data & 0xf0) >> 4) << 12; + m_cfg[0x03] = ~((data & 0x0f) >> 0) << 12; +} + +void amiga_autoconfig::autoconfig_manufacturer(UINT16 data) +{ + m_cfg[0x08] = ~((data & 0xf000) >> 12) << 12; + m_cfg[0x09] = ~((data & 0x0f00) >> 8) << 12; + m_cfg[0x0a] = ~((data & 0x00f0) >> 4) << 12; + m_cfg[0x0b] = ~((data & 0x000f) >> 0) << 12; +} + +void amiga_autoconfig::autoconfig_serial(UINT32 data) +{ + m_cfg[0x0c] = ~((data & 0xf0000000) >> 28) << 12; + m_cfg[0x0d] = ~((data & 0x0f000000) >> 24) << 12; + m_cfg[0x0e] = ~((data & 0x00f00000) >> 20) << 12; + m_cfg[0x0f] = ~((data & 0x000f0000) >> 16) << 12; + m_cfg[0x10] = ~((data & 0x0000f000) >> 12) << 12; + m_cfg[0x11] = ~((data & 0x00000f00) >> 8) << 12; + m_cfg[0x12] = ~((data & 0x000000f0) >> 4) << 12; + m_cfg[0x13] = ~((data & 0x0000000f) >> 0) << 12; +} + +void amiga_autoconfig::autoconfig_rom_vector(UINT16 data) +{ + m_cfg[0x14] = ~((data & 0xf000) >> 12) << 12; + m_cfg[0x15] = ~((data & 0x0f00) >> 8) << 12; + m_cfg[0x16] = ~((data & 0x00f0) >> 4) << 12; + m_cfg[0x17] = ~((data & 0x000f) >> 0) << 12; +} + + +//************************************************************************** +// MEMORY INTERFACE +//************************************************************************** + +READ16_MEMBER( amiga_autoconfig::autoconfig_read ) +{ + UINT16 data = m_cfg[offset] | 0x0fff; + + if (VERBOSE && !space.debugger_access()) + logerror("autoconfig_read %04x @ %02x [mask = %04x]\n", data, offset, mem_mask); + + return data; +} + +WRITE16_MEMBER( amiga_autoconfig::autoconfig_write ) +{ + if (VERBOSE && !space.debugger_access()) + logerror("autoconfig_write %04x @ %02x [mask = %04x]\n", data, offset, mem_mask); + + switch (offset) + { + case 0x20: + // user-definable + break; + + case 0x21: + // bit 0 = interrupt enable + // bit 1 = user-definable + // bit 2 = local reset + // bit 3 = user-definable + break; + + case 0x24: + // base address register + m_cfg[0x24] = data & 0xf000; + autoconfig_base_address((m_cfg[0x24] << 8) | (m_cfg[0x25] << 4)); + break; + + case 0x25: + // latch low-nibble + m_cfg[0x25] = data & 0xf000; + break; + + case 0x26: + // shut-up register + autoconfig_base_address(0); + break; + + case 0x27: + break; + } +} diff --git a/src/emu/machine/autoconfig.h b/src/emu/machine/autoconfig.h new file mode 100644 index 00000000000..5183f474af9 --- /dev/null +++ b/src/emu/machine/autoconfig.h @@ -0,0 +1,72 @@ +/*************************************************************************** + + Amiga Autoconfig + +***************************************************************************/ + +#pragma once + +#ifndef __AUTOCONFIG_H__ +#define __AUTOCONFIG_H__ + +#include "emu.h" + +class amiga_autoconfig +{ +public: + amiga_autoconfig(); + virtual ~amiga_autoconfig(); + + // read from autoconfig space + DECLARE_READ16_MEMBER( autoconfig_read ); + + // write to autoconfig space + DECLARE_WRITE16_MEMBER( autoconfig_write ); + +protected: + enum board_type + { + BOARD_TYPE_ZORRO3 = 2, + BOARD_TYPE_ZORRO2 = 3 + }; + + enum board_size + { + BOARD_SIZE_8M = 0, + BOARD_SIZE_64K = 1, + BOARD_SIZE_128K = 2, + BOARD_SIZE_256K = 3, + BOARD_SIZE_512K = 4, + BOARD_SIZE_1M = 5, + BOARD_SIZE_2M = 6, + BOARD_SIZE_4M = 7 + }; + + // board type & size + void autoconfig_board_type(board_type type); + void autoconfig_board_size(board_size size); + + // various flags + void autoconfig_rom_vector_valid(bool state); + void autoconfig_link_into_memory(bool state); + void autoconfig_multi_device(bool state); + void autoconfig_8meg_preferred(bool state); + void autoconfig_can_shutup(bool state); + + // product number, manufacturer number, serial number + void autoconfig_product(UINT8 data); + void autoconfig_manufacturer(UINT16 data); + void autoconfig_serial(UINT32 data); + + // rom vector + void autoconfig_rom_vector(UINT16 data); + + // called once we have received a valid base address from the host system + virtual void autoconfig_base_address(offs_t address) = 0; + +private: + // configuration information about our autoconfig board, 256 nibbles + UINT16 m_cfg[0x40]; +}; + +#endif // __AUTOCONFIG_H__ diff --git a/src/emu/machine/cr511b.c b/src/emu/machine/cr511b.c new file mode 100644 index 00000000000..0a4ee90bf80 --- /dev/null +++ b/src/emu/machine/cr511b.c @@ -0,0 +1,123 @@ +/*************************************************************************** + + CR-511-B CD-ROM drive + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + CD-ROM drive with a custom MKE/Panasonic interface as used in the + Commodore CDTV and early SoundBlaster cards. + +***************************************************************************/ + +#include "cr511b.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type CR511B = &device_creator<cr511b_device>; + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( cr511b ) + MCFG_CDROM_ADD("cdrom") + MCFG_CDROM_INTERFACE("cdrom") + MCFG_SOUND_ADD("cdda", CDDA, 0) + MCFG_SOUND_ROUTE(0, ":lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, ":rspeaker", 1.0) +MACHINE_CONFIG_END + +machine_config_constructor cr511b_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( cr511b ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// cr511b_device - constructor +//------------------------------------------------- + +cr511b_device::cr511b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, CR511B, "CR-511-B CD-ROM drive", tag, owner, clock, "cr511b", __FILE__), + m_cdrom(*this, "cdrom"), + m_cdda(*this, "cdda"), + m_stch_handler(*this), + m_sten_handler(*this), + m_drq_handler(*this), + m_dten_handler(*this), + m_scor_handler(*this), + m_xaen_handler(*this), + m_frame_timer(NULL), + m_motor(false), + m_enabled(-1), + m_cmd(-1) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cr511b_device::device_start() +{ + // resolve callbacks + m_stch_handler.resolve_safe(); + m_sten_handler.resolve_safe(); + m_drq_handler.resolve_safe(); + m_dten_handler.resolve_safe(); + m_scor_handler.resolve_safe(); + m_xaen_handler.resolve_safe(); + + m_frame_timer = timer_alloc(0, NULL); + m_frame_timer->adjust(attotime::never); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void cr511b_device::device_reset() +{ +} + +//------------------------------------------------- +// device_timer - device-specific timer events +//------------------------------------------------- + +void cr511b_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +READ8_MEMBER( cr511b_device::read ) +{ + return 0xff; +} + +WRITE8_MEMBER ( cr511b_device::write ) +{ + +} + +WRITE_LINE_MEMBER( cr511b_device::enable_w ) +{ + m_enabled = state; +} + +WRITE_LINE_MEMBER( cr511b_device::cmd_w ) +{ + m_cmd = state; +} diff --git a/src/emu/machine/cr511b.h b/src/emu/machine/cr511b.h new file mode 100644 index 00000000000..5def8947fc9 --- /dev/null +++ b/src/emu/machine/cr511b.h @@ -0,0 +1,152 @@ +/*************************************************************************** + + CR-511-B CD-ROM drive + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + CD-ROM drive with a custom MKE/Panasonic interface as used in the + Commodore CDTV and early SoundBlaster cards. + + 1 _RESET 2 GND + 3 EFFK 4 SCCK + 5 SBCP 6 SCOR + 7 GND 8 GND + 9 C16M 10 GND + 11 _XAEN 12 GND + 13 EMPASIS 14 D0 + 15 LRCK 16 DSCK + 17 _MUTE 18 GND + 19 _BUSY 20 _STCH + 21 _ENABLE 22 DRQ + 23 _HWR 24 GND + 25 _DTEN 26 _HRD + 27 _STEN 28 _CMD + 29 _EOP 30 GND + 31 DB7 32 GND + 33 DB6 34 DB5 + 35 DB4 36 GND + 37 DB3 38 DB2 + 39 DB1 40 DB0 + +***************************************************************************/ + +#pragma once + +#ifndef __CR511B_H__ +#define __CR511B_H__ + +#include "emu.h" +#include "imagedev/chd_cd.h" +#include "sound/cdda.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_CR511B_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, CR511B, 0) \ + +#define MCFG_CR511B_STCH_HANDLER(_devcb) \ + devcb = &cr511b_device::set_stch_handler(*device, DEVCB2_##_devcb); + +#define MCFG_CR511B_STEN_HANDLER(_devcb) \ + devcb = &cr511b_device::set_sten_handler(*device, DEVCB2_##_devcb); + +#define MCFG_CR511B_DRQ_HANDLER(_devcb) \ + devcb = &cr511b_device::set_drq_handler(*device, DEVCB2_##_devcb); + +#define MCFG_CR511B_DTEN_HANDLER(_devcb) \ + devcb = &cr511b_device::set_dten_handler(*device, DEVCB2_##_devcb); + +#define MCFG_CR511B_SCOR_HANDLER(_devcb) \ + devcb = &cr511b_device::set_scor_handler(*device, DEVCB2_##_devcb); + +#define MCFG_CR511B_XAEN_HANDLER(_devcb) \ + devcb = &cr511b_device::set_xaen_handler(*device, DEVCB2_##_devcb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> cr511b_device + +class cr511b_device : public device_t +{ +public: + // construction/destruction + cr511b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // callbacks + template<class _Object> static devcb2_base &set_stch_handler(device_t &device, _Object object) + { return downcast<cr511b_device &>(device).m_stch_handler.set_callback(object); } + + template<class _Object> static devcb2_base &set_sten_handler(device_t &device, _Object object) + { return downcast<cr511b_device &>(device).m_sten_handler.set_callback(object); } + + template<class _Object> static devcb2_base &set_drq_handler(device_t &device, _Object object) + { return downcast<cr511b_device &>(device).m_drq_handler.set_callback(object); } + + template<class _Object> static devcb2_base &set_dten_handler(device_t &device, _Object object) + { return downcast<cr511b_device &>(device).m_dten_handler.set_callback(object); } + + template<class _Object> static devcb2_base &set_scor_handler(device_t &device, _Object object) + { return downcast<cr511b_device &>(device).m_scor_handler.set_callback(object); } + + template<class _Object> static devcb2_base &set_xaen_handler(device_t &device, _Object object) + { return downcast<cr511b_device &>(device).m_xaen_handler.set_callback(object); } + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER ( write ); + + DECLARE_WRITE_LINE_MEMBER( enable_w ); + DECLARE_WRITE_LINE_MEMBER( cmd_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + enum + { + STATUS_DOOR_CLOSED = 0x80, + STATUS_MEDIA = 0x40, + STATUS_MOTOR = 0x20, + STATUS_ERROR = 0x10, + STATUS_SUCCESS = 0x08, + STATUS_PLAYING = 0x04, + STATUS_DOOR_LOCKED = 0x02, + STATUS_READY = 0x01 + }; + + required_device<cdrom_image_device> m_cdrom; + required_device<cdda_device> m_cdda; + + devcb2_write_line m_stch_handler; + devcb2_write_line m_sten_handler; + devcb2_write_line m_drq_handler; + devcb2_write_line m_dten_handler; + devcb2_write_line m_scor_handler; + devcb2_write_line m_xaen_handler; + + emu_timer *m_frame_timer; + + bool m_motor; + + // state of lines + int m_enabled; + int m_cmd; + + // data transfer + UINT8 m_sector_buffer[CD_MAX_SECTOR_DATA]; +}; + +// device type definition +extern const device_type CR511B; + +#endif diff --git a/src/emu/machine/dmac.c b/src/emu/machine/dmac.c new file mode 100644 index 00000000000..7f2f674a793 --- /dev/null +++ b/src/emu/machine/dmac.c @@ -0,0 +1,467 @@ +/*************************************************************************** + + DMAC + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + 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) + +***************************************************************************/ + +#include "dmac.h" + + +//************************************************************************** +// CONSTANTS / MACROS +//************************************************************************** + +#define VERBOSE 1 + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type DMAC = &device_creator<dmac_device>; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// dmac_device - constructor +//------------------------------------------------- + +dmac_device::dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, DMAC, "DMAC DMA Controller", tag, owner, clock, "dmac", __FILE__), + amiga_autoconfig(), + m_cfgout_handler(*this), + m_int_handler(*this), + m_xdack_handler(*this), + m_scsi_read_handler(*this), + m_scsi_write_handler(*this), + m_io_read_handler(*this), + m_io_write_handler(*this), + m_space(NULL), + m_rom(NULL), + m_ram(NULL), + 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) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void dmac_device::device_start() +{ + // resolve callbacks + m_cfgout_handler.resolve_safe(); + m_int_handler.resolve_safe(); + m_xdack_handler.resolve_safe(); + m_scsi_read_handler.resolve_safe(0); + m_scsi_write_handler.resolve_safe(); + m_io_read_handler.resolve_safe(0); + m_io_write_handler.resolve_safe(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void dmac_device::device_reset() +{ + // fifo empty + m_istr |= ISTR_FE_FLG; +} + +void dmac_device::autoconfig_base_address(offs_t address) +{ + if (VERBOSE) + logerror("%s('%s'): autoconfig_base_address received: 0x%06x\n", shortname(), basetag(), address); + + if (!m_configured && m_ram_size > 0) + { + if (VERBOSE) + logerror("-> 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); + + // first device configured + m_configured = true; + } + else + { + if (VERBOSE) + logerror("-> installing dmac\n"); + + // internal dmac registers + m_space->install_readwrite_handler(address, address + 0xff, + read16_delegate(FUNC(dmac_device::register_read), this), + write16_delegate(FUNC(dmac_device::register_write), this), 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); + } + + // stop responding to autoconfig + m_space->unmap_readwrite(0xe80000, 0xe8007f); + + // we're done + m_cfgout_handler(0); + } +} + +void dmac_device::check_interrupts() +{ + // interrupts enabled? + if (m_cntr & CNTR_INTEN) + { + // any interrupts pending? + if (m_istr & ISTR_INT_MASK) + m_istr |= ISTR_INT_P; + } + else + m_istr &= ~ISTR_INT_P; + + // finally update interrupt line + m_int_handler((m_istr & ISTR_INT_P) ? 1 : 0); +} + +void dmac_device::stop_dma() +{ + m_dma_active = false; + m_istr &= ~ISTR_E_INT; + check_interrupts(); +} + +void dmac_device::start_dma() +{ + m_dma_active = true; +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +READ16_MEMBER( dmac_device::register_read ) +{ + UINT16 data = 0xffff; + + // autoconfig handles this + if (offset < 0x20) + return autoconfig_read(space, offset, mem_mask); + + switch (offset) + { + case 0x20: + data = m_istr; + + // reading clears fifo status (?) + m_istr &= ~0x0f; + check_interrupts(); + + if (VERBOSE) + logerror("%s('%s'): read istr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + break; + + case 0x21: + data = m_cntr; + + if (VERBOSE) + logerror("%s('%s'): read cntr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + break; + + case 0x48: + case 0x49: + case 0x50: + case 0x58: + case 0x59: + case 0x5a: + case 0x5b: + case 0x5c: + case 0x5e: + case 0x5f: + data = m_scsi_read_handler(offset); + + if (VERBOSE) + logerror("%s('%s'): read scsi data @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask); + + break; + + case 0x70: + if (VERBOSE) + logerror("%s('%s'): read dma start strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + start_dma(); + break; + + case 0x71: + if (VERBOSE) + logerror("%s('%s'): read dma stop strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + stop_dma(); + break; + + case 0x72: + if (VERBOSE) + logerror("%s('%s'): read clear irq strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + // clear all interrupts + m_istr &= ~ISTR_INT_MASK; + check_interrupts(); + break; + + case 0x74: + if (VERBOSE) + logerror("%s('%s'): read flush fifo strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + m_istr |= ISTR_FE_FLG; + break; + + default: + if (VERBOSE) + logerror("%s('%s'): register_read %04x @ %02x [mask = %04x]\n", shortname(), basetag(), data, offset, mem_mask); + } + + return data; +} + +WRITE16_MEMBER( dmac_device::register_write ) +{ + switch (offset) + { + case 0x21: + if (VERBOSE) + logerror("%s('%s'): write cntr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + m_cntr = data; + check_interrupts(); + break; + + case 0x40: + if (VERBOSE) + logerror("%s('%s'): write wtc hi %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + m_wtc &= 0x0000ffff; + m_wtc |= ((UINT32) data) << 16; + break; + + case 0x41: + if (VERBOSE) + logerror("%s('%s'): write wtc lo %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + m_wtc &= 0xffff0000; + m_wtc |= data; + break; + + case 0x42: + if (VERBOSE) + logerror("%s('%s'): write acr hi %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + m_acr &= 0x0000ffff; + m_acr |= ((UINT32) data) << 16; + break; + + case 0x43: + if (VERBOSE) + logerror("%s('%s'): write acr lo %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + m_acr &= 0xffff0000; + m_acr |= data; + break; + + case 0x47: + if (VERBOSE) + logerror("%s('%s'): write dawr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + break; + + case 0x48: + case 0x49: + case 0x50: + case 0x58: + case 0x59: + case 0x5a: + case 0x5b: + case 0x5c: + case 0x5e: + case 0x5f: + if (VERBOSE) + logerror("%s('%s'): write scsi data @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask); + + m_scsi_write_handler(offset, data, 0xff); + break; + + case 0x70: + if (VERBOSE) + logerror("%s('%s'): write dma start strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + start_dma(); + break; + + case 0x71: + if (VERBOSE) + logerror("%s('%s'): write dma stop strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + stop_dma(); + break; + + case 0x72: + if (VERBOSE) + logerror("%s('%s'): write clear irq strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + // clear all interrupts + m_istr &= ~ISTR_INT_MASK; + check_interrupts(); + break; + + case 0x74: + if (VERBOSE) + logerror("%s('%s'): write flush fifo strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); + + m_istr |= ISTR_FE_FLG; + break; + + default: + if (VERBOSE) + logerror("%s('%s'): write %04x @ %02x [mask = %04x]\n", shortname(), basetag(), data, offset, mem_mask); + } +} + +// this signal tells us to expose our autoconfig values +WRITE_LINE_MEMBER( dmac_device::configin_w ) +{ + if (VERBOSE) + logerror("%s('%s'): configin_w (%d)\n", shortname(), basetag(), state); + + if (state == 0 && !m_configured) + { + // common autoconfig values + autoconfig_board_type(BOARD_TYPE_ZORRO2); + autoconfig_manufacturer(0x0202); + autoconfig_serial(0x00000000); + autoconfig_8meg_preferred(false); + autoconfig_can_shutup(true); + + // if we have ram, configure it first + if (m_ram_size > 0) + { + // product id 10 + autoconfig_product(0x0a); + + // 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; + } + + // no rom and link into free memory + autoconfig_rom_vector_valid(false); + autoconfig_link_into_memory(true); + + // the main device follows + autoconfig_multi_device(true); + } + else + { + // 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); + } + + // install autoconfig handler + m_space->install_readwrite_handler(0xe80000, 0xe8007f, + read16_delegate(FUNC(amiga_autoconfig::autoconfig_read), static_cast<amiga_autoconfig *>(this)), + write16_delegate(FUNC(amiga_autoconfig::autoconfig_write), static_cast<amiga_autoconfig *>(this)), 0xffff); + } +} + +// this sets the ram size depending on the line voltage +WRITE_LINE_MEMBER( dmac_device::ramsz_w ) +{ + if (VERBOSE) + logerror("%s('%s'): ramsz_w (%d)\n", shortname(), basetag(), state); + + 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; + } +} + +// reset the device +WRITE_LINE_MEMBER( dmac_device::rst_w ) +{ + if (VERBOSE) + logerror("%s('%s'): rst_w (%d)\n", shortname(), basetag(), state); + + if (m_rst == 1 && state == 0) + device_reset(); + + m_rst = state; +} + +// external interrupt +WRITE_LINE_MEMBER( dmac_device::intx_w ) +{ + if (VERBOSE) + logerror("%s('%s'): intx_w (%d)\n", shortname(), basetag(), state); + + if (state) + m_istr |= ISTR_INTS; + else + m_istr &= ~ISTR_INTS; + + check_interrupts(); +} + +// data request +WRITE_LINE_MEMBER( dmac_device::xdreq_w ) +{ + if (VERBOSE) + logerror("%s('%s'): xdreq_w (%d)\n", shortname(), basetag(), state); + + if (m_dma_active) + { + + } +} diff --git a/src/emu/machine/dmac.h b/src/emu/machine/dmac.h new file mode 100644 index 00000000000..ce3849d9ea5 --- /dev/null +++ b/src/emu/machine/dmac.h @@ -0,0 +1,173 @@ +/*************************************************************************** + + DMAC + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + DMA controller used in Amiga systems + +***************************************************************************/ + +#pragma once + +#ifndef __DMAC_H__ +#define __DMAC_H__ + +#include "emu.h" +#include "autoconfig.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_DMAC_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, DMAC, _clock) \ + +#define MCFG_DMAC_CFGOUT_HANDLER(_devcb) \ + devcb = &dmac_device::set_cfgout_handler(*device, DEVCB2_##_devcb); + +#define MCFG_DMAC_INT_HANDLER(_devcb) \ + devcb = &dmac_device::set_int_handler(*device, DEVCB2_##_devcb); + +#define MCFG_DMAC_XDACK_HANDLER(_devcb) \ + devcb = &dmac_device::set_xdack_handler(*device, DEVCB2_##_devcb); + +#define MCFG_DMAC_SCSI_READ_HANDLER(_devcb) \ + devcb = &dmac_device::set_scsi_read_handler(*device, DEVCB2_##_devcb); + +#define MCFG_DMAC_SCSI_WRITE_HANDLER(_devcb) \ + devcb = &dmac_device::set_scsi_write_handler(*device, DEVCB2_##_devcb); + +#define MCFG_DMAC_IO_READ_HANDLER(_devcb) \ + devcb = &dmac_device::set_io_read_handler(*device, DEVCB2_##_devcb); + +#define MCFG_DMAC_IO_WRITE_HANDLER(_devcb) \ + devcb = &dmac_device::set_io_write_handler(*device, DEVCB2_##_devcb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> dmac_device + +class dmac_device : public device_t, public amiga_autoconfig +{ +public: + // construction/destruction + dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // callbacks + template<class _Object> static devcb2_base &set_cfgout_handler(device_t &device, _Object object) + { return downcast<dmac_device &>(device).m_cfgout_handler.set_callback(object); } + + template<class _Object> static devcb2_base &set_int_handler(device_t &device, _Object object) + { return downcast<dmac_device &>(device).m_int_handler.set_callback(object); } + + template<class _Object> static devcb2_base &set_xdack_handler(device_t &device, _Object object) + { return downcast<dmac_device &>(device).m_xdack_handler.set_callback(object); } + + template<class _Object> static devcb2_base &set_scsi_read_handler(device_t &device, _Object object) + { return downcast<dmac_device &>(device).m_scsi_read_handler.set_callback(object); } + + template<class _Object> static devcb2_base &set_scsi_write_handler(device_t &device, _Object object) + { return downcast<dmac_device &>(device).m_scsi_write_handler.set_callback(object); } + + template<class _Object> static devcb2_base &set_io_read_handler(device_t &device, _Object object) + { return downcast<dmac_device &>(device).m_io_read_handler.set_callback(object); } + + template<class _Object> static devcb2_base &set_io_write_handler(device_t &device, _Object object) + { return downcast<dmac_device &>(device).m_io_write_handler.set_callback(object); } + + void set_address_space(address_space *space) { m_space = space; }; + void set_rom(UINT8 *rom) { m_rom = rom; }; + void set_ram(UINT8 *ram) { m_ram = ram; }; + + // input lines + DECLARE_WRITE_LINE_MEMBER( configin_w ); + DECLARE_WRITE_LINE_MEMBER( ramsz_w ); + DECLARE_WRITE_LINE_MEMBER( rst_w ); + DECLARE_WRITE_LINE_MEMBER( intx_w ); + DECLARE_WRITE_LINE_MEMBER( xdreq_w ); + + // dmac register access + DECLARE_READ16_MEMBER( register_read ); + DECLARE_WRITE16_MEMBER( register_write ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // amiga_autoconfig overrides + virtual void autoconfig_base_address(offs_t address); + +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 const int ISTR_INT_MASK = 0x1fc; + + // callbacks + devcb2_write_line m_cfgout_handler; + devcb2_write_line m_int_handler; + devcb2_write_line m_xdack_handler; + devcb2_read8 m_scsi_read_handler; + devcb2_write8 m_scsi_write_handler; + devcb2_read8 m_io_read_handler; + devcb2_write8 m_io_write_handler; + + address_space *m_space; + UINT8 *m_rom; + UINT8 *m_ram; + int m_ram_size; + + // autoconfig state + bool m_configured; + + // state of lines + int m_rst; + + // register + UINT16 m_cntr; // control register + UINT16 m_istr; // interrupt status register + UINT32 m_wtc; // word transfer count + UINT32 m_acr; // address control register + + bool m_dma_active; + + void check_interrupts(); + void start_dma(); + void stop_dma(); +}; + + +// device type definition +extern const device_type DMAC; + + +#endif /* __DMAC_H__ */ diff --git a/src/emu/machine/machine.mak b/src/emu/machine/machine.mak index 18897309000..de303b9dfa7 100644 --- a/src/emu/machine/machine.mak +++ b/src/emu/machine/machine.mak @@ -16,6 +16,46 @@ MACHINEOBJ = $(EMUOBJ)/machine #------------------------------------------------- # +#@src/emu/machine/akiko.h,MACHINES += AKIKO +#------------------------------------------------- + +ifneq ($(filter AKIKO,$(MACHINES)),) +MACHINEOBJS += $(MACHINEOBJ)/akiko.o +endif + + +#------------------------------------------------- +# +#@src/emu/machine/autoconfig.h,MACHINES += AUTOCONFIG +#------------------------------------------------- + +ifneq ($(filter AUTOCONFIG,$(MACHINES)),) +MACHINEOBJS += $(MACHINEOBJ)/autoconfig.o +endif + + +#------------------------------------------------- +# +#@src/emu/machine/cr511b.h,MACHINES += CR511B +#------------------------------------------------- + +ifneq ($(filter CR511B,$(MACHINES)),) +MACHINEOBJS += $(MACHINEOBJ)/cr511b.o +endif + + +#------------------------------------------------- +# +#@src/emu/machine/dmac.h,MACHINES += DMAC +#------------------------------------------------- + +ifneq ($(filter DMAC,$(MACHINES)),) +MACHINEOBJS += $(MACHINEOBJ)/dmac.o +endif + + +#------------------------------------------------- +# #@src/emu/machine/40105.h,MACHINES += CMOS40105 #------------------------------------------------- diff --git a/src/mame/audio/amiga.c b/src/emu/sound/amiga.c index 22e5e0ef2a6..c4c9f045352 100644 --- a/src/mame/audio/amiga.c +++ b/src/emu/sound/amiga.c @@ -1,54 +1,40 @@ /*************************************************************************** - Amiga Computer / Arcadia Game System - - Driver by: - - Ernesto Corvi & Mariusz Wojcieszek + Amiga audio hardware ***************************************************************************/ -#include "emu.h" +#include "amiga.h" #include "includes/amiga.h" -#include "cpu/m68000/m68000.h" -/************************************* - * - * Debugging - * - *************************************/ +//************************************************************************** +// CONSTANTS / MACROS +//************************************************************************** #define VERBOSE 0 #define LOG(x) do { if (VERBOSE) logerror x; } while (0) - -/************************************* - * - * Constants - * - *************************************/ - -#define CLOCK_DIVIDER 16 - +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** const device_type AMIGA = &device_creator<amiga_sound_device>; -amiga_sound_device::amiga_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, AMIGA, "Amiga Paula", tag, owner, clock, "amiga_paula", __FILE__), - device_sound_interface(mconfig, *this), - m_stream(NULL) -{ -} + +//************************************************************************* +// LIVE DEVICE +//************************************************************************** //------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete +// amiga_sound_device - constructor //------------------------------------------------- -void amiga_sound_device::device_config_complete() +amiga_sound_device::amiga_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, AMIGA, "Amiga Paula", tag, owner, clock, "amiga_paula", __FILE__), + device_sound_interface(mconfig, *this), + m_stream(NULL) { } @@ -58,71 +44,66 @@ void amiga_sound_device::device_config_complete() void amiga_sound_device::device_start() { - int i; - - for (i = 0; i < 4; i++) + // initialize channels + for (int i = 0; i < 4; i++) { m_channel[i].index = i; m_channel[i].irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(amiga_sound_device::signal_irq), this)); - m_channel[i].curticks = 0; - m_channel[i].latched = 0; - m_channel[i].manualmode = 0; - m_channel[i].curlocation = 0; } - /* create the stream */ + // create the stream m_stream = machine().sound().stream_alloc(*this, 0, 4, clock() / CLOCK_DIVIDER); } -/************************************* - * - * DMA reload/IRQ signalling - * - *************************************/ +//************************************************************************* +// IMPLEMENTATION +//************************************************************************** + +//------------------------------------------------- +// signal_irq - irq signaling +//------------------------------------------------- TIMER_CALLBACK_MEMBER( amiga_sound_device::signal_irq ) { amiga_state *state = machine().driver_data<amiga_state>(); - state->amiga_custom_w(*state->m_maincpu_program_space, REG_INTREQ, 0x8000 | (0x80 << param), 0xffff); + + state->custom_chip_w(REG_INTREQ, INTENA_SETCLR | (0x80 << param)); } +//------------------------------------------------- +// dma_reload +//------------------------------------------------- -static void dma_reload(amiga_state *state, audio_channel *chan) +void amiga_sound_device::dma_reload(audio_channel *chan) { + amiga_state *state = machine().driver_data<amiga_state>(); + chan->curlocation = CUSTOM_REG_LONG(REG_AUD0LCH + chan->index * 8); chan->curlength = CUSTOM_REG(REG_AUD0LEN + chan->index * 8); chan->irq_timer->adjust(attotime::from_hz(15750), chan->index); + LOG(("dma_reload(%d): offs=%05X len=%04X\n", chan->index, chan->curlocation, chan->curlength)); } - - -/************************************* - * - * Manual mode data writer - * - *************************************/ +//------------------------------------------------- +// data_w - manual mode data writer +//------------------------------------------------- void amiga_sound_device::data_w(int which, UINT16 data) { - m_channel[which].manualmode = TRUE; + m_channel[which].manualmode = true; } - - -/************************************* - * - * Stream updater - * - *************************************/ +//------------------------------------------------- +// update - stream updater +//------------------------------------------------- void amiga_sound_device::update() { m_stream->update(); } - //------------------------------------------------- // sound_stream_update - handle a stream update //------------------------------------------------- @@ -132,15 +113,15 @@ void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample amiga_state *state = machine().driver_data<amiga_state>(); int channum, sampoffs = 0; - /* if all DMA off, disable all channels */ + // if all DMA off, disable all channels if (!(CUSTOM_REG(REG_DMACON) & 0x0200)) { - m_channel[0].dmaenabled = - m_channel[1].dmaenabled = - m_channel[2].dmaenabled = - m_channel[3].dmaenabled = FALSE; + m_channel[0].dma_enabled = + m_channel[1].dma_enabled = + m_channel[2].dma_enabled = + m_channel[3].dma_enabled = false; - /* clear the sample data to 0 */ + // clear the sample data to 0 for (channum = 0; channum < 4; channum++) memset(outputs[channum], 0, sizeof(stream_sample_t) * samples); return; @@ -148,22 +129,22 @@ void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample samples *= CLOCK_DIVIDER; - /* update the DMA states on each channel and reload if fresh */ + // update the DMA states on each channel and reload if fresh for (channum = 0; channum < 4; channum++) { audio_channel *chan = &m_channel[channum]; - if (!chan->dmaenabled && ((CUSTOM_REG(REG_DMACON) >> channum) & 1)) - dma_reload(state, chan); - chan->dmaenabled = (CUSTOM_REG(REG_DMACON) >> channum) & 1; + if (!chan->dma_enabled && ((CUSTOM_REG(REG_DMACON) >> channum) & 1)) + dma_reload(chan); + chan->dma_enabled = (CUSTOM_REG(REG_DMACON) >> channum) & 1; } - /* loop until done */ + // loop until done while (samples > 0) { int nextper, nextvol; int ticks = samples; - /* determine the number of ticks we can do in this chunk */ + // determine the number of ticks we can do in this chunk if (ticks > m_channel[0].curticks) ticks = m_channel[0].curticks; if (ticks > m_channel[1].curticks) @@ -173,7 +154,7 @@ void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample if (ticks > m_channel[3].curticks) ticks = m_channel[3].curticks; - /* loop over channels */ + // loop over channels nextper = nextvol = -1; for (channum = 0; channum < 4; channum++) { @@ -183,11 +164,11 @@ void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample stream_sample_t sample; int i; - /* normalize the volume value */ + // normalize the volume value volume = (volume & 0x40) ? 64 : (volume & 0x3f); volume *= 4; - /* are we modulating the period of the next channel? */ + // are we modulating the period of the next channel? if ((CUSTOM_REG(REG_ADKCON) >> channum) & 0x10) { nextper = CUSTOM_REG(REG_AUD0DAT + channum * 8); @@ -195,7 +176,7 @@ void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample sample = 0; } - /* are we modulating the volume of the next channel? */ + // are we modulating the volume of the next channel? else if ((CUSTOM_REG(REG_ADKCON) >> channum) & 0x01) { nextper = -1; @@ -203,56 +184,56 @@ void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample sample = 0; } - /* otherwise, we are generating data */ + // otherwise, we are generating data else { nextper = nextvol = -1; sample = chan->latched * volume; } - /* fill the buffer with the sample */ + // fill the buffer with the sample for (i = 0; i < ticks; i += CLOCK_DIVIDER) outputs[channum][(sampoffs + i) / CLOCK_DIVIDER] = sample; - /* account for the ticks; if we hit 0, advance */ + // account for the ticks; if we hit 0, advance chan->curticks -= ticks; if (chan->curticks == 0) { - /* reset the clock and ensure we're above the minimum ticks */ + // reset the clock and ensure we're above the minimum ticks chan->curticks = period; if (chan->curticks < 124) chan->curticks = 124; - /* move forward one byte; if we move to an even byte, fetch new */ - if (chan->dmaenabled || chan->manualmode) + // move forward one byte; if we move to an even byte, fetch new + if (chan->dma_enabled || chan->manualmode) chan->curlocation++; - if (chan->dmaenabled && !(chan->curlocation & 1)) + if (chan->dma_enabled && !(chan->curlocation & 1)) { CUSTOM_REG(REG_AUD0DAT + channum * 8) = (*state->m_chip_ram_r)(state, chan->curlocation); if (chan->curlength != 0) chan->curlength--; - /* if we run out of data, reload the dma */ + // if we run out of data, reload the dma if (chan->curlength == 0) - dma_reload(state, chan); + dma_reload(chan); } - /* latch the next byte of the sample */ + // latch the next byte of the sample if (!(chan->curlocation & 1)) chan->latched = CUSTOM_REG(REG_AUD0DAT + channum * 8) >> 8; else chan->latched = CUSTOM_REG(REG_AUD0DAT + channum * 8) >> 0; - /* if we're in manual mode, signal an interrupt once we latch the low byte */ - if (!chan->dmaenabled && chan->manualmode && (chan->curlocation & 1)) + // if we're in manual mode, signal an interrupt once we latch the low byte + if (!chan->dma_enabled && chan->manualmode && (chan->curlocation & 1)) { signal_irq(NULL, channum); - chan->manualmode = FALSE; + chan->manualmode = false; } } } - /* bump ourselves forward by the number of ticks */ + // bump ourselves forward by the number of ticks sampoffs += ticks; samples -= ticks; } diff --git a/src/emu/sound/amiga.h b/src/emu/sound/amiga.h new file mode 100644 index 00000000000..56e092b248f --- /dev/null +++ b/src/emu/sound/amiga.h @@ -0,0 +1,63 @@ +/*************************************************************************** + + Amiga audio hardware + +***************************************************************************/ + +#pragma once + +#ifndef __SOUND_AMIGA_H__ +#define __SOUND_AMIGA_H__ + +#include "emu.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> amiga_sound_device + +class amiga_sound_device : public device_t, public device_sound_interface +{ +public: + amiga_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~amiga_sound_device() {} + + void update(); + void data_w(int which, UINT16 data); + +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +private: + static const int CLOCK_DIVIDER = 16; + + struct audio_channel + { + emu_timer *irq_timer; + UINT32 curlocation; + UINT16 curlength; + UINT16 curticks; + UINT8 index; + bool dma_enabled; + bool manualmode; + INT8 latched; + }; + + void dma_reload(audio_channel *chan); + + // internal state + audio_channel m_channel[4]; + sound_stream *m_stream; + + TIMER_CALLBACK_MEMBER( signal_irq ); +}; + +extern const device_type AMIGA; + +#endif // __SOUND_AMIGA_H__ diff --git a/src/emu/sound/sound.mak b/src/emu/sound/sound.mak index 070534c8e09..6a6a0cf0d0d 100644 --- a/src/emu/sound/sound.mak +++ b/src/emu/sound/sound.mak @@ -101,6 +101,17 @@ endif #------------------------------------------------- +# Amiga audio hardware +#@src/emu/sound/amiga.h,SOUNDS += AMIGA +#------------------------------------------------- + +ifneq ($(filter AMIGA,$(SOUNDS)),) +SOUNDOBJS += $(SOUNDOBJ)/amiga.o +endif + + + +#------------------------------------------------- # Bally Astrocade sound system #@src/emu/sound/astrocde.h,SOUNDS += ASTROCADE #------------------------------------------------- diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c index 7658aa321ce..c8a0d0e4f93 100644 --- a/src/mame/drivers/alg.c +++ b/src/mame/drivers/alg.c @@ -39,30 +39,36 @@ public: : amiga_state(mconfig, type, tag), m_laserdisc(*this, "laserdisc") { } - - required_device<sony_ldp1450_device> m_laserdisc; - emu_timer *m_serial_timer; - UINT8 m_serial_timer_active; - UINT16 m_input_select; DECLARE_CUSTOM_INPUT_MEMBER(lightgun_pos_r); DECLARE_CUSTOM_INPUT_MEMBER(lightgun_trigger_r); DECLARE_CUSTOM_INPUT_MEMBER(lightgun_holster_r); - DECLARE_WRITE8_MEMBER(alg_cia_0_porta_w); - DECLARE_READ8_MEMBER(alg_cia_0_porta_r); - DECLARE_READ8_MEMBER(alg_cia_0_portb_r); - DECLARE_WRITE8_MEMBER(alg_cia_0_portb_w); - DECLARE_READ8_MEMBER(alg_cia_1_porta_r); - DECLARE_WRITE8_MEMBER(alg_cia_1_porta_w); + DECLARE_DRIVER_INIT(aplatoon); DECLARE_DRIVER_INIT(palr3); DECLARE_DRIVER_INIT(palr1); - DECLARE_DRIVER_INIT(none); DECLARE_DRIVER_INIT(palr6); - DECLARE_MACHINE_START(alg); - DECLARE_MACHINE_RESET(alg); + DECLARE_DRIVER_INIT(ntsc); + DECLARE_DRIVER_INIT(pal); + DECLARE_VIDEO_START(alg); TIMER_CALLBACK_MEMBER(response_timer); - void alg_init(); + +protected: + // driver_device overrides + virtual void machine_start(); + + // amiga_state overrides + virtual void vblank(); + virtual void serdat_w(UINT16 data); + virtual void potgo_w(UINT16 data); + +private: + required_device<sony_ldp1450_device> m_laserdisc; + + emu_timer *m_serial_timer; + UINT8 m_serial_timer_active; + + UINT16 m_input_select; }; @@ -116,21 +122,15 @@ VIDEO_START_MEMBER(alg_state,alg) * *************************************/ -MACHINE_START_MEMBER(alg_state,alg) +void alg_state::machine_start() { - MACHINE_START_CALL_MEMBER(amiga); + amiga_state::machine_start(); m_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alg_state::response_timer),this)); m_serial_timer_active = FALSE; } -MACHINE_RESET_MEMBER(alg_state,alg) -{ - MACHINE_RESET_CALL_MEMBER(amiga); -} - - /************************************* * @@ -146,42 +146,40 @@ TIMER_CALLBACK_MEMBER(alg_state::response_timer) UINT8 data = m_laserdisc->data_r(); if (data != 0x0a) osd_printf_debug("Sending serial data = %02X\n", data); - amiga_serial_in_w(machine(), data); + serial_in_w(data); } /* if there's more to come, set another timer */ if (m_laserdisc->data_available_r() == ASSERT_LINE) - m_serial_timer->adjust(amiga_get_serial_char_period(machine())); + m_serial_timer->adjust(serial_char_period()); else m_serial_timer_active = FALSE; } -static void vsync_callback(running_machine &machine) +void alg_state::vblank() { - alg_state *state = machine.driver_data<alg_state>(); + amiga_state::vblank(); /* if we have data available, set a timer to read it */ - if (!state->m_serial_timer_active && state->m_laserdisc->data_available_r() == ASSERT_LINE) + if (!m_serial_timer_active && m_laserdisc->data_available_r() == ASSERT_LINE) { - state->m_serial_timer->adjust(amiga_get_serial_char_period(machine)); - state->m_serial_timer_active = TRUE; + m_serial_timer->adjust(serial_char_period()); + m_serial_timer_active = TRUE; } } -static void serial_w(running_machine &machine, UINT16 data) +void alg_state::serdat_w(UINT16 data) { - alg_state *state = machine.driver_data<alg_state>(); - /* write to the laserdisc player */ - state->m_laserdisc->data_w(data & 0xff); + m_laserdisc->data_w(data & 0xff); /* if we have data available, set a timer to read it */ - if (!state->m_serial_timer_active && state->m_laserdisc->data_available_r() == ASSERT_LINE) + if (!m_serial_timer_active && m_laserdisc->data_available_r() == ASSERT_LINE) { - state->m_serial_timer->adjust(amiga_get_serial_char_period(machine)); - state->m_serial_timer_active = TRUE; + m_serial_timer->adjust(serial_char_period()); + m_serial_timer_active = TRUE; } } @@ -193,13 +191,11 @@ static void serial_w(running_machine &machine, UINT16 data) * *************************************/ -static void alg_potgo_w(running_machine &machine, UINT16 data) +void alg_state::potgo_w(UINT16 data) { - alg_state *state = machine.driver_data<alg_state>(); - /* bit 15 controls whether pin 9 is input/output */ /* bit 14 controls the value, which selects which player's controls to read */ - state->m_input_select = (data & 0x8000) ? ((data >> 14) & 1) : 0; + m_input_select = (data & 0x8000) ? ((data >> 14) & 1) : 0; } @@ -228,61 +224,6 @@ CUSTOM_INPUT_MEMBER(alg_state::lightgun_holster_r) -/************************************* - * - * CIA port accesses - * - *************************************/ - -WRITE8_MEMBER(alg_state::alg_cia_0_porta_w) -{ - /* switch banks as appropriate */ - m_bank1->set_entry(data & 1); - - /* swap the write handlers between ROM and bank 1 based on the bit */ - if ((data & 1) == 0) - /* overlay disabled, map RAM on 0x000000 */ - space.install_write_bank(0x000000, 0x07ffff, "bank1"); - - else - /* overlay enabled, map Amiga system ROM on 0x000000 */ - space.unmap_write(0x000000, 0x07ffff); -} - - -READ8_MEMBER(alg_state::alg_cia_0_porta_r) -{ - return ioport("FIRE")->read() | 0x3f; -} - - -READ8_MEMBER(alg_state::alg_cia_0_portb_r) -{ - logerror("%s:alg_cia_0_portb_r\n", machine().describe_context()); - return 0xff; -} - - -WRITE8_MEMBER(alg_state::alg_cia_0_portb_w) -{ - /* parallel port */ - logerror("%s:alg_cia_0_portb_w(%02x)\n", machine().describe_context(), data); -} - - -READ8_MEMBER(alg_state::alg_cia_1_porta_r) -{ - logerror("%s:alg_cia_1_porta_r\n", machine().describe_context()); - return 0xff; -} - - -WRITE8_MEMBER(alg_state::alg_cia_1_porta_w) -{ - logerror("%s:alg_cia_1_porta_w(%02x)\n", machine().describe_context(), data); -} - - /************************************* * @@ -290,40 +231,39 @@ WRITE8_MEMBER(alg_state::alg_cia_1_porta_w) * *************************************/ -static ADDRESS_MAP_START( main_map_r1, AS_PROGRAM, 16, alg_state ) +static ADDRESS_MAP_START( overlay_512kb_map, AS_PROGRAM, 16, alg_state ) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram") - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia_r, amiga_cia_w) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_SHARE("custom_regs") - AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE(amiga_autoconfig_r, amiga_autoconfig_w) - AM_RANGE(0xfc0000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* System ROM */ + AM_RANGE(0x000000, 0x07ffff) AM_MIRROR(0x180000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END +static ADDRESS_MAP_START( a500_mem, AS_PROGRAM, 16, alg_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xd80000, 0xddffff) AM_NOP + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( main_map_r1, AS_PROGRAM, 16, alg_state ) + AM_IMPORT_FROM(a500_mem) AM_RANGE(0xf00000, 0xf1ffff) AM_ROM AM_REGION("user2", 0) /* Custom ROM */ AM_RANGE(0xf54000, 0xf55fff) AM_RAM AM_SHARE("nvram") ADDRESS_MAP_END - static ADDRESS_MAP_START( main_map_r2, AS_PROGRAM, 16, alg_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram") - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia_r, amiga_cia_w) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_SHARE("custom_regs") - AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE(amiga_autoconfig_r, amiga_autoconfig_w) - AM_RANGE(0xfc0000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* System ROM */ - + AM_IMPORT_FROM(a500_mem) AM_RANGE(0xf00000, 0xf3ffff) AM_ROM AM_REGION("user2", 0) /* Custom ROM */ AM_RANGE(0xf7c000, 0xf7dfff) AM_RAM AM_SHARE("nvram") ADDRESS_MAP_END - static ADDRESS_MAP_START( main_map_picmatic, AS_PROGRAM, 16, alg_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram") - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia_r, amiga_cia_w) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_SHARE("custom_regs") - AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE(amiga_autoconfig_r, amiga_autoconfig_w) - AM_RANGE(0xfc0000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* System ROM */ - + AM_IMPORT_FROM(a500_mem) AM_RANGE(0xf00000, 0xf1ffff) AM_ROM AM_REGION("user2", 0) /* Custom ROM */ AM_RANGE(0xf40000, 0xf41fff) AM_RAM AM_SHARE("nvram") ADDRESS_MAP_END @@ -337,15 +277,15 @@ ADDRESS_MAP_END *************************************/ static INPUT_PORTS_START( alg ) - PORT_START("JOY0DAT") /* read by Amiga core */ + PORT_START("joy_0_dat") /* read by Amiga core */ PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, alg_state,amiga_joystick_convert, 0) PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_START("JOY1DAT") /* read by Amiga core */ + PORT_START("joy_1_dat") /* read by Amiga core */ PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, alg_state,amiga_joystick_convert, 1) PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_START("POTGO") /* read by Amiga core */ + PORT_START("potgo") /* read by Amiga core */ PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) @@ -359,13 +299,13 @@ static INPUT_PORTS_START( alg ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("P1JOY") /* referenced by JOY0DAT */ + PORT_START("p1_joy") /* referenced by JOY0DAT */ PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_HIGH ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_START("P2JOY") /* referenced by JOY1DAT */ + PORT_START("p2_joy") /* referenced by JOY1DAT */ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -382,14 +322,14 @@ INPUT_PORTS_END static INPUT_PORTS_START( alg_2p ) PORT_INCLUDE(alg) - PORT_MODIFY("POTGO") + PORT_MODIFY("potgo") PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, alg_state,lightgun_trigger_r, NULL) PORT_MODIFY("FIRE") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_MODIFY("P2JOY") + PORT_MODIFY("p2_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, alg_state,lightgun_holster_r, NULL) PORT_START("GUN2X") /* referenced by lightgun_pos_r */ @@ -416,11 +356,16 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( alg_r1, alg_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, AMIGA_68000_NTSC_CLOCK) + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_NTSC) MCFG_CPU_PROGRAM_MAP(main_map_r1) - MCFG_MACHINE_START_OVERRIDE(alg_state,alg) - MCFG_MACHINE_RESET_OVERRIDE(alg_state,alg) + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_512kb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + MCFG_NVRAM_ADD_0FILL("nvram") MCFG_LASERDISC_LDP1450_ADD("laserdisc") @@ -442,7 +387,7 @@ static MACHINE_CONFIG_START( alg_r1, alg_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("amiga", AMIGA, 3579545) + MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_NTSC) MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) MCFG_SOUND_ROUTE(1, "rspeaker", 0.25) MCFG_SOUND_ROUTE(2, "rspeaker", 0.25) @@ -453,19 +398,15 @@ static MACHINE_CONFIG_START( alg_r1, alg_state ) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) /* cia */ - MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, AMIGA_68000_NTSC_CLOCK / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_0_irq)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(alg_state,alg_cia_0_porta_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(alg_state,alg_cia_0_porta_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(alg_state,alg_cia_0_portb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(alg_state,alg_cia_0_portb_w)) - MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, AMIGA_68000_NTSC_CLOCK / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_1_irq)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(alg_state,alg_cia_1_porta_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(alg_state,alg_cia_1_porta_w)) + MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, amiga_state::CLK_E_NTSC) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_0_irq)) + MCFG_MOS6526_PA_INPUT_CALLBACK(IOPORT("FIRE")) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, cia_0_port_a_write)) + MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, amiga_state::CLK_E_NTSC) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_1_irq)) /* fdc */ - MCFG_DEVICE_ADD("fdc", AMIGA_FDC, AMIGA_68000_NTSC_CLOCK) + MCFG_DEVICE_ADD("fdc", AMIGA_FDC, amiga_state::CLK_7M_NTSC) MCFG_AMIGA_FDC_INDEX_CALLBACK(DEVWRITELINE("cia_1", legacy_mos6526_device, flag_w)) MACHINE_CONFIG_END @@ -480,13 +421,22 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( picmatic, alg_r1 ) /* adjust for PAL specs */ - MCFG_CPU_REPLACE("maincpu", M68000, AMIGA_68000_PAL_CLOCK) + MCFG_CPU_REPLACE("maincpu", M68000, amiga_state::CLK_7M_PAL) MCFG_CPU_PROGRAM_MAP(main_map_picmatic) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(512*2, 312) MCFG_SCREEN_VISIBLE_AREA((129-8)*2, (449+8-1)*2, 44-8, 300+8-1) + + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_PAL) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_PAL) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_PAL) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_PAL) MACHINE_CONFIG_END @@ -497,13 +447,11 @@ MACHINE_CONFIG_END * *************************************/ -#define ROM_LOAD16_WORD_BIOS(bios,name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_BIOS(bios+1)) - #define ALG_BIOS \ - ROM_REGION16_BE( 0x80000, "user1", 0 ) \ - ROM_SYSTEM_BIOS( 0, "Kick1.3", "Kickstart 1.3") \ - ROM_LOAD16_WORD_BIOS(0, "kick13.rom", 0x000000, 0x40000, CRC(c4f0f55f) SHA1(891e9a547772fe0c6c19b610baf8bc4ea7fcb785)) \ - ROM_COPY( "user1", 0x000000, 0x040000, 0x040000 ) + ROM_REGION16_BE(0x80000, "kickstart", 0) \ + ROM_SYSTEM_BIOS(0, "kick13", "Kickstart 1.3 (34.5)") \ + ROMX_LOAD("315093-02.u2", 0x00000, 0x40000, CRC(c4f0f55f) SHA1(891e9a547772fe0c6c19b610baf8bc4ea7fcb785), ROM_GROUPWORD | ROM_BIOS(1)) \ + ROM_COPY("kickstart", 0x000000, 0x040000, 0x040000) @@ -672,42 +620,29 @@ ROM_END + /************************************* * - * Generic driver init + * Per-game decryption * *************************************/ -void alg_state::alg_init() +DRIVER_INIT_MEMBER( alg_state, ntsc ) { - static const amiga_machine_interface alg_intf = - { - ANGUS_CHIP_RAM_MASK, - NULL, NULL, alg_potgo_w, - serial_w, - - vsync_callback, - NULL, - NULL, - 0 - }; - amiga_machine_config(machine(), &alg_intf); - - /* set up memory */ - m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, memregion("user1")->base()); + m_agnus_id = AGNUS_HR_NTSC; + m_denise_id = DENISE; } - - -/************************************* - * - * Per-game decryption - * - *************************************/ +DRIVER_INIT_MEMBER( alg_state, pal ) +{ + m_agnus_id = AGNUS_HR_PAL; + m_denise_id = DENISE; +} DRIVER_INIT_MEMBER(alg_state,palr1) { + DRIVER_INIT_CALL(ntsc); + UINT32 length = memregion("user2")->bytes(); UINT8 *rom = memregion("user2")->base(); dynamic_buffer original(length); @@ -721,12 +656,12 @@ DRIVER_INIT_MEMBER(alg_state,palr1) if (srcaddr & 0x8000) dstaddr ^= 0x4000; rom[dstaddr] = original[srcaddr]; } - - alg_init(); } DRIVER_INIT_MEMBER(alg_state,palr3) { + DRIVER_INIT_CALL(ntsc); + UINT32 length = memregion("user2")->bytes(); UINT8 *rom = memregion("user2")->base(); dynamic_buffer original(length); @@ -739,12 +674,12 @@ DRIVER_INIT_MEMBER(alg_state,palr3) if (srcaddr & 0x2000) dstaddr ^= 0x1000; rom[dstaddr] = original[srcaddr]; } - - alg_init(); } DRIVER_INIT_MEMBER(alg_state,palr6) { + DRIVER_INIT_CALL(ntsc); + UINT32 length = memregion("user2")->bytes(); UINT8 *rom = memregion("user2")->base(); dynamic_buffer original(length); @@ -759,12 +694,12 @@ DRIVER_INIT_MEMBER(alg_state,palr6) dstaddr ^= 0x20000; rom[dstaddr] = original[srcaddr]; } - - alg_init(); } DRIVER_INIT_MEMBER(alg_state,aplatoon) { + DRIVER_INIT_CALL(ntsc); + /* NOT DONE TODO FIGURE OUT THE RIGHT ORDER!!!! */ UINT8 *rom = memregion("user2")->base(); UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x40000); @@ -780,13 +715,8 @@ DRIVER_INIT_MEMBER(alg_state,aplatoon) memcpy(decrypted + i * 0x1000, rom + shuffle[i] * 0x1000, 0x1000); memcpy(rom, decrypted, 0x40000); logerror("decrypt done\n "); - alg_init(); } -DRIVER_INIT_MEMBER(alg_state,none) -{ - alg_init(); -} @@ -797,7 +727,7 @@ DRIVER_INIT_MEMBER(alg_state,none) *************************************/ /* BIOS */ -GAME( 199?, alg_bios, 0, alg_r1, alg, alg_state, none, ROT0, "American Laser Games", "American Laser Games BIOS", GAME_IS_BIOS_ROOT ) +GAME( 199?, alg_bios, 0, alg_r1, alg, alg_state, ntsc, ROT0, "American Laser Games", "American Laser Games BIOS", GAME_IS_BIOS_ROOT ) /* Rev. A board */ /* PAL R1 */ @@ -829,4 +759,4 @@ GAME( 1995, fastdraw, alg_bios, alg_r2, alg_2p, alg_state, palr6, ROT90, "A GAME( 199?, aplatoon, alg_bios, alg_r2, alg, alg_state, aplatoon, ROT0, "Nova?", "Platoon V.?.? US", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS ) /* Web Picmatic games PAL tv standard, own rom board */ -GAME( 1993, zortonbr, alg_bios, picmatic, alg, alg_state, none, ROT0, "Web Picmatic", "Zorton Brothers (Los Justicieros)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS ) +GAME( 1993, zortonbr, alg_bios, picmatic, alg, alg_state, pal, ROT0, "Web Picmatic", "Zorton Brothers (Los Justicieros)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/arcadia.c b/src/mame/drivers/arcadia.c index 381aa09d2d3..1f22b2fa1f8 100644 --- a/src/mame/drivers/arcadia.c +++ b/src/mame/drivers/arcadia.c @@ -63,17 +63,18 @@ public: arcadia_amiga_state(const machine_config &mconfig, device_type type, const char *tag) : amiga_state(mconfig, type, tag) { } - UINT8 coin_counter[2]; + UINT8 m_coin_counter[2]; + DECLARE_WRITE16_MEMBER(arcadia_multibios_change_game); DECLARE_CUSTOM_INPUT_MEMBER(coin_counter_r); DECLARE_INPUT_CHANGED_MEMBER(coin_changed_callback); - DECLARE_WRITE8_MEMBER(arcadia_cia_0_porta_w); DECLARE_WRITE8_MEMBER(arcadia_cia_0_portb_w); + + DECLARE_DRIVER_INIT(arcadia); DECLARE_DRIVER_INIT(xeon); DECLARE_DRIVER_INIT(sdwr); DECLARE_DRIVER_INIT(dart); DECLARE_DRIVER_INIT(bowl); - DECLARE_DRIVER_INIT(none); DECLARE_DRIVER_INIT(sprg); DECLARE_DRIVER_INIT(rdwr); DECLARE_DRIVER_INIT(ninj); @@ -84,8 +85,11 @@ public: DECLARE_DRIVER_INIT(pm); DECLARE_DRIVER_INIT(dlta); DECLARE_DRIVER_INIT(argh); - void arcadia_init(); + inline void generic_decode(const char *tag, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0); + +protected: + virtual void machine_reset(); }; @@ -106,40 +110,6 @@ WRITE16_MEMBER(arcadia_amiga_state::arcadia_multibios_change_game) -/************************************* - * - * CIA-A port A access: - * - * PA7 = game port 1, pin 6 (fire) - * PA6 = game port 0, pin 6 (fire) - * PA5 = /RDY (disk ready) - * PA4 = /TK0 (disk track 00) - * PA3 = /WPRO (disk write protect) - * PA2 = /CHNG (disk change) - * PA1 = /LED (LED, 0=bright / audio filter control) - * PA0 = OVL (ROM/RAM overlay bit) - * - *************************************/ - -WRITE8_MEMBER(arcadia_amiga_state::arcadia_cia_0_porta_w) -{ - /* switch banks as appropriate */ - m_bank1->set_entry(data & 1); - - /* swap the write handlers between ROM and bank 1 based on the bit */ - if ((data & 1) == 0) - /* overlay disabled, map RAM on 0x000000 */ - m_maincpu->space(AS_PROGRAM).install_write_bank(0x000000, 0x07ffff, "bank1"); - - else - /* overlay enabled, map Amiga system ROM on 0x000000 */ - m_maincpu->space(AS_PROGRAM).unmap_write(0x000000, 0x07ffff); - - /* bit 2 = Power Led on Amiga */ - set_led_status(machine(), 0, (data & 2) ? 0 : 1); -} - - /************************************* * @@ -161,10 +131,10 @@ WRITE8_MEMBER(arcadia_amiga_state::arcadia_cia_0_portb_w) /* writing a 0 in the low bit clears one of the coins */ if ((data & 1) == 0) { - if (coin_counter[0] > 0) - coin_counter[0]--; - else if (coin_counter[1] > 0) - coin_counter[1]--; + if (m_coin_counter[0] > 0) + m_coin_counter[0]--; + else if (m_coin_counter[1] > 0) + m_coin_counter[1]--; } } @@ -181,7 +151,7 @@ CUSTOM_INPUT_MEMBER(arcadia_amiga_state::coin_counter_r) int coin = (FPTR)param; /* return coin counter values */ - return coin_counter[coin] & 3; + return m_coin_counter[coin] & 3; } @@ -190,17 +160,18 @@ INPUT_CHANGED_MEMBER(arcadia_amiga_state::coin_changed_callback) int coin = (FPTR)param; /* check for a 0 -> 1 transition */ - if (!oldval && newval && coin_counter[coin] < 3) - coin_counter[coin] += 1; + if (!oldval && newval && m_coin_counter[coin] < 3) + m_coin_counter[coin] += 1; } -static void arcadia_reset_coins(running_machine &machine) +void arcadia_amiga_state::machine_reset() { - UINT8 *coin_counter = machine.driver_data<arcadia_amiga_state>()->coin_counter; + // reset base machine + amiga_state::machine_reset(); - /* reset coin counters */ - coin_counter[0] = coin_counter[1] = 0; + // reset coin counters + m_coin_counter[0] = m_coin_counter[1] = 0; } @@ -211,14 +182,27 @@ static void arcadia_reset_coins(running_machine &machine) * *************************************/ -static ADDRESS_MAP_START( amiga_map, AS_PROGRAM, 16, arcadia_amiga_state ) +static ADDRESS_MAP_START( overlay_512kb_map, AS_PROGRAM, 16, arcadia_amiga_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x07ffff) AM_MIRROR(0x180000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( a500_mem, AS_PROGRAM, 16, arcadia_amiga_state ) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram") - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia_r, amiga_cia_w) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_SHARE("custom_regs") - AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE(amiga_autoconfig_r, amiga_autoconfig_w) - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* Kickstart BIOS */ + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xd80000, 0xddffff) AM_NOP + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END +static ADDRESS_MAP_START( arcadia_map, AS_PROGRAM, 16, arcadia_amiga_state ) + AM_IMPORT_FROM(a500_mem) AM_RANGE(0x800000, 0x97ffff) AM_ROMBANK("bank2") AM_REGION("user3", 0) AM_RANGE(0x980000, 0x9fbfff) AM_ROM AM_REGION("user2", 0) AM_RANGE(0x9fc000, 0x9ffffd) AM_RAM AM_SHARE("nvram") @@ -227,13 +211,7 @@ static ADDRESS_MAP_START( amiga_map, AS_PROGRAM, 16, arcadia_amiga_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( argh_map, AS_PROGRAM, 16, arcadia_amiga_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram") - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia_r, amiga_cia_w) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_SHARE("custom_regs") - AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE(amiga_autoconfig_r, amiga_autoconfig_w) - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* Kickstart BIOS */ - + AM_IMPORT_FROM(a500_mem) AM_RANGE(0x800000, 0x97ffff) AM_ROMBANK("bank2") AM_REGION("user3", 0) // AM_RANGE(0x980000, 0x9fefff) AM_ROM AM_REGION("user3", 0) AM_RANGE(0x9ff000, 0x9fffff) AM_RAM AM_SHARE("nvram") @@ -262,28 +240,28 @@ static INPUT_PORTS_START( arcadia ) PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arcadia_amiga_state,coin_counter_r, 0) PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arcadia_amiga_state,coin_counter_r, 1) - PORT_START("JOY0DAT") + PORT_START("joy_0_dat") PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arcadia_amiga_state,amiga_joystick_convert, 0) PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_START("JOY1DAT") + PORT_START("joy_1_dat") PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arcadia_amiga_state,amiga_joystick_convert, 1) PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_START("POTGO") + PORT_START("potgo") PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL PORT_BIT( 0xaaff, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_START("P1JOY") + PORT_START("p1_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) - PORT_START("P2JOY") + PORT_START("p2_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) @@ -305,11 +283,16 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( arcadia, arcadia_amiga_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, AMIGA_68000_NTSC_CLOCK) - MCFG_CPU_PROGRAM_MAP(amiga_map) + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_NTSC) + MCFG_CPU_PROGRAM_MAP(arcadia_map) + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_512kb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - MCFG_MACHINE_START_OVERRIDE(amiga_state, amiga ) - MCFG_MACHINE_RESET_OVERRIDE(arcadia_amiga_state,amiga) MCFG_NVRAM_ADD_0FILL("nvram") /* video hardware */ @@ -330,24 +313,24 @@ static MACHINE_CONFIG_START( arcadia, arcadia_amiga_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("amiga", AMIGA, 3579545) + MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_NTSC) MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) MCFG_SOUND_ROUTE(3, "lspeaker", 0.50) /* cia */ - MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, AMIGA_68000_NTSC_CLOCK / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_0_irq)) + MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, amiga_state::CLK_E_NTSC) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_0_irq)) MCFG_MOS6526_PA_INPUT_CALLBACK(IOPORT("CIA0PORTA")) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(arcadia_amiga_state,arcadia_cia_0_porta_w)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, cia_0_port_a_write)) MCFG_MOS6526_PB_INPUT_CALLBACK(IOPORT("CIA0PORTB")) MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(arcadia_amiga_state,arcadia_cia_0_portb_w)) - MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, AMIGA_68000_NTSC_CLOCK / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_1_irq)) + MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, amiga_state::CLK_E_NTSC) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_1_irq)) /* fdc */ - MCFG_DEVICE_ADD("fdc", AMIGA_FDC, AMIGA_68000_NTSC_CLOCK) + MCFG_DEVICE_ADD("fdc", AMIGA_FDC, amiga_state::CLK_7M_NTSC) MCFG_AMIGA_FDC_INDEX_CALLBACK(DEVWRITELINE("cia_1", legacy_mos6526_device, flag_w)) MACHINE_CONFIG_END @@ -368,9 +351,9 @@ MACHINE_CONFIG_END #define ROM_LOAD16_BYTE_BIOS(bios,name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_SKIP(1) | ROM_BIOS(bios+1)) #define ARCADIA_BIOS \ - ROM_REGION16_BE(0x80000, "user1", 0 ) \ - ROM_LOAD16_WORD( "kick12.rom", 0x000000, 0x040000, CRC(a6ce1636) SHA1(11f9e62cf299f72184835b7b2a70a16333fc0d88) ) \ - ROM_COPY( "user1", 0x000000, 0x040000, 0x040000 ) \ + ROM_REGION16_BE(0x80000, "kickstart", 0 ) \ + ROM_LOAD16_WORD("315093-01.u2", 0x000000, 0x040000, CRC(a6ce1636) SHA1(11f9e62cf299f72184835b7b2a70a16333fc0d88)) \ + ROM_COPY("kickstart", 0x000000, 0x040000, 0x040000) \ \ ROM_REGION16_BE( 0x80000, "user2", 0 ) \ ROM_SYSTEM_BIOS(0, "onep300", "OnePlay 3.00") \ @@ -866,9 +849,9 @@ ROM_END ROM_START( ar_argh ) // this plugs directly into the a500 motherboard, no arcadia bios, just the a500 kickstart and game ROMs - ROM_REGION16_BE(0x80000, "user1", 0 ) - ROM_LOAD16_WORD( "kick12.rom", 0x000000, 0x040000, CRC(a6ce1636) SHA1(11f9e62cf299f72184835b7b2a70a16333fc0d88) ) - ROM_COPY( "user1", 0x000000, 0x040000, 0x040000 ) + ROM_REGION16_BE(0x80000, "kickstart", 0 ) + ROM_LOAD16_WORD("315093-01.u2", 0x00000, 0x40000, CRC(a6ce1636) SHA1(11f9e62cf299f72184835b7b2a70a16333fc0d88)) + ROM_COPY("kickstart", 0x00000, 0x40000, 0x40000 ) ROM_REGION16_BE( 0x180000, "user3", ROMREGION_ERASEFF ) ROM_LOAD16_BYTE( "argh-1-hi-11-28-87.u12", 0x000000, 0x10000, CRC(3b1f8075) SHA1(61aeff9f6a2dff6efe4276cb0bcbb80b495e26b6) ) @@ -940,28 +923,13 @@ void arcadia_amiga_state::generic_decode(const char *tag, int bit7, int bit6, in * *************************************/ -void arcadia_amiga_state::arcadia_init() +DRIVER_INIT_MEMBER( arcadia_amiga_state, arcadia ) { - static const amiga_machine_interface arcadia_intf = - { - ANGUS_CHIP_RAM_MASK, - NULL, NULL, NULL, - NULL, - NULL, arcadia_reset_coins, - NULL, - 0 - }; - UINT16 *biosrom; - - /* configure our Amiga setup */ - amiga_machine_config(machine(), &arcadia_intf); - - /* set up memory */ - m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, memregion("user1")->base()); + m_agnus_id = AGNUS_HR_NTSC; + m_denise_id = DENISE; /* OnePlay bios is encrypted, TenPlay is not */ - biosrom = (UINT16 *)memregion("user2")->base(); + UINT16 *biosrom = (UINT16 *)memregion("user2")->base(); if (biosrom) if (biosrom[0] != 0x4afc) @@ -970,27 +938,27 @@ void arcadia_amiga_state::arcadia_init() + /************************************* * * Per-game decryption * *************************************/ -DRIVER_INIT_MEMBER(arcadia_amiga_state,none) { arcadia_init(); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,airh) { arcadia_init(); generic_decode("user3", 5, 0, 2, 4, 7, 6, 1, 3); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,bowl) { arcadia_init(); generic_decode("user3", 7, 6, 0, 1, 2, 3, 4, 5); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,blast){ arcadia_init(); generic_decode("user3", 4, 1, 7, 6, 2, 0, 3, 5); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,dart) { arcadia_init(); generic_decode("user3", 4, 0, 7, 6, 3, 1, 2, 5); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,ldrb) { arcadia_init(); generic_decode("user3", 2, 3, 4, 1, 0, 7, 5, 6); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,ninj) { arcadia_init(); generic_decode("user3", 1, 6, 5, 7, 4, 2, 0, 3); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,rdwr) { arcadia_init(); generic_decode("user3", 3, 1, 6, 4, 0, 5, 2, 7); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,sdwr) { arcadia_init(); generic_decode("user3", 6, 3, 4, 5, 2, 1, 0, 7); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,socc) { arcadia_init(); generic_decode("user3", 0, 7, 1, 6, 5, 4, 3, 2); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,sprg) { arcadia_init(); generic_decode("user3", 4, 7, 3, 0, 6, 5, 2, 1); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,xeon) { arcadia_init(); generic_decode("user3", 3, 1, 2, 4, 0, 5, 6, 7); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,pm) { arcadia_init(); generic_decode("user3", 7, 6, 5, 4, 3, 2, 1, 0); } // no scramble -DRIVER_INIT_MEMBER(arcadia_amiga_state,dlta) { arcadia_init(); generic_decode("user3", 4, 1, 7, 6, 2, 0, 3, 5); } -DRIVER_INIT_MEMBER(arcadia_amiga_state,argh) { arcadia_init(); generic_decode("user3", 5, 0, 2, 4, 7, 6, 1, 3); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,airh) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 5, 0, 2, 4, 7, 6, 1, 3); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,bowl) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 7, 6, 0, 1, 2, 3, 4, 5); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,blast){ DRIVER_INIT_CALL(arcadia); generic_decode("user3", 4, 1, 7, 6, 2, 0, 3, 5); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,dart) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 4, 0, 7, 6, 3, 1, 2, 5); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,ldrb) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 2, 3, 4, 1, 0, 7, 5, 6); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,ninj) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 1, 6, 5, 7, 4, 2, 0, 3); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,rdwr) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 3, 1, 6, 4, 0, 5, 2, 7); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,sdwr) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 6, 3, 4, 5, 2, 1, 0, 7); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,socc) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 0, 7, 1, 6, 5, 4, 3, 2); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,sprg) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 4, 7, 3, 0, 6, 5, 2, 1); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,xeon) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 3, 1, 2, 4, 0, 5, 6, 7); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,pm) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 7, 6, 5, 4, 3, 2, 1, 0); } // no scramble +DRIVER_INIT_MEMBER(arcadia_amiga_state,dlta) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 4, 1, 7, 6, 2, 0, 3, 5); } +DRIVER_INIT_MEMBER(arcadia_amiga_state,argh) { DRIVER_INIT_CALL(arcadia); generic_decode("user3", 5, 0, 2, 4, 7, 6, 1, 3); } /************************************* @@ -1000,7 +968,7 @@ DRIVER_INIT_MEMBER(arcadia_amiga_state,argh) { arcadia_init(); generic_decode("u *************************************/ /* BIOS */ -GAME( 1988, ar_bios, 0, arcadia, arcadia, arcadia_amiga_state, none, ROT0, "Arcadia Systems", "Arcadia System BIOS", GAME_IS_BIOS_ROOT ) +GAME( 1988, ar_bios, 0, arcadia, arcadia, arcadia_amiga_state, arcadia, ROT0, "Arcadia Systems", "Arcadia System BIOS", GAME_IS_BIOS_ROOT ) GAME( 1988, ar_blast, ar_bios, arcadia, arcadia, arcadia_amiga_state, blast, ROT0, "Arcadia Systems", "Blastaball (Arcadia, V 2.1)", 0 ) @@ -1012,12 +980,12 @@ GAME( 1988, ar_bowl, ar_bios, arcadia, arcadia, arcadia_amiga_state, bowl, R GAME( 1987, ar_dart, ar_bios, arcadia, arcadia, arcadia_amiga_state, dart, ROT0, "Arcadia Systems", "World Darts (Arcadia, set 1, V 2.1)", 0 ) GAME( 1987, ar_dart2, ar_dart, arcadia, arcadia, arcadia_amiga_state, dart, ROT0, "Arcadia Systems", "World Darts (Arcadia, set 2)", GAME_NOT_WORKING ) // bad dump -GAME( 1988, ar_fast, ar_bios, arcadia, arcadia, arcadia_amiga_state, none, ROT0, "Arcadia Systems", "Magic Johnson's Fast Break (Arcadia, V 2.8)", 0 ) -GAME( 1988, ar_fasta, ar_fast, arcadia, arcadia, arcadia_amiga_state, none, ROT0, "Arcadia Systems", "Magic Johnson's Fast Break (Arcadia, V 2.7)", 0 ) +GAME( 1988, ar_fast, ar_bios, arcadia, arcadia, arcadia_amiga_state, arcadia, ROT0, "Arcadia Systems", "Magic Johnson's Fast Break (Arcadia, V 2.8)", 0 ) +GAME( 1988, ar_fasta, ar_fast, arcadia, arcadia, arcadia_amiga_state, arcadia, ROT0, "Arcadia Systems", "Magic Johnson's Fast Break (Arcadia, V 2.7)", 0 ) GAME( 1988, ar_ldrb, ar_bios, arcadia, arcadia, arcadia_amiga_state, ldrb, ROT0, "Arcadia Systems", "Leader Board (Arcadia, set 1, V 2.5)", 0 ) -GAME( 1988, ar_ldrba, ar_ldrb, arcadia, arcadia, arcadia_amiga_state, none, ROT0, "Arcadia Systems", "Leader Board (Arcadia, set 2, V 2.4)", 0 ) -GAME( 1988, ar_ldrbb, ar_ldrb, arcadia, arcadia, arcadia_amiga_state, none, ROT0, "Arcadia Systems", "Leader Board (Arcadia, set 3)", 0 ) +GAME( 1988, ar_ldrba, ar_ldrb, arcadia, arcadia, arcadia_amiga_state, arcadia, ROT0, "Arcadia Systems", "Leader Board (Arcadia, set 2, V 2.4)", 0 ) +GAME( 1988, ar_ldrbb, ar_ldrb, arcadia, arcadia, arcadia_amiga_state, arcadia, ROT0, "Arcadia Systems", "Leader Board (Arcadia, set 3)", 0 ) GAME( 1987, ar_ninj, ar_bios, arcadia, arcadia, arcadia_amiga_state, ninj, ROT0, "Arcadia Systems", "Ninja Mission (Arcadia, set 1, V 2.5)", 0 ) GAME( 1987, ar_ninj2, ar_ninj, arcadia, arcadia, arcadia_amiga_state, ninj, ROT0, "Arcadia Systems", "Ninja Mission (Arcadia, set 2)", 0 ) @@ -1029,7 +997,7 @@ GAME( 1988, ar_sdwr2, ar_sdwr, arcadia, arcadia, arcadia_amiga_state, sdwr, R GAME( 1989, ar_socc, ar_bios, arcadia, arcadia, arcadia_amiga_state, socc, ROT0, "Arcadia Systems", "World Trophy Soccer (Arcadia, V 3.0)", 0 ) -GAME( 1990, ar_spot, ar_bios, arcadia, arcadia, arcadia_amiga_state, none, ROT0, "Arcadia Systems", "Spot (Arcadia, V 2.0)", 0 ) +GAME( 1990, ar_spot, ar_bios, arcadia, arcadia, arcadia_amiga_state, arcadia, ROT0, "Arcadia Systems", "Spot (Arcadia, V 2.0)", 0 ) GAME( 1987, ar_sprg, ar_bios, arcadia, arcadia, arcadia_amiga_state, sprg, ROT0, "Arcadia Systems", "Space Ranger (Arcadia, V 2.0)", 0 ) diff --git a/src/mame/drivers/cd32.c b/src/mame/drivers/cubo.c index 4bb0fc1abe1..4f04f342a3d 100644 --- a/src/mame/drivers/cd32.c +++ b/src/mame/drivers/cubo.c @@ -1,43 +1,315 @@ /* - Commodore Amiga CD-32 and related hardware - (Cubo CD32 for arcades) - - Driver by Mariusz Wojcieszek - CD-ROM controller by Ernesto Corvi - Inputs by stephh - - This is basically a CD32 (Amiga 68020, AGA based games system) hacked up to run arcade games. - see http://ninjaw.ifrance.com/cd32/cubo/ for a brief overview. - - Several of the games have Audio tracks, therefore the CRC / SHA1 information you get when - reading your own CDs may not match those in the driver. There is currently no 100% accurate - way to rip the audio data with full sub-track and offset information. - - CD32 Hardware Specs (from Wikipedia, http://en.wikipedia.org/wiki/Amiga_CD32) - * Main Processor: Motorola 68EC020 at 14.3 MHz - * System Memory: 2 MB Chip RAM - * 1 MB ROM with Kickstart ROM 3.1 and integrated cdfs.filesystem - * 1KB of FlashROM for game saves - * Graphics/Chipset: AGA Chipset - * Akiko chip, which handles CD-ROM and can do Chunky to Planar conversion - * Proprietary (MKE) CD-ROM drive at 2x speed - * Expansion socket for MPEG cartridge, as well as 3rd party devices such as the SX-1 and SX32 expansion packs. - * 4 8-bit audio channels (2 for left, 2 for right) - * Gamepad, Serial port, 2 Gameports, Interfaces for keyboard + + Cubo CD32 (additional hardware and games by CD Express, Milan, Italy) + + The CuboCD32 is a stock retail CD32 unit with additional hardware to adapt it + for JAMMA use. + + copyright-holders: Aaron Giles, Mariusz Wojcieszek, Ernesto Corvi, Stephh, Dirk Best + + Known Games: + Title | rev. | year + ---------------------------------------------- + Candy Puzzle | 1.0 | 1995 + Harem Challenge | | 1995 + Laser Quiz | | 1995 + Laser Quiz 2 "Italy" | 1.0 | 1995 + Laser Strixx | | 1995 + Laser Strixx 2 | | 1995 + Magic Premium | 1.1 | 1996 + Laser Quiz France | 1.0 | 1995 + Odeon Twister | | 199x + Odeon Twister 2 |202.19| 1999 + + + ToDo: + - remove the hack needed to make inputs working + + +Stephh's notes (based on the game M68EC020 code and some tests) : + + +1) "Candy Puzzle" + +settings (A5=0x059ac0) : + + - 051ba0.w (-$7f20,A5) : difficulty player 1 (0) + - 051ba2.w (-$7f1e,A5) : difficulty player 2 (0) + - 051ba4.w (-$7f1c,A5) : challenge rounds (3) + - 051ba6.w (-$7f1a,A5) : death in 2P mode (0) - 0 = NO / 1 = YES + - 051ba8.w (-$7f18,A5) : play x credit (1) + - 051bac.w (-$7f14,A5) : coin x 1 play (1) + - 051bb0.w (-$7f10,A5) : maxpalleattack (2) + - : reset high score - NO* / YES + - 051baa.w (-$7f16,A5) : 1 coin 2 players (1) - 0 = NO / 1 = YES + +useful addresses : + + - 051c02.w (-$7ebe,A5) : must be 0x0000 instead of 0x0001 to accept coins ! + - 051c04.b (-$7ebc,A5) : credits + - 051c10.l (-$7eb0,A5) : basic address for inputs = 0006fd18 : + * BA + 1 x 6 + 4 : start 2 (bit 5) + * BA + 1 x 6 + 0 : player 2 L/R (-1/0/1) + * BA + 1 x 6 + 2 : player 2 U/D (-1/0/1) + * BA + 0 x 6 + 4 : start 1 (bit 5) + * BA + 0 x 6 + 0 : player 1 L/R (-1/0/1) + * BA + 0 x 6 + 2 : player 1 U/D (-1/0/1) + +routines : + + - 07acae : inputs read + - 092c8a : buttons + coin read + * D0 = 0 : read potgo (player 2) + * D0 = 1 : read potgo (player 1) + - 092baa : joy read - test bits 1 and 9 : 1 if bit 1, -1 if bit 9, 0 if none + * D0 = 0 : read joy_0_dat (player 2) + * D0 = 1 : read joy_1_dat (player 1) + - 092bd4 : joy read - test bits 0 and 8 : 1 if bit 0, -1 if bit 8, 0 if none ("eor.w read, read >> 1" before test) + * D0 = 0 : read joy_0_dat (player 2) + * D0 = 1 : read joy_1_dat (player 1) + + - 07ada4 : coin verification + - 07d0fe : start buttons verification + + +2) "Harem Challenge" + +settings (A5=0x00a688 & A2=0x0028e8) : + + - : photo level - soft* / erotic / porno + - 002906.b (A2 + 0x1e) : difficulty (2) - 1 = LOW / 2 = NORMAL / 3 = HIGH + - 0028fc.b (A2 + 0x14) : deadly selftouch (0) - 0 = NO / 1 = YES + - 0028ff.b (A2 + 0x17) : energy supply - 100%* / 0% / 50% + - 002900.b (A2 + 0x18) : area to cover 1P - 75% / 80%* / 85% + - 002901.b (A2 + 0x19) : area to cover 2P - 70% / 75%* / 80% + - 002902.w (A2 + 0x1a) : level time (00C8) - 0096 = 1:00 / 00C8 = 1:20 / 00FA = 1:40 + - 002904.b (A2 + 0x1c) : tournament mode (2) - 0 = NO CHALLENGE / 2 = BEST OF 3 / 3 = BEST OF 5 + - : reset hi-score - NO* / YES + - 0028fd.b (A2 + 0x15) : coin x 1 play (1) <=> number of credits used for each play + - 0028fe.b (A2 + 0x16) : play x credit (1) <=> credits awarded for each coin + - : demo photo level - soft* / erot + +useful addresses : + + - 002907.b (-$7f00,A5 -> $1f,A2) : must be 0x00 instead of 0x01 to accept coins ! + - 00278c.w (-$7efc,A5) : player 2 inputs + - 00278e.w (-$7efa,A5) : player 1 inputs + - 002790.b (-$7ef8,A5) : credits + + - 0028e8.b (A2 ) : level - range (0x01 - 0x09 and 0x00 when in "attract mode") + - 0028ea.w (A2 + 0x02) : time (not used for "continue play") - range (0x0000 - 0x0014 with 0x0000 being max) + + - 026fe8.l (-$7fa0,A5 -> A2 + $18 x 0 + 0x00) : player 1 energy (in MSW after swap) - range (0x00000000 - 0x00270000) + - 026fec.l (-$7fa0,A5 -> A2 + $18 x 0 + 0x04) : player 1 score + - 026ff8.w (-$7fa0,A5 -> A2 + $18 x 0 + 0x10) : player 1 girls + - 027000.l (-$7fa0,A5 -> A2 + $18 x 1 + 0x00) : player 2 energy (in MSW after swap) - range (0x00000000 - 0x00270000) + - 027004.l (-$7fa0,A5 -> A2 + $18 x 1 + 0x04) : player 2 score + - 027010.w (-$7fa0,A5 -> A2 + $18 x 1 + 0x10) : player 2 girls + +routines : + + - 04a5de : inputs read + - 061928 : buttons + coin read + * D0 = 0 : read potgo (player 2) + * D0 = 1 : read potgo (player 1) + + - 04a692 : coin verification + - 050b8c : start buttons verification + + +3) "Laser Quiz" + +settings (A5=0x00a580 & A2=0x001e08) : + + - 001a54.w (see below) : numero di vite (2) + - 001e08.w (A2 ) : primo bonus dom. (5) + - 001e0a.w (A2 + 0x02) : max dom. facili (7) + - 001e0c.w (A2 + 0x04) : incremento dom. (2) + - 001e0e.w (A2 + 0x06) : inizio dom. diff. (10) + - 001e10.w (A2 + 0x08) : risposte a video (4) + - 001e12.w (A2 + 0x0a) : checkmark risp. (1) - 0 = CONTEMPORANEO / 1 = IMMEDIATO + - 001e16.w (A2 + 0x0e) : vel. chronometro (32) - 3C = LENTA / 32 = NORMALE / 28 = VELOCE + - 001e14.w (A2 + 0x0c) : volume musica (14) - 14 = NORMALE / 0A = BASSO / 00 = NO MUSICA + - 001e18.b (A2 + 0x10) : vita premio bonus (1) - 0 = PER IL PRIMO / 1 = PER EMTRAMBI + - : reset hi-score - NO* / SI + - 001e19.b (A2 + 0x11) : coin x 1 play (1) <=> number of credits used for each play + - 001e1a.b (A2 + 0x12) : foto erotiche (1) - 1 = SI / 2 = NO + +useful addresses : + + - 001e1b.b (-$7fe0,A5 -> $13,A2) : must be 0x00 instead of 0x01 to accept coins ! + - 0026a4.w (-$7f0c,A5) : player 2 inputs + - 0026a6.w (-$7f0a,A5) : player 1 inputs + - 002606.b (-$7faa,A5) : credits + + - 001a54.w (-$7fe4,A5 -> $04,A2) : lives at start + - 001a59.b (-$7fe4,A5 -> $09,A2) : bonus level (so lives aren't decremented) ? 0x00 = NO / 0x01 YES + - 001a5a.b (-$7fe4,A5 -> $0a,A2) : level - range 0x00-0x63 + + - 00c9b0.b (-$7fdc,A5 -> A2 + $06 x 0 + 0x00) : player 1 active ? 0x00 = NO / 0x01 YES / 0x02 = "ATTENDI" + - 00c9b1.b (-$7fdc,A5 -> A2 + $06 x 0 + 0x01) : player 1 lives - range 0x00-0x63 + - 00c9b2.l (-$7fdc,A5 -> A2 + $06 x 0 + 0x02) : player 1 score + - 00c9b6.b (-$7fdc,A5 -> A2 + $06 x 1 + 0x00) : player 2 active ? 0x00 = NO / 0x01 YES / 0x02 = "ATTENDI" + - 00c9b7.b (-$7fdc,A5 -> A2 + $06 x 1 + 0x01) : player 2 lives - range 0x00-0x63 + - 00c9b8.l (-$7fdc,A5 -> A2 + $06 x 1 + 0x02) : player 2 score + + - 02327c.l (-$50,A4) : player 1 inputs (ingame) + - 023280.l (-$4c,A4) : player 2 inputs (ingame) + +routines : + + - 0cedf8 : inputs read + - 0d8150 : buttons + coin read + * D0 = 0 : read potgo (player 2) + * D0 = 1 : read potgo (player 1) + + - 0cee42 : coin verification + - 0cefc6 : start buttons verification + + - 0cb40c : inputs (ingame) read + + +4) "Laser Quiz 2" + +settings (A5=0x0531e8 & A2=0x0460f0) : + + - 0460f0.w (A2 ) : numero di vite (2) + - 0460f0.w (A2 + 0x02) : primo bonus dom. (5) + - 0460f0.w (A2 + 0x04) : max dom. facili (7) + - 0460f0.w (A2 + 0x06) : incremento dom. (2) + - 0460f0.w (A2 + 0x08) : inizio dom. diff. (10) + - 0460f0.w (A2 + 0x0a) : risposte a video (4) + - 0460f0.w (A2 + 0x0c) : checkmark risp. (1) - 0 = CONTEMPORANEO / 1 = IMMEDIATO + - 0460f0.w (A2 + 0x10) : vel. chronometro (5) - 5 = LENTA / 4 = NORMALE / 3 = VELOCE + - 0460f0.w (A2 + 0x0e) : volume musica (3F) - 3F = NORMALE / 20 = BASSO / 00 = NO MUSICA + - 0460f0.b (A2 + 0x12) : vita premio bonus (1) - 0 = PER IL PRIMO / 1 = PER TUTTI + - : reset hi-score - NO* / SI + - 0460f0.b (A2 + 0x13) : coin x 1 play (1) <=> number of credits used for each play + - 0460f0.b (A2 + 0x14) : play x credit (1) <=> credits awarded for each coin + - 0460f0.b (A2 + 0x15) : foto erotiche (1) - 1 = SI / 2 = NO + - 0460f0.b (A2 + 0x16) : numero giocatori (0) - 0 = 2 / 1 = 4 + +useful addresses : + + - 046107.b (-$7fdc,A5 -> $17,A2) : must be 0x00 instead of 0x01 to accept coins ! + - 04b250.w (-$7f98,A5) : player 2 inputs + - 04b252.w (-$7f96,A5) : player 1 inputs + - 04b254.w (-$7f94,A5) : player 3 inputs + - 04b256.w (-$7f92,A5) : player 4 inputs + - 04b248.b (-$7fa0,A5) : credits + + - 04570d.b (-$7fe0,A5 -> $05,A2) : bonus level (so lives aren't decremented) ? 0x00 = NO / 0x01 YES + - 04570e.b (-$7fe4,A5 -> $06,A2) : level - range 0x00-0x63 + + - 051fc0.b (-$7fd8,A5 -> A2 + $12 x 0 + 0x00) : player 1 active ? 0x00 = NO / 0x01 = YES / 0x02 = "ATTENDI" + - 051fc1.b (-$7fd8,A5 -> A2 + $12 x 0 + 0x01) : player 1 lives - range 0x00-0x63 + - 051fc2.l (-$7fd8,A5 -> A2 + $12 x 0 + 0x02) : player 1 score + - 051fd2.b (-$7fd8,A5 -> A2 + $12 x 1 + 0x00) : player 2 active ? 0x00 = NO / 0x01 = YES / 0x02 = "ATTENDI" + - 051fd3.b (-$7fd8,A5 -> A2 + $12 x 1 + 0x01) : player 2 lives - range 0x00-0x63 + - 051fd4.l (-$7fd8,A5 -> A2 + $12 x 1 + 0x02) : player 2 score + - 051fe4.b (-$7fd8,A5 -> A2 + $12 x 2 + 0x00) : player 3 active ? 0x00 = NO / 0x01 = YES / 0x02 = "ATTENDI" + - 051fe5.b (-$7fd8,A5 -> A2 + $12 x 2 + 0x01) : player 3 lives - range 0x00-0x63 + - 051fe6.l (-$7fd8,A5 -> A2 + $12 x 2 + 0x02) : player 3 score + - 051ff6.b (-$7fd8,A5 -> A2 + $12 x 3 + 0x00) : player 4 active ? 0x00 = NO / 0x01 = YES / 0x02 = "ATTENDI" + - 051ff7.b (-$7fd8,A5 -> A2 + $12 x 3 + 0x01) : player 4 lives - range 0x00-0x63 + - 051ff8.l (-$7fd8,A5 -> A2 + $12 x 3 + 0x02) : player 4 score + +routines : + + - 0746d6 : inputs read + - 08251a : buttons + coin read + * D0 = 0 : read potgo (player 2) + * D0 = 1 : read potgo (player 1) + + - 07472e : coin verification + + +5) "Laser Strixx 2" + +settings (A5=0x00a688 & A2=0x0027f8) : + + - : photo level - soft* / erotic / porno + - 002910.l (A2 + 0x18) : difficulty (00010000) - 00008000 = LOW / 00010000 = NORMAL / 00018000 = HIGH + - 002818.b (A2 + 0x20) : deadly selftouch (0) - 0 = NO / 1 = YES + - 00281b.b (A2 + 0x23) : energy supply - 100%* / 0% / 50% + - 002819.b (A2 + 0x21) : coin x 1 play (1) <=> number of credits used for each play + - 00281a.b (A2 + 0x22) : play x credit (1) <=> credits awarded for each coin + +useful addresses : + + - 00281c.b (-$7fa2,A5 -> $24,A2) : must be 0x00 instead of 0x01 to accept coins ! + - 0026f4.l (-$7f94,A5) : player 1 inputs (in MSW after swap) + - 0026ee.b (-$7f9a,A5) : credits + + - 0027f8.l (A2 + 0x00) : player 1 energy (in MSW after swap) - range (0x00000000 - 0x00270000) + - 0027fc.b (A2 + 0x04) : level - range (0x01 - 0x09 and 0x00 when in "attract mode") + - 0027fe.w (A2 + 0x06) : time (not used for "continue play") - range (0x0000 - 0x0014 with 0x0000 being max) + - 002800.l (A2 + 0x08) : player 1 score + - 00280a.b (A2 + 0x12) : mouth status (0x00 = not out - 0x01 = out - 0x02 = captured = LIVE STRIP at the end of level) + - 00280b.b (A2 + 0x13) : strip phase (0x01 - n with 0x01 being last phase) + Ann : n = 0x05 + Eva : n = 0x04 + Jo : n = 0x06 + Sue : n = 0x04 + Bob : n = 0x05 + +routines : + + - 04d1ae : inputs read + - 058340 : buttons + coin read + * D0 = 0 : read potgo (player 2) + * D0 = 1 : read potgo (player 1) + + - 04d1da : coin verification + + +6) "Magic Number" + +settings (A5=0x053e78 & A2=0x03f540) : TO DO ! + +useful addresses : + + - 04bfa0.l (-$7ed8,A5) : must be 0x00000000 instead of 0x00010000 to accept coins ! + - 04bf18.w (-$7f60,A5) : player 1 inputs (in MSW after swap) + - 04bf78.l (-$7e00,A5) : player 2 inputs (in MSW after swap) + - 03f547.b (-$7f92,A5 -> $7,A2) : credits + +routines : + + - 07a480 : inputs read + - 085bb8 : buttons + coin read + * D0 = 0 : read potgo (player 2) + * D0 = 1 : read potgo (player 1) + + - 07a50e : coin verification + + +7) "Magic Premium" + +settings (A5=0x04ce48 & A2=0x0419b0) : TO DO ! + +useful addresses : + + - 044f7e.b (-$7eca,A5) : must be 0x00 instead of 0x01 to accept coins ! + - 044f02.w (-$7f94,A5) : player 1 inputs + - 044f6a.l (-$7ede,A5) : player 2 inputs (in MSW after swap) + - 0419b1.b (-$7fc0,A5 -> $1,A2) : credits - range 0x00-0x09 + +routines : + + - 0707d6 : inputs read + - 07b3b2 : buttons + coin read + * D0 = 0 : read potgo (player 2) + * D0 = 1 : read potgo (player 1) + + - 070802 : coin verification */ #include "emu.h" -#include "cpu/m68000/m68000.h" -#include "sound/cdda.h" -#include "machine/6526cia.h" -#include "includes/cd32.h" +#include "includes/amiga.h" #include "imagedev/chd_cd.h" -#include "machine/amigafdc.h" - -#define CD32PAL_XTAL_X1 XTAL_28_37516MHz -#define CD32PAL_XTAL_X2 XTAL_4_433619MHz -#define CD32PAL_XTAL_X3 XTAL_16_9344MHz +#include "machine/microtch.h" /* set to 0 to use control panel with only buttons (as in quiz games) - joy is default in dispenser setup */ @@ -45,26 +317,63 @@ #define MGNUMBER_USE_JOY 1 +class cubo_state : public amiga_state +{ +public: + cubo_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_p1_port(*this, "P1"), + m_p2_port(*this, "P2"), + m_microtouch(*this, "microtouch"), + m_cdda(*this, "cdda") + { } + + DECLARE_WRITE8_MEMBER(microtouch_tx); + + DECLARE_CUSTOM_INPUT_MEMBER(cubo_input); + DECLARE_CUSTOM_INPUT_MEMBER(cd32_sel_mirror_input); + + DECLARE_WRITE8_MEMBER( akiko_cia_0_port_a_write ); + + DECLARE_DRIVER_INIT(cubo); + DECLARE_DRIVER_INIT(mgprem11); + DECLARE_DRIVER_INIT(odeontw2); + DECLARE_DRIVER_INIT(cndypuzl); + DECLARE_DRIVER_INIT(haremchl); + DECLARE_DRIVER_INIT(mgnumber); + DECLARE_DRIVER_INIT(lsrquiz2); + DECLARE_DRIVER_INIT(lasstixx); + DECLARE_DRIVER_INIT(lsrquiz); + + required_ioport m_p1_port; + required_ioport m_p2_port; + + int m_oldstate[2]; + int m_cd32_shifter[2]; + UINT16 m_potgo_value; + +protected: + virtual void serdat_w(UINT16 data); + virtual void potgo_w(UINT16 data); + +private: + required_device<microtouch_device> m_microtouch; + required_device<cdda_device> m_cdda; + + typedef void (cubo_state::*input_hack_func)(); + input_hack_func m_input_hack; + + void cndypuzl_input_hack(); + void haremchl_input_hack(); + void lsrquiz_input_hack(); + void lsrquiz2_input_hack(); + void lasstixx_input_hack(); + void mgnumber_input_hack(); + void mgprem11_input_hack(); +}; + static void handle_cd32_joystick_cia(running_machine &machine, UINT8 pra, UINT8 dra); -WRITE32_MEMBER(cd32_state::aga_overlay_w) -{ - if (ACCESSING_BITS_16_23) - { - data = (data >> 16) & 1; - - /* switch banks as appropriate */ - m_bank1->set_entry(data & 1); - - /* swap the write handlers between ROM and bank 1 based on the bit */ - if ((data & 1) == 0) - /* overlay disabled, map RAM on 0x000000 */ - space.install_write_bank(0x000000, 0x1fffff, "bank1"); - else - /* overlay enabled, map Amiga system ROM on 0x000000 */ - space.unmap_write(0x000000, 0x1fffff); - } -} /************************************* * @@ -81,7 +390,8 @@ WRITE32_MEMBER(cd32_state::aga_overlay_w) * *************************************/ -WRITE8_MEMBER(cd32_state::cd32_cia_0_porta_w) + +WRITE8_MEMBER( cubo_state::akiko_cia_0_port_a_write ) { /* bit 1 = cd audio mute */ m_cdda->set_output_gain( 0, ( data & 1 ) ? 0.0 : 1.0 ); @@ -92,64 +402,43 @@ WRITE8_MEMBER(cd32_state::cd32_cia_0_porta_w) handle_cd32_joystick_cia(machine(), data, m_cia_0->read(space, 2)); } -/************************************* - * - * CIA-A port B access: - * - * PB7 = parallel data 7 - * PB6 = parallel data 6 - * PB5 = parallel data 5 - * PB4 = parallel data 4 - * PB3 = parallel data 3 - * PB2 = parallel data 2 - * PB1 = parallel data 1 - * PB0 = parallel data 0 - * - *************************************/ -READ8_MEMBER(cd32_state::cd32_cia_0_portb_r) -{ - /* parallel port */ - logerror("%s:CIA0_portb_r\n", machine().describe_context()); - return 0xff; -} -WRITE8_MEMBER(cd32_state::cd32_cia_0_portb_w) -{ - /* parallel port */ - logerror("%s:CIA0_portb_w(%02x)\n", machine().describe_context(), data); -} +static ADDRESS_MAP_START( overlay_2mb_map32, AS_PROGRAM, 32, cubo_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END -static ADDRESS_MAP_START( cd32_map, AS_PROGRAM, 32, cd32_state ) +static ADDRESS_MAP_START( cubo_mem, AS_PROGRAM, 32, cubo_state ) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1fffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram") + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) AM_RANGE(0x800000, 0x800003) AM_READ_PORT("DIPSW1") AM_RANGE(0x800010, 0x800013) AM_READ_PORT("DIPSW2") AM_RANGE(0xb80000, 0xb8003f) AM_DEVREADWRITE("akiko", akiko_device, read, write) - AM_RANGE(0xbfa000, 0xbfa003) AM_WRITE(aga_overlay_w) - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE16(amiga_cia_r, amiga_cia_w, 0xffffffff) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE16(amiga_custom_r, amiga_custom_w, 0xffffffff) AM_SHARE("custom_regs") - AM_RANGE(0xe00000, 0xe7ffff) AM_ROM AM_REGION("user1", 0x80000) /* CD32 Extended ROM */ + AM_RANGE(0xbf0000, 0xbfffff) AM_READWRITE16(cia_r, gayle_cia_w, 0xffffffff) + AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe7ffff) AM_ROM AM_REGION("kickstart", 0x80000) AM_RANGE(0xa00000, 0xf7ffff) AM_NOP - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("user1", 0x0) /* Kickstart */ + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) ADDRESS_MAP_END + /************************************* * * Inputs * *************************************/ -static void cd32_potgo_w(running_machine &machine, UINT16 data) +void cubo_state::potgo_w(UINT16 data) { - cd32_state *state = machine.driver_data<cd32_state>(); int i; - if (state->m_input_hack != NULL) - (*state->m_input_hack)(machine); + if (m_input_hack != NULL) + (this->*m_input_hack)(); - state->m_potgo_value = state->m_potgo_value & 0x5500; - state->m_potgo_value |= data & 0xaa00; + m_potgo_value = m_potgo_value & 0x5500; + m_potgo_value |= data & 0xaa00; for (i = 0; i < 8; i += 2) { @@ -157,22 +446,22 @@ static void cd32_potgo_w(running_machine &machine, UINT16 data) if (data & dir) { UINT16 d = 0x0100 << i; - state->m_potgo_value &= ~d; - state->m_potgo_value |= data & d; + m_potgo_value &= ~d; + m_potgo_value |= data & d; } } for (i = 0; i < 2; i++) { UINT16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ UINT16 p5dat = 0x0100 << (i * 4); /* data P5 */ - if ((state->m_potgo_value & p5dir) && (state->m_potgo_value & p5dat)) - state->m_cd32_shifter[i] = 8; + if ((m_potgo_value & p5dir) && (m_potgo_value & p5dat)) + m_cd32_shifter[i] = 8; } } static void handle_cd32_joystick_cia(running_machine &machine, UINT8 pra, UINT8 dra) { - cd32_state *state = machine.driver_data<cd32_state>(); + cubo_state *state = machine.driver_data<cubo_state>(); int i; for (i = 0; i < 2; i++) @@ -199,7 +488,7 @@ static void handle_cd32_joystick_cia(running_machine &machine, UINT8 pra, UINT8 static UINT16 handle_joystick_potgor(running_machine &machine, UINT16 potgor) { - cd32_state *state = machine.driver_data<cd32_state>(); + cubo_state *state = machine.driver_data<cubo_state>(); ioport_port * player_portname[] = { state->m_p2_port, state->m_p1_port }; int i; @@ -227,14 +516,12 @@ static UINT16 handle_joystick_potgor(running_machine &machine, UINT16 potgor) return potgor; } -CUSTOM_INPUT_MEMBER(cd32_state::cubo_input) +CUSTOM_INPUT_MEMBER( cubo_state::cubo_input ) { return handle_joystick_potgor(machine(), m_potgo_value) >> 8; } - - -CUSTOM_INPUT_MEMBER(cd32_state::cd32_sel_mirror_input) +CUSTOM_INPUT_MEMBER( cubo_state::cd32_sel_mirror_input ) { ioport_port* ports[2]= { m_p1_port, m_p2_port }; UINT8 bits = ports[(int)(FPTR)param]->read(); @@ -243,26 +530,26 @@ CUSTOM_INPUT_MEMBER(cd32_state::cd32_sel_mirror_input) -static INPUT_PORTS_START( cd32 ) +static INPUT_PORTS_START( cubo ) PORT_START("CIA0PORTA") PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_SPECIAL ) /* this is the regular port for reading a single button joystick on the Amiga, many CD32 games require this to mirror the pad start button! */ - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state,cd32_sel_mirror_input, 1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state,cd32_sel_mirror_input, 0) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cubo_state,cd32_sel_mirror_input, 1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cubo_state,cd32_sel_mirror_input, 0) PORT_START("CIA0PORTB") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_START("JOY0DAT") - PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state,amiga_joystick_convert, 1) + PORT_START("joy_0_dat") + PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cubo_state, amiga_joystick_convert, 1) PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_START("JOY1DAT") - PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state,amiga_joystick_convert, 0) + PORT_START("joy_1_dat") + PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cubo_state, amiga_joystick_convert, 0) PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_START("POTGO") - PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state,cubo_input, 0) + PORT_START("potgo") + PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cubo_state,cubo_input, 0) PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -275,7 +562,7 @@ static INPUT_PORTS_START( cd32 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Yellow") /* BUTTON4 */ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Red / SELECT") /* BUTTON1 = START1 */ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("P1 Blue / STOP") /* BUTTON2 */ - PORT_START("P1JOY") + PORT_START("p1_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) @@ -290,7 +577,7 @@ static INPUT_PORTS_START( cd32 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Yellow") /* BUTTON4 */ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Red / SELECT") /* BUTTON1 = START2 */ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("P2 Blue / STOP") /* BUTTON2 */ - PORT_START("P2JOY") + PORT_START("p2_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) @@ -352,7 +639,7 @@ static INPUT_PORTS_START( cd32 ) INPUT_PORTS_END static INPUT_PORTS_START( cndypuzl ) - PORT_INCLUDE( cd32 ) + PORT_INCLUDE( cubo ) PORT_MODIFY("P1") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNKNOWN ) @@ -385,7 +672,7 @@ static INPUT_PORTS_START( cndypuzl ) INPUT_PORTS_END static INPUT_PORTS_START( haremchl ) - PORT_INCLUDE( cd32 ) + PORT_INCLUDE( cubo ) PORT_MODIFY("P1") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNKNOWN ) @@ -418,15 +705,15 @@ static INPUT_PORTS_START( haremchl ) INPUT_PORTS_END static INPUT_PORTS_START( lsrquiz ) - PORT_INCLUDE( cd32 ) + PORT_INCLUDE( cubo ) - PORT_MODIFY("P1JOY") + PORT_MODIFY("p1_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_MODIFY("P2JOY") + PORT_MODIFY("p2_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) @@ -463,15 +750,15 @@ static INPUT_PORTS_START( lsrquiz ) INPUT_PORTS_END static INPUT_PORTS_START( lsrquiz2 ) - PORT_INCLUDE( cd32 ) + PORT_INCLUDE( cubo ) - PORT_MODIFY("P1JOY") + PORT_MODIFY("p1_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_MODIFY("P2JOY") + PORT_MODIFY("p2_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) @@ -521,12 +808,12 @@ static INPUT_PORTS_START( lsrquiz2 ) INPUT_PORTS_END static INPUT_PORTS_START( lasstixx ) - PORT_INCLUDE( cd32 ) + PORT_INCLUDE( cubo ) PORT_MODIFY("CIA0PORTA") PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) - PORT_MODIFY("P2JOY") + PORT_MODIFY("p2_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) @@ -563,11 +850,11 @@ static INPUT_PORTS_START( lasstixx ) INPUT_PORTS_END static INPUT_PORTS_START( mgnumber ) - PORT_INCLUDE( cd32 ) + PORT_INCLUDE( cubo ) #if MGNUMBER_USE_JOY - /* P1JOY, P2JOY, P1 and P2 inputs when control panel is set to "joystick" in the dispenser setup */ - PORT_MODIFY("P2JOY") + /* p1_joy, p2_joy, P1 and P2 inputs when control panel is set to "joystick" in the dispenser setup */ + PORT_MODIFY("p2_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) @@ -593,9 +880,9 @@ static INPUT_PORTS_START( mgnumber ) PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNKNOWN ) #else - /* P1JOY, P2JOY, P1 and P2 inputs when control panel is set to "buttons" ("pulsanti") in the dispenser setup */ - /* P1JOY is still needed in the dispenser setup, so I don't remove it even if it isn't needed to play the game */ - PORT_MODIFY("P2JOY") + /* p1_joy, p2_joy, P1 and P2 inputs when control panel is set to "buttons" ("pulsanti") in the dispenser setup */ + /* p1_joy is still needed in the dispenser setup, so I don't remove it even if it isn't needed to play the game */ + PORT_MODIFY("p2_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) @@ -638,15 +925,15 @@ static INPUT_PORTS_START( mgnumber ) INPUT_PORTS_END static INPUT_PORTS_START( mgprem11 ) - PORT_INCLUDE( cd32 ) + PORT_INCLUDE( cubo ) #if MGPREM11_USE_JOY - /* P1JOY, P2JOY, P1 and P2 inputs when control panel is set to "joystick" in the dispenser setup */ - PORT_MODIFY("P1JOY") + /* p1_joy, p2_joy, P1 and P2 inputs when control panel is set to "joystick" in the dispenser setup */ + PORT_MODIFY("p1_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_MODIFY("P2JOY") + PORT_MODIFY("p2_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) @@ -672,15 +959,15 @@ static INPUT_PORTS_START( mgprem11 ) PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_PLAYER(1) PORT_NAME( "P2 B (setup)" ) PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNKNOWN ) #else - /* P1JOY, P2JOY, P1 and P2 inputs when control panel is set to "buttons" ("pulsanti") in the dispenser setup */ - /* P1JOY is still needed in the dispenser setup, so I don't remove it even if it isn't needed to play the game */ - PORT_MODIFY("P1JOY") + /* p1_joy, p2_joy, P1 and P2 inputs when control panel is set to "buttons" ("pulsanti") in the dispenser setup */ + /* p1_joy is still needed in the dispenser setup, so I don't remove it even if it isn't needed to play the game */ + PORT_MODIFY("p1_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_MODIFY("P2JOY") + PORT_MODIFY("p2_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) @@ -730,427 +1017,91 @@ static INPUT_PORTS_START( mgprem11 ) INPUT_PORTS_END -/************************************* - * - * Sound definitions - * - *************************************/ - -#define NVRAM_SIZE 1024 -#define NVRAM_PAGE_SIZE 16 /* max size of one write request */ -static MACHINE_CONFIG_START( cd32base, cd32_state ) +static MACHINE_CONFIG_START( cubo, cubo_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68EC020, AMIGA_68EC020_PAL_CLOCK) /* 14.3 Mhz */ - MCFG_CPU_PROGRAM_MAP(cd32_map) - MCFG_DEVICE_ADD("akiko", AKIKO, 0) + MCFG_CPU_ADD("maincpu", M68EC020, amiga_state::CLK_28M_PAL / 2) + MCFG_CPU_PROGRAM_MAP(cubo_mem) - MCFG_MACHINE_START_OVERRIDE(amiga_state, amiga ) - MCFG_MACHINE_RESET_OVERRIDE(amiga_state,amiga) + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_2mb_map32) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) MCFG_I2CMEM_ADD("i2cmem") - MCFG_I2CMEM_PAGE_SIZE(NVRAM_PAGE_SIZE) - MCFG_I2CMEM_DATA_SIZE(NVRAM_SIZE) + MCFG_I2CMEM_PAGE_SIZE(16) + MCFG_I2CMEM_DATA_SIZE(1024) - /* video hardware */ + MCFG_AKIKO_ADD("akiko", "maincpu") + MCFG_AKIKO_SCL_HANDLER(DEVWRITELINE("i2cmem", i2cmem_device, write_scl)) + MCFG_AKIKO_SDA_READ_HANDLER(DEVREADLINE("i2cmem", i2cmem_device, read_sda)) + MCFG_AKIKO_SDA_WRITE_HANDLER(DEVWRITELINE("i2cmem", i2cmem_device, write_sda)) + + // video hardware MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(512*2, 312) - MCFG_SCREEN_VISIBLE_AREA((129-8-8)*2, (449+8-1+8)*2, 44-8, 300+8-1) + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_PAL / 4 * 2, 910, 186, 910, 312, 29 /* 26 */, 312) MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) - MCFG_VIDEO_START_OVERRIDE(cd32_state,amiga_aga) + MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga_aga) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("amiga", AMIGA, 3579545) + MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_PAL) MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) MCFG_SOUND_ROUTE(1, "rspeaker", 0.25) MCFG_SOUND_ROUTE(2, "rspeaker", 0.25) MCFG_SOUND_ROUTE(3, "lspeaker", 0.25) - MCFG_SOUND_ADD( "cdda", CDDA, 0 ) - MCFG_SOUND_ROUTE( 0, "lspeaker", 0.50 ) - MCFG_SOUND_ROUTE( 1, "rspeaker", 0.50 ) + MCFG_SOUND_ADD("cdda", CDDA, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) /* cia */ // these are setup differently on other amiga drivers (needed for floppy to work) which is correct / why? - MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, AMIGA_68EC020_PAL_CLOCK / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_0_irq)) + MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, amiga_state::CLK_E_PAL) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_0_irq)) MCFG_MOS6526_PA_INPUT_CALLBACK(IOPORT("CIA0PORTA")) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(cd32_state,cd32_cia_0_porta_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(cd32_state,cd32_cia_0_portb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(cd32_state,cd32_cia_0_portb_w)) - MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, AMIGA_68EC020_PAL_CLOCK / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_1_irq)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(cubo_state, akiko_cia_0_port_a_write)) + MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, amiga_state::CLK_E_PAL) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_1_irq)) + + MCFG_MICROTOUCH_ADD("microtouch", WRITE8(cubo_state, microtouch_tx)) - MCFG_MICROTOUCH_ADD( "microtouch", WRITE8(cd32_state, microtouch_tx) ) + MCFG_CDROM_ADD("cd32_cdrom") + MCFG_CDROM_INTERFACE("cd32_cdrom") /* fdc */ - MCFG_DEVICE_ADD("fdc", AMIGA_FDC, AMIGA_68000_NTSC_CLOCK) + MCFG_DEVICE_ADD("fdc", AMIGA_FDC, amiga_state::CLK_7M_PAL) MCFG_AMIGA_FDC_INDEX_CALLBACK(DEVWRITELINE("cia_1", legacy_mos6526_device, flag_w)) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( cd32, cd32base ) - MCFG_CDROM_ADD( "cdrom" ) - MCFG_CDROM_INTERFACE("cd32_cdrom") - MCFG_SOFTWARE_LIST_ADD("cd_list","cd32") -MACHINE_CONFIG_END - #define ROM_LOAD16_WORD_BIOS(bios,name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_BIOS(bios+1)) #define CD32_BIOS \ - ROM_REGION32_BE(0x100000, "user1", 0 ) \ + ROM_REGION32_BE(0x100000, "kickstart", 0 ) \ ROM_SYSTEM_BIOS(0, "cd32", "Kickstart v3.1 rev 40.60 with CD32 Extended-ROM" ) \ ROM_LOAD16_WORD_BIOS(0, "391640-03.u6a", 0x000000, 0x100000, CRC(d3837ae4) SHA1(06807db3181637455f4d46582d9972afec8956d9) ) -ROM_START( cd32 ) +ROM_START( cubo ) CD32_BIOS ROM_END -ROM_START( cd32bios ) - CD32_BIOS -ROM_END /***************************************************************************************************/ -DRIVER_INIT_MEMBER(cd32_state,cd32) +DRIVER_INIT_MEMBER( cubo_state, cubo ) { - static const amiga_machine_interface cd32_intf = - { - AGA_CHIP_RAM_MASK, - NULL, NULL, cd32_potgo_w, - NULL, - NULL, NULL, - NULL, - FLAGS_AGA_CHIPSET | FLAGS_IS_32BIT - }; - - /* configure our Amiga setup */ - amiga_machine_config(machine(), &cd32_intf); - - /* set up memory */ - m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, memregion("user1")->base()); - - /* input hack */ + m_agnus_id = ALICE_PAL_NEW; + m_denise_id = LISA; m_input_hack = NULL; } -/* BIOS */ -CONS( 1993, cd32, 0, 0, cd32, cd32, cd32_state, cd32, "Commodore Business Machines", "Amiga CD32 (PAL)" , GAME_NOT_WORKING ) - - -/* - - Cubo CD32 (additional hardware and games by CD Express, Milan, Italy) - - The CuboCD32 is a stock retail CD32 unit with additional hardware to adapt it - for JAMMA use - - Known Games: - Title | rev. | year - ---------------------------------------------- - Candy Puzzle | 1.0 | 1995 - Harem Challenge | | 1995 - Laser Quiz | | 1995 - Laser Quiz 2 "Italy" | 1.0 | 1995 - Laser Strixx | | 1995 - Laser Strixx 2 | | 1995 - Magic Premium | 1.1 | 1996 - Laser Quiz France | 1.0 | 1995 - Odeon Twister | | 199x - Odeon Twister 2 |202.19| 1999 - - - ToDo: - - remove the hack needed to make inputs working - - -Stephh's notes (based on the game M68EC020 code and some tests) : - - -1) "Candy Puzzle" - -settings (A5=0x059ac0) : - - - 051ba0.w (-$7f20,A5) : difficulty player 1 (0) - - 051ba2.w (-$7f1e,A5) : difficulty player 2 (0) - - 051ba4.w (-$7f1c,A5) : challenge rounds (3) - - 051ba6.w (-$7f1a,A5) : death in 2P mode (0) - 0 = NO / 1 = YES - - 051ba8.w (-$7f18,A5) : play x credit (1) - - 051bac.w (-$7f14,A5) : coin x 1 play (1) - - 051bb0.w (-$7f10,A5) : maxpalleattack (2) - - : reset high score - NO* / YES - - 051baa.w (-$7f16,A5) : 1 coin 2 players (1) - 0 = NO / 1 = YES - -useful addresses : - - - 051c02.w (-$7ebe,A5) : must be 0x0000 instead of 0x0001 to accept coins ! - - 051c04.b (-$7ebc,A5) : credits - - 051c10.l (-$7eb0,A5) : basic address for inputs = 0006fd18 : - * BA + 1 x 6 + 4 : start 2 (bit 5) - * BA + 1 x 6 + 0 : player 2 L/R (-1/0/1) - * BA + 1 x 6 + 2 : player 2 U/D (-1/0/1) - * BA + 0 x 6 + 4 : start 1 (bit 5) - * BA + 0 x 6 + 0 : player 1 L/R (-1/0/1) - * BA + 0 x 6 + 2 : player 1 U/D (-1/0/1) - -routines : - - - 07acae : inputs read - - 092c8a : buttons + coin read - * D0 = 0 : read POTGO (player 2) - * D0 = 1 : read POTGO (player 1) - - 092baa : joy read - test bits 1 and 9 : 1 if bit 1, -1 if bit 9, 0 if none - * D0 = 0 : read JOY0DAT (player 2) - * D0 = 1 : read JOY1DAT (player 1) - - 092bd4 : joy read - test bits 0 and 8 : 1 if bit 0, -1 if bit 8, 0 if none ("eor.w read, read >> 1" before test) - * D0 = 0 : read JOY0DAT (player 2) - * D0 = 1 : read JOY1DAT (player 1) - - - 07ada4 : coin verification - - 07d0fe : start buttons verification - - -2) "Harem Challenge" - -settings (A5=0x00a688 & A2=0x0028e8) : - - - : photo level - soft* / erotic / porno - - 002906.b (A2 + 0x1e) : difficulty (2) - 1 = LOW / 2 = NORMAL / 3 = HIGH - - 0028fc.b (A2 + 0x14) : deadly selftouch (0) - 0 = NO / 1 = YES - - 0028ff.b (A2 + 0x17) : energy supply - 100%* / 0% / 50% - - 002900.b (A2 + 0x18) : area to cover 1P - 75% / 80%* / 85% - - 002901.b (A2 + 0x19) : area to cover 2P - 70% / 75%* / 80% - - 002902.w (A2 + 0x1a) : level time (00C8) - 0096 = 1:00 / 00C8 = 1:20 / 00FA = 1:40 - - 002904.b (A2 + 0x1c) : tournament mode (2) - 0 = NO CHALLENGE / 2 = BEST OF 3 / 3 = BEST OF 5 - - : reset hi-score - NO* / YES - - 0028fd.b (A2 + 0x15) : coin x 1 play (1) <=> number of credits used for each play - - 0028fe.b (A2 + 0x16) : play x credit (1) <=> credits awarded for each coin - - : demo photo level - soft* / erot - -useful addresses : - - - 002907.b (-$7f00,A5 -> $1f,A2) : must be 0x00 instead of 0x01 to accept coins ! - - 00278c.w (-$7efc,A5) : player 2 inputs - - 00278e.w (-$7efa,A5) : player 1 inputs - - 002790.b (-$7ef8,A5) : credits - - - 0028e8.b (A2 ) : level - range (0x01 - 0x09 and 0x00 when in "attract mode") - - 0028ea.w (A2 + 0x02) : time (not used for "continue play") - range (0x0000 - 0x0014 with 0x0000 being max) - - - 026fe8.l (-$7fa0,A5 -> A2 + $18 x 0 + 0x00) : player 1 energy (in MSW after swap) - range (0x00000000 - 0x00270000) - - 026fec.l (-$7fa0,A5 -> A2 + $18 x 0 + 0x04) : player 1 score - - 026ff8.w (-$7fa0,A5 -> A2 + $18 x 0 + 0x10) : player 1 girls - - 027000.l (-$7fa0,A5 -> A2 + $18 x 1 + 0x00) : player 2 energy (in MSW after swap) - range (0x00000000 - 0x00270000) - - 027004.l (-$7fa0,A5 -> A2 + $18 x 1 + 0x04) : player 2 score - - 027010.w (-$7fa0,A5 -> A2 + $18 x 1 + 0x10) : player 2 girls - -routines : - - - 04a5de : inputs read - - 061928 : buttons + coin read - * D0 = 0 : read POTGO (player 2) - * D0 = 1 : read POTGO (player 1) - - - 04a692 : coin verification - - 050b8c : start buttons verification - - -3) "Laser Quiz" - -settings (A5=0x00a580 & A2=0x001e08) : - - - 001a54.w (see below) : numero di vite (2) - - 001e08.w (A2 ) : primo bonus dom. (5) - - 001e0a.w (A2 + 0x02) : max dom. facili (7) - - 001e0c.w (A2 + 0x04) : incremento dom. (2) - - 001e0e.w (A2 + 0x06) : inizio dom. diff. (10) - - 001e10.w (A2 + 0x08) : risposte a video (4) - - 001e12.w (A2 + 0x0a) : checkmark risp. (1) - 0 = CONTEMPORANEO / 1 = IMMEDIATO - - 001e16.w (A2 + 0x0e) : vel. chronometro (32) - 3C = LENTA / 32 = NORMALE / 28 = VELOCE - - 001e14.w (A2 + 0x0c) : volume musica (14) - 14 = NORMALE / 0A = BASSO / 00 = NO MUSICA - - 001e18.b (A2 + 0x10) : vita premio bonus (1) - 0 = PER IL PRIMO / 1 = PER EMTRAMBI - - : reset hi-score - NO* / SI - - 001e19.b (A2 + 0x11) : coin x 1 play (1) <=> number of credits used for each play - - 001e1a.b (A2 + 0x12) : foto erotiche (1) - 1 = SI / 2 = NO - -useful addresses : - - - 001e1b.b (-$7fe0,A5 -> $13,A2) : must be 0x00 instead of 0x01 to accept coins ! - - 0026a4.w (-$7f0c,A5) : player 2 inputs - - 0026a6.w (-$7f0a,A5) : player 1 inputs - - 002606.b (-$7faa,A5) : credits - - - 001a54.w (-$7fe4,A5 -> $04,A2) : lives at start - - 001a59.b (-$7fe4,A5 -> $09,A2) : bonus level (so lives aren't decremented) ? 0x00 = NO / 0x01 YES - - 001a5a.b (-$7fe4,A5 -> $0a,A2) : level - range 0x00-0x63 - - - 00c9b0.b (-$7fdc,A5 -> A2 + $06 x 0 + 0x00) : player 1 active ? 0x00 = NO / 0x01 YES / 0x02 = "ATTENDI" - - 00c9b1.b (-$7fdc,A5 -> A2 + $06 x 0 + 0x01) : player 1 lives - range 0x00-0x63 - - 00c9b2.l (-$7fdc,A5 -> A2 + $06 x 0 + 0x02) : player 1 score - - 00c9b6.b (-$7fdc,A5 -> A2 + $06 x 1 + 0x00) : player 2 active ? 0x00 = NO / 0x01 YES / 0x02 = "ATTENDI" - - 00c9b7.b (-$7fdc,A5 -> A2 + $06 x 1 + 0x01) : player 2 lives - range 0x00-0x63 - - 00c9b8.l (-$7fdc,A5 -> A2 + $06 x 1 + 0x02) : player 2 score - - - 02327c.l (-$50,A4) : player 1 inputs (ingame) - - 023280.l (-$4c,A4) : player 2 inputs (ingame) - -routines : - - - 0cedf8 : inputs read - - 0d8150 : buttons + coin read - * D0 = 0 : read POTGO (player 2) - * D0 = 1 : read POTGO (player 1) - - - 0cee42 : coin verification - - 0cefc6 : start buttons verification - - - 0cb40c : inputs (ingame) read - - -4) "Laser Quiz 2" - -settings (A5=0x0531e8 & A2=0x0460f0) : - - - 0460f0.w (A2 ) : numero di vite (2) - - 0460f0.w (A2 + 0x02) : primo bonus dom. (5) - - 0460f0.w (A2 + 0x04) : max dom. facili (7) - - 0460f0.w (A2 + 0x06) : incremento dom. (2) - - 0460f0.w (A2 + 0x08) : inizio dom. diff. (10) - - 0460f0.w (A2 + 0x0a) : risposte a video (4) - - 0460f0.w (A2 + 0x0c) : checkmark risp. (1) - 0 = CONTEMPORANEO / 1 = IMMEDIATO - - 0460f0.w (A2 + 0x10) : vel. chronometro (5) - 5 = LENTA / 4 = NORMALE / 3 = VELOCE - - 0460f0.w (A2 + 0x0e) : volume musica (3F) - 3F = NORMALE / 20 = BASSO / 00 = NO MUSICA - - 0460f0.b (A2 + 0x12) : vita premio bonus (1) - 0 = PER IL PRIMO / 1 = PER TUTTI - - : reset hi-score - NO* / SI - - 0460f0.b (A2 + 0x13) : coin x 1 play (1) <=> number of credits used for each play - - 0460f0.b (A2 + 0x14) : play x credit (1) <=> credits awarded for each coin - - 0460f0.b (A2 + 0x15) : foto erotiche (1) - 1 = SI / 2 = NO - - 0460f0.b (A2 + 0x16) : numero giocatori (0) - 0 = 2 / 1 = 4 - -useful addresses : - - - 046107.b (-$7fdc,A5 -> $17,A2) : must be 0x00 instead of 0x01 to accept coins ! - - 04b250.w (-$7f98,A5) : player 2 inputs - - 04b252.w (-$7f96,A5) : player 1 inputs - - 04b254.w (-$7f94,A5) : player 3 inputs - - 04b256.w (-$7f92,A5) : player 4 inputs - - 04b248.b (-$7fa0,A5) : credits - - - 04570d.b (-$7fe0,A5 -> $05,A2) : bonus level (so lives aren't decremented) ? 0x00 = NO / 0x01 YES - - 04570e.b (-$7fe4,A5 -> $06,A2) : level - range 0x00-0x63 - - - 051fc0.b (-$7fd8,A5 -> A2 + $12 x 0 + 0x00) : player 1 active ? 0x00 = NO / 0x01 = YES / 0x02 = "ATTENDI" - - 051fc1.b (-$7fd8,A5 -> A2 + $12 x 0 + 0x01) : player 1 lives - range 0x00-0x63 - - 051fc2.l (-$7fd8,A5 -> A2 + $12 x 0 + 0x02) : player 1 score - - 051fd2.b (-$7fd8,A5 -> A2 + $12 x 1 + 0x00) : player 2 active ? 0x00 = NO / 0x01 = YES / 0x02 = "ATTENDI" - - 051fd3.b (-$7fd8,A5 -> A2 + $12 x 1 + 0x01) : player 2 lives - range 0x00-0x63 - - 051fd4.l (-$7fd8,A5 -> A2 + $12 x 1 + 0x02) : player 2 score - - 051fe4.b (-$7fd8,A5 -> A2 + $12 x 2 + 0x00) : player 3 active ? 0x00 = NO / 0x01 = YES / 0x02 = "ATTENDI" - - 051fe5.b (-$7fd8,A5 -> A2 + $12 x 2 + 0x01) : player 3 lives - range 0x00-0x63 - - 051fe6.l (-$7fd8,A5 -> A2 + $12 x 2 + 0x02) : player 3 score - - 051ff6.b (-$7fd8,A5 -> A2 + $12 x 3 + 0x00) : player 4 active ? 0x00 = NO / 0x01 = YES / 0x02 = "ATTENDI" - - 051ff7.b (-$7fd8,A5 -> A2 + $12 x 3 + 0x01) : player 4 lives - range 0x00-0x63 - - 051ff8.l (-$7fd8,A5 -> A2 + $12 x 3 + 0x02) : player 4 score - -routines : - - - 0746d6 : inputs read - - 08251a : buttons + coin read - * D0 = 0 : read POTGO (player 2) - * D0 = 1 : read POTGO (player 1) - - - 07472e : coin verification - - -5) "Laser Strixx 2" - -settings (A5=0x00a688 & A2=0x0027f8) : - - - : photo level - soft* / erotic / porno - - 002910.l (A2 + 0x18) : difficulty (00010000) - 00008000 = LOW / 00010000 = NORMAL / 00018000 = HIGH - - 002818.b (A2 + 0x20) : deadly selftouch (0) - 0 = NO / 1 = YES - - 00281b.b (A2 + 0x23) : energy supply - 100%* / 0% / 50% - - 002819.b (A2 + 0x21) : coin x 1 play (1) <=> number of credits used for each play - - 00281a.b (A2 + 0x22) : play x credit (1) <=> credits awarded for each coin - -useful addresses : - - - 00281c.b (-$7fa2,A5 -> $24,A2) : must be 0x00 instead of 0x01 to accept coins ! - - 0026f4.l (-$7f94,A5) : player 1 inputs (in MSW after swap) - - 0026ee.b (-$7f9a,A5) : credits - - - 0027f8.l (A2 + 0x00) : player 1 energy (in MSW after swap) - range (0x00000000 - 0x00270000) - - 0027fc.b (A2 + 0x04) : level - range (0x01 - 0x09 and 0x00 when in "attract mode") - - 0027fe.w (A2 + 0x06) : time (not used for "continue play") - range (0x0000 - 0x0014 with 0x0000 being max) - - 002800.l (A2 + 0x08) : player 1 score - - 00280a.b (A2 + 0x12) : mouth status (0x00 = not out - 0x01 = out - 0x02 = captured = LIVE STRIP at the end of level) - - 00280b.b (A2 + 0x13) : strip phase (0x01 - n with 0x01 being last phase) - Ann : n = 0x05 - Eva : n = 0x04 - Jo : n = 0x06 - Sue : n = 0x04 - Bob : n = 0x05 - -routines : - - - 04d1ae : inputs read - - 058340 : buttons + coin read - * D0 = 0 : read POTGO (player 2) - * D0 = 1 : read POTGO (player 1) - - - 04d1da : coin verification - - -6) "Magic Number" - -settings (A5=0x053e78 & A2=0x03f540) : TO DO ! - -useful addresses : - - - 04bfa0.l (-$7ed8,A5) : must be 0x00000000 instead of 0x00010000 to accept coins ! - - 04bf18.w (-$7f60,A5) : player 1 inputs (in MSW after swap) - - 04bf78.l (-$7e00,A5) : player 2 inputs (in MSW after swap) - - 03f547.b (-$7f92,A5 -> $7,A2) : credits - -routines : - - - 07a480 : inputs read - - 085bb8 : buttons + coin read - * D0 = 0 : read POTGO (player 2) - * D0 = 1 : read POTGO (player 1) - - - 07a50e : coin verification - - -7) "Magic Premium" - -settings (A5=0x04ce48 & A2=0x0419b0) : TO DO ! - -useful addresses : - - - 044f7e.b (-$7eca,A5) : must be 0x00 instead of 0x01 to accept coins ! - - 044f02.w (-$7f94,A5) : player 1 inputs - - 044f6a.l (-$7ede,A5) : player 2 inputs (in MSW after swap) - - 0419b1.b (-$7fc0,A5 -> $1,A2) : credits - range 0x00-0x09 - -routines : - - - 0707d6 : inputs read - - 07b3b2 : buttons + coin read - * D0 = 0 : read POTGO (player 2) - * D0 = 1 : read POTGO (player 1) - - - 070802 : coin verification - -*/ ROM_START( cndypuzl ) @@ -1217,149 +1168,114 @@ ROM_END * *************************************/ -static void cndypuzl_input_hack(running_machine &machine) +void cubo_state::cndypuzl_input_hack() { - cd32_state *state = machine.driver_data<cd32_state>(); - cpu_device* thiscpu = (cpu_device*)state->m_maincpu; - - if (thiscpu->pc() < state->m_chip_ram.bytes()) + if (m_maincpu->pc < m_chip_ram.bytes()) { - //(*state->m_chip_ram_w)(0x051c02, 0x0000); - - UINT32 r_A5 = state->m_maincpu->state_int(M68K_A5); - (*state->m_chip_ram_w)(state, r_A5 - 0x7ebe, 0x0000); + UINT32 r_A5 = m_maincpu->state_int(M68K_A5); + (*m_chip_ram_w)(this, r_A5 - 0x7ebe, 0x0000); } } -DRIVER_INIT_MEMBER(cd32_state,cndypuzl) +DRIVER_INIT_MEMBER( cubo_state, cndypuzl ) { - DRIVER_INIT_CALL(cd32); - m_input_hack = cndypuzl_input_hack; + DRIVER_INIT_CALL(cubo); + m_input_hack = &cubo_state::cndypuzl_input_hack; } -static void haremchl_input_hack(running_machine &machine) +void cubo_state::haremchl_input_hack() { - cd32_state *state = machine.driver_data<cd32_state>(); - cpu_device* thiscpu = (cpu_device*)state->m_maincpu; - - if (thiscpu->pc() < state->m_chip_ram.bytes()) + if (m_maincpu->pc < m_chip_ram.bytes()) { - //amiga_chip_ram_w8(state, 0x002907, 0x00); - - UINT32 r_A5 = state->m_maincpu->state_int(M68K_A5); - UINT32 r_A2 = ((*state->m_chip_ram_r)(state, r_A5 - 0x7f00 + 0) << 16) | ((*state->m_chip_ram_r)(state, r_A5 - 0x7f00 + 2)); - amiga_chip_ram_w8(state, r_A2 + 0x1f, 0x00); + UINT32 r_A5 = m_maincpu->state_int(M68K_A5); + UINT32 r_A2 = ((*m_chip_ram_r)(this, r_A5 - 0x7f00 + 0) << 16) | ((*m_chip_ram_r)(this, r_A5 - 0x7f00 + 2)); + amiga_chip_ram_w8(this, r_A2 + 0x1f, 0x00); } } -DRIVER_INIT_MEMBER(cd32_state,haremchl) +DRIVER_INIT_MEMBER( cubo_state, haremchl ) { - DRIVER_INIT_CALL(cd32); - m_input_hack = haremchl_input_hack; + DRIVER_INIT_CALL(cubo); + m_input_hack = &cubo_state::haremchl_input_hack; } -static void lsrquiz_input_hack(running_machine &machine) +void cubo_state::lsrquiz_input_hack() { - cd32_state *state = machine.driver_data<cd32_state>(); - cpu_device* thiscpu = (cpu_device*)state->m_maincpu; - - if (thiscpu->pc() < state->m_chip_ram.bytes()) + if (m_maincpu->pc < m_chip_ram.bytes()) { - //amiga_chip_ram_w8(state, 0x001e1b, 0x00); - - UINT32 r_A5 = state->m_maincpu->state_int(M68K_A5); - UINT32 r_A2 = ((*state->m_chip_ram_r)(state, r_A5 - 0x7fe0 + 0) << 16) | ((*state->m_chip_ram_r)(state, r_A5 - 0x7fe0 + 2)); - amiga_chip_ram_w8(state, r_A2 + 0x13, 0x00); + UINT32 r_A5 = m_maincpu->state_int(M68K_A5); + UINT32 r_A2 = ((*m_chip_ram_r)(this, r_A5 - 0x7fe0 + 0) << 16) | ((*m_chip_ram_r)(this, r_A5 - 0x7fe0 + 2)); + amiga_chip_ram_w8(this, r_A2 + 0x13, 0x00); } } -DRIVER_INIT_MEMBER(cd32_state,lsrquiz) +DRIVER_INIT_MEMBER( cubo_state, lsrquiz ) { - DRIVER_INIT_CALL(cd32); - m_input_hack = lsrquiz_input_hack; + DRIVER_INIT_CALL(cubo); + m_input_hack = &cubo_state::lsrquiz_input_hack; } /* The hack isn't working if you exit the test mode with P1 button 2 ! */ -static void lsrquiz2_input_hack(running_machine &machine) +void cubo_state::lsrquiz2_input_hack() { - cd32_state *state = machine.driver_data<cd32_state>(); - cpu_device* thiscpu = (cpu_device*)state->m_maincpu; - - if (thiscpu->pc() < state->m_chip_ram.bytes()) + if (m_maincpu->pc < m_chip_ram.bytes()) { - //amiga_chip_ram_w8(state, 0x046107, 0x00); - - UINT32 r_A5 = state->m_maincpu->state_int(M68K_A5); - UINT32 r_A2 = ((*state->m_chip_ram_r)(state, r_A5 - 0x7fdc + 0) << 16) | ((*state->m_chip_ram_r)(state, r_A5 - 0x7fdc + 2)); - amiga_chip_ram_w8(state, r_A2 + 0x17, 0x00); + UINT32 r_A5 = m_maincpu->state_int(M68K_A5); + UINT32 r_A2 = ((*m_chip_ram_r)(this, r_A5 - 0x7fdc + 0) << 16) | ((*m_chip_ram_r)(this, r_A5 - 0x7fdc + 2)); + amiga_chip_ram_w8(this, r_A2 + 0x17, 0x00); } } -DRIVER_INIT_MEMBER(cd32_state,lsrquiz2) +DRIVER_INIT_MEMBER( cubo_state, lsrquiz2 ) { - DRIVER_INIT_CALL(cd32); - m_input_hack = lsrquiz2_input_hack; + DRIVER_INIT_CALL(cubo); + m_input_hack = &cubo_state::lsrquiz2_input_hack; } -static void lasstixx_input_hack(running_machine &machine) +void cubo_state::lasstixx_input_hack() { - cd32_state *state = machine.driver_data<cd32_state>(); - cpu_device* thiscpu = (cpu_device*)state->m_maincpu; - - if (thiscpu->pc() < state->m_chip_ram.bytes()) + if (m_maincpu->pc < m_chip_ram.bytes()) { - //amiga_chip_ram_w8(state, 0x00281c, 0x00); - - UINT32 r_A5 = state->m_maincpu->state_int(M68K_A5); - UINT32 r_A2 = ((*state->m_chip_ram_r)(state, r_A5 - 0x7fa2 + 0) << 16) | ((*state->m_chip_ram_r)(state, r_A5 - 0x7fa2 + 2)); - amiga_chip_ram_w8(state, r_A2 + 0x24, 0x00); + UINT32 r_A5 = m_maincpu->state_int(M68K_A5); + UINT32 r_A2 = ((*m_chip_ram_r)(this, r_A5 - 0x7fa2 + 0) << 16) | ((*m_chip_ram_r)(this, r_A5 - 0x7fa2 + 2)); + amiga_chip_ram_w8(this, r_A2 + 0x24, 0x00); } } -DRIVER_INIT_MEMBER(cd32_state,lasstixx) +DRIVER_INIT_MEMBER(cubo_state, lasstixx) { - DRIVER_INIT_CALL(cd32); - m_input_hack = lasstixx_input_hack; + DRIVER_INIT_CALL(cubo); + m_input_hack = &cubo_state::lasstixx_input_hack; } -static void mgnumber_input_hack(running_machine &machine) +void cubo_state::mgnumber_input_hack() { - cd32_state *state = machine.driver_data<cd32_state>(); - cpu_device* thiscpu = (cpu_device*)state->m_maincpu; - - if (thiscpu->pc() < state->m_chip_ram.bytes()) + if (m_maincpu->pc < m_chip_ram.bytes()) { - //(*state->m_chip_ram_w)(0x04bfa0, 0x0000); - - UINT32 r_A5 = state->m_maincpu->state_int(M68K_A5); - (*state->m_chip_ram_w)(state, r_A5 - 0x7ed8, 0x0000); + UINT32 r_A5 = m_maincpu->state_int(M68K_A5); + (*m_chip_ram_w)(this, r_A5 - 0x7ed8, 0x0000); } } -DRIVER_INIT_MEMBER(cd32_state,mgnumber) +DRIVER_INIT_MEMBER( cubo_state, mgnumber ) { - DRIVER_INIT_CALL(cd32); - m_input_hack = mgnumber_input_hack; + DRIVER_INIT_CALL(cubo); + m_input_hack = &cubo_state::mgnumber_input_hack; } -static void mgprem11_input_hack(running_machine &machine) +void cubo_state::mgprem11_input_hack() { - cd32_state *state = machine.driver_data<cd32_state>(); - cpu_device* thiscpu = (cpu_device*)state->m_maincpu; - - if (thiscpu->pc() < state->m_chip_ram.bytes()) + if (m_maincpu->pc < m_chip_ram.bytes()) { - //amiga_chip_ram_w8(state, 0x044f7e, 0x00); - - UINT32 r_A5 = state->m_maincpu->state_int(M68K_A5); - amiga_chip_ram_w8(state, r_A5 - 0x7eca, 0x00); + UINT32 r_A5 = m_maincpu->state_int(M68K_A5); + amiga_chip_ram_w8(this, r_A5 - 0x7eca, 0x00); } } -DRIVER_INIT_MEMBER(cd32_state,mgprem11) +DRIVER_INIT_MEMBER( cubo_state, mgprem11 ) { - DRIVER_INIT_CALL(cd32); - m_input_hack = mgprem11_input_hack; + DRIVER_INIT_CALL(cubo); + m_input_hack = &cubo_state::mgprem11_input_hack; } static INPUT_PORTS_START( odeontw2 ) @@ -1425,51 +1341,27 @@ static INPUT_PORTS_START( odeontw2 ) INPUT_PORTS_END -static void serial_w(running_machine &machine, UINT16 data) -{ - cd32_state *state = machine.driver_data<cd32_state>(); - UINT8 data8 = data & 0xff; - if ( data8 != 0x00 ) - state->m_microtouch->rx(machine.driver_data()->generic_space(), 0, data8); -} -WRITE8_MEMBER (cd32_state::microtouch_tx) +void cubo_state::serdat_w(UINT16 data) { - amiga_serial_in_w(machine(), data); + data &= 0xff; + if (data) + m_microtouch->rx(generic_space(), 0, data); } -DRIVER_INIT_MEMBER(cd32_state,odeontw2) +WRITE8_MEMBER( cubo_state::microtouch_tx ) { - static const amiga_machine_interface cd32_intf = - { - AGA_CHIP_RAM_MASK, - NULL, NULL, cd32_potgo_w, - serial_w, - NULL, NULL, - NULL, - FLAGS_AGA_CHIPSET - }; - - /* configure our Amiga setup */ - amiga_machine_config(machine(), &cd32_intf); - - /* set up memory */ - m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, memregion("user1")->base()); - - /* input hack */ - m_input_hack = NULL; + serial_in_w(data); } -/***************************************************************************************************/ -// these are clones of the cd32 SYSTEM because they run on a stock retail unit, with additional HW -GAME( 1993, cd32bios, 0, cd32base, cd32, cd32_state, cd32, ROT0, "Commodore Business Machines", "CD32 Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND | GAME_IS_BIOS_ROOT ) -GAME( 1995, cndypuzl, cd32bios, cd32base, cndypuzl, cd32_state, cndypuzl, ROT0, "CD Express", "Candy Puzzle (v1.0)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND ) -GAME( 1995, haremchl, cd32bios, cd32base, haremchl, cd32_state, haremchl, ROT0, "CD Express", "Harem Challenge", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND ) -GAME( 1995, lsrquiz, cd32bios, cd32base, lsrquiz, cd32_state, lsrquiz, ROT0, "CD Express", "Laser Quiz Italy", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND ) /* no player 2 inputs (ingame) */ -GAME( 1995, lsrquiz2, cd32bios, cd32base, lsrquiz2, cd32_state, lsrquiz2, ROT0, "CD Express", "Laser Quiz 2 Italy (v1.0)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND ) -GAME( 1995, lasstixx, cd32bios, cd32base, lasstixx, cd32_state, lasstixx, ROT0, "CD Express", "Laser Strixx 2", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND ) -GAME( 1995, mgnumber, cd32bios, cd32base, mgnumber, cd32_state, mgnumber, ROT0, "CD Express", "Magic Number", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND ) -GAME( 1996, mgprem11, cd32bios, cd32base, mgprem11, cd32_state, mgprem11, ROT0, "CD Express", "Magic Premium (v1.1)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND ) -GAME( 1999, odeontw2, cd32bios, cd32base, odeontw2, cd32_state, odeontw2, ROT0, "CD Express", "Odeon Twister 2 (v202.19)", GAME_NOT_WORKING ) + +GAME( 1993, cubo, 0, cubo, cubo, cubo_state, cubo, ROT0, "Commodore", "Cubo BIOS", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_IS_BIOS_ROOT ) +GAME( 1995, cndypuzl, cubo, cubo, cndypuzl, cubo_state, cndypuzl, ROT0, "CD Express", "Candy Puzzle (v1.0)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) +GAME( 1995, haremchl, cubo, cubo, haremchl, cubo_state, haremchl, ROT0, "CD Express", "Harem Challenge", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) +GAME( 1995, lsrquiz, cubo, cubo, lsrquiz, cubo_state, lsrquiz, ROT0, "CD Express", "Laser Quiz Italy", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) /* no player 2 inputs (ingame) */ +GAME( 1995, lsrquiz2, cubo, cubo, lsrquiz2, cubo_state, lsrquiz2, ROT0, "CD Express", "Laser Quiz 2 Italy (v1.0)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) +GAME( 1995, lasstixx, cubo, cubo, lasstixx, cubo_state, lasstixx, ROT0, "CD Express", "Laser Strixx 2", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) +GAME( 1995, mgnumber, cubo, cubo, mgnumber, cubo_state, mgnumber, ROT0, "CD Express", "Magic Number", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) +GAME( 1996, mgprem11, cubo, cubo, mgprem11, cubo_state, mgprem11, ROT0, "CD Express", "Magic Premium (v1.1)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) +GAME( 1999, odeontw2, cubo, cubo, odeontw2, cubo_state, cubo, ROT0, "CD Express", "Odeon Twister 2 (v202.19)", GAME_NOT_WORKING ) diff --git a/src/mame/drivers/mquake.c b/src/mame/drivers/mquake.c index 1784448c805..a16785a476d 100644 --- a/src/mame/drivers/mquake.c +++ b/src/mame/drivers/mquake.c @@ -40,82 +40,28 @@ #include "machine/nvram.h" #include "machine/amigafdc.h" + class mquake_state : public amiga_state { public: mquake_state(const machine_config &mconfig, device_type type, const char *tag) - : amiga_state(mconfig, type, tag) { } + : amiga_state(mconfig, type, tag), + m_es5503(*this, "es5503"), + m_es5503_rom(*this, "es5503") + { } DECLARE_DRIVER_INIT(mquake); - DECLARE_MACHINE_RESET(mquake); - DECLARE_WRITE8_MEMBER( mquake_cia_0_porta_w ); - DECLARE_READ8_MEMBER( mquake_cia_0_portb_r ); - DECLARE_WRITE8_MEMBER( mquake_cia_0_portb_w ); + DECLARE_READ8_MEMBER( es5503_sample_r ); DECLARE_WRITE16_MEMBER( output_w ); DECLARE_READ16_MEMBER( coin_chip_r ); DECLARE_WRITE16_MEMBER( coin_chip_w ); -}; - -/************************************* - * - * CIA-A port A access: - * - * PA7 = game port 1, pin 6 (fire) - * PA6 = game port 0, pin 6 (fire) - * PA5 = /RDY (disk ready) - * PA4 = /TK0 (disk track 00) - * PA3 = /WPRO (disk write protect) - * PA2 = /CHNG (disk change) - * PA1 = /LED (LED, 0=bright / audio filter control) - * PA0 = OVL (ROM/RAM overlay bit) - * - *************************************/ - -WRITE8_MEMBER(mquake_state::mquake_cia_0_porta_w) -{ - /* switch banks as appropriate */ - m_bank1->set_entry(data & 1); - - /* swap the write handlers between ROM and bank 1 based on the bit */ - if ((data & 1) == 0) - /* overlay disabled, map RAM on 0x000000 */ - m_maincpu->space(AS_PROGRAM).install_write_bank(0x000000, 0x07ffff, "bank1"); - - else - /* overlay enabled, map Amiga system ROM on 0x000000 */ - m_maincpu->space(AS_PROGRAM).unmap_write(0x000000, 0x07ffff); -} - - - -/************************************* - * - * CIA-A port B access: - * - * PB7 = parallel data 7 - * PB6 = parallel data 6 - * PB5 = parallel data 5 - * PB4 = parallel data 4 - * PB3 = parallel data 3 - * PB2 = parallel data 2 - * PB1 = parallel data 1 - * PB0 = parallel data 0 - * - *************************************/ -READ8_MEMBER(mquake_state::mquake_cia_0_portb_r) -{ - /* parallel port */ - logerror("%s:CIA0_portb_r\n", machine().describe_context()); - return 0xff; -} +private: + required_device<es5503_device> m_es5503; + required_memory_region m_es5503_rom; +}; -WRITE8_MEMBER(mquake_state::mquake_cia_0_portb_w) -{ - /* parallel port */ - logerror("%s:CIA0_portb_w(%02x)\n", machine().describe_context(), data); -} @@ -125,26 +71,23 @@ WRITE8_MEMBER(mquake_state::mquake_cia_0_portb_w) * *************************************/ -READ8_MEMBER(mquake_state::es5503_sample_r) +READ8_MEMBER( mquake_state::es5503_sample_r ) { - UINT8 *rom = memregion("es5503")->base(); - es5503_device *es5503 = machine().device<es5503_device>("es5503"); - - return rom[offset + (es5503->get_channel_strobe() * 0x10000)]; + return m_es5503_rom->base()[offset + (m_es5503->get_channel_strobe() * 0x10000)]; } static ADDRESS_MAP_START( mquake_es5503_map, AS_0, 8, mquake_state ) AM_RANGE(0x000000, 0x1ffff) AM_READ(es5503_sample_r) ADDRESS_MAP_END -WRITE16_MEMBER(mquake_state::output_w) +WRITE16_MEMBER( mquake_state::output_w ) { if (ACCESSING_BITS_0_7) logerror("%06x:output_w(%x) = %02x\n", space.device().safe_pc(), offset, data); } -READ16_MEMBER(mquake_state::coin_chip_r) +READ16_MEMBER( mquake_state::coin_chip_r ) { if (offset == 1) return ioport("COINCHIP")->read(); @@ -152,7 +95,7 @@ READ16_MEMBER(mquake_state::coin_chip_r) return 0xffff; } -WRITE16_MEMBER(mquake_state::coin_chip_w) +WRITE16_MEMBER( mquake_state::coin_chip_w ) { logerror("%06x:coin_chip_w(%02x) = %04x & %04x\n", space.device().safe_pc(), offset, data, mem_mask); } @@ -171,14 +114,27 @@ WRITE16_MEMBER(mquake_state::coin_chip_w) * *************************************/ -static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, mquake_state ) +static ADDRESS_MAP_START( overlay_512kb_map, AS_PROGRAM, 16, mquake_state ) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram") - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia_r, amiga_cia_w) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_SHARE("custom_regs") - AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE(amiga_autoconfig_r, amiga_autoconfig_w) - AM_RANGE(0xfc0000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* System ROM */ + AM_RANGE(0x000000, 0x07ffff) AM_MIRROR(0x180000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( a500_mem, AS_PROGRAM, 16, mquake_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xd80000, 0xddffff) AM_NOP + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END +static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, mquake_state ) + AM_IMPORT_FROM(a500_mem) AM_RANGE(0x200000, 0x203fff) AM_RAM AM_SHARE("nvram") AM_RANGE(0x204000, 0x2041ff) AM_DEVREADWRITE8("es5503", es5503_device, read, write, 0x00ff) AM_RANGE(0x282000, 0x282001) AM_READ_PORT("SW.LO") @@ -203,21 +159,21 @@ static INPUT_PORTS_START( mquake ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) /* JS0SW */ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* JS1SW */ - PORT_START("JOY0DAT") + PORT_START("joy_0_dat") PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mquake_state,amiga_joystick_convert, 0) PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_START("JOY1DAT") + PORT_START("joy_1_dat") PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mquake_state,amiga_joystick_convert, 1) PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_START("P1JOY") + PORT_START("p1_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) - PORT_START("P2JOY") + PORT_START("p2_joy") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) @@ -336,16 +292,6 @@ INPUT_PORTS_END -/************************************* - * - * Sound definitions - * - *************************************/ - -MACHINE_RESET_MEMBER(mquake_state,mquake) -{ - MACHINE_RESET_CALL_MEMBER(amiga); -} /************************************* * @@ -356,11 +302,16 @@ MACHINE_RESET_MEMBER(mquake_state,mquake) static MACHINE_CONFIG_START( mquake, mquake_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, AMIGA_68000_NTSC_CLOCK) + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_NTSC) MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_MACHINE_START_OVERRIDE(amiga_state, amiga) - MCFG_MACHINE_RESET_OVERRIDE(mquake_state,mquake) + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_512kb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + MCFG_NVRAM_ADD_0FILL("nvram") /* video hardware */ @@ -381,30 +332,28 @@ static MACHINE_CONFIG_START( mquake, mquake_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("amiga", AMIGA, 3579545) + MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_NTSC) MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) MCFG_SOUND_ROUTE(3, "lspeaker", 0.50) - MCFG_ES5503_ADD("es5503", 7159090) /* ES5503 is likely mono due to channel strobe used as bank select */ + MCFG_ES5503_ADD("es5503", amiga_state::CLK_7M_NTSC) /* ES5503 is likely mono due to channel strobe used as bank select */ MCFG_ES5503_OUTPUT_CHANNELS(1) MCFG_DEVICE_ADDRESS_MAP(AS_0, mquake_es5503_map) MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(0, "rspeaker", 0.50) /* cia */ - MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, AMIGA_68000_NTSC_CLOCK / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_0_irq)) + MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, amiga_state::CLK_E_NTSC) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_0_irq)) MCFG_MOS6526_PA_INPUT_CALLBACK(IOPORT("CIA0PORTA")) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(mquake_state,mquake_cia_0_porta_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(mquake_state,mquake_cia_0_portb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(mquake_state,mquake_cia_0_portb_w)) - MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, AMIGA_68000_NTSC_CLOCK / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_1_irq)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, cia_0_port_a_write)) + MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, amiga_state::CLK_E_NTSC) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_1_irq)) /* fdc */ - MCFG_DEVICE_ADD("fdc", AMIGA_FDC, AMIGA_68000_NTSC_CLOCK) + MCFG_DEVICE_ADD("fdc", AMIGA_FDC, amiga_state::CLK_7M_NTSC) MCFG_AMIGA_FDC_INDEX_CALLBACK(DEVWRITELINE("cia_1", legacy_mos6526_device, flag_w)) MACHINE_CONFIG_END @@ -417,9 +366,9 @@ MACHINE_CONFIG_END *************************************/ ROM_START( mquake ) - ROM_REGION(0x80000, "user1", 0) - ROM_LOAD16_WORD_SWAP( "kick12.rom", 0x000000, 0x40000, CRC(a6ce1636) SHA1(11f9e62cf299f72184835b7b2a70a16333fc0d88) ) - ROM_COPY( "user1", 0x000000, 0x040000, 0x040000 ) + ROM_REGION(0x80000, "kickstart", 0) + ROM_LOAD16_WORD_SWAP("315093-01.u2", 0x00000, 0x40000, CRC(a6ce1636) SHA1(11f9e62cf299f72184835b7b2a70a16333fc0d88)) + ROM_COPY("kickstart", 0x00000, 0x40000, 0x40000) ROM_REGION(0xc0000, "user2", 0) ROM_LOAD16_BYTE( "rom0l.bin", 0x00000, 0x10000, CRC(60c35ec3) SHA1(84fe88af54903cbd46044ef52bb50e8f94a94dcd) ) @@ -447,32 +396,22 @@ ROM_END + /************************************* * * Driver init * *************************************/ -DRIVER_INIT_MEMBER(mquake_state,mquake) +DRIVER_INIT_MEMBER( mquake_state, mquake ) { - static const amiga_machine_interface mquake_intf = - { - ANGUS_CHIP_RAM_MASK, - NULL, NULL, NULL, - NULL, - NULL, NULL, - NULL, - 0 - }; - amiga_machine_config(machine(), &mquake_intf); - - /* set up memory */ - m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, memregion("user1")->base()); + m_agnus_id = AGNUS_HR_NTSC; + m_denise_id = DENISE; } + /************************************* * * Game drivers diff --git a/src/mame/drivers/upscope.c b/src/mame/drivers/upscope.c index ae4adf50aaf..132ae5b8d15 100644 --- a/src/mame/drivers/upscope.c +++ b/src/mame/drivers/upscope.c @@ -35,19 +35,26 @@ class upscope_state : public amiga_state { public: upscope_state(const machine_config &mconfig, device_type type, const char *tag) - : amiga_state(mconfig, type, tag) { } + : amiga_state(mconfig, type, tag), + m_prev_cia1_porta(0xff), + m_parallel_data(0xff) + { } - UINT8 m_nvram[0x100]; + UINT8 m_nvram[0x100]; UINT8 m_prev_cia1_porta; UINT8 m_parallel_data; UINT8 m_nvram_address_latch; UINT8 m_nvram_data_latch; - DECLARE_WRITE8_MEMBER(upscope_cia_0_porta_w); - DECLARE_WRITE8_MEMBER(upscope_cia_0_portb_w); + DECLARE_READ8_MEMBER(upscope_cia_0_portb_r); + DECLARE_WRITE8_MEMBER(upscope_cia_0_portb_w); DECLARE_READ8_MEMBER(upscope_cia_1_porta_r); DECLARE_WRITE8_MEMBER(upscope_cia_1_porta_w); + DECLARE_DRIVER_INIT(upscope); + +protected: + virtual void machine_reset(); }; @@ -67,67 +74,21 @@ public: * *************************************/ -static void upscope_reset(running_machine &machine) +void upscope_state::machine_reset() { - upscope_state *state = machine.driver_data<upscope_state>(); - state->m_prev_cia1_porta = 0xff; -} - - - -/************************************* - * - * CIA-A port A access: - * - * PA7 = game port 1, pin 6 (fire) - * PA6 = game port 0, pin 6 (fire) - * PA5 = /RDY (disk ready) - * PA4 = /TK0 (disk track 00) - * PA3 = /WPRO (disk write protect) - * PA2 = /CHNG (disk change) - * PA1 = /LED (LED, 0=bright / audio filter control) - * PA0 = OVL (ROM/RAM overlay bit) - * - *************************************/ - -WRITE8_MEMBER(upscope_state::upscope_cia_0_porta_w) -{ - /* switch banks as appropriate */ - m_bank1->set_entry(data & 1); - - /* swap the write handlers between ROM and bank 1 based on the bit */ - if ((data & 1) == 0) - /* overlay disabled, map RAM on 0x000000 */ - m_maincpu->space(AS_PROGRAM).install_write_bank(0x000000, 0x07ffff, "bank1"); + // reset base machine + amiga_state::machine_reset(); - else - /* overlay enabled, map Amiga system ROM on 0x000000 */ - m_maincpu->space(AS_PROGRAM).unmap_write(0x000000, 0x07ffff); + m_prev_cia1_porta = 0xff; } - -/************************************* - * - * CIA-A port B access: - * - * PB7 = parallel data 7 - * PB6 = parallel data 6 - * PB5 = parallel data 5 - * PB4 = parallel data 4 - * PB3 = parallel data 3 - * PB2 = parallel data 2 - * PB1 = parallel data 1 - * PB0 = parallel data 0 - * - *************************************/ - -WRITE8_MEMBER(upscope_state::upscope_cia_0_portb_w) +WRITE8_MEMBER( upscope_state::upscope_cia_0_portb_w ) { m_parallel_data = data; } -READ8_MEMBER(upscope_state::upscope_cia_0_portb_r) +READ8_MEMBER( upscope_state::upscope_cia_0_portb_r ) { return m_nvram_data_latch; } @@ -149,12 +110,12 @@ READ8_MEMBER(upscope_state::upscope_cia_0_portb_r) * *************************************/ -READ8_MEMBER(upscope_state::upscope_cia_1_porta_r) +READ8_MEMBER( upscope_state::upscope_cia_1_porta_r ) { return 0xf8 | (m_prev_cia1_porta & 0x07); } -WRITE8_MEMBER(upscope_state::upscope_cia_1_porta_w) +WRITE8_MEMBER( upscope_state::upscope_cia_1_porta_w ) { /* on a low transition of POUT, we latch stuff for the NVRAM */ if ((m_prev_cia1_porta & 2) && !(data & 2)) @@ -243,14 +204,27 @@ WRITE8_MEMBER(upscope_state::upscope_cia_1_porta_w) * *************************************/ -static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, upscope_state ) +static ADDRESS_MAP_START( overlay_512kb_map, AS_PROGRAM, 16, upscope_state ) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram") - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia_r, amiga_cia_w) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_SHARE("custom_regs") - AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE(amiga_autoconfig_r, amiga_autoconfig_w) - AM_RANGE(0xfc0000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* System ROM */ + AM_RANGE(0x000000, 0x07ffff) AM_MIRROR(0x180000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END +static ADDRESS_MAP_START( a500_mem, AS_PROGRAM, 16, upscope_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xd80000, 0xddffff) AM_NOP + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, upscope_state ) + AM_IMPORT_FROM(a500_mem) AM_RANGE(0xf00000, 0xf7ffff) AM_ROM AM_REGION("user2", 0) ADDRESS_MAP_END @@ -286,11 +260,16 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( upscope, upscope_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, AMIGA_68000_NTSC_CLOCK) + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_NTSC) MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_MACHINE_START_OVERRIDE(amiga_state, amiga ) - MCFG_MACHINE_RESET_OVERRIDE(upscope_state,amiga) + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_512kb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + MCFG_NVRAM_ADD_0FILL("nvram") /* video hardware */ @@ -311,25 +290,25 @@ static MACHINE_CONFIG_START( upscope, upscope_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("amiga", AMIGA, 3579545) + MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_NTSC) MCFG_SOUND_ROUTE(0, "rspeaker", 0.50) MCFG_SOUND_ROUTE(1, "lspeaker", 0.50) MCFG_SOUND_ROUTE(2, "lspeaker", 0.50) MCFG_SOUND_ROUTE(3, "rspeaker", 0.50) /* cia */ - MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, AMIGA_68000_NTSC_CLOCK / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_0_irq)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(upscope_state,upscope_cia_0_porta_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(upscope_state,upscope_cia_0_portb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(upscope_state,upscope_cia_0_portb_w)) - MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, AMIGA_68000_NTSC_CLOCK / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_1_irq)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(upscope_state,upscope_cia_1_porta_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(upscope_state,upscope_cia_1_porta_w)) + MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, amiga_state::CLK_E_NTSC) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_0_irq)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, cia_0_port_a_write)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(upscope_state, upscope_cia_0_portb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(upscope_state, upscope_cia_0_portb_w)) + MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, amiga_state::CLK_E_NTSC) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_1_irq)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(upscope_state, upscope_cia_1_porta_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(upscope_state, upscope_cia_1_porta_w)) /* fdc */ - MCFG_DEVICE_ADD("fdc", AMIGA_FDC, AMIGA_68000_NTSC_CLOCK) + MCFG_DEVICE_ADD("fdc", AMIGA_FDC, amiga_state::CLK_7M_NTSC) MCFG_AMIGA_FDC_INDEX_CALLBACK(DEVWRITELINE("cia_1", legacy_mos6526_device, flag_w)) MACHINE_CONFIG_END @@ -342,9 +321,9 @@ MACHINE_CONFIG_END *************************************/ ROM_START( upscope ) - ROM_REGION(0x80000, "user1", 0) - ROM_LOAD16_WORD_SWAP( "kick12.rom", 0x000000, 0x40000, CRC(a6ce1636) SHA1(11f9e62cf299f72184835b7b2a70a16333fc0d88) ) - ROM_COPY( "user1", 0x000000, 0x040000, 0x040000 ) + ROM_REGION(0x80000, "kickstart", 0) + ROM_LOAD16_WORD_SWAP("315093-01.u2", 0x00000, 0x40000, CRC(a6ce1636) SHA1(11f9e62cf299f72184835b7b2a70a16333fc0d88)) + ROM_COPY("kickstart", 0x00000, 0x40000, 0x40000) ROM_REGION(0x080000, "user2", 0) ROM_LOAD16_BYTE( "upscope.u5", 0x000000, 0x008000, CRC(c109912e) SHA1(dcac9522e3c4818b2a02212b9173540fcf4bd463) ) @@ -371,25 +350,13 @@ ROM_END * *************************************/ -DRIVER_INIT_MEMBER(upscope_state,upscope) +DRIVER_INIT_MEMBER(upscope_state, upscope) { - static const amiga_machine_interface upscope_intf = - { - ANGUS_CHIP_RAM_MASK, - NULL, NULL, NULL, - NULL, - NULL, upscope_reset, - NULL, - 0 - }; - amiga_machine_config(machine(), &upscope_intf); - - /* allocate NVRAM */ - machine().device<nvram_device>("nvram")->set_base(m_nvram, sizeof(m_nvram)); + m_agnus_id = AGNUS_HR_NTSC; + m_denise_id = DENISE; - /* set up memory */ - m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, memregion("user1")->base()); + // allocate nvram + machine().device<nvram_device>("nvram")->set_base(m_nvram, sizeof(m_nvram)); } diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h index 01aed8c4e93..806397ecdbf 100644 --- a/src/mame/includes/amiga.h +++ b/src/mame/includes/amiga.h @@ -10,11 +10,15 @@ Ernesto Corvi & Mariusz Wojcieszek #ifndef __AMIGA_H__ #define __AMIGA_H__ +#include "cpu/m68000/m68000.h" +#include "machine/bankdev.h" #include "bus/centronics/ctronics.h" #include "machine/6526cia.h" #include "machine/amigafdc.h" #include "machine/msm6242.h" -#include "cpu/m68000/m68000.h" +#include "machine/akiko.h" +#include "machine/i2cmem.h" +#include "sound/amiga.h" /************************************* @@ -308,139 +312,59 @@ Ernesto Corvi & Mariusz Wojcieszek #define MAX_PLANES 6 /* 0 to 6, inclusive ( but we count from 0 to 5 ) */ -/* Clock speeds */ -#define AMIGA_68000_NTSC_CLOCK XTAL_28_63636MHz/4 -#define AMIGA_68000_PAL_CLOCK XTAL_28_37516MHz/4 -#define AMIGA_68EC020_NTSC_CLOCK XTAL_28_63636MHz/2 -#define AMIGA_68EC020_PAL_CLOCK XTAL_28_37516MHz/2 -#define CDTV_CLOCK_X1 XTAL_28_63636MHz -#define CDTV_CLOCK_X5 XTAL_28_37516MHz - - -#define ANGUS_CHIP_RAM_MASK 0x07fffe -#define FAT_ANGUS_CHIP_RAM_MASK 0x0ffffe -#define ECS_CHIP_RAM_MASK 0x1ffffe -#define AGA_CHIP_RAM_MASK 0x1ffffe - -#define FLAGS_AGA_CHIPSET (1 << 0) -#define FLAGS_IS_32BIT (1 << 1) - -struct amiga_machine_interface -{ - UINT32 chip_ram_mask; - - UINT16 (*joy0dat_r)(running_machine &machine); - UINT16 (*joy1dat_r)(running_machine &machine); - void (*potgo_w)(running_machine &machine, UINT16 data); - void (*serdat_w)(running_machine &machine, UINT16 data); +// chipset +#define IS_OCS(state) (state->m_denise_id == 0xff) +#define IS_ECS(state) (state->m_denise_id == 0xfc) +#define IS_AGA(state) (state->m_denise_id == 0xf8) - void (*scanline0_callback)(running_machine &machine); - void (*reset_callback)(running_machine &machine); - void (*nmi_callback)(running_machine &machine); - - UINT32 flags; -}; - -#define IS_AGA(intf) ( intf->chip_ram_mask == AGA_CHIP_RAM_MASK && (( intf->flags & FLAGS_AGA_CHIPSET) != 0)) -#define IS_ECS(intf) ( intf->chip_ram_mask == ECS_CHIP_RAM_MASK && (( intf->flags & FLAGS_AGA_CHIPSET) == 0)) -#define IS_ECS_OR_AGA(intf) ( intf->chip_ram_mask == ECS_CHIP_RAM_MASK) -#define IS_32BIT(intf) (( intf->flags & FLAGS_IS_32BIT) != 0) - -struct amiga_autoconfig_device -{ - UINT8 link_memory; /* link into free memory list */ - UINT8 rom_vector_valid; /* ROM vector offset valid */ - UINT8 multi_device; /* multiple devices on card */ - UINT8 size; /* number of 64k pages */ - UINT16 product_number; /* product number */ - UINT8 prefer_8meg; /* prefer 8MB address space */ - UINT8 can_shutup; /* can be shut up */ - UINT16 mfr_number; /* manufacturers number */ - UINT32 serial_number; /* serial number */ - UINT16 rom_vector; /* ROM vector offset */ - UINT8 (*int_control_r)(running_machine &machine); /* interrupt control read */ - void (*int_control_w)(running_machine &machine, UINT8 data); /* interrupt control write */ - void (*install)(running_machine &machine, offs_t base); /* memory installation */ - void (*uninstall)(running_machine &machine, offs_t base); /* memory uninstallation */ -}; - -struct autoconfig_device -{ - autoconfig_device * next; - amiga_autoconfig_device device; - offs_t base; -}; - -class amiga_sound_device; class amiga_state : public driver_device { public: - enum - { - TIMER_SCANLINE, - TIMER_AMIGA_IRQ, - TIMER_AMIGA_BLITTER, - TIMER_FINISH_SERIAL_WRITE - }; - - amiga_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), /* accelerator cards may present an interesting challenge because the maincpu will be the one on the card instead */ - m_cia_0(*this, "cia_0"), - m_cia_1(*this, "cia_1"), - m_centronics(*this, "centronics"), - m_sound(*this, "amiga"), - m_rtc(*this, "rtc"), - m_fdc(*this, "fdc"), - m_chip_ram(*this, "chip_ram", 0), - m_custom_regs(*this, "custom_regs", 0), - m_joy0dat_port(*this, "JOY0DAT"), - m_joy1dat_port(*this, "JOY1DAT"), - m_potgo_port(*this, "POTGO"), - m_pot0dat_port(*this, "POT0DAT"), - m_pot1dat_port(*this, "POT1DAT"), - m_p1joy_port(*this, "P1JOY"), - m_p2joy_port(*this, "P2JOY"), - m_bank1(*this, "bank1"), - m_screen(*this, "screen"), - m_palette(*this, "palette") - + amiga_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_chip_ram(*this, "chip_ram", 0), + m_custom_regs(*this, "custom_regs", 0), + m_agnus_id(AGNUS_NTSC), + m_denise_id(DENISE), + m_maincpu(*this, "maincpu"), + m_cia_0(*this, "cia_0"), + m_cia_1(*this, "cia_1"), + m_centronics(*this, "centronics"), + m_sound(*this, "amiga"), + m_fdc(*this, "fdc"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), + m_overlay(*this, "overlay"), + m_kickstart(*this, "kickstart"), + m_input_device(*this, "input"), + m_joy0dat_port(*this, "joy_0_dat"), + m_joy1dat_port(*this, "joy_1_dat"), + m_potgo_port(*this, "potgo"), + m_pot0dat_port(*this, "POT0DAT"), + m_pot1dat_port(*this, "POT1DAT"), + m_p1joy_port(*this, "p1_joy"), + m_p2joy_port(*this, "p2_joy"), + m_p1_mouse_x(*this, "p1_mouse_x"), + m_p1_mouse_y(*this, "p1_mouse_y"), + m_p2_mouse_x(*this, "p2_mouse_x"), + m_p2_mouse_y(*this, "p2_mouse_y"), + m_chip_ram_mask(0), + m_chip_ram_mirror(0), + m_cia_0_irq(0), + m_cia_1_irq(0), + m_centronics_busy(0), + m_centronics_perror(0), + m_centronics_select(0), + m_gayle_reset(false) { } - required_device<m68000_base_device> m_maincpu; - required_device<legacy_mos6526_device> m_cia_0; - required_device<legacy_mos6526_device> m_cia_1; - optional_device<centronics_device> m_centronics; - required_device<amiga_sound_device> m_sound; - optional_device<msm6242_device> m_rtc; - optional_device<amiga_fdc> m_fdc; - required_shared_ptr<UINT16> m_chip_ram; + UINT16 (*m_chip_ram_r)(amiga_state *state, offs_t offset); void (*m_chip_ram_w)(amiga_state *state, offs_t offset, UINT16 data); - required_shared_ptr<UINT16> m_custom_regs; - - optional_ioport m_joy0dat_port; - optional_ioport m_joy1dat_port; - optional_ioport m_potgo_port; - optional_ioport m_pot0dat_port; - optional_ioport m_pot1dat_port; - optional_ioport m_p1joy_port; - optional_ioport m_p2joy_port; - optional_memory_bank m_bank1; - - required_device<screen_device> m_screen; - optional_device<palette_device> m_palette; - - address_space* m_maincpu_program_space; - - const amiga_machine_interface *m_intf; - autoconfig_device *m_autoconfig_list; - autoconfig_device *m_cur_autoconfig; - emu_timer * m_irq_timer; - emu_timer * m_blitter_timer; + /* sprite states */ UINT8 m_sprite_comparitor_enable_mask; UINT8 m_sprite_dma_reload_mask; @@ -480,132 +404,185 @@ public: int m_aga_sprite_fetched_words; int m_aga_sprite_dma_used_words[8]; - DECLARE_CUSTOM_INPUT_MEMBER( amiga_joystick_convert ); - DECLARE_DRIVER_INIT(amiga); - DECLARE_DRIVER_INIT(cdtv); - DECLARE_DRIVER_INIT(a3000); - DECLARE_MACHINE_START(amiga); - DECLARE_MACHINE_RESET(amiga); - DECLARE_VIDEO_START(amiga); - DECLARE_PALETTE_INIT(amiga); - DECLARE_VIDEO_START(amiga_aga); + DECLARE_VIDEO_START( amiga ); + DECLARE_VIDEO_START( amiga_aga ); + DECLARE_PALETTE_INIT( amiga ); + UINT32 screen_update_amiga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_amiga_aga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(scanline_callback); - TIMER_CALLBACK_MEMBER(amiga_irq_proc); - TIMER_CALLBACK_MEMBER(amiga_blitter_proc); - TIMER_CALLBACK_MEMBER(finish_serial_write); - DECLARE_WRITE_LINE_MEMBER(amiga_cia_0_irq); - DECLARE_WRITE_LINE_MEMBER(amiga_cia_1_irq); - DECLARE_READ8_MEMBER( amiga_cia_0_portA_r ); - DECLARE_WRITE8_MEMBER( amiga_cia_0_portA_w ); - - DECLARE_READ16_MEMBER( amiga_clock_r ); - DECLARE_WRITE16_MEMBER( amiga_clock_w ); - - DECLARE_READ8_MEMBER(amiga_cia_1_porta_r); - DECLARE_WRITE_LINE_MEMBER( write_centronics_ack ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_perror ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_select ); - - DECLARE_READ16_MEMBER( amiga_custom_r ); - DECLARE_WRITE16_MEMBER( amiga_custom_w ); - - DECLARE_READ16_MEMBER( amiga_autoconfig_r ); - DECLARE_WRITE16_MEMBER( amiga_autoconfig_w ); - - DECLARE_READ16_MEMBER( amiga_cia_r ); - DECLARE_WRITE16_MEMBER( amiga_cia_w ); - // action replay - DECLARE_READ16_MEMBER( amiga_ar23_cia_r ); - DECLARE_READ16_MEMBER( amiga_ar23_mode_r ); - DECLARE_WRITE16_MEMBER( amiga_ar23_mode_w ); - void amiga_ar23_init( running_machine &machine, int ar3 ); - - DECLARE_READ8_MEMBER( amigacd_tpi6525_portc_r ); - DECLARE_WRITE8_MEMBER( amigacd_tpi6525_portb_w ); - DECLARE_WRITE_LINE_MEMBER( amigacd_tpi6525_irq ); - - DECLARE_WRITE_LINE_MEMBER(amiga_m68k_reset); - - IRQ_CALLBACK_MEMBER(amiga_ar1_irqack); - DECLARE_WRITE16_MEMBER( amiga_ar1_chipmem_w ); - DECLARE_WRITE16_MEMBER( amiga_ar23_chipmem_w ); - DECLARE_READ16_MEMBER( amiga_dmac_r ); - DECLARE_WRITE16_MEMBER( amiga_dmac_w ); + TIMER_CALLBACK_MEMBER( scanline_callback ); + TIMER_CALLBACK_MEMBER (amiga_irq_proc ); + TIMER_CALLBACK_MEMBER( amiga_blitter_proc ); + TIMER_CALLBACK_MEMBER( finish_serial_write ); + + void update_irqs(); + + void serial_in_w(UINT16 data); + attotime serial_char_period(); + + DECLARE_CUSTOM_INPUT_MEMBER( amiga_joystick_convert ); + DECLARE_CUSTOM_INPUT_MEMBER( floppy_drive_status ); + + DECLARE_WRITE_LINE_MEMBER( m68k_reset ); + + DECLARE_READ16_MEMBER( cia_r ); + DECLARE_WRITE16_MEMBER( cia_w ); + DECLARE_WRITE16_MEMBER( gayle_cia_w ); + DECLARE_WRITE8_MEMBER( cia_0_port_a_write ); + DECLARE_WRITE_LINE_MEMBER( cia_0_irq ); + DECLARE_READ8_MEMBER( cia_1_port_a_read ); + DECLARE_WRITE_LINE_MEMBER( cia_1_irq ); - int m_centronics_busy; - int m_centronics_perror; - int m_centronics_select; + DECLARE_WRITE_LINE_MEMBER( centronics_ack_w ); + DECLARE_WRITE_LINE_MEMBER( centronics_busy_w ); + DECLARE_WRITE_LINE_MEMBER( centronics_perror_w ); + DECLARE_WRITE_LINE_MEMBER( centronics_select_w ); + + DECLARE_READ16_MEMBER( custom_chip_r ); + DECLARE_WRITE16_MEMBER( custom_chip_w ); + + DECLARE_READ16_MEMBER( rom_mirror_r ); + DECLARE_READ32_MEMBER( rom_mirror32_r ); + + // standard clocks + static const int CLK_28M_PAL = XTAL_28_37516MHz; + static const int CLK_7M_PAL = CLK_28M_PAL / 4; + static const int CLK_C1_PAL = CLK_28M_PAL / 8; + static const int CLK_E_PAL = CLK_7M_PAL / 10; + + static const int CLK_28M_NTSC = XTAL_28_63636MHz; + static const int CLK_7M_NTSC = CLK_28M_NTSC / 4; + static const int CLK_C1_NTSC = CLK_28M_NTSC / 8; + static const int CLK_E_NTSC = CLK_7M_NTSC / 10; + + required_shared_ptr<UINT16> m_chip_ram; + required_shared_ptr<UINT16> m_custom_regs; + + emu_timer *m_blitter_timer; + + UINT16 m_agnus_id; + UINT16 m_denise_id; + + void custom_chip_w(UINT16 offset, UINT16 data, UINT16 mem_mask = 0xffff) + { + custom_chip_w(m_maincpu->space(AS_PROGRAM), offset, data, mem_mask); + } protected: + // agnus/alice chip id + enum + { + AGNUS_PAL = 0x00, + AGNUS_NTSC = 0x10, + AGNUS_HR_PAL = 0x20, + AGNUS_HR_PAL_NEW = 0x21, + AGNUS_HR_NTSC = 0x30, + AGNUS_HR_NTSC_NEW = 0x31, + ALICE_PAL = 0x22, + ALICE_PAL_NEW = 0x23, + ALICE_NTSC = 0x32, + ALICE_NTSC_NEW = 0x33 + }; + + // denise/lisa chip id + enum + { + DENISE = 0xffff, // actually this register doesn't exist on ocs + DENISE_HR = 0x00fc, + LISA = 0x00f8 + }; + + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + + // device_t overrides virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; + void custom_chip_reset(); -/*----------- defined in machine/amiga.c -----------*/ + // interrupts + void set_interrupt(int interrupt); -extern const char *const amiga_custom_names[0x100]; + virtual void update_irq2() + { + set_interrupt((m_cia_0_irq ? 0x8000 : 0x0000) | INTENA_PORTS); + } -void amiga_chip_ram_w8(amiga_state *state, offs_t offset, UINT8 data); + virtual void update_irq6() + { + set_interrupt((m_cia_1_irq ? 0x8000 : 0x0000) | INTENA_EXTER); + } -void amiga_machine_config(running_machine &machine, const amiga_machine_interface *intf); + virtual void vblank(); + virtual void potgo_w(UINT16 data) {}; + virtual void serdat_w(UINT16 data) {}; + // joystick/mouse + virtual UINT16 joy0dat_r(); + virtual UINT16 joy1dat_r(); + // devices + required_device<m68000_base_device> m_maincpu; + required_device<legacy_mos6526_device> m_cia_0; + required_device<legacy_mos6526_device> m_cia_1; + optional_device<centronics_device> m_centronics; + required_device<amiga_sound_device> m_sound; + optional_device<amiga_fdc> m_fdc; + required_device<screen_device> m_screen; + optional_device<palette_device> m_palette; + required_device<address_map_bank_device> m_overlay; + optional_memory_region m_kickstart; + // i/o ports + optional_ioport m_input_device; + optional_ioport m_joy0dat_port; + optional_ioport m_joy1dat_port; + optional_ioport m_potgo_port; + optional_ioport m_pot0dat_port; + optional_ioport m_pot1dat_port; + optional_ioport m_p1joy_port; + optional_ioport m_p2joy_port; + optional_ioport m_p1_mouse_x; + optional_ioport m_p1_mouse_y; + optional_ioport m_p2_mouse_x; + optional_ioport m_p2_mouse_y; -void amiga_serial_in_w(running_machine &machine, UINT16 data); -attotime amiga_get_serial_char_period(running_machine &machine); + UINT32 m_chip_ram_mask; + UINT32 m_chip_ram_mirror; -void amiga_add_autoconfig(running_machine &machine, const amiga_autoconfig_device *device); + int m_cia_0_irq; + int m_cia_1_irq; -const amiga_machine_interface *amiga_get_interface(running_machine &machine); +private: + enum + { + TIMER_SCANLINE, + TIMER_AMIGA_IRQ, + TIMER_AMIGA_BLITTER, + TIMER_FINISH_SERIAL_WRITE + }; + int m_centronics_busy; + int m_centronics_perror; + int m_centronics_select; -/*----------- defined in audio/amiga.c -----------*/ + emu_timer *m_irq_timer; -struct audio_channel -{ - emu_timer * irq_timer; - UINT32 curlocation; - UINT16 curlength; - UINT16 curticks; - UINT8 index; - UINT8 dmaenabled; - UINT8 manualmode; - INT8 latched; + bool m_gayle_reset; }; -class amiga_sound_device : public device_t, - public device_sound_interface -{ -public: - amiga_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~amiga_sound_device() {} - void update(); - void data_w(int which, UINT16 data); +/*----------- defined in machine/amiga.c -----------*/ -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); +extern const char *const amiga_custom_names[0x100]; - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); -private: - // internal state - audio_channel m_channel[4]; - sound_stream * m_stream; +void amiga_chip_ram_w8(amiga_state *state, offs_t offset, UINT8 data); - TIMER_CALLBACK_MEMBER( signal_irq ); -}; -extern const device_type AMIGA; /*----------- defined in video/amiga.c -----------*/ diff --git a/src/mame/machine/amiga.c b/src/mame/machine/amiga.c index 0538a38c76a..09cda3d589b 100644 --- a/src/mame/machine/amiga.c +++ b/src/mame/machine/amiga.c @@ -133,34 +133,18 @@ const char *const amiga_custom_names[0x100] = /************************************* * - * Prototypes - * - *************************************/ - -static void custom_reset(running_machine &machine); -static void autoconfig_reset(running_machine &machine); - - - - - - -/************************************* - * * Chipmem 16/32 bit access * *************************************/ static UINT16 amiga_chip_ram16_r(amiga_state *state, offs_t offset) { - offset &= state->m_intf->chip_ram_mask; + // logerror("chip ram read %08x\n", offset); return (offset < state->m_chip_ram.bytes()) ? state->m_chip_ram[offset/2] : 0xffff; } static UINT16 amiga_chip_ram32_r(amiga_state *state, offs_t offset) { - offset &= state->m_intf->chip_ram_mask; - if (offset < state->m_chip_ram.bytes()) { UINT32 *amiga_chip_ram32 = reinterpret_cast<UINT32 *>(state->m_chip_ram.target()); @@ -177,16 +161,12 @@ static UINT16 amiga_chip_ram32_r(amiga_state *state, offs_t offset) static void amiga_chip_ram16_w(amiga_state *state, offs_t offset, UINT16 data) { - offset &= state->m_intf->chip_ram_mask; - if (offset < state->m_chip_ram.bytes()) state->m_chip_ram[offset/2] = data; } static void amiga_chip_ram32_w(amiga_state *state, offs_t offset, UINT16 data) { - offset &= state->m_intf->chip_ram_mask; - if (offset < state->m_chip_ram.bytes()) { UINT32 *amiga_chip_ram32 = reinterpret_cast<UINT32 *>(state->m_chip_ram.target()); @@ -226,80 +206,77 @@ void amiga_chip_ram_w8(amiga_state *state, offs_t offset, UINT8 data) (*state->m_chip_ram_w)(state, offset, dat); } + + /************************************* * - * Machine config/reset + * Machine reset * *************************************/ -void amiga_machine_config(running_machine &machine, const amiga_machine_interface *intf) +void amiga_state::machine_start() { - amiga_state *state = machine.driver_data<amiga_state>(); - state->m_intf = intf; + // add callback for RESET instruction + m_maincpu->set_reset_callback(write_line_delegate(FUNC(amiga_state::m68k_reset), this)); - /* setup chipmem handlers */ - if ( IS_32BIT(intf) ) + switch (m_maincpu->space(AS_PROGRAM).data_width()) { - state->m_chip_ram_r = amiga_chip_ram32_r; - state->m_chip_ram_w = amiga_chip_ram32_w; - } - else - { - state->m_chip_ram_r = amiga_chip_ram16_r; - state->m_chip_ram_w = amiga_chip_ram16_w; + case 16: + m_chip_ram_r = amiga_chip_ram16_r; + m_chip_ram_w = amiga_chip_ram16_w; + break; + case 32: + m_chip_ram_r = amiga_chip_ram32_r; + m_chip_ram_w = amiga_chip_ram32_w; + break; + default: + fatalerror("Invalid data bus width\n"); } - /* setup the timers */ - state->m_irq_timer = state->timer_alloc(amiga_state::TIMER_AMIGA_IRQ); - state->m_blitter_timer = state->timer_alloc(amiga_state::TIMER_AMIGA_BLITTER); + m_chip_ram_mask = m_chip_ram.mask() & ~1; + m_chip_ram_mirror = ~m_chip_ram.mask() & 0x1fffff; -} + // setup the timers + m_irq_timer = timer_alloc(TIMER_AMIGA_IRQ); + m_blitter_timer = timer_alloc(TIMER_AMIGA_BLITTER); + // start the scanline timer + timer_set(m_screen->time_until_pos(0), TIMER_SCANLINE); +} -WRITE_LINE_MEMBER(amiga_state::amiga_m68k_reset) +WRITE_LINE_MEMBER( amiga_state::m68k_reset ) { - address_space &space = m_maincpu->space(AS_PROGRAM); - - logerror("Executed RESET at PC=%06x\n", space.device().safe_pc()); + logerror("%s: Executed RESET\n", space().machine().describe_context()); + machine_reset(); +} - /* Initialize the various chips */ +void amiga_state::machine_reset() +{ + // reset cia chips m_cia_0->reset(); m_cia_1->reset(); - custom_reset(machine()); - autoconfig_reset(machine()); - /* set the overlay bit */ - if ( IS_AGA(m_intf) ) - { - space.write_byte( 0xbfa001, 1 ); - } - else - { - amiga_cia_w(space, 0x1001/2, 1, 0xffff); - } + // reset custom chip registers + custom_chip_reset(); + + // map kickstart rom to location 0 + // this either done by reseting the cia chips + // or directly by gayle where available + m_gayle_reset = true; + m_overlay->set_bank(1); } -MACHINE_START_MEMBER(amiga_state,amiga) +// simple mirror of region 0xf80000 to 0xfbffff +READ16_MEMBER( amiga_state::rom_mirror_r ) { - m_maincpu_program_space = &m_maincpu->space(AS_PROGRAM); + return m_maincpu->space(AS_PROGRAM).read_word(offset + 0xf80000, mem_mask); } -MACHINE_RESET_MEMBER(amiga_state,amiga) +READ32_MEMBER( amiga_state::rom_mirror32_r ) { - /* set m68k reset function */ - m_maincpu->set_reset_callback(write_line_delegate(FUNC(amiga_state::amiga_m68k_reset),this)); - - amiga_m68k_reset(1); - - /* call the system-specific callback */ - if (m_intf->reset_callback) - (*m_intf->reset_callback)(machine()); - - /* start the scanline timer */ - timer_set(m_screen->time_until_pos(0), TIMER_SCANLINE); + return m_maincpu->space(AS_PROGRAM).read_dword(offset + 0xf80000, mem_mask); } - void amiga_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) @@ -328,33 +305,32 @@ void amiga_state::device_timer(emu_timer &timer, device_timer_id id, int param, * *************************************/ -TIMER_CALLBACK_MEMBER(amiga_state::scanline_callback) +void amiga_state::vblank() { - int scanline = param; + // signal vblank irq + set_interrupt(INTENA_SETCLR | INTENA_VERTB); - /* on the first scanline, we do some extra bookkeeping */ - if (scanline == 0) - { - /* signal VBLANK IRQ */ - amiga_custom_w(m_maincpu->space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_VERTB, 0xffff); + // clock cia a (todo: this can be connected to either a fixed 50/60hz signal from the power supply, or the vblank) + m_cia_0->tod_w(1); + m_cia_0->tod_w(0); +} - /* clock the first CIA TOD */ - m_cia_0->tod_w(1); - m_cia_0->tod_w(0); +TIMER_CALLBACK_MEMBER( amiga_state::scanline_callback ) +{ + int scanline = param; - /* call the system-specific callback */ - if (m_intf->scanline0_callback != NULL) - (*m_intf->scanline0_callback)(machine()); - } + // on the first scanline, we do some extra bookkeeping + if (scanline == 0) + vblank(); - /* on every scanline, clock the second CIA TOD */ + // on every scanline, clock the second cia tod m_cia_1->tod_w(1); m_cia_1->tod_w(0); - /* render up to this scanline */ + // render up to this scanline if (!m_screen->update_partial(scanline)) { - if (IS_AGA(m_intf)) + if (IS_AGA(this)) { bitmap_rgb32 dummy_bitmap; amiga_aga_render_scanline(machine(), dummy_bitmap, scanline); @@ -366,10 +342,10 @@ TIMER_CALLBACK_MEMBER(amiga_state::scanline_callback) } } - /* force a sound update */ + // force a sound update m_sound->update(); - /* set timer for next line */ + // set timer for next line scanline = (scanline + 1) % m_screen->height(); timer_set(m_screen->time_until_pos(scanline), TIMER_SCANLINE, scanline); } @@ -382,64 +358,71 @@ TIMER_CALLBACK_MEMBER(amiga_state::scanline_callback) * *************************************/ -static void update_irqs(running_machine &machine) +void amiga_state::set_interrupt(int interrupt) { - amiga_state *state = machine.driver_data<amiga_state>(); + custom_chip_w(m_maincpu->space(AS_PROGRAM), REG_INTREQ, interrupt, 0xffff); +} + +void amiga_state::update_irqs() +{ + amiga_state *state = this; int ints = CUSTOM_REG(REG_INTENA) & CUSTOM_REG(REG_INTREQ); - /* Master interrupt switch */ - if (CUSTOM_REG(REG_INTENA) & 0x4000) + // master interrupt switch + if (CUSTOM_REG(REG_INTENA) & INTENA_INTEN) { - /* Serial transmit buffer empty, disk block finished, software interrupts */ - state->m_maincpu->set_input_line(1, ints & 0x0007 ? ASSERT_LINE : CLEAR_LINE); - - /* I/O ports and timer interrupts */ - state->m_maincpu->set_input_line(2, ints & 0x0008 ? ASSERT_LINE : CLEAR_LINE); - - /* Copper, VBLANK, blitter interrupts */ - state->m_maincpu->set_input_line(3, ints & 0x0070 ? ASSERT_LINE : CLEAR_LINE); - - /* Audio interrupts */ - state->m_maincpu->set_input_line(4, ints & 0x0780 ? ASSERT_LINE : CLEAR_LINE); - - /* Serial receive buffer full, disk sync match */ - state->m_maincpu->set_input_line(5, ints & 0x1800 ? ASSERT_LINE : CLEAR_LINE); - - /* External interrupts */ - state->m_maincpu->set_input_line(6, ints & 0x2000 ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(1, ints & (INTENA_TBE | INTENA_DSKBLK | INTENA_SOFT) ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(2, ints & (INTENA_PORTS) ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(3, ints & (INTENA_COPER | INTENA_VERTB | INTENA_BLIT) ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(4, ints & (INTENA_AUD0 | INTENA_AUD1 | INTENA_AUD2 | INTENA_AUD3) ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(5, ints & (INTENA_RBF | INTENA_DSKSYN) ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(6, ints & (INTENA_EXTER) ? ASSERT_LINE : CLEAR_LINE); } else { - state->m_maincpu->set_input_line(1, CLEAR_LINE); - state->m_maincpu->set_input_line(2, CLEAR_LINE); - state->m_maincpu->set_input_line(3, CLEAR_LINE); - state->m_maincpu->set_input_line(4, CLEAR_LINE); - state->m_maincpu->set_input_line(5, CLEAR_LINE); - state->m_maincpu->set_input_line(6, CLEAR_LINE); + m_maincpu->set_input_line(1, CLEAR_LINE); + m_maincpu->set_input_line(2, CLEAR_LINE); + m_maincpu->set_input_line(3, CLEAR_LINE); + m_maincpu->set_input_line(4, CLEAR_LINE); + m_maincpu->set_input_line(5, CLEAR_LINE); + m_maincpu->set_input_line(6, CLEAR_LINE); } } - -TIMER_CALLBACK_MEMBER(amiga_state::amiga_irq_proc) +TIMER_CALLBACK_MEMBER( amiga_state::amiga_irq_proc ) { - update_irqs(machine()); - m_irq_timer->reset( ); + update_irqs(); + m_irq_timer->reset(); } +//************************************************************************** +// INPUTS +//************************************************************************** -/************************************* - * - * Standard joystick conversion - * - *************************************/ +UINT16 amiga_state::joy0dat_r() +{ + if (m_input_device->read_safe(0xff) & 0x10) + return m_joy0dat_port->read_safe(0xffff); + else + return (m_p1_mouse_y->read_safe(0xff) << 8) | m_p1_mouse_x->read_safe(0xff); +} + +UINT16 amiga_state::joy1dat_r() +{ + if (m_input_device->read_safe(0xff) & 0x20) + return m_joy1dat_port->read_safe(0xffff); + else + return (m_p2_mouse_y->read_safe(0xff) << 8) | m_p2_mouse_x->read_safe(0xff); +} CUSTOM_INPUT_MEMBER( amiga_state::amiga_joystick_convert ) { - ioport_port* ports[2] = { m_p1joy_port, m_p2joy_port }; - UINT8 bits; - if (ports[(int)(FPTR)param]) bits = ports[(int)(FPTR)param]->read(); - else bits = 0xff; + ioport_port *ports[2] = { m_p1joy_port, m_p2joy_port }; + UINT8 bits = 0xff; + + if (ports[(int)(FPTR)param]) + bits = ports[(int)(FPTR)param]->read(); int up = (bits >> 0) & 1; int down = (bits >> 1) & 1; @@ -483,6 +466,7 @@ static UINT32 blit_ascending(amiga_state *state) /* fetch data for A */ if (CUSTOM_REG(REG_BLTCON0) & 0x0800) { + //CUSTOM_REG(REG_BLTADAT) = state->m_maincpu->space(AS_PROGRAM).read_word(CUSTOM_REG_LONG(REG_BLTAPTH)); CUSTOM_REG(REG_BLTADAT) = (*state->m_chip_ram_r)(state, CUSTOM_REG_LONG(REG_BLTAPTH)); CUSTOM_REG_LONG(REG_BLTAPTH) += 2; } @@ -913,7 +897,7 @@ static UINT32 blit_line(amiga_state *state) * *************************************/ -TIMER_CALLBACK_MEMBER(amiga_state::amiga_blitter_proc) +TIMER_CALLBACK_MEMBER( amiga_state::amiga_blitter_proc ) { amiga_state *state = machine().driver_data<amiga_state>(); UINT32 blitsum = 0; @@ -960,11 +944,11 @@ TIMER_CALLBACK_MEMBER(amiga_state::amiga_blitter_proc) /* no longer busy */ CUSTOM_REG(REG_DMACON) &= ~0x4000; - /* signal an interrupt */ - amiga_custom_w(m_maincpu->space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_BLIT, 0xffff); + // signal an interrupt + set_interrupt(0x8000 | INTENA_BLIT); /* reset the blitter timer */ - m_blitter_timer->reset( ); + m_blitter_timer->reset(); } @@ -1022,7 +1006,7 @@ static void blitter_setup(address_space &space) } /* AGA has twice the bus bandwidth, so blits take half the time */ - if ( IS_AGA(state->m_intf) ) + if (IS_AGA(state)) blittime /= 2; /* signal blitter busy */ @@ -1033,141 +1017,147 @@ static void blitter_setup(address_space &space) } +//************************************************************************** +// CENTRONICS +//************************************************************************** -/************************************* - * - * 8520 CIA read handler - * - *************************************/ +WRITE_LINE_MEMBER( amiga_state::centronics_ack_w ) +{ + m_cia_0->flag_w(state); +} -READ16_MEMBER( amiga_state::amiga_cia_r ) +WRITE_LINE_MEMBER( amiga_state::centronics_busy_w ) { - UINT8 data; - int shift; + m_centronics_busy = state; + m_cia_1->sp_w(state); +} - /* offsets 0000-07ff reference CIA B, and are accessed via the MSB */ - if ((offset & 0x0800) == 0) - { - data = m_cia_1->read(space, offset >> 7); - shift = 8; - } +WRITE_LINE_MEMBER( amiga_state::centronics_perror_w ) +{ + m_centronics_perror = state; + m_cia_1->cnt_w(state); +} - /* offsets 0800-0fff reference CIA A, and are accessed via the LSB */ - else - { - data = m_cia_0->read(space, offset >> 7); - shift = 0; - } +WRITE_LINE_MEMBER( amiga_state::centronics_select_w ) +{ + m_centronics_select = state; +} - if (LOG_CIA) - logerror("%06x:cia_%c_read(%03x) = %04x & %04x\n", space.device().safe_pc(), 'A' + ((~offset & 0x0800) >> 11), offset * 2, data << shift, mem_mask); - return data << shift; -} +//************************************************************************** +// 8520 CIA +//************************************************************************** +// CIA-A access: 101x xxxx xxx0 oooo xxxx xxx1 +// CIA-B access: 101x xxxx xx0x oooo xxxx xxx0 +READ16_MEMBER( amiga_state::cia_r ) +{ + UINT16 data = 0; -/************************************* - * - * 8520 CIA write handler - * - *************************************/ + if ((offset & 0x1000/2) == 0 && ACCESSING_BITS_0_7) + data |= m_cia_0->read(space, offset >> 7); -WRITE16_MEMBER( amiga_state::amiga_cia_w ) + if ((offset & 0x2000/2) == 0 && ACCESSING_BITS_8_15) + data |= m_cia_1->read(space, offset >> 7) << 8; + + if (LOG_CIA) + logerror("%s: cia_r(%06x) = %04x & %04x\n", space.machine().describe_context(), offset, data, mem_mask); + + return data; +} + +WRITE16_MEMBER( amiga_state::cia_w ) { if (LOG_CIA) - logerror("%06x:cia_%c_write(%03x) = %04x & %04x\n", space.device().safe_pc(), 'A' + ((~offset & 0x0800) >> 11), offset * 2, data, mem_mask); + logerror("%s: cia_w(%06x) = %04x & %04x\n", space.machine().describe_context(), offset, data, mem_mask); - /* offsets 0000-07ff reference CIA B, and are accessed via the MSB */ - if ((offset & 0x0800) == 0) - { - if (!ACCESSING_BITS_8_15) - return; - m_cia_1->write(space, offset >> 7, (UINT8) data); - data >>= 8; - } + if ((offset & 0x1000/2) == 0 && ACCESSING_BITS_0_7) + m_cia_0->write(space, offset >> 7, data & 0xff); - /* offsets 0800-0fff reference CIA A, and are accessed via the LSB */ - else + if ((offset & 0x2000/2) == 0 && ACCESSING_BITS_8_15) + m_cia_1->write(space, offset >> 7, data >> 8); +} + +WRITE16_MEMBER( amiga_state::gayle_cia_w ) +{ + // the first write to cia 0 after a reset switches in chip ram + if (m_gayle_reset && (offset & 0x1000/2) == 0 && ACCESSING_BITS_0_7) { - if (!ACCESSING_BITS_0_7) - return; - m_cia_0->write(space, offset >> 7, (UINT8) data); - data &= 0xff; + m_gayle_reset = false; + m_overlay->set_bank(0); } + + // hand down to the standard cia handler + cia_w(space, offset, data, mem_mask); } +CUSTOM_INPUT_MEMBER( amiga_state::floppy_drive_status ) +{ + return m_fdc->ciaapra_r(); +} +WRITE8_MEMBER( amiga_state::cia_0_port_a_write ) +{ + // bit 0, kickstart overlay + m_overlay->set_bank(BIT(data, 0)); -/************************************* - * - * CIA interrupt callbacks - * - *************************************/ + // bit 1, power led + set_led_status(space.machine(), 0, !BIT(data, 1)); + output_set_value("power_led", !BIT(data, 1)); +} -WRITE_LINE_MEMBER(amiga_state::amiga_cia_0_irq) +WRITE_LINE_MEMBER( amiga_state::cia_0_irq ) { - amiga_custom_w(m_maincpu->space(AS_PROGRAM), REG_INTREQ, (state ? 0x8000 : 0x0000) | INTENA_PORTS, 0xffff); + m_cia_0_irq = state; + update_irq2(); } - -WRITE_LINE_MEMBER(amiga_state::amiga_cia_1_irq) +READ8_MEMBER( amiga_state::cia_1_port_a_read ) { - amiga_custom_w(m_maincpu->space(AS_PROGRAM), REG_INTREQ, (state ? 0x8000 : 0x0000) | INTENA_EXTER, 0xffff); + UINT8 data = 0; + + // centronics + data |= m_centronics_busy << 0; + data |= m_centronics_perror << 1; + data |= m_centronics_select << 2; // shared with rs232 "ring indicator" (not emulated) + + // bit 3 to 7, serial line (not emulated) + + return data; } +WRITE_LINE_MEMBER( amiga_state::cia_1_irq ) +{ + m_cia_1_irq = state; + update_irq6(); +} -/************************************* - * - * Custom chip reset - * - *************************************/ +//************************************************************************** +// CUSTOM CHIPS +//************************************************************************** -static void custom_reset(running_machine &machine) +void amiga_state::custom_chip_reset() { - amiga_state *state = machine.driver_data<amiga_state>(); - int clock = state->m_maincpu->unscaled_clock(); - UINT16 vidmode = (clock == AMIGA_68000_NTSC_CLOCK || clock == AMIGA_68EC020_NTSC_CLOCK ) ? 0x1000 : 0x0000; /* NTSC or PAL? */ + amiga_state *state = this; + CUSTOM_REG(REG_DENISEID) = m_denise_id; + CUSTOM_REG(REG_VPOSR) = m_agnus_id << 8; CUSTOM_REG(REG_DDFSTRT) = 0x18; CUSTOM_REG(REG_DDFSTOP) = 0xd8; CUSTOM_REG(REG_INTENA) = 0x0000; - CUSTOM_REG(REG_VPOSR) = vidmode; CUSTOM_REG(REG_SERDATR) = 0x3000; - - switch (state->m_intf->chip_ram_mask) - { - case ANGUS_CHIP_RAM_MASK: - case FAT_ANGUS_CHIP_RAM_MASK: - CUSTOM_REG(REG_DENISEID) = 0x00FF; - break; - - case ECS_CHIP_RAM_MASK: - CUSTOM_REG(REG_VPOSR) |= 0x2000; - CUSTOM_REG(REG_DENISEID) = 0x00FC; - if (IS_AGA(state->m_intf)) - { - CUSTOM_REG(REG_VPOSR) |= 0x0300; - CUSTOM_REG(REG_DENISEID) = 0x00F8; - } - break; - } } - - -/************************************* - * - * Custom chip register read - * - *************************************/ - -READ16_MEMBER( amiga_state::amiga_custom_r ) +READ16_MEMBER( amiga_state::custom_chip_r ) { - amiga_state *state = space.machine().driver_data<amiga_state>(); + amiga_state *state = this; UINT16 temp; + if (LOG_CUSTOM) + logerror("%06X:read from custom %s\n", space.device().safe_pc(), amiga_custom_names[offset & 0xff]); + switch (offset & 0xff) { case REG_BLTDDAT: @@ -1193,18 +1183,10 @@ READ16_MEMBER( amiga_state::amiga_custom_r ) return CUSTOM_REG(REG_SERDATR); case REG_JOY0DAT: - if (state->m_intf->joy0dat_r != NULL) - return (*state->m_intf->joy0dat_r)(space.machine()); - - if (state->m_joy0dat_port) return state->m_joy0dat_port->read(); - else return 0xffff; + return joy0dat_r(); case REG_JOY1DAT: - if (state->m_intf->joy1dat_r != NULL) - return (*state->m_intf->joy1dat_r)(space.machine()); - - if (state->m_joy1dat_port) return state->m_joy1dat_port->read(); - else return 0xffff; + return joy1dat_r(); case REG_POTGOR: if (state->m_potgo_port) return state->m_potgo_port->read(); @@ -1257,33 +1239,10 @@ READ16_MEMBER( amiga_state::amiga_custom_r ) break; } - if (LOG_CUSTOM) - logerror("%06X:read from custom %s\n", space.device().safe_pc(), amiga_custom_names[offset & 0xff]); - return 0xffff; } - - -/************************************* - * - * Custom chip register write - * - *************************************/ - -TIMER_CALLBACK_MEMBER(amiga_state::finish_serial_write) -{ - amiga_state *state = machine().driver_data<amiga_state>(); - - /* mark the transfer buffer empty */ - CUSTOM_REG(REG_SERDATR) |= 0x3000; - - /* signal an interrupt */ - amiga_custom_w(state->m_maincpu->space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_TBE, 0xffff); -} - - -WRITE16_MEMBER( amiga_state::amiga_custom_w ) +WRITE16_MEMBER( amiga_state::custom_chip_w ) { amiga_state *state = space.machine().driver_data<amiga_state>(); UINT16 temp; @@ -1322,15 +1281,13 @@ WRITE16_MEMBER( amiga_state::amiga_custom_w ) break; case REG_POTGO: - if (state->m_intf->potgo_w != NULL) - (*state->m_intf->potgo_w)(space.machine(), data); + potgo_w(data); break; case REG_SERDAT: - if (state->m_intf->serdat_w != NULL) - (*state->m_intf->serdat_w)(space.machine(), data); + serdat_w(data); CUSTOM_REG(REG_SERDATR) &= ~0x3000; - timer_set(amiga_get_serial_char_period(space.machine()), TIMER_FINISH_SERIAL_WRITE); + timer_set(serial_char_period(), TIMER_FINISH_SERIAL_WRITE); break; case REG_BLTSIZE: @@ -1342,16 +1299,16 @@ WRITE16_MEMBER( amiga_state::amiga_custom_w ) blitter_setup(space); break; - case REG_BLTSIZV: /* ECS-AGA only */ - if ( IS_ECS_OR_AGA(state->m_intf) ) + case REG_BLTSIZV: + if (IS_ECS(state) || IS_AGA(state)) { CUSTOM_REG(REG_BLTSIZV) = data & 0x7fff; if ( CUSTOM_REG(REG_BLTSIZV) == 0 ) CUSTOM_REG(REG_BLTSIZV) = 0x8000; } break; - case REG_BLTSIZH: /* ECS-AGA only */ - if ( IS_ECS_OR_AGA(state->m_intf) ) + case REG_BLTSIZH: + if (IS_ECS(state) || IS_AGA(state)) { CUSTOM_REG(REG_BLTSIZH) = data & 0x7ff; if ( CUSTOM_REG(REG_BLTSIZH) == 0 ) CUSTOM_REG(REG_BLTSIZH) = 0x800; @@ -1359,8 +1316,8 @@ WRITE16_MEMBER( amiga_state::amiga_custom_w ) } break; - case REG_BLTCON0L: /* ECS-AGA only */ - if ( IS_ECS_OR_AGA(state->m_intf) ) + case REG_BLTCON0L: + if (IS_ECS(state) || IS_AGA(state)) { CUSTOM_REG(REG_BLTCON0) &= 0xff00; CUSTOM_REG(REG_BLTCON0) |= data & 0xff; @@ -1369,7 +1326,7 @@ WRITE16_MEMBER( amiga_state::amiga_custom_w ) case REG_SPR0PTH: case REG_SPR1PTH: case REG_SPR2PTH: case REG_SPR3PTH: case REG_SPR4PTH: case REG_SPR5PTH: case REG_SPR6PTH: case REG_SPR7PTH: - data &= ( state->m_intf->chip_ram_mask >> 16 ); + data &= ( state->m_chip_ram_mask >> 16 ); break; case REG_SPR0PTL: case REG_SPR1PTL: case REG_SPR2PTL: case REG_SPR3PTL: @@ -1390,7 +1347,7 @@ WRITE16_MEMBER( amiga_state::amiga_custom_w ) break; case REG_COP1LCH: case REG_COP2LCH: - data &= ( state->m_intf->chip_ram_mask >> 16 ); + data &= ( state->m_chip_ram_mask >> 16 ); break; case REG_COPJMP1: @@ -1425,37 +1382,39 @@ WRITE16_MEMBER( amiga_state::amiga_custom_w ) /* if 'blitter-nasty' has been turned on and we have a blit pending, reschedule it */ if ( ( data & 0x400 ) && ( CUSTOM_REG(REG_DMACON) & 0x4000 ) ) - state->m_blitter_timer->adjust( downcast<cpu_device *>(&space.device())->cycles_to_attotime( BLITTER_NASTY_DELAY )); + m_blitter_timer->adjust(m_maincpu->cycles_to_attotime(BLITTER_NASTY_DELAY)); break; case REG_INTENA: temp = data; - data = (data & 0x8000) ? (CUSTOM_REG(offset) | (data & 0x7fff)) : (CUSTOM_REG(offset) & ~(data & 0x7fff)); + data = (data & INTENA_SETCLR) ? (CUSTOM_REG(offset) | (data & 0x7fff)) : (CUSTOM_REG(offset) & ~(data & 0x7fff)); CUSTOM_REG(offset) = data; - if ( temp & 0x8000 ) /* if we're enabling irq's, delay a bit */ - state->m_irq_timer->adjust( downcast<cpu_device *>(&space.device())->cycles_to_attotime( AMIGA_IRQ_DELAY_CYCLES )); - else /* if we're disabling irq's, process right away */ - update_irqs(space.machine()); + if (temp & INTENA_SETCLR) + // if we're enabling irq's, delay a bit + m_irq_timer->adjust(m_maincpu->cycles_to_attotime(AMIGA_IRQ_DELAY_CYCLES)); + else + // if we're disabling irq's, process right away + update_irqs(); break; case REG_INTREQ: temp = data; - /* Update serial data line status if appropiate */ - if (!(data & 0x8000) && (data & INTENA_RBF)) - CUSTOM_REG(REG_SERDATR) &= ~0x8000; + // update serial data line status if appropriate */ + if (!(data & INTENA_SETCLR) && (data & INTENA_RBF)) + CUSTOM_REG(REG_SERDATR) &= ~INTENA_SETCLR; - data = (data & 0x8000) ? (CUSTOM_REG(offset) | (data & 0x7fff)) : (CUSTOM_REG(offset) & ~(data & 0x7fff)); - if ( state->m_cia_0->irq_r() ) data |= INTENA_PORTS; - if ( state->m_cia_1->irq_r() ) data |= INTENA_EXTER; + data = (data & INTENA_SETCLR) ? (CUSTOM_REG(offset) | (data & 0x7fff)) : (CUSTOM_REG(offset) & ~(data & 0x7fff)); CUSTOM_REG(offset) = data; - if ( temp & 0x8000 ) /* if we're generating irq's, delay a bit */ - state->m_irq_timer->adjust( state->m_maincpu->cycles_to_attotime( AMIGA_IRQ_DELAY_CYCLES )); - else /* if we're clearing irq's, process right away */ - update_irqs(space.machine()); + if (temp & INTENA_SETCLR) + // if we're generating irq's, delay a bit + m_irq_timer->adjust(m_maincpu->cycles_to_attotime(AMIGA_IRQ_DELAY_CYCLES)); + else + // if we're clearing irq's, process right away + update_irqs(); break; case REG_ADKCON: @@ -1477,7 +1436,7 @@ WRITE16_MEMBER( amiga_state::amiga_custom_w ) case REG_BPL1PTH: case REG_BPL2PTH: case REG_BPL3PTH: case REG_BPL4PTH: case REG_BPL5PTH: case REG_BPL6PTH: - data &= ( state->m_intf->chip_ram_mask >> 16 ); + data &= ( state->m_chip_ram_mask >> 16 ); break; case REG_BPLCON0: @@ -1497,7 +1456,7 @@ WRITE16_MEMBER( amiga_state::amiga_custom_w ) case REG_COLOR20: case REG_COLOR21: case REG_COLOR22: case REG_COLOR23: case REG_COLOR24: case REG_COLOR25: case REG_COLOR26: case REG_COLOR27: case REG_COLOR28: case REG_COLOR29: case REG_COLOR30: case REG_COLOR31: - if (IS_AGA(state->m_intf)) + if (IS_AGA(state)) { amiga_aga_palette_write(space.machine(), offset - REG_COLOR00, data); } @@ -1509,11 +1468,11 @@ WRITE16_MEMBER( amiga_state::amiga_custom_w ) break; case REG_DIWSTRT: case REG_DIWSTOP: - if (IS_AGA(state->m_intf)) + if (IS_AGA(state)) amiga_aga_diwhigh_written(space.machine(), 0); break; case REG_DIWHIGH: - if (IS_AGA(state->m_intf)) + if (IS_AGA(state)) amiga_aga_diwhigh_written(space.machine(), 1); break; @@ -1521,7 +1480,7 @@ WRITE16_MEMBER( amiga_state::amiga_custom_w ) break; } - if (IS_AGA(state->m_intf)) + if (IS_AGA(state)) CUSTOM_REG(offset) = data; else if (offset <= REG_COLOR31) @@ -1529,298 +1488,48 @@ WRITE16_MEMBER( amiga_state::amiga_custom_w ) } +//************************************************************************** +// SERIAL +//************************************************************************** -/************************************* - * - * Serial writes - * - *************************************/ +TIMER_CALLBACK_MEMBER( amiga_state::finish_serial_write ) +{ + amiga_state *state = machine().driver_data<amiga_state>(); + + // mark the transfer buffer empty + CUSTOM_REG(REG_SERDATR) |= 0x3000; + + // signal an interrupt + set_interrupt(INTENA_SETCLR | INTENA_TBE); +} -void amiga_serial_in_w(running_machine &machine, UINT16 data) +void amiga_state::serial_in_w(UINT16 data) { - amiga_state *state = machine.driver_data<amiga_state>(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); + amiga_state *state = this; int mask = (CUSTOM_REG(REG_SERPER) & 0x8000) ? 0x1ff : 0xff; - /* copy the data to the low 8 bits of SERDATR and set RBF */ + // copy the data to the low 8 bits of SERDATR and set RBF CUSTOM_REG(REG_SERDATR) &= ~0x3ff; CUSTOM_REG(REG_SERDATR) |= (data & mask) | (mask + 1) | 0x4000; - /* set overrun if we weren't cleared */ + // set overrun if we weren't cleared if (CUSTOM_REG(REG_INTREQ) & INTENA_RBF) { osd_printf_debug("Serial data overflow\n"); CUSTOM_REG(REG_SERDATR) |= 0x8000; } - /* signal an interrupt */ - state->amiga_custom_w(space, REG_INTREQ, 0x8000 | INTENA_RBF, 0xffff); + // signal an interrupt + set_interrupt(INTENA_SETCLR | INTENA_RBF); } - -attotime amiga_get_serial_char_period(running_machine &machine) +attotime amiga_state::serial_char_period() { - amiga_state *state = machine.driver_data<amiga_state>(); + amiga_state *state = this; + UINT32 divisor = (CUSTOM_REG(REG_SERPER) & 0x7fff) + 1; - UINT32 baud = state->m_maincpu->unscaled_clock() / 2 / divisor; + UINT32 baud = m_maincpu->unscaled_clock() / 2 / divisor; UINT32 numbits = 2 + ((CUSTOM_REG(REG_SERPER) & 0x8000) ? 9 : 8); - return attotime::from_hz(baud) * numbits; -} - - - -/************************************* - * - * Autoconfig registration - * - *************************************/ - -void amiga_add_autoconfig(running_machine &machine, const amiga_autoconfig_device *device) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - autoconfig_device *dev, **d; - - /* validate the data */ - assert_always(machine.phase() == MACHINE_PHASE_INIT, "Can only call amiga_add_autoconfig at init time!"); - assert_always((device->size & (device->size - 1)) == 0, "device->size must be power of 2!"); - - /* allocate memory and link it in at the end of the list */ - dev = auto_alloc(machine, autoconfig_device); - dev->next = NULL; - for (d = &state->m_autoconfig_list; *d; d = &(*d)->next) ; - *d = dev; - - /* fill in the data */ - dev->device = *device; - dev->base = 0; -} - - -/************************************* - * - * Autoconfig reset - * - *************************************/ - -static void autoconfig_reset(running_machine &machine) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - autoconfig_device *dev; - - /* uninstall any installed devices */ - for (dev = state->m_autoconfig_list; dev; dev = dev->next) - if (dev->base && dev->device.uninstall) - { - (*dev->device.uninstall)(machine, dev->base); - dev->base = 0; - } - - /* reset the current autoconfig */ - state->m_cur_autoconfig = state->m_autoconfig_list; -} - - - -/************************************* - * - * Autoconfig space read - * - *************************************/ - -READ16_MEMBER( amiga_state::amiga_autoconfig_r ) -{ - amiga_state *state = space.machine().driver_data<amiga_state>(); - autoconfig_device *cur_autoconfig = state->m_cur_autoconfig; - UINT8 byte; - int i; - - /* if nothing present, just return */ - if (!cur_autoconfig) - { - logerror("autoconfig_r(%02X) but no device selected\n", offset); - return 0; - } - - /* switch off of the base offset */ - switch (offset/2) - { - /* - 00/02 1 1 x x x 0 0 0 = 8 Megabytes - ^ ^ ^ 0 0 1 = 64 Kbytes - | | | 0 1 0 = 128 Kbytes - | | | 0 1 1 = 256 Kbytes - | | | 1 0 0 = 1 Megabyte - | | | 1 1 0 = 2 Megabytes - | | | 1 1 1 = 4 Megabytes - | | | - | | `-- 1 = multiple devices on this card - | `-------- 1 = ROM vector offset is valid - `----------- 1 = link into free memory list - */ - case 0x00/4: - byte = 0xc0; - if (cur_autoconfig->device.link_memory) - byte |= 0x20; - if (cur_autoconfig->device.rom_vector_valid) - byte |= 0x10; - if (cur_autoconfig->device.multi_device) - byte |= 0x08; - for (i = 0; i < 8; i++) - if (cur_autoconfig->device.size & (1 << i)) - break; - byte |= (i + 1) & 7; - break; - - /* - 04/06 product number (all bits inverted) - */ - case 0x04/4: - byte = ~cur_autoconfig->device.product_number; - break; - - /* - 08/0a x x 1 1 1 1 1 1 - ^ ^ - | | - | `-- 1 = this board can be shut up - `----- 0 = prefer 8 Meg address space - */ - case 0x08/4: - byte = 0x3f; - if (!cur_autoconfig->device.prefer_8meg) - byte |= 0x80; - if (cur_autoconfig->device.can_shutup) - byte |= 0x40; - break; - - /* - 10/12 manufacturers number (high byte, all inverted) - 14/16 '' (low byte, all inverted) - */ - case 0x10/4: - byte = ~cur_autoconfig->device.mfr_number >> 8; - break; - - case 0x14/4: - byte = ~cur_autoconfig->device.mfr_number >> 0; - break; - - /* - 18/1a optional serial number (all bits inverted) byte0 - 1c/1e '' byte1 - 20/22 '' byte2 - 24/26 '' byte3 - */ - case 0x18/4: - byte = ~cur_autoconfig->device.serial_number >> 24; - break; - - case 0x1c/4: - byte = ~cur_autoconfig->device.serial_number >> 16; - break; - - case 0x20/4: - byte = ~cur_autoconfig->device.serial_number >> 8; - break; - - case 0x24/4: - byte = ~cur_autoconfig->device.serial_number >> 0; - break; - - /* - 28/2a optional ROM vector offset (all bits inverted) high byte - 2c/2e '' low byte - */ - case 0x28/4: - byte = ~cur_autoconfig->device.rom_vector >> 8; - break; - - case 0x2c/4: - byte = ~cur_autoconfig->device.rom_vector >> 0; - break; - - /* - 40/42 optional interrupt control and status register - */ - case 0x40/4: - byte = 0x00; - if (cur_autoconfig->device.int_control_r) - byte = (*cur_autoconfig->device.int_control_r)(space.machine()); - break; - - default: - byte = 0xff; - break; - } - - /* return the appropriate nibble */ - logerror("autoconfig_r(%02X) = %04X\n", offset, (offset & 1) ? ((byte << 12) | 0xfff) : ((byte << 8) | 0xfff)); - return (offset & 1) ? ((byte << 12) | 0xfff) : ((byte << 8) | 0xfff); -} - - - -/************************************* - * - * Autoconfig space write - * - *************************************/ - -WRITE16_MEMBER( amiga_state::amiga_autoconfig_w ) -{ - amiga_state *state = space.machine().driver_data<amiga_state>(); - autoconfig_device *cur_autoconfig = state->m_cur_autoconfig; - int move_to_next = FALSE; - - logerror("autoconfig_w(%02X) = %04X & %04X\n", offset, data, mem_mask); - - /* if no current device, bail */ - if (!cur_autoconfig || !ACCESSING_BITS_8_15) - return; - - /* switch off of the base offset */ - switch (offset/2) - { - /* - 48/4a write-only register for base address (A23-A16) - */ - case 0x48/4: - if ((offset & 1) == 0) - cur_autoconfig->base = (cur_autoconfig->base & ~0xf00000) | ((data & 0xf000) << 8); - else - cur_autoconfig->base = (cur_autoconfig->base & ~0x0f0000) | ((data & 0xf000) << 4); - move_to_next = TRUE; - break; - - /* - 4c/4e optional write-only 'shutup' trigger - */ - case 0x4c/4: - cur_autoconfig->base = 0; - move_to_next = TRUE; - break; - } - - /* install and move to the next device if requested */ - if (move_to_next && (offset & 1) == 0) - { - logerror("Install to %06X\n", cur_autoconfig->base); - if (cur_autoconfig->base && cur_autoconfig->device.install) - (*cur_autoconfig->device.install)(space.machine(), cur_autoconfig->base); - state->m_cur_autoconfig = cur_autoconfig->next; - } -} - - - -/************************************* - * - * Get interface - * - *************************************/ - -const amiga_machine_interface *amiga_get_interface(running_machine &machine) -{ - return machine.driver_data<amiga_state>()->m_intf; + return attotime::from_hz(baud) * numbits; } diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 98418b5309b..fbfaee8948f 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -9916,7 +9916,7 @@ mquake // (c) 1987 upscope // (c) 1986 Grand products // Cubo32 (Commodore CD32-based HW) -cd32bios // Base unit +cubo // Base unit cndypuzl // (c) 1995 haremchl // (c) 1995 lsrquiz // (c) 1995 diff --git a/src/mame/mame.mak b/src/mame/mame.mak index d6d34e80446..b8c40855ba5 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -177,6 +177,7 @@ SOUNDS += SN76496 SOUNDS += POKEY SOUNDS += TIA SOUNDS += NES_APU +SOUNDS += AMIGA SOUNDS += ASTROCADE SOUNDS += NAMCO SOUNDS += NAMCO_15XX @@ -338,6 +339,7 @@ VIDEOS += VOODOO # specify available machine cores #------------------------------------------------- +MACHINES += AKIKO MACHINES += NCR53C7XX MACHINES += LSI53C810 MACHINES += 6522VIA @@ -777,9 +779,9 @@ $(MAMEOBJ)/alpha.a: \ $(MAMEOBJ)/amiga.a: \ $(DRIVERS)/alg.o \ - $(MACHINE)/amiga.o $(AUDIO)/amiga.o $(VIDEO)/amiga.o $(VIDEO)/amigaaga.o\ + $(MACHINE)/amiga.o $(VIDEO)/amiga.o $(VIDEO)/amigaaga.o\ $(DRIVERS)/arcadia.o \ - $(DRIVERS)/cd32.o $(MACHINE)/cd32.o \ + $(DRIVERS)/cubo.o \ $(DRIVERS)/mquake.o \ $(DRIVERS)/upscope.o \ diff --git a/src/mame/video/amiga.c b/src/mame/video/amiga.c index 30a1080b832..335edfbcb5b 100644 --- a/src/mame/video/amiga.c +++ b/src/mame/video/amiga.c @@ -206,7 +206,7 @@ int amiga_copper_execute_next(running_machine &machine, int xpos) { if (LOG_COPPER) logerror("%02X.%02X: Write to %s = %04x\n", state->m_last_scanline, xpos / 2, amiga_custom_names[state->m_copper_pending_offset & 0xff], state->m_copper_pending_data); - state->amiga_custom_w(*state->m_maincpu_program_space, state->m_copper_pending_offset, state->m_copper_pending_data, 0xffff); + state->custom_chip_w(state->m_copper_pending_offset, state->m_copper_pending_data); state->m_copper_pending_offset = 0; } @@ -262,7 +262,7 @@ int amiga_copper_execute_next(running_machine &machine, int xpos) { if (LOG_COPPER) logerror("%02X.%02X: Write to %s = %04x\n", state->m_last_scanline, xpos / 2, amiga_custom_names[word0 & 0xff], word1); - state->amiga_custom_w(*state->m_maincpu_program_space, word0, word1, 0xffff); + state->custom_chip_w(word0, word1); } else // additional 2 cycles needed for non-Agnus registers { @@ -624,6 +624,7 @@ void amiga_render_scanline(running_machine &machine, bitmap_ind16 &bitmap, int s UINT16 save_color0 = CUSTOM_REG(REG_COLOR00); int ddf_start_pixel = 0, ddf_stop_pixel = 0; int hires = 0, dualpf = 0, ham = 0; + //int lace = 0; int hstart = 0, hstop = 0; int vstart = 0, vstop = 0; int pf1pri = 0, pf2pri = 0; @@ -663,7 +664,7 @@ void amiga_render_scanline(running_machine &machine, bitmap_ind16 &bitmap, int s /* loop over the line */ next_copper_x = 0; - for (x = 0; x < 0xe4*2; x++) + for (x = 0; x < 227.5*2; x++) { int sprpix; @@ -682,11 +683,13 @@ void amiga_render_scanline(running_machine &machine, bitmap_ind16 &bitmap, int s hires = CUSTOM_REG(REG_BPLCON0) & BPLCON0_HIRES; ham = CUSTOM_REG(REG_BPLCON0) & BPLCON0_HOMOD; dualpf = CUSTOM_REG(REG_BPLCON0) & BPLCON0_DBLPF; -// lace = CUSTOM_REG(REG_BPLCON0) & BPLCON0_LACE; + //lace = CUSTOM_REG(REG_BPLCON0) & BPLCON0_LACE; /* compute the pixel fetch parameters */ - ddf_start_pixel = ( CUSTOM_REG(REG_DDFSTRT) & 0xfc ) * 2 + (hires ? 9 : 17); - ddf_stop_pixel = ( CUSTOM_REG(REG_DDFSTOP) & 0xfc ) * 2 + (hires ? (9 + defbitoffs) : (17 + defbitoffs)); + ddf_start_pixel = (CUSTOM_REG(REG_DDFSTRT) & (hires ? 0xfc : 0xf8)) * 2; + ddf_start_pixel += hires ? 9 : 17; + ddf_stop_pixel = (CUSTOM_REG(REG_DDFSTOP) & (hires ? 0xfc : 0xf8)) * 2; + ddf_stop_pixel += hires ? (9 + defbitoffs) : (17 + defbitoffs); if ( ( CUSTOM_REG(REG_DDFSTRT) ^ CUSTOM_REG(REG_DDFSTOP) ) & 0x04 ) ddf_stop_pixel += 8; @@ -943,24 +946,27 @@ void amiga_render_scanline(running_machine &machine, bitmap_ind16 &bitmap, int s } #if 0 - if ( m_screen->frame_number() % 64 == 0 && scanline == 100 ) + if ( machine.first_screen()->frame_number() % 64 == 0 && scanline == 100 ) { +#if 0 const char *m_lores = "LORES"; const char *m_hires = "HIRES"; const char *m_ham = "HAM"; const char *m_dualpf = "DUALPF"; - const char *m_lace = "LACE"; - const char *m_hilace = "HI-LACE"; + //const char *m_lace = "LACE"; + //const char *m_hilace = "HI-LACE"; const char *p = m_lores; if ( hires ) p = m_hires; if ( ham ) p = m_ham; if ( dualpf ) p = m_dualpf; - if ( lace ) p = m_lace; - - if ( hires && lace ) p = m_hilace; + //if ( lace ) p = m_lace; - popmessage("%s(%d pl od=%04x ed=%04x start=%04x stop=%04x)", p, planes, odelay, edelay, CUSTOM_REG(REG_DDFSTRT), CUSTOM_REG(REG_DDFSTOP) ); + //if ( hires && lace ) p = m_hilace; +#endif + //popmessage("%s(%d pl od=%04x ed=%04x start=%04x stop=%04x)", p, planes, odelay, edelay, CUSTOM_REG(REG_DDFSTRT), CUSTOM_REG(REG_DDFSTOP) ); + //popmessage("%s(%d pl y=%d vstart=%04x vstop=%04x start=%04x stop=%04x)", p, planes, scanline, vstart, vstop, CUSTOM_REG(REG_DDFSTRT), CUSTOM_REG(REG_DDFSTOP) ); + popmessage("DDFSTRT=%04x, DDFSTOP=%04x, DIWSTRT=%04x, DIWSTOP=%04x", CUSTOM_REG(REG_DDFSTRT), CUSTOM_REG(REG_DDFSTOP), CUSTOM_REG(REG_DIWSTRT), CUSTOM_REG(REG_DIWSTOP)); } #endif @@ -974,6 +980,9 @@ void amiga_render_scanline(running_machine &machine, bitmap_ind16 &bitmap, int s /* update even planes */ for (pl = 1; pl < planes; pl += 2) CUSTOM_REG_LONG(REG_BPL1PTH + pl * 2) += CUSTOM_REG_SIGNED(REG_BPL2MOD); + + if (machine.input().code_pressed(KEYCODE_Q)) + printf("%03d BPL1MOD=%04x BPL2MOD=%04x BPLCON1=%04x\n", scanline, CUSTOM_REG(REG_BPL1MOD), CUSTOM_REG(REG_BPL2MOD), CUSTOM_REG(REG_BPLCON1)); } /* restore color00 */ @@ -1001,10 +1010,8 @@ void amiga_render_scanline(running_machine &machine, bitmap_ind16 &bitmap, int s /* TODO: alg.c requires that this uses RGB32 */ UINT32 amiga_state::screen_update_amiga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - - /* render each scanline in the visible region */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + // render each scanline in the visible region + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) amiga_render_scanline(machine(), bitmap, y); return 0; diff --git a/src/mess/drivers/amiga.c b/src/mess/drivers/amiga.c index 72a00a2f8cc..17b78ad2947 100644 --- a/src/mess/drivers/amiga.c +++ b/src/mess/drivers/amiga.c @@ -1,1290 +1,1957 @@ /*************************************************************************** -Commodore Amiga - (c) 1985, Commodore Business Machines Co. -Preliminary driver by: + Commodore Amiga -Ernesto Corvi - -Note 1: The 'fast-mem' memory detector in Kickstart 1.2 expects to -see the custom chips at the end of any present fast memory (mapped -from $C00000 onwards). I assume this is a bug, given that the routine -was entirely rewritten for Kickstart 1.3. So the strategy is, for -any machine that can run Kickstart 1.2 (a500,a1000 and a2000), we -map a mirror of the custom chips right after any fast-mem we mapped. -If we didn't map any, then we still put a mirror, but where fast-mem -would commence ($C00000). - -Note 2: when you do disk swapping it often causes crashes in the system. -This is because you have to UNLOAD the image first then LOAD whatever image -the program asked to. Just like on a real system, apparently the Amiga is -very fussy with the state machine. + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best ***************************************************************************/ -/* - Amiga 1200 - - Preliminary MAME driver by Mariusz Wojcieszek - CD-ROM controller by Ernesto Corvi - Borrowed by incog for MESS - - 2009-05 Fabio Priuli: - Amiga 1200 support is just sketched (I basically took cd32 and removed Akiko). I connected - the floppy drive in the same way as in amiga.c but it seems to be not working, since I - tried to load WB3.1 with no success. However, this problem may be due to anything: maybe - the floppy code must be connected elsewhere, or the .adf image is broken, or I made some - stupid mistake in the CIA interfaces. - Later, it could be wise to re-factor this source and merge the non-AGA code with - mess/drivers/amiga.c -*/ - -/* Core includes */ + #include "emu.h" #include "includes/amiga.h" -#include "includes/cd32.h" - -/* Components */ +#include "bus/zorro/zorro.h" #include "cpu/m68000/m68000.h" #include "cpu/m6502/m6502.h" +#include "machine/bankdev.h" #include "machine/6525tpi.h" #include "machine/6526cia.h" -#include "machine/amigafdc.h" -#include "machine/amigakbd.h" -#include "machine/amigacd.h" -#include "machine/amigacrt.h" +#include "machine/dmac.h" #include "machine/nvram.h" -#include "sound/cdda.h" #include "machine/i2cmem.h" -#include "amiga.lh" +#include "machine/amigafdc.h" +#include "machine/amigakbd.h" +#include "machine/cr511b.h" +#include "machine/rp5c01.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** -/* Devices */ -#include "imagedev/chd_cd.h" -#include "imagedev/cartslot.h" +class a1000_state : public amiga_state +{ +public: + a1000_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_bootrom(*this, "bootrom"), + m_wom(*this, "wom") + { } + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + + DECLARE_WRITE16_MEMBER( write_protect_w ); + +protected: + virtual void machine_start(); + virtual void machine_reset(); + +private: + required_device<address_map_bank_device> m_bootrom; + required_memory_bank m_wom; + dynamic_array<UINT16> m_wom_ram; +}; + +class a2000_state : public amiga_state +{ +public: + a2000_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_rtc(*this, "u65"), + m_zorro2_int2(0), + m_zorro2_int6(0) + { } + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + + DECLARE_WRITE_LINE_MEMBER( zorro2_int2_w ); + DECLARE_WRITE_LINE_MEMBER( zorro2_int6_w ); + + DECLARE_READ16_MEMBER( clock_r ); + DECLARE_WRITE16_MEMBER( clock_w ); + +protected: + // amiga_state overrides + virtual void update_int2(); + virtual void update_int6(); + +private: + // devices + required_device<msm6242_device> m_rtc; + + // internal state + int m_zorro2_int2; + int m_zorro2_int6; +}; + +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_int2(0), + m_side_int6(0) + { } + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + +protected: + +private: + // internal state + int m_side_int2; + int m_side_int6; +}; class cdtv_state : public amiga_state { public: - cdtv_state(const machine_config &mconfig, device_type type, const char *tag) - : amiga_state(mconfig, type, tag) { } + cdtv_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_rtc(*this, "u61"), + m_dmac(*this, "u36"), + m_tpi(*this, "u32"), + m_cdrom(*this, "cdrom"), + m_dmac_irq(0), + m_tpi_irq(0) + { } + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + + DECLARE_READ16_MEMBER( clock_r ); + DECLARE_WRITE16_MEMBER( clock_w ); + + DECLARE_READ8_MEMBER( dmac_scsi_data_read ); + DECLARE_WRITE8_MEMBER( dmac_scsi_data_write ); + DECLARE_READ8_MEMBER( dmac_io_read ); + DECLARE_WRITE8_MEMBER( dmac_io_write ); + DECLARE_WRITE_LINE_MEMBER( dmac_int_w ); + + DECLARE_WRITE8_MEMBER( tpi_port_b_write ); + DECLARE_WRITE_LINE_MEMBER( tpi_int_w ); + +protected: + // driver_device overrides + virtual void machine_start(); + + // amiga_state overrides + virtual void update_int2(); + virtual void update_int6(); + +private: + // devices + required_device<msm6242_device> m_rtc; + required_device<dmac_device> m_dmac; + required_device<tpi6525_device> m_tpi; + required_device<cr511b_device> m_cdrom; + + // internal state + int m_dmac_irq; + int m_tpi_irq; +}; + +class a3000_state : public amiga_state +{ +public: + a3000_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_rtc(*this, "u190") + { } + + DECLARE_READ32_MEMBER( clock_r ); + DECLARE_WRITE32_MEMBER( clock_w ); + DECLARE_READ32_MEMBER( scsi_r ); + DECLARE_WRITE32_MEMBER( scsi_w ); + DECLARE_READ32_MEMBER( motherboard_r ); + DECLARE_WRITE32_MEMBER( motherboard_w ); + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + +protected: + +private: + required_device<rp5c01_device> m_rtc; +}; + +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_rtc(*this, "u9"), + m_side_int2(0), + m_side_int6(0) + { } + + DECLARE_READ16_MEMBER( clock_r ); + DECLARE_WRITE16_MEMBER( clock_w ); + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + +protected: + +private: + // devices + required_device<msm6242_device> m_rtc; - DECLARE_MACHINE_START(cdtv); - DECLARE_MACHINE_RESET(cdtv); + // internal state + int m_side_int2; + int m_side_int6; }; +class a600_state : public amiga_state +{ +public: + a600_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_gayle_id_count(0) + { } + + DECLARE_READ16_MEMBER( ide_r ); + DECLARE_WRITE16_MEMBER( ide_w ); + DECLARE_READ16_MEMBER( gayle_r ); + DECLARE_WRITE16_MEMBER( gayle_w ); + DECLARE_READ16_MEMBER( gayle_id_r ); + DECLARE_WRITE16_MEMBER( gayle_id_w ); + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + +protected: + virtual void machine_reset(); +private: + static const int GAYLE_ID = 0xd0; + + int m_gayle_id_count; + UINT8 m_gayle_reg[4]; +}; class a1200_state : public amiga_state { public: - a1200_state(const machine_config &mconfig, device_type type, const char *tag) - : amiga_state(mconfig, type, tag) { } + a1200_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_gayle_id_count(0) + { } - UINT16 m_potgo_value; - int m_cd32_shifter[2]; - int m_oldstate[2]; - DECLARE_WRITE32_MEMBER(aga_overlay_w); - DECLARE_DRIVER_INIT(a1200); - DECLARE_WRITE8_MEMBER(ami1200_cia_0_porta_w); - DECLARE_READ8_MEMBER(ami1200_cia_0_portb_r); - DECLARE_WRITE8_MEMBER(ami1200_cia_0_portb_w); - DECLARE_READ8_MEMBER(a1200_cia_0_portA_r); + DECLARE_READ32_MEMBER( ide_r ); + DECLARE_WRITE32_MEMBER( ide_w ); + DECLARE_READ32_MEMBER( gayle_r ); + DECLARE_WRITE32_MEMBER( gayle_w ); + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + +protected: + virtual void machine_reset(); + +private: + static const int GAYLE_ID = 0xd1; + + int m_gayle_id_count; + UINT8 m_gayle_reg[4]; }; +class a4000_state : public amiga_state +{ +public: + a4000_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_rtc(*this, "rtc"), + m_ramsey_config(0), + m_gary_coldboot(1), + m_gary_timeout(0), + m_gary_toenb(0) + { } + + DECLARE_READ32_MEMBER( scsi_r ); + DECLARE_WRITE32_MEMBER( scsi_w ); + DECLARE_READ32_MEMBER( ide_r ); + DECLARE_WRITE32_MEMBER( ide_w ); + DECLARE_READ32_MEMBER( clock_r ); + DECLARE_WRITE32_MEMBER( clock_w ); + DECLARE_READ32_MEMBER( motherboard_r ); + DECLARE_WRITE32_MEMBER( motherboard_w ); + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + +protected: + +private: + required_device<rp5c01_device> m_rtc; + + int m_ramsey_config; + int m_gary_coldboot; + int m_gary_timeout; + int m_gary_toenb; +}; +class cd32_state : public amiga_state +{ +public: + cd32_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_p1_port(*this, "p1_cd32_buttons"), + m_p2_port(*this, "p2_cd32_buttons"), + m_cdda(*this, "cdda") + { } -#define A1200PAL_XTAL_X1 XTAL_28_37516MHz -#define A1200PAL_XTAL_X2 XTAL_4_433619MHz + DECLARE_WRITE8_MEMBER( akiko_cia_0_port_a_write ); + DECLARE_CUSTOM_INPUT_MEMBER( cd32_input ); + DECLARE_CUSTOM_INPUT_MEMBER( cd32_sel_mirror_input ); + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + required_ioport m_p1_port; + required_ioport m_p2_port; + int m_oldstate[2]; + int m_cd32_shifter[2]; + UINT16 m_potgo_value; -/*************************************************************************** - Battery Backed-Up Clock (MSM6264) -***************************************************************************/ +protected: + // amiga_state overrides + virtual void potgo_w(UINT16 data); -READ16_MEMBER( amiga_state::amiga_clock_r ) +private: + required_device<cdda_device> m_cdda; +}; + + +//************************************************************************** +// REAL TIME CLOCK +//************************************************************************** + +READ16_MEMBER( cdtv_state::clock_r ) { return m_rtc->read(space, offset / 2); } +WRITE16_MEMBER( cdtv_state::clock_w ) +{ + m_rtc->write(space, offset / 2, data); +} -WRITE16_MEMBER( amiga_state::amiga_clock_w ) +READ16_MEMBER( a2000_state::clock_r ) +{ + return m_rtc->read(space, offset / 2); +} + +WRITE16_MEMBER( a2000_state::clock_w ) { m_rtc->write(space, offset / 2, data); } +READ32_MEMBER( a3000_state::clock_r ) +{ + return m_rtc->read(space, offset / 4); +} -/*************************************************************************** - CENTRONICS PORT -***************************************************************************/ +WRITE32_MEMBER( a3000_state::clock_w ) +{ + m_rtc->write(space, offset / 4, data); +} -READ8_MEMBER( amiga_state::amiga_cia_1_porta_r ) +READ16_MEMBER( a500p_state::clock_r ) { - UINT8 result = 0; + return m_rtc->read(space, offset / 2); +} - /* centronics status is stored in PA0 to PA2 */ - result |= m_centronics_busy << 0; - result |= m_centronics_perror << 1; - result |= m_centronics_select << 2; // shared with rs232 "ring indicator" (not emulated) +WRITE16_MEMBER( a500p_state::clock_w ) +{ + m_rtc->write(space, offset / 2, data); +} - /* PA3 to PA7 store the serial line status (not emulated) */ +READ32_MEMBER( a4000_state::clock_r ) +{ + return m_rtc->read(space, offset / 4); +} - return result; +WRITE32_MEMBER( a4000_state::clock_w ) +{ + m_rtc->write(space, offset / 4, data); } -WRITE_LINE_MEMBER( amiga_state::write_centronics_ack ) + +//************************************************************************** +// CD-ROM CONTROLLER +//************************************************************************** + +READ8_MEMBER( cdtv_state::dmac_scsi_data_read ) { - m_cia_0->flag_w(state); + if (offset >= 0xb0 && offset <= 0xbf) + return m_tpi->read(space, offset); + + return 0xff; } -WRITE_LINE_MEMBER( amiga_state::write_centronics_busy ) +WRITE8_MEMBER( cdtv_state::dmac_scsi_data_write ) { - m_centronics_busy = state; - m_cia_1->sp_w(state); + if (offset >= 0xb0 && offset <= 0xbf) + m_tpi->write(space, offset, data); } -WRITE_LINE_MEMBER( amiga_state::write_centronics_perror ) +READ8_MEMBER( cdtv_state::dmac_io_read ) { - m_centronics_perror = state; - m_cia_1->cnt_w(state); + return m_cdrom->read(space, 0); } -WRITE_LINE_MEMBER( amiga_state::write_centronics_select ) +WRITE8_MEMBER( cdtv_state::dmac_io_write ) { - m_centronics_select = state; + m_cdrom->write(space, 0, data); } -/*************************************************************************** - Address maps -***************************************************************************/ +WRITE_LINE_MEMBER( cdtv_state::dmac_int_w ) +{ + m_dmac_irq = state; + update_int2(); +} -static ADDRESS_MAP_START(amiga_mem, AS_PROGRAM, 16, amiga_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x07ffff) AM_MIRROR(0x80000) AM_RAMBANK("bank1") AM_SHARE("chip_ram") - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia_r, amiga_cia_w) - AM_RANGE(0xc00000, 0xc7ffff) AM_RAM /* slow-mem */ - AM_RANGE(0xc80000, 0xcfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) /* see Note 1 above */ - AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_SHARE("custom_regs") /* Custom Chips */ - AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE(amiga_autoconfig_r, amiga_autoconfig_w) - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* System ROM - mirror */ -ADDRESS_MAP_END +WRITE8_MEMBER( cdtv_state::tpi_port_b_write ) +{ + m_cdrom->cmd_w(BIT(data, 0)); + m_cdrom->enable_w(BIT(data, 1)); +} -static ADDRESS_MAP_START( a1200_map, AS_PROGRAM, 32, a1200_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1fffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram") - AM_RANGE(0xbfa000, 0xbfa003) AM_WRITE(aga_overlay_w) - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE16(amiga_cia_r, amiga_cia_w, 0xffffffff) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE16(amiga_custom_r, amiga_custom_w, 0xffffffff) AM_SHARE("custom_regs") - AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE16(amiga_autoconfig_r, amiga_autoconfig_w, 0xffffffff) - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* Kickstart */ -ADDRESS_MAP_END +WRITE_LINE_MEMBER( cdtv_state::tpi_int_w ) +{ + m_tpi_irq = state; + update_int2(); +} -static ADDRESS_MAP_START( amiga_mem32, AS_PROGRAM, 32, amiga_state ) - ADDRESS_MAP_UNMAP_HIGH -// ADDRESS_MAP_GLOBAL_MASK(0xffffff) // not sure - AM_RANGE(0x000000, 0x1fffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram") - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE16(amiga_cia_r, amiga_cia_w, 0xffffffff) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE16(amiga_custom_r, amiga_custom_w, 0xffffffff) AM_SHARE("custom_regs") - AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE16(amiga_autoconfig_r, amiga_autoconfig_w, 0xffffffff) - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* Kickstart */ -ADDRESS_MAP_END -static ADDRESS_MAP_START(keyboard_mem, AS_PROGRAM, 8, amiga_state ) - AM_RANGE(0x0000, 0x003f) AM_RAM /* internal user ram */ - AM_RANGE(0x0040, 0x007f) AM_NOP /* unassigned */ - AM_RANGE(0x0080, 0x0080) AM_NOP /* port a */ - AM_RANGE(0x0081, 0x0081) AM_NOP /* port b */ - AM_RANGE(0x0082, 0x0082) AM_NOP /* port c */ - AM_RANGE(0x0083, 0x0083) AM_NOP /* port d */ - AM_RANGE(0x0084, 0x0085) AM_NOP /* latch */ - AM_RANGE(0x0086, 0x0087) AM_NOP /* count */ - AM_RANGE(0x0088, 0x0088) AM_NOP /* upper latch & transfer latch to counter */ - AM_RANGE(0x0089, 0x0089) AM_NOP /* clear pa0 pos edge detected */ - AM_RANGE(0x008a, 0x008a) AM_NOP /* clear pa1 neg edge detected */ - AM_RANGE(0x008b, 0x008e) AM_NOP /* unassigned */ - AM_RANGE(0x008f, 0x008f) AM_NOP /* control register */ - AM_RANGE(0x0090, 0x07ff) AM_NOP /* unassigned */ - AM_RANGE(0x0800, 0x0fff) AM_ROM AM_REGION("keyboard", 0) /* internal mask rom */ -ADDRESS_MAP_END +//************************************************************************** +// DRIVER INIT +//************************************************************************** +// ocs chipset (agnus with support for 512k or 1mb chip ram, denise) +DRIVER_INIT_MEMBER( a1000_state, pal ) +{ + m_agnus_id = AGNUS_PAL; // 8367 + m_denise_id = DENISE; // 8362 +} -/* - * CDTV memory map (source: http://www.l8r.net/technical/cdtv-technical.html) - * - * 000000-0FFFFF Chip memory - * 100000-1FFFFF Space for extra chip memory (Megachip) - * 200000-9FFFFF Space for AutoConfig memory - * A00000-BFFFFF CIA chips - * C00000-C7FFFF Space for slow-fast memory - * C80000-DBFFFF Space - * DC0000-DC7FFF Power backed-up real time clock - * DC8000-DC87FF Non-volatile RAM - * DC8800-DCFFFF Space in non-volatile RAM decoded area - * DD0000-DEFFFF Space - * DF0000-DFFFFF Custom chips - * E00000-E7FFFF Memory card address space for front panel memory card - * E80000-E8FFFF AutoConfig configuration space - * E90000-E9FFFF First AutoConfig device, used by DMAC - * EA0000-EFFFFF Space for other AutoConfig devices - * F00000-F3FFFF CDTV ROM - * F40000-F7FFFF Space in CDTV ROM decoded area - * F80000-FBFFFF Space in Kickstart ROM decoded area (used by Kickstart 2) - * FC0000-FFFFFF Kickstart ROM - * - */ - -static ADDRESS_MAP_START(cdtv_mem, AS_PROGRAM, 16, amiga_state ) - AM_RANGE(0x000000, 0x0fffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram") - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia_r, amiga_cia_w) - AM_RANGE(0xdc0000, 0xdc003f) AM_READWRITE(amiga_clock_r, amiga_clock_w) - AM_RANGE(0xdc8000, 0xdc87ff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_SHARE("custom_regs") /* Custom Chips */ - AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE(amiga_autoconfig_r, amiga_autoconfig_w) - AM_RANGE(0xf00000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* CDTV & System ROM */ -ADDRESS_MAP_END +DRIVER_INIT_MEMBER( a1000_state, ntsc ) +{ + m_agnus_id = AGNUS_NTSC; // 8361 + m_denise_id = DENISE; // 8362 +} -static ADDRESS_MAP_START(cdtv_rcmcu_mem, AS_PROGRAM, 8, amiga_state ) - AM_RANGE(0x0000, 0x003f) AM_RAM /* internal user ram */ - AM_RANGE(0x0040, 0x007f) AM_NOP /* unassigned */ - AM_RANGE(0x0080, 0x0080) AM_NOP /* port a */ - AM_RANGE(0x0081, 0x0081) AM_NOP /* port b */ - AM_RANGE(0x0082, 0x0082) AM_NOP /* port c */ - AM_RANGE(0x0083, 0x0083) AM_NOP /* port d */ - AM_RANGE(0x0084, 0x0085) AM_NOP /* latch */ - AM_RANGE(0x0086, 0x0087) AM_NOP /* count */ - AM_RANGE(0x0088, 0x0088) AM_NOP /* upper latch & transfer latch to counter */ - AM_RANGE(0x0089, 0x0089) AM_NOP /* clear pa0 pos edge detected */ - AM_RANGE(0x008a, 0x008a) AM_NOP /* clear pa1 neg edge detected */ - AM_RANGE(0x008b, 0x008e) AM_NOP /* unassigned */ - AM_RANGE(0x008f, 0x008f) AM_NOP /* control register */ - AM_RANGE(0x0090, 0x07ff) AM_NOP /* unassigned */ - AM_RANGE(0x0800, 0x0fff) AM_ROM AM_REGION("rcmcu", 0) /* internal mask rom */ -ADDRESS_MAP_END +DRIVER_INIT_MEMBER( a2000_state, pal ) +{ + m_agnus_id = AGNUS_HR_PAL; // 8371 (later versions 8372A) + m_denise_id = DENISE; // 8362 +} -static ADDRESS_MAP_START(a1000_mem, AS_PROGRAM, 16, amiga_state ) - AM_RANGE(0x000000, 0x03ffff) AM_MIRROR(0xc0000) AM_RAMBANK("bank1") AM_SHARE("chip_ram") - AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia_r, amiga_cia_w) - AM_RANGE(0xc00000, 0xc3ffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) /* See Note 1 above */ - AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_SHARE("custom_regs") /* Custom Chips */ - AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE(amiga_autoconfig_r, amiga_autoconfig_w) - AM_RANGE(0xf80000, 0xfbffff) AM_ROM AM_REGION("user1", 0) /* Bootstrap ROM */ - AM_RANGE(0xfc0000, 0xffffff) AM_RAMBANK("bank2") /* Writable Control Store RAM */ -ADDRESS_MAP_END +DRIVER_INIT_MEMBER( a2000_state, ntsc ) +{ + m_agnus_id = AGNUS_HR_NTSC; // 8370 (later versions 8372A) + m_denise_id = DENISE; // 8362 +} +DRIVER_INIT_MEMBER( a500_state, pal ) +{ + m_agnus_id = AGNUS_HR_PAL; // 8371 (later versions 8372A) + m_denise_id = 0x0097; /*DENISE;*/ // 8362 + m_denise_id = 0x00fc; +} -/*************************************************************************** - Inputs -***************************************************************************/ +DRIVER_INIT_MEMBER( a500_state, ntsc ) +{ + m_agnus_id = AGNUS_HR_NTSC; // 8370 (later versions 8372A) + m_denise_id = DENISE; // 8362 +} -static INPUT_PORTS_START( amiga_common ) - PORT_START("input") - PORT_CONFNAME( 0x20, 0x00, "Input Port 0 Device") - PORT_CONFSETTING( 0x00, "Mouse" ) - PORT_CONFSETTING( 0x20, DEF_STR(Joystick) ) - PORT_CONFNAME( 0x10, 0x10, "Input Port 1 Device") - PORT_CONFSETTING( 0x00, "Mouse" ) - PORT_CONFSETTING( 0x10, DEF_STR(Joystick) ) - - PORT_START("CIA0PORTA") - PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_SPECIAL ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) +DRIVER_INIT_MEMBER( cdtv_state, pal ) +{ + m_agnus_id = AGNUS_HR_PAL; // 8372A + m_denise_id = DENISE; // 8362 +} - PORT_START("JOY0DAT") - PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state,amiga_joystick_convert, 0) - PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED ) +DRIVER_INIT_MEMBER( cdtv_state, ntsc ) +{ + m_agnus_id = AGNUS_HR_NTSC; // 8372A + m_denise_id = DENISE; // 8362 +} - PORT_START("JOY1DAT") - PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state,amiga_joystick_convert, 1) - PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED ) +// ecs chipset (agnus with support for 2mb chip ram, super denise) +DRIVER_INIT_MEMBER( a3000_state, pal ) +{ + m_agnus_id = AGNUS_HR_PAL_NEW; // 8372B (early versions: 8372AB) + m_denise_id = DENISE_HR; // 8373 +} - PORT_START("POTGO") - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0xaaff, IP_ACTIVE_HIGH, IPT_UNUSED ) +DRIVER_INIT_MEMBER( a3000_state, ntsc ) +{ + m_agnus_id = AGNUS_HR_NTSC_NEW; // 8372B (early versions: 8372AB) + m_denise_id = DENISE_HR; // 8373 +} - PORT_START("P1JOY") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) +DRIVER_INIT_MEMBER( a500p_state, pal ) +{ + m_agnus_id = AGNUS_HR_PAL; // 8375 (390544-01) + m_denise_id = DENISE_HR; // 8373 +} - PORT_START("P2JOY") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) +DRIVER_INIT_MEMBER( a500p_state, ntsc ) +{ + m_agnus_id = AGNUS_HR_NTSC; // 8375 (390544-02) + m_denise_id = DENISE_HR; // 8373 +} - PORT_START("P0MOUSEX") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) +DRIVER_INIT_MEMBER( a600_state, pal ) +{ + m_agnus_id = AGNUS_HR_PAL; // 8375 (390544-01) + m_denise_id = DENISE_HR; // 8373 +} - PORT_START("P0MOUSEY") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) +DRIVER_INIT_MEMBER( a600_state, ntsc ) +{ + m_agnus_id = AGNUS_HR_NTSC; // 8375 (390544-02) + m_denise_id = DENISE_HR; // 8373 +} - PORT_START("P1MOUSEX") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(2) +// aga chipset (alice and lisa) +DRIVER_INIT_MEMBER( a1200_state, pal ) +{ + m_agnus_id = ALICE_PAL_NEW; + m_denise_id = LISA; +} - PORT_START("P1MOUSEY") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(2) -INPUT_PORTS_END +DRIVER_INIT_MEMBER( a1200_state, ntsc ) +{ + m_agnus_id = ALICE_NTSC_NEW; + m_denise_id = LISA; +} + +DRIVER_INIT_MEMBER( a4000_state, pal ) +{ + m_agnus_id = ALICE_PAL_NEW; + m_denise_id = LISA; +} +DRIVER_INIT_MEMBER( a4000_state, ntsc ) +{ + m_agnus_id = ALICE_NTSC_NEW; + m_denise_id = LISA; +} -static INPUT_PORTS_START( amiga ) - PORT_START("hardware") - PORT_CONFNAME( 0x08, 0x08, "Battery backed-up RTC") - PORT_CONFSETTING( 0x00, "Not Installed" ) - PORT_CONFSETTING( 0x08, "Installed" ) +DRIVER_INIT_MEMBER( cd32_state, pal ) +{ + m_agnus_id = ALICE_PAL_NEW; + m_denise_id = LISA; +} - PORT_INCLUDE( amiga_common ) -INPUT_PORTS_END +DRIVER_INIT_MEMBER( cd32_state, ntsc ) +{ + m_agnus_id = ALICE_NTSC_NEW; + m_denise_id = LISA; +} -/* TODO: Support for the CDTV remote control */ -static INPUT_PORTS_START( cdtv ) - PORT_INCLUDE( amiga_common ) -INPUT_PORTS_END +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** +void a1000_state::machine_start() +{ + // start base machine + amiga_state::machine_start(); -/*************************************************************************** - Machine drivers -***************************************************************************/ + // allocate 256kb for wom + m_wom_ram.resize(256 * 1024 / 2); + m_wom->set_base(m_wom_ram); +} +void a1000_state::machine_reset() +{ + // base reset + amiga_state::machine_reset(); -static void handle_cd32_joystick_cia(a1200_state *state, UINT8 pra, UINT8 dra); + // bootrom visible, wom writable + m_bootrom->set_bank(0); + m_maincpu->space(AS_PROGRAM).install_write_bank(0xfc0000, 0xffffff, "wom"); +} -WRITE32_MEMBER(a1200_state::aga_overlay_w) +// any write to this area will write protect the wom and disable the bootrom +WRITE16_MEMBER( a1000_state::write_protect_w ) { - if (ACCESSING_BITS_16_23) - { - data = (data >> 16) & 1; - - /* switch banks as appropriate */ - m_bank1->set_entry(data & 1); - - /* swap the write handlers between ROM and bank 1 based on the bit */ - if ((data & 1) == 0) - /* overlay disabled, map RAM on 0x000000 */ - space.install_write_bank(0x000000, 0x1fffff, "bank1"); - else - /* overlay enabled, map Amiga system ROM on 0x000000 */ - space.unmap_write(0x000000, 0x1fffff); - } + m_bootrom->set_bank(1); + m_maincpu->space(AS_PROGRAM).nop_write(0xfc0000, 0xffffff); } -/************************************* - * - * CIA-A port A access: - * - * PA7 = game port 1, pin 6 (fire) - * PA6 = game port 0, pin 6 (fire) - * PA5 = /RDY (disk ready) - * PA4 = /TK0 (disk track 00) - * PA3 = /WPRO (disk write protect) - * PA2 = /CHNG (disk change) - * PA1 = /LED (LED, 0=bright / audio filter control) - * PA0 = MUTE - * - *************************************/ +WRITE_LINE_MEMBER( a2000_state::zorro2_int2_w ) +{ + m_zorro2_int2 = state; + update_irq2(); +} -WRITE8_MEMBER(a1200_state::ami1200_cia_0_porta_w) +WRITE_LINE_MEMBER( a2000_state::zorro2_int6_w ) { - /* bit 2 = Power Led on Amiga */ - output_set_value("audio_led", !BIT(data, 1)); + m_zorro2_int6 = state; + update_irq6(); +} - handle_cd32_joystick_cia(this, data, m_cia_0->read(space, 2)); +void a2000_state::update_int2() +{ + int state = (m_cia_0_irq || m_zorro2_int2); + set_interrupt((state ? INTENA_SETCLR : 0x0000) | INTENA_PORTS); } -/************************************* - * - * CIA-A port B access: - * - * PB7 = parallel data 7 - * PB6 = parallel data 6 - * PB5 = parallel data 5 - * PB4 = parallel data 4 - * PB3 = parallel data 3 - * PB2 = parallel data 2 - * PB1 = parallel data 1 - * PB0 = parallel data 0 - * - *************************************/ +void a2000_state::update_int6() +{ + int state = (m_cia_1_irq || m_zorro2_int6); + set_interrupt((state ? INTENA_SETCLR : 0x0000) | INTENA_EXTER); +} +void cdtv_state::machine_start() +{ + // start base machine + amiga_state::machine_start(); + // setup dmac + m_dmac->set_address_space(&m_maincpu->space(AS_PROGRAM)); + m_dmac->ramsz_w(0); +} +void cdtv_state::update_int2() +{ + int state = (m_cia_0_irq || m_dmac_irq || m_tpi_irq); + set_interrupt((state ? INTENA_SETCLR : 0x0000) | INTENA_PORTS); +} -//int cd32_input_port_val = 0; -//int cd32_input_select = 0; -#if 0 -static void cd32_potgo_w(running_machine &machine, UINT16 data) +void cdtv_state::update_int6() { - a1200_state *state = machine.driver_data<a1200_state>(); - int i; + int state = (m_cia_1_irq); + set_interrupt((state ? INTENA_SETCLR : 0x0000) | INTENA_EXTER); +} - state->m_potgo_value = state->m_potgo_value & 0x5500; - state->m_potgo_value |= data & 0xaa00; +READ32_MEMBER( a3000_state::scsi_r ) +{ + UINT32 data = 0xffffffff; + logerror("scsi_r(%06x): %08x & %08x\n", offset, data, mem_mask); + return data; +} - for (i = 0; i < 8; i += 2) - { - UINT16 dir = 0x0200 << i; - if (data & dir) - { - UINT16 d = 0x0100 << i; - state->m_potgo_value &= ~d; - state->m_potgo_value |= data & d; - } - } - for (i = 0; i < 2; i++) - { - UINT16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ - UINT16 p5dat = 0x0100 << (i * 4); /* data P5 */ - if ((state->m_potgo_value & p5dir) && (state->m_potgo_value & p5dat)) - state->m_cd32_shifter[i] = 8; - } +WRITE32_MEMBER( a3000_state::scsi_w ) +{ + logerror("scsi_w(%06x): %08x & %08x\n", offset, data, mem_mask); } -#endif -static void handle_cd32_joystick_cia(a1200_state *state, UINT8 pra, UINT8 dra) +READ32_MEMBER( a3000_state::motherboard_r ) { - int i; + UINT32 data = 0xffffffff; + logerror("motherboard_r(%06x): %08x & %08x\n", offset, data, mem_mask); + return data; +} - for (i = 0; i < 2; i++) - { - UINT8 but = 0x40 << i; - UINT16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ - UINT16 p5dat = 0x0100 << (i * 4); /* data P5 */ - if (!(state->m_potgo_value & p5dir) || !(state->m_potgo_value & p5dat)) - { - if ((dra & but) && (pra & but) != state->m_oldstate[i]) - { - if (!(pra & but)) - { - state->m_cd32_shifter[i]--; - if (state->m_cd32_shifter[i] < 0) - state->m_cd32_shifter[i] = 0; - } - } - } - state->m_oldstate[i] = pra & but; - } +WRITE32_MEMBER( a3000_state::motherboard_w ) +{ + logerror("motherboard_w(%06x): %08x & %08x\n", offset, data, mem_mask); } +void a600_state::machine_reset() +{ + // base reset + amiga_state::machine_reset(); + m_gayle_reg[0] = 0; + m_gayle_reg[1] = 0; + m_gayle_reg[2] = 0; + m_gayle_reg[3] = 0; +} -READ8_MEMBER(a1200_state::ami1200_cia_0_portb_r) +// note: for ide a12 = cs0/cs1, offset >> 2 for reg +READ16_MEMBER( a600_state::ide_r ) { - /* parallel port */ - logerror("%s:CIA0_portb_r\n", machine().describe_context()); - return 0xff; + UINT16 data = 0xffff; + logerror("ide_r(%06x): %08x & %08x\n", offset, data, mem_mask); + return data; } -WRITE8_MEMBER(a1200_state::ami1200_cia_0_portb_w) +WRITE16_MEMBER( a600_state::ide_w ) { - /* parallel port */ - logerror("%s:CIA0_portb_w(%02x)\n", machine().describe_context(), data); + logerror("ide_w(%06x): %08x & %08x\n", offset, data, mem_mask); } +READ16_MEMBER( a600_state::gayle_r ) +{ + UINT16 data = 0xffff; + switch (offset) + { + case 0x0000: data = m_gayle_reg[0]; break; + case 0x1000: data = m_gayle_reg[1]; break; + case 0x2000: data = m_gayle_reg[2]; break; + case 0x3000: data = m_gayle_reg[3]; break; + } -MACHINE_START_MEMBER(cdtv_state,cdtv) -{ - MACHINE_START_CALL_MEMBER(amiga); - amigacd_start(machine()); + logerror("gayle_r(%06x): %08x & %08x\n", offset, data, mem_mask); + return data; } - -MACHINE_RESET_MEMBER(cdtv_state,cdtv) +WRITE16_MEMBER( a600_state::gayle_w ) { - MACHINE_RESET_CALL_MEMBER( amiga ); + logerror("gayle_w(%06x): %08x & %08x\n", offset, data, mem_mask); - /* initialize the cdrom controller */ - amigacd_reset(machine()); + switch (offset) + { + case 0x0000: + break; + case 0x1000: + break; + case 0x2000: + break; + case 0x3000: + break; + } } -READ8_MEMBER(a1200_state::a1200_cia_0_portA_r) +READ16_MEMBER( a600_state::gayle_id_r ) { - UINT8 ret = ioport("CIA0PORTA")->read() & 0xc0; /* Gameport 1 and 0 buttons */ - ret |= machine().device<amiga_fdc>("fdc")->ciaapra_r(); - return ret; + if (ACCESSING_BITS_8_15) + return ((GAYLE_ID << m_gayle_id_count++) & 0x80) << 8; + else + return 0xffff; } -#if 0 -static const legacy_mos6526_interface a1200_cia_0_intf = -{ - DEVCB_DRIVER_LINE_MEMBER(amiga_state, amiga_cia_0_irq), /* irq_func */ - DEVCB_NULL, /* pc_func */ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_DRIVER_MEMBER(a1200_state,a1200_cia_0_portA_r), - DEVCB_DRIVER_MEMBER(a1200_state,ami1200_cia_0_porta_w), /* port A */ - DEVCB_DRIVER_MEMBER(a1200_state,ami1200_cia_0_portb_r), - DEVCB_DRIVER_MEMBER(a1200_state,ami1200_cia_0_portb_w) /* port B */ -}; +WRITE16_MEMBER( a600_state::gayle_id_w ) +{ + m_gayle_id_count = 0; +} -static const legacy_mos6526_interface a1200_cia_1_intf = +void a1200_state::machine_reset() { - DEVCB_DRIVER_LINE_MEMBER(amiga_state, amiga_cia_1_irq), /* irq_func */ - DEVCB_NULL, /* pc_func */ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, /* port A */ - DEVCB_NULL, - DEVCB_DEVICE_MEMBER("fdc", amiga_fdc, ciaaprb_w) /* port B */ -}; -#endif + // base reset + amiga_state::machine_reset(); + m_gayle_reg[0] = 0; + m_gayle_reg[1] = 0; + m_gayle_reg[2] = 0; + m_gayle_reg[3] = 0; +} -static SLOT_INTERFACE_START( amiga_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END +READ32_MEMBER( a1200_state::ide_r ) +{ + UINT16 data = 0xffff; + logerror("ide_r(%06x): %08x & %08x\n", offset, data, mem_mask); + return data; +} -static MACHINE_CONFIG_FRAGMENT( amiga_cartslot ) - MCFG_CARTSLOT_ADD("cart") - MCFG_CARTSLOT_EXTENSION_LIST("rom,bin") - MCFG_CARTSLOT_NOT_MANDATORY -MACHINE_CONFIG_END +WRITE32_MEMBER( a1200_state::ide_w ) +{ + logerror("ide_w(%06x): %08x & %08x\n", offset, data, mem_mask); +} +READ32_MEMBER( a1200_state::gayle_r ) +{ + UINT16 data = 0xffff; -static MACHINE_CONFIG_START( ntsc, amiga_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, AMIGA_68000_NTSC_CLOCK) - MCFG_CPU_PROGRAM_MAP(amiga_mem) + switch (offset) + { + case 0x0000: data = m_gayle_reg[0]; break; + case 0x1000: data = m_gayle_reg[1]; break; + case 0x2000: data = m_gayle_reg[2]; break; + case 0x3000: data = m_gayle_reg[3]; break; + } - MCFG_CPU_ADD("keyboard", M6502, XTAL_1MHz) /* 1 MHz? */ - MCFG_CPU_PROGRAM_MAP(keyboard_mem) - MCFG_DEVICE_DISABLE() + logerror("gayle_r(%06x): %08x & %08x\n", offset, data, mem_mask); + return data; +} - MCFG_SCREEN_ADD("screen", RASTER) -// MCFG_SCREEN_REFRESH_RATE(59.997) -// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) +WRITE32_MEMBER( a1200_state::gayle_w ) +{ + logerror("gayle_w(%06x): %08x & %08x\n", offset, data, mem_mask); - MCFG_MACHINE_START_OVERRIDE(amiga_state, amiga ) - MCFG_MACHINE_RESET_OVERRIDE(amiga_state, amiga ) + switch (offset) + { + case 0x0000: + break; + case 0x1000: + break; + case 0x2000: + break; + case 0x3000: + break; + } +} - MCFG_DEFAULT_LAYOUT(layout_amiga) +READ32_MEMBER( a4000_state::scsi_r ) +{ + UINT16 data = 0xffff; + logerror("scsi_r(%06x): %08x & %08x\n", offset, data, mem_mask); + return data; +} - /* video hardware */ - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) -// MCFG_SCREEN_SIZE(228*4, 262) -// MCFG_SCREEN_VISIBLE_AREA(214, (228*4)-1, 34, 262-1) - MCFG_SCREEN_RAW_PARAMS(AMIGA_68000_NTSC_CLOCK*2,228*4,214,228*4,262,34,262) - MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga) - MCFG_SCREEN_PALETTE("palette") +WRITE32_MEMBER( a4000_state::scsi_w ) +{ + logerror("scsi_w(%06x): %08x & %08x\n", offset, data, mem_mask); +} - MCFG_PALETTE_ADD("palette", 4096) - MCFG_PALETTE_INIT_OWNER(amiga_state, amiga ) +READ32_MEMBER( a4000_state::ide_r ) +{ + UINT16 data = 0xffff; + logerror("ide_r(%06x): %08x & %08x\n", offset, data, mem_mask); + return data; +} - MCFG_VIDEO_START_OVERRIDE(amiga_state,amiga) +WRITE32_MEMBER( a4000_state::ide_w ) +{ + logerror("ide_w(%06x): %08x & %08x\n", offset, data, mem_mask); +} - /* devices */ - MCFG_DEVICE_ADD("rtc", MSM6242, XTAL_32_768kHz) - MCFG_CENTRONICS_ADD("centronics", centronics_printers, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(amiga_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(amiga_state, write_centronics_busy)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(amiga_state, write_centronics_perror)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(amiga_state, write_centronics_select)) +READ32_MEMBER( a4000_state::motherboard_r ) +{ + UINT32 data = 0; - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + if (offset == 0) + { + if (ACCESSING_BITS_0_7) + data |= m_ramsey_config & 0xff; + if (ACCESSING_BITS_8_15) + data |= (m_gary_coldboot << 7 | 0x7f) << 8; + if (ACCESSING_BITS_16_23) + data |= (m_gary_toenb << 7 | 0x7f) << 16; + if (ACCESSING_BITS_24_31) + data |= (m_gary_timeout << 7 | 0x7f) << 24; + } + else + data = 0xffffffff; - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + logerror("motherboard_r(%06x): %08x & %08x\n", offset, data, mem_mask); - MCFG_SOUND_ADD("amiga", AMIGA, 3579545) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) - MCFG_SOUND_ROUTE(3, "lspeaker", 0.50) + return data; +} - /* cia */ - MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, AMIGA_68000_NTSC_CLOCK / 10) - MCFG_MOS6526_TOD(60) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_0_irq)) - MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE("centronics", centronics_device, write_strobe)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(amiga_state, amiga_cia_0_portA_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, amiga_cia_0_portA_w)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, AMIGA_68000_NTSC_CLOCK / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_1_irq)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(amiga_state, amiga_cia_1_porta_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("fdc", amiga_fdc, ciaaprb_w)) +WRITE32_MEMBER( a4000_state::motherboard_w ) +{ + if (offset == 0) + { + if (ACCESSING_BITS_0_7) + m_ramsey_config = data & 0xff; + if (ACCESSING_BITS_8_15) + m_gary_coldboot = BIT(data, 7); + if (ACCESSING_BITS_16_23) + m_gary_toenb = BIT(data, 7); + if (ACCESSING_BITS_24_31) + m_gary_timeout = BIT(data, 7); + } - /* fdc */ - MCFG_DEVICE_ADD("fdc", AMIGA_FDC, AMIGA_68000_NTSC_CLOCK) - MCFG_AMIGA_FDC_INDEX_CALLBACK(DEVWRITELINE("cia_1", legacy_mos6526_device, flag_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", amiga_floppies, "35dd", amiga_fdc::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", amiga_floppies, 0, amiga_fdc::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", amiga_floppies, 0, amiga_fdc::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:3", amiga_floppies, 0, amiga_fdc::floppy_formats) + logerror("motherboard_w(%06x): %08x & %08x\n", offset, data, mem_mask); +} - MCFG_DEVICE_ADD("kbd", AMIGAKBD, 0) - MCFG_AMIGA_KEYBOARD_KCLK_CALLBACK(DEVWRITELINE("cia_0", legacy_mos6526_device, cnt_w)) - MCFG_AMIGA_KEYBOARD_KDAT_CALLBACK(DEVWRITELINE("cia_0", legacy_mos6526_device, sp_w)) -MACHINE_CONFIG_END +void cd32_state::potgo_w(UINT16 data) +{ + int i; -static MACHINE_CONFIG_DERIVED( a1000ntsc, ntsc ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(a1000_mem) -MACHINE_CONFIG_END + m_potgo_value = m_potgo_value & 0x5500; + m_potgo_value |= data & 0xaa00; -static MACHINE_CONFIG_DERIVED( a500ntsc, ntsc ) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_MOS6526_TOD(0) + for (i = 0; i < 8; i += 2) + { + UINT16 dir = 0x0200 << i; + if (data & dir) + { + UINT16 d = 0x0100 << i; + m_potgo_value &= ~d; + m_potgo_value |= data & d; + } + } + for (i = 0; i < 2; i++) + { + UINT16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ + UINT16 p5dat = 0x0100 << (i * 4); /* data P5 */ + if ((m_potgo_value & p5dir) && (m_potgo_value & p5dat)) + m_cd32_shifter[i] = 8; + } +} - MCFG_FRAGMENT_ADD(amiga_cartslot) +static void handle_cd32_joystick_cia(running_machine &machine, UINT8 pra, UINT8 dra) +{ + cd32_state *state = machine.driver_data<cd32_state>(); + int i; - MCFG_SOFTWARE_LIST_ADD("flop_misc","amiga_flop") - MCFG_SOFTWARE_LIST_ADD("flop_ocs","amigaocs_flop") - MCFG_SOFTWARE_LIST_ADD("flop_ecs","amigaecs_flop") -MACHINE_CONFIG_END + for (i = 0; i < 2; i++) + { + UINT8 but = 0x40 << i; + UINT16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ + UINT16 p5dat = 0x0100 << (i * 4); /* data P5 */ -static MACHINE_CONFIG_DERIVED_CLASS( cdtv, ntsc, cdtv_state) - MCFG_CPU_REPLACE("maincpu", M68000, CDTV_CLOCK_X1 / 4) - MCFG_CPU_PROGRAM_MAP(cdtv_mem) + if (!(state->m_potgo_value & p5dir) || !(state->m_potgo_value & p5dat)) + { + if ((dra & but) && (pra & but) != state->m_oldstate[i]) + { + if (!(pra & but)) + { + state->m_cd32_shifter[i]--; + if (state->m_cd32_shifter[i] < 0) + state->m_cd32_shifter[i] = 0; + } + } + } + state->m_oldstate[i] = pra & but; + } +} - MCFG_DEVICE_REMOVE("keyboard") +static UINT16 handle_joystick_potgor(running_machine &machine, UINT16 potgor) +{ + cd32_state *state = machine.driver_data<cd32_state>(); + ioport_port * player_portname[] = { state->m_p1_port, state->m_p2_port }; + int i; - MCFG_CPU_ADD("rcmcu", M6502, XTAL_1MHz) /* 1 MHz? */ - MCFG_CPU_PROGRAM_MAP(cdtv_rcmcu_mem) - MCFG_DEVICE_DISABLE() + for (i = 0; i < 2; i++) + { + UINT16 p9dir = 0x0800 << (i * 4); /* output enable P9 */ + UINT16 p9dat = 0x0400 << (i * 4); /* data P9 */ + UINT16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ + UINT16 p5dat = 0x0100 << (i * 4); /* data P5 */ -// MCFG_CPU_ADD("lcd", LC6554, XTAL_4MHz) /* 4 MHz? */ -// MCFG_CPU_PROGRAM_MAP(cdtv_lcd_mem) + /* p5 is floating in input-mode */ + potgor &= ~p5dat; + potgor |= state->m_potgo_value & p5dat; + if (!(state->m_potgo_value & p9dir)) + potgor |= p9dat; + /* P5 output and 1 -> shift register is kept reset (Blue button) */ + if ((state->m_potgo_value & p5dir) && (state->m_potgo_value & p5dat)) + state->m_cd32_shifter[i] = 8; + /* shift at 1 == return one, >1 = return button states */ + if (state->m_cd32_shifter[i] == 0) + potgor &= ~p9dat; /* shift at zero == return zero */ + if (state->m_cd32_shifter[i] >= 2 && ((player_portname[i])->read() & (1 << (state->m_cd32_shifter[i] - 2)))) + potgor &= ~p9dat; + } + return potgor; +} - MCFG_MACHINE_START_OVERRIDE(cdtv_state, cdtv ) - MCFG_MACHINE_RESET_OVERRIDE(cdtv_state, cdtv ) +CUSTOM_INPUT_MEMBER( cd32_state::cd32_input ) +{ + return handle_joystick_potgor(machine(), m_potgo_value) >> 8; +} - MCFG_NVRAM_ADD_0FILL("nvram") +CUSTOM_INPUT_MEMBER( cd32_state::cd32_sel_mirror_input ) +{ + ioport_port* ports[2]= { m_p1_port, m_p2_port }; + UINT8 bits = ports[(int)(FPTR)param]->read(); + return (bits & 0x20)>>5; +} - MCFG_SOUND_ADD( "cdda", CDDA, 0 ) - MCFG_SOUND_ROUTE( 0, "lspeaker", 1.0 ) - MCFG_SOUND_ROUTE( 1, "rspeaker", 1.0 ) +WRITE8_MEMBER( cd32_state::akiko_cia_0_port_a_write ) +{ + // bit 0, cd audio mute + m_cdda->set_output_gain(0, BIT(data, 0) ? 0.0 : 1.0); - /* cdrom */ - MCFG_CDROM_ADD( "cdrom") - MCFG_CDROM_INTERFACE("cdrom") - - MCFG_SOFTWARE_LIST_ADD("cd_list", "cdtv") + // bit 1, power led + set_led_status(machine(), 0, BIT(data, 1) ? 0 : 1); - MCFG_DEVICE_ADD("tpi6525", TPI6525, 0) - MCFG_TPI6525_OUT_IRQ_CB(WRITELINE(amiga_state, amigacd_tpi6525_irq)) - MCFG_TPI6525_OUT_PB_CB(WRITE8(amiga_state, amigacd_tpi6525_portb_w)) - MCFG_TPI6525_IN_PC_CB(READ8(amiga_state, amigacd_tpi6525_portc_r)) - - MCFG_DEVICE_MODIFY("cia_0") - MCFG_MOS6526_TOD(0) // connected to vsync -MACHINE_CONFIG_END + handle_cd32_joystick_cia(machine(), data, m_cia_0->read(space, 2)); +} -static MACHINE_CONFIG_DERIVED( pal, ntsc ) +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** - /* adjust for PAL specs */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK( AMIGA_68000_PAL_CLOCK) +// The first Amiga systems used a PAL to decode chip selects, later systems +// switched to the "Gary" chip, the A3000 and A4000 used the "Super Gary" +// chip. The A600 and A1200 use the Gayle chip, while the CD32 uses its +// Akiko custom chip. - // Change the FDC clock too? +#if 0 +static ADDRESS_MAP_START( a1000_overlay_map, AS_PROGRAM, 16, a1000_state ) + AM_RANGE(0x000000, 0x03ffff) AM_MIRROR(0x1c0000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x201fff) AM_MIRROR(0x03e000) AM_ROM AM_REGION("bootrom", 0) + AM_RANGE(0x280000, 0x2bffff) AM_MIRROR(0x040000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x300000, 0x33ffff) AM_MIRROR(0x040000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x380000, 0x381fff) AM_MIRROR(0x03e000) AM_ROM AM_REGION("bootrom", 0) +ADDRESS_MAP_END +#endif - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_RAW_PARAMS(AMIGA_68000_PAL_CLOCK*2,228*4,214,228*4,312,34,312) -// MCFG_SCREEN_REFRESH_RATE(50) -// MCFG_SCREEN_SIZE(228*4, 312) -// MCFG_SCREEN_VISIBLE_AREA(214, (228*4)-1, 34, 312-1) +static ADDRESS_MAP_START( a1000_overlay_map, AS_PROGRAM, 16, a1000_state ) + AM_RANGE(0x000000, 0x07ffff) AM_MIRROR(0x180000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x201fff) AM_MIRROR(0x03e000) AM_ROM AM_REGION("bootrom", 0) + AM_RANGE(0x280000, 0x2fffff) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x300000, 0x37ffff) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x380000, 0x381fff) AM_MIRROR(0x03e000) AM_ROM AM_REGION("bootrom", 0) +ADDRESS_MAP_END - /* cia */ - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(AMIGA_68000_PAL_CLOCK / 10) - MCFG_MOS6526_TOD(50) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(AMIGA_68000_PAL_CLOCK / 10) +static ADDRESS_MAP_START( a1000_bootrom_map, AS_PROGRAM, 16, a1000_state ) + AM_RANGE(0x000000, 0x001fff) AM_MIRROR(0x3e000) AM_ROM AM_REGION("bootrom", 0) AM_WRITE(write_protect_w) + AM_RANGE(0x040000, 0x07ffff) AM_ROMBANK("wom") +ADDRESS_MAP_END - /* fdc */ - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(AMIGA_68000_PAL_CLOCK) -MACHINE_CONFIG_END +static ADDRESS_MAP_START( a1000_mem, AS_PROGRAM, 16, a1000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf80000, 0xfbffff) AM_DEVICE("bootrom", address_map_bank_device, amap16) + AM_RANGE(0xfc0000, 0xffffff) AM_READWRITE_BANK("wom") +ADDRESS_MAP_END -static MACHINE_CONFIG_DERIVED( a500p, pal ) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_MOS6526_TOD(0) // connected to vsync +// Gary/Super Gary/Gayle with 512KB chip RAM +static ADDRESS_MAP_START( overlay_512kb_map, AS_PROGRAM, 16, amiga_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x07ffff) AM_MIRROR(0x180000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END - MCFG_FRAGMENT_ADD(amiga_cartslot) +// Gary/Super Gary/Gayle with 1MB chip RAM +static ADDRESS_MAP_START( overlay_1mb_map, AS_PROGRAM, 16, amiga_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x0fffff) AM_MIRROR(0x100000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END - MCFG_SOFTWARE_LIST_ADD("flop_misc","amiga_flop") - MCFG_SOFTWARE_LIST_ADD("flop_ocs","amigaocs_flop") - MCFG_SOFTWARE_LIST_ADD("flop_ecs","amigaecs_flop") -MACHINE_CONFIG_END +// Gary/Super Gary/Gayle with 1MB chip RAM (32 bit system) +static ADDRESS_MAP_START( overlay_1mb_map32, AS_PROGRAM, 32, amiga_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x0fffff) AM_MIRROR(0x100000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END -static MACHINE_CONFIG_DERIVED( a1000p, pal ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(a1000_mem) -MACHINE_CONFIG_END +// Gary/Super Gary/Gayle with 2MB chip RAM (32 bit system) +static ADDRESS_MAP_START( overlay_2mb_map32, AS_PROGRAM, 32, amiga_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END -/* Machine definitions with Software List associations for system software */ +// 512KB chip RAM, 512KB slow RAM, RTC +static ADDRESS_MAP_START( a2000_mem, AS_PROGRAM, 16, a2000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xc7ffff) AM_RAM + AM_RANGE(0xc80000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xd80000, 0xdbffff) AM_NOP + AM_RANGE(0xdc0000, 0xdc7fff) AM_READWRITE(clock_r, clock_w) + AM_RANGE(0xd80000, 0xddffff) AM_NOP + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END -/* Amiga 1000 */ +// 512KB chip RAM and no clock +static ADDRESS_MAP_START( a500_mem, AS_PROGRAM, 16, a500_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xd80000, 0xddffff) AM_NOP + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END -static MACHINE_CONFIG_DERIVED( a1000, a1000p ) - MCFG_SOFTWARE_LIST_ADD("flop_list","amiga1000_flop") -MACHINE_CONFIG_END +// 1MB chip RAM, RTC and CDTV specific hardware +static ADDRESS_MAP_START( cdtv_mem, AS_PROGRAM, 16, cdtv_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xd80000, 0xdbffff) AM_NOP + AM_RANGE(0xdc0000, 0xdc7fff) AM_READWRITE(clock_r, clock_w) + AM_RANGE(0xdc8000, 0xdc87ff) AM_MIRROR(0x7800) AM_RAM AM_SHARE("sram") + AM_RANGE(0xdd0000, 0xddffff) AM_NOP + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe3ffff) AM_MIRROR(0x40000) AM_RAM AM_SHARE("memcard") + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf00000, 0xf3ffff) AM_MIRROR(0x40000) AM_ROM AM_REGION("cdrom", 0) + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END -static MACHINE_CONFIG_DERIVED( a1000n, a1000ntsc ) - MCFG_SOFTWARE_LIST_ADD("flop_list","amiga1000_flop") -MACHINE_CONFIG_END +static ADDRESS_MAP_START( cdtv_rc_mem, AS_PROGRAM, 8, cdtv_state ) + AM_RANGE(0x0800, 0x0fff) AM_ROM AM_REGION("rcmcu", 0) +ADDRESS_MAP_END -/* Amiga 500 */ +static ADDRESS_MAP_START( a3000_mem, AS_PROGRAM, 32, a3000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x001fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) + AM_RANGE(0x00b80000, 0x00bfffff) AM_READWRITE16(cia_r, cia_w, 0xffffffff) + AM_RANGE(0x00c00000, 0x00cfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) + AM_RANGE(0x00d00000, 0x00dbffff) AM_NOP + AM_RANGE(0x00dc0000, 0x00dcffff) AM_READWRITE(clock_r, clock_w) + AM_RANGE(0x00dd0000, 0x00ddffff) AM_READWRITE(scsi_r, scsi_w) + AM_RANGE(0x00de0000, 0x00deffff) AM_READWRITE(motherboard_r, motherboard_w) + AM_RANGE(0x00df0000, 0x00dfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) AM_SHARE("custom_regs") + AM_RANGE(0x00e80000, 0x00efffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0x00f00000, 0x00f7ffff) AM_NOP // cartridge space + AM_RANGE(0x00f80000, 0x00ffffff) AM_ROM AM_REGION("kickstart", 0) + AM_RANGE(0x07f00000, 0x07ffffff) AM_RAM // motherboard ram (up to 16mb), grows downward +ADDRESS_MAP_END -static MACHINE_CONFIG_DERIVED( a500, a500p ) - MCFG_SOFTWARE_LIST_ADD("flop_list","amiga500_flop") -MACHINE_CONFIG_END +// 1MB chip RAM and RTC +static ADDRESS_MAP_START( a500p_mem, AS_PROGRAM, 16, a500p_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xc7ffff) AM_RAM + AM_RANGE(0xc80000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xd80000, 0xdbffff) AM_NOP + AM_RANGE(0xdc0000, 0xdc7fff) AM_READWRITE(clock_r, clock_w) + AM_RANGE(0xd80000, 0xddffff) AM_NOP + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END -static MACHINE_CONFIG_DERIVED( a500n, a500ntsc ) - MCFG_SOFTWARE_LIST_ADD("flop_list","amiga500_flop") -MACHINE_CONFIG_END +// 1MB chip RAM, IDE and PCMCIA +static ADDRESS_MAP_START( a600_mem, AS_PROGRAM, 16, a600_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0x200000, 0xa7ffff) AM_NOP + AM_RANGE(0xa80000, 0xafffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xb00000, 0xb7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xb80000, 0xbeffff) AM_NOP // reserved (cdtv) + AM_RANGE(0xbf0000, 0xbfffff) AM_READWRITE(cia_r, gayle_cia_w) + AM_RANGE(0xc00000, 0xd7ffff) AM_NOP // slow mem +// AM_RANGE(0xd80000, 0xd8ffff) AM_NOP // spare chip select +// AM_RANGE(0xd90000, 0xd9ffff) AM_NOP // arcnet chip select + AM_RANGE(0xda0000, 0xda3fff) AM_READWRITE(ide_r, ide_w) +// AM_RANGE(0xda4000, 0xda7fff) AM_NOP // ide reserved + AM_RANGE(0xda8000, 0xdaffff) AM_READWRITE(gayle_r, gayle_w) +// AM_RANGE(0xdb0000, 0xdbffff) AM_NOP // reserved (external ide) + AM_RANGE(0xdc0000, 0xdcffff) AM_NOP // rtc +// AM_RANGE(0xdd0000, 0xddffff) AM_NOP // reserved (dma controller) + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(gayle_id_r, gayle_id_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf00000, 0xf7ffff) AM_NOP // cartridge space + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END -/* Amiga 500 Plus */ +// 2MB chip RAM, IDE and PCMCIA +static ADDRESS_MAP_START( a1200_mem, AS_PROGRAM, 32, a1200_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) + AM_RANGE(0x200000, 0xa7ffff) AM_NOP + AM_RANGE(0xa80000, 0xafffff) AM_WRITENOP AM_READ(rom_mirror32_r) + AM_RANGE(0xb00000, 0xb7ffff) AM_WRITENOP AM_READ(rom_mirror32_r) + AM_RANGE(0xb80000, 0xbeffff) AM_NOP // reserved (cdtv) + AM_RANGE(0xbf0000, 0xbfffff) AM_READWRITE16(cia_r, gayle_cia_w, 0xffffffff) + AM_RANGE(0xc00000, 0xd7ffff) AM_NOP // slow mem + AM_RANGE(0xd80000, 0xd8ffff) AM_NOP // spare chip select + AM_RANGE(0xd90000, 0xd9ffff) AM_NOP // arcnet chip select + AM_RANGE(0xda0000, 0xda3fff) AM_READWRITE(ide_r, ide_w) + AM_RANGE(0xda4000, 0xda7fff) AM_NOP // ide reserved + AM_RANGE(0xda8000, 0xdaffff) AM_READWRITE(gayle_r, gayle_w) + AM_RANGE(0xdb0000, 0xdbffff) AM_NOP // reserved (external ide) + AM_RANGE(0xdc0000, 0xdcffff) AM_NOP // rtc + AM_RANGE(0xdd0000, 0xddffff) AM_NOP // reserved (dma controller) + AM_RANGE(0xde0000, 0xdeffff) AM_NOP // reserved (mb resources) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror32_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf00000, 0xf7ffff) AM_NOP // cartridge space + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END -static MACHINE_CONFIG_DERIVED( a500pls, a500p ) - MCFG_SOFTWARE_LIST_ADD("flop_list","amiga500plus_flop") -MACHINE_CONFIG_END +// 2MB chip RAM, 4 MB fast RAM, RTC and IDE +static ADDRESS_MAP_START( a4000_mem, AS_PROGRAM, 32, a4000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x001fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) + AM_RANGE(0x00200000, 0x009fffff) AM_NOP // zorro2 expansion + AM_RANGE(0x00a00000, 0x00b7ffff) AM_NOP + AM_RANGE(0x00b80000, 0x00beffff) AM_NOP + AM_RANGE(0x00bf0000, 0x00bfffff) AM_READWRITE16(cia_r, cia_w, 0xffffffff) + AM_RANGE(0x00c00000, 0x00cfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) + AM_RANGE(0x00d00000, 0x00d9ffff) AM_NOP + AM_RANGE(0x00da0000, 0x00dbffff) AM_NOP + AM_RANGE(0x00dc0000, 0x00dcffff) AM_READWRITE(clock_r, clock_w) + AM_RANGE(0x00dd0000, 0x00dd0fff) AM_NOP + AM_RANGE(0x00dd1000, 0x00dd3fff) AM_READWRITE(ide_r, ide_w) + AM_RANGE(0x00dd4000, 0x00ddffff) AM_NOP + AM_RANGE(0x00de0000, 0x00deffff) AM_READWRITE(motherboard_r, motherboard_w) + AM_RANGE(0x00df0000, 0x00dfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) AM_SHARE("custom_regs") + AM_RANGE(0x00e00000, 0x00e7ffff) AM_WRITENOP AM_READ(rom_mirror32_r) + AM_RANGE(0x00e80000, 0x00efffff) AM_NOP // zorro2 autoconfig space (installed by devices) + AM_RANGE(0x00f00000, 0x00f7ffff) AM_NOP // cartridge space + AM_RANGE(0x00f80000, 0x00ffffff) AM_ROM AM_REGION("kickstart", 0) + AM_RANGE(0x01000000, 0x017fffff) AM_NOP // reserved (8 mb chip ram) + AM_RANGE(0x01800000, 0x06ffffff) AM_NOP // reserved (motherboard fast ram expansion) + AM_RANGE(0x07000000, 0x07bfffff) AM_NOP // motherboard ram + AM_RANGE(0x07c00000, 0x07ffffff) AM_RAM // motherboard ram (up to 16mb), grows downward +ADDRESS_MAP_END -static MACHINE_CONFIG_DERIVED( a500plsn, a500ntsc ) - MCFG_SOFTWARE_LIST_ADD("flop_list","amiga500plus_flop") -MACHINE_CONFIG_END +// 2MB chip RAM, 2 MB fast RAM, RTC and IDE +static ADDRESS_MAP_START( a400030_mem, AS_PROGRAM, 32, a4000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_IMPORT_FROM(a4000_mem) + AM_RANGE(0x07000000, 0x07dfffff) AM_NOP // motherboard ram + AM_RANGE(0x07e00000, 0x07ffffff) AM_RAM // motherboard ram (up to 16mb), grows downward +ADDRESS_MAP_END -/* Amiga 600 */ +// 2MB chip RAM and CD-ROM +static ADDRESS_MAP_START( cd32_mem, AS_PROGRAM, 32, cd32_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) + AM_RANGE(0xb80000, 0xb8003f) AM_DEVREADWRITE("akiko", akiko_device, read, write) + AM_RANGE(0xbf0000, 0xbfffff) AM_READWRITE16(cia_r, gayle_cia_w, 0xffffffff) + AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) AM_SHARE("custom_regs") + AM_RANGE(0xe00000, 0xe7ffff) AM_ROM AM_REGION("kickstart", 0x80000) + AM_RANGE(0xa00000, 0xf7ffff) AM_NOP + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END -static MACHINE_CONFIG_DERIVED( a600, a500p ) - MCFG_SOFTWARE_LIST_ADD("flop_list","amiga600_flop") -MACHINE_CONFIG_END +// 2 MB chip RAM, IDE, RTC and SCSI +static ADDRESS_MAP_START( a4000t_mem, AS_PROGRAM, 32, a4000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_IMPORT_FROM(a4000_mem) + AM_RANGE(0x00dd0000, 0x00dd0fff) AM_READWRITE(scsi_r, scsi_w) +ADDRESS_MAP_END -static MACHINE_CONFIG_DERIVED( a600n, a500ntsc ) - MCFG_SOFTWARE_LIST_ADD("flop_list","amiga600_flop") -MACHINE_CONFIG_END +//************************************************************************** +// INPUTS +//************************************************************************** +static INPUT_PORTS_START( amiga ) + PORT_START("input") + PORT_CONFNAME(0x10, 0x00, "Game Port 0 Device") + PORT_CONFSETTING(0x00, "Mouse") + PORT_CONFSETTING(0x10, DEF_STR(Joystick)) + PORT_CONFNAME(0x20, 0x20, "Game Port 1 Device") + PORT_CONFSETTING(0x00, "Mouse") + PORT_CONFSETTING(0x20, DEF_STR(Joystick) ) + + PORT_START("cia_0_port_a") + PORT_BIT(0x3f, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, floppy_drive_status, 0) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) + + PORT_START("joy_0_dat") + PORT_BIT(0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, amiga_joystick_convert, 0) + PORT_BIT(0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("joy_1_dat") + PORT_BIT(0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, amiga_joystick_convert, 1) + PORT_BIT(0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("potgo") + PORT_BIT(0x0100, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x0400, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1) + PORT_BIT(0x1000, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x4000, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) + PORT_BIT(0xaaff, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("p1_joy") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) + + PORT_START("p2_joy") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) + + PORT_START("p1_mouse_x") + PORT_BIT(0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) + + PORT_START("p1_mouse_y") + PORT_BIT(0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) + + PORT_START("p2_mouse_x") + PORT_BIT(0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(2) + + PORT_START("p2_mouse_y") + PORT_BIT(0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(2) +INPUT_PORTS_END -static MACHINE_CONFIG_START( a1200n, a1200_state ) +INPUT_PORTS_START( cd32 ) + PORT_INCLUDE(amiga) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68EC020, AMIGA_68EC020_NTSC_CLOCK) /* 14.3 Mhz */ - MCFG_CPU_PROGRAM_MAP(a1200_map) + PORT_MODIFY("cia_0_port_a") + PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_SPECIAL ) + // this is the regular port for reading a single button joystick on the Amiga, many CD32 games require this to mirror the pad start button! + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state, cd32_sel_mirror_input, 0) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state, cd32_sel_mirror_input, 1) - MCFG_CPU_ADD("keyboard", M6502, XTAL_1MHz) /* 1 MHz? */ - MCFG_CPU_PROGRAM_MAP(keyboard_mem) - MCFG_DEVICE_DISABLE() + PORT_MODIFY("joy_0_dat") + PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, amiga_joystick_convert, 0) + PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED ) - MCFG_MACHINE_START_OVERRIDE(amiga_state, amiga ) - MCFG_MACHINE_RESET_OVERRIDE(amiga_state, amiga ) + PORT_MODIFY("joy_1_dat") + PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, amiga_joystick_convert, 1) + PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED ) - /* TODO: params */ - MCFG_SCREEN_ADD("screen", RASTER) -// MCFG_SCREEN_REFRESH_RATE(59.997) -// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) -// MCFG_SCREEN_SIZE(512*2, 312) -// MCFG_SCREEN_VISIBLE_AREA((129-8-8)*2, (449+8-1+8)*2, 44-8, 300+8-1) -// MCFG_SCREEN_RAW_PARAMS(AMIGA_68EC020_NTSC_CLOCK,512*2,(129-8-8)*2,(449+8-1+8)*2,312,44-8,300+8) - MCFG_SCREEN_RAW_PARAMS(AMIGA_68EC020_NTSC_CLOCK,228*4,214,228*4,262,34,262) + PORT_MODIFY("potgo") + PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state, cd32_input, 0) + PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) + + // CD32 '11' button pad (4 dpad directions + 7 buttons), not read directly + PORT_START("p1_cd32_buttons") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Play/Pause") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Left Trigger/Rewind") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Right Trigger/Forward") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Green/Stop") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Yellow/Shuffle") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Red/Select") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("P1 Blue/Loop") + + // CD32 '11' button pad (4 dpad directions + 7 buttons), not read directly + PORT_START("p2_cd32_buttons") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Play/Pause") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Left Trigger/Rewind") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Right Trigger/Forward") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Green/Stop") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Yellow/Shuffle") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Red/Select") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("P2 Blue/Loop") +INPUT_PORTS_END - MCFG_SCREEN_UPDATE_DRIVER(a1200_state, screen_update_amiga_aga) - MCFG_VIDEO_START_OVERRIDE(a1200_state,amiga_aga) +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** - MCFG_DEFAULT_LAYOUT(layout_amiga) +static SLOT_INTERFACE_START( amiga_floppies ) + SLOT_INTERFACE("35dd", FLOPPY_35_DD) +SLOT_INTERFACE_END + +// basic elements common to all amigas +static MACHINE_CONFIG_START( amiga_base, amiga_state ) + // video + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_PAL / 4 * 2, 910, 186, 910, 312, 29 /* 26 */, 312) + MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga) + MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD("palette", 4096) - MCFG_PALETTE_INIT_OWNER(amiga_state, amiga ) + MCFG_PALETTE_INIT_OWNER(amiga_state, amiga) - MCFG_VIDEO_START_OVERRIDE(amiga_state,amiga) + MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga) - /* devices */ - MCFG_DEVICE_ADD("rtc", MSM6242, XTAL_32_768kHz) - MCFG_CENTRONICS_ADD("centronics", centronics_printers, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(amiga_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(amiga_state, write_centronics_busy)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(amiga_state, write_centronics_perror)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(amiga_state, write_centronics_select)) + // cia + MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, amiga_state::CLK_E_PAL) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_0_irq)) + MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE("centronics", centronics_device, write_strobe)) + MCFG_MOS6526_PA_INPUT_CALLBACK(IOPORT("cia_0_port_a")) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, cia_0_port_a_write)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, amiga_state::CLK_E_PAL) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_1_irq)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(amiga_state, cia_1_port_a_read)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("fdc", amiga_fdc, ciaaprb_w)) - /* sound hardware */ + // audio MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_SOUND_ADD("amiga", AMIGA, 3579545) + MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_PAL) MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) MCFG_SOUND_ROUTE(3, "lspeaker", 0.50) - /* cia */ - MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, AMIGA_68EC020_NTSC_CLOCK /2 / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_0_irq)) - MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE("centronics", centronics_device, write_strobe)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(amiga_state, amiga_cia_0_portA_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, amiga_cia_0_portA_w)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, AMIGA_68EC020_NTSC_CLOCK /2 / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_1_irq)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(amiga_state, amiga_cia_1_porta_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("fdc", amiga_fdc, ciaaprb_w)) - - /* fdc */ - MCFG_DEVICE_ADD("fdc", AMIGA_FDC, AMIGA_68EC020_NTSC_CLOCK / 2) - MCFG_AMIGA_FDC_INDEX_CALLBACK(DEVWRITELINE("cia_1", legacy_mos6526_device, flag_w)) + // floppy drives + MCFG_DEVICE_ADD("fdc", AMIGA_FDC, amiga_state::CLK_7M_PAL) MCFG_FLOPPY_DRIVE_ADD("fdc:0", amiga_floppies, "35dd", amiga_fdc::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", amiga_floppies, 0, amiga_fdc::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", amiga_floppies, 0, amiga_fdc::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:3", amiga_floppies, 0, amiga_fdc::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", amiga_floppies, 0, amiga_fdc::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", amiga_floppies, 0, amiga_fdc::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", amiga_floppies, 0, amiga_fdc::floppy_formats) + + // centronics + MCFG_CENTRONICS_ADD("centronics", centronics_printers, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(amiga_state, centronics_ack_w)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(amiga_state, centronics_busy_w)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(amiga_state, centronics_perror_w)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(amiga_state, centronics_select_w)) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + // todo: rs232 + // keyboard MCFG_DEVICE_ADD("kbd", AMIGAKBD, 0) MCFG_AMIGA_KEYBOARD_KCLK_CALLBACK(DEVWRITELINE("cia_0", legacy_mos6526_device, cnt_w)) MCFG_AMIGA_KEYBOARD_KDAT_CALLBACK(DEVWRITELINE("cia_0", legacy_mos6526_device, sp_w)) - - MCFG_SOFTWARE_LIST_ADD("flop_list","amiga1200_flop") - MCFG_SOFTWARE_LIST_ADD("flop_misc","amiga_flop") - MCFG_SOFTWARE_LIST_ADD("flop_ocs","amigaocs_flop") - MCFG_SOFTWARE_LIST_ADD("flop_ecs","amigaecs_flop") - MCFG_SOFTWARE_LIST_ADD("flop_aga","amigaaga_flop") - - - MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED_CLASS( a1000, amiga_base, a1000_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) + MCFG_CPU_PROGRAM_MAP(a1000_mem) -static MACHINE_CONFIG_DERIVED( a1200, a1200n ) - - /* adjust for PAL specs */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(AMIGA_68EC020_PAL_CLOCK) /* 14.18758 MHz */ + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(a1000_overlay_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + MCFG_DEVICE_ADD("bootrom", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(a1000_bootrom_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(19) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x40000) +MACHINE_CONFIG_END - /* video hardware */ - /* TODO: params */ - MCFG_SCREEN_MODIFY("screen") -// MCFG_SCREEN_RAW_PARAMS(AMIGA_68EC020_PAL_CLOCK,512*2,(129-8-8)*2,(449+8-1+8)*2,312,44-8,300+8) - MCFG_SCREEN_RAW_PARAMS(AMIGA_68EC020_PAL_CLOCK,228*4,214,228*4,312,34,312) +static MACHINE_CONFIG_DERIVED_CLASS( a1000n, a1000, a1000_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_NTSC / 4 * 2, 910, 186, 910, 262, 21, 262) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END - /* sound hardware */ - MCFG_SOUND_MODIFY("amiga") - MCFG_SOUND_CLOCK(AMIGA_68EC020_PAL_CLOCK/4) /* 3.546895 MHz */ +static MACHINE_CONFIG_DERIVED_CLASS( a2000, amiga_base, a2000_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) + MCFG_CPU_PROGRAM_MAP(a2000_mem) + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_512kb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + // real-time clock + MCFG_DEVICE_ADD("u65", MSM6242, XTAL_32_768kHz) + + // cpu slot + MCFG_EXPANSION_SLOT_ADD("maincpu", a2000_expansion_cards, NULL) + + // zorro slots + MCFG_ZORRO2_ADD("maincpu") + MCFG_ZORRO2_INT2_HANDLER(WRITELINE(a2000_state, zorro2_int2_w)) + MCFG_ZORRO2_INT6_HANDLER(WRITELINE(a2000_state, zorro2_int6_w)) + MCFG_ZORRO2_SLOT_ADD("zorro1", zorro2_cards, NULL) + MCFG_ZORRO2_SLOT_ADD("zorro2", zorro2_cards, NULL) + MCFG_ZORRO2_SLOT_ADD("zorro3", zorro2_cards, NULL) + MCFG_ZORRO2_SLOT_ADD("zorro4", zorro2_cards, NULL) + MCFG_ZORRO2_SLOT_ADD("zorro5", zorro2_cards, NULL) +MACHINE_CONFIG_END - /* cia */ +static MACHINE_CONFIG_DERIVED_CLASS( a2000n, a2000, a2000_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_NTSC / 4 * 2, 910, 186, 910, 262, 21, 262) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(AMIGA_68EC020_PAL_CLOCK/10/2) + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(AMIGA_68EC020_PAL_CLOCK/10/2) - - /* fdc */ + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(AMIGA_68EC020_PAL_CLOCK/2) + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED_CLASS( a500, amiga_base, a500_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) + MCFG_CPU_PROGRAM_MAP(a500_mem) + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + //MCFG_DEVICE_PROGRAM_MAP(overlay_512kb_map) + MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + // cpu slot + MCFG_EXPANSION_SLOT_ADD("maincpu", a500_expansion_cards, NULL) +MACHINE_CONFIG_END -// 16mhz and 25mhz versions were available -// 68030 / 68040 options available -#define A3000_XTAL XTAL_25MHz - -/* ToDo: proper A3000 clocks */ +static MACHINE_CONFIG_DERIVED_CLASS( a500n, a500, a500_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_NTSC / 4 * 2, 910, 186, 910, 262, 21, 262) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END -static MACHINE_CONFIG_START( a3000n, amiga_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68030, A3000_XTAL) - MCFG_CPU_PROGRAM_MAP(amiga_mem32) +static MACHINE_CONFIG_DERIVED_CLASS( cdtv, amiga_base, cdtv_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) + MCFG_CPU_PROGRAM_MAP(cdtv_mem) - MCFG_CPU_ADD("keyboard", M6502, XTAL_1MHz) /* 1 MHz? */ - MCFG_CPU_PROGRAM_MAP(keyboard_mem) + // remote control input converter + MCFG_CPU_ADD("u75", M6502, XTAL_3MHz) + MCFG_CPU_PROGRAM_MAP(cdtv_rc_mem) MCFG_DEVICE_DISABLE() - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(59.997) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + // lcd controller +#if 0 + MCFG_CPU_ADD("u62", LC6554, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(lcd_mem) +#endif - MCFG_MACHINE_START_OVERRIDE(amiga_state, amiga ) - MCFG_MACHINE_RESET_OVERRIDE(amiga_state, amiga ) + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + // standard sram + MCFG_NVRAM_ADD_0FILL("sram") + + // 256kb memory card + MCFG_NVRAM_ADD_0FILL("memcard") + + // real-time clock + MCFG_DEVICE_ADD("u61", MSM6242, XTAL_32_768kHz) + + // cd-rom controller + MCFG_DMAC_ADD("u36", amiga_state::CLK_7M_PAL) + MCFG_DMAC_SCSI_READ_HANDLER(READ8(cdtv_state, dmac_scsi_data_read)) + MCFG_DMAC_SCSI_WRITE_HANDLER(WRITE8(cdtv_state, dmac_scsi_data_write)) + MCFG_DMAC_IO_READ_HANDLER(READ8(cdtv_state, dmac_io_read)) + MCFG_DMAC_IO_WRITE_HANDLER(WRITE8(cdtv_state, dmac_io_write)) + MCFG_DMAC_INT_HANDLER(WRITELINE(cdtv_state, dmac_int_w)) + + MCFG_DEVICE_ADD("u32", TPI6525, 0) + MCFG_TPI6525_OUT_IRQ_CB(WRITELINE(cdtv_state, tpi_int_w)) + MCFG_TPI6525_OUT_PB_CB(WRITE8(cdtv_state, tpi_port_b_write)) + + // cd-rom + MCFG_CR511B_ADD("cdrom") + MCFG_CR511B_SCOR_HANDLER(DEVWRITELINE("u32", tpi6525_device, i1_w)) MCFG_DEVCB_INVERT + MCFG_CR511B_STCH_HANDLER(DEVWRITELINE("u32", tpi6525_device, i2_w)) MCFG_DEVCB_INVERT + MCFG_CR511B_STEN_HANDLER(DEVWRITELINE("u32", tpi6525_device, i3_w)) + MCFG_CR511B_XAEN_HANDLER(DEVWRITELINE("u32", tpi6525_device, pb2_w)) + MCFG_CR511B_DRQ_HANDLER(DEVWRITELINE("u36", dmac_device, xdreq_w)) + MCFG_CR511B_DTEN_HANDLER(DEVWRITELINE("u36", dmac_device, xdreq_w)) - MCFG_DEFAULT_LAYOUT(layout_amiga) + MCFG_SOFTWARE_LIST_ADD("cd_list", "cdtv") +MACHINE_CONFIG_END - /* video hardware */ - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(A3000_XTAL,228*4,214,228*4,262,34,262) -// MCFG_SCREEN_SIZE(228*4, 262) -// MCFG_SCREEN_VISIBLE_AREA(214, (228*4)-1, 34, 262-1) - MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga) - MCFG_SCREEN_PALETTE("palette") +static MACHINE_CONFIG_DERIVED_CLASS( cdtvn, cdtv, cdtv_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_NTSC / 4 * 2, 910, 186, 910, 262, 21, 262) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("u36") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END - MCFG_PALETTE_ADD("palette", 4096) - MCFG_PALETTE_INIT_OWNER(amiga_state, amiga ) +static MACHINE_CONFIG_DERIVED_CLASS( a3000, amiga_base, a3000_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68030, XTAL_32MHz / 2) + MCFG_CPU_PROGRAM_MAP(a3000_mem) - MCFG_VIDEO_START_OVERRIDE(amiga_state,amiga) + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map32) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - /* devices */ - MCFG_DEVICE_ADD("rtc", MSM6242, XTAL_32_768kHz) - MCFG_CENTRONICS_ADD("centronics", centronics_printers, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(amiga_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(amiga_state, write_centronics_busy)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(amiga_state, write_centronics_perror)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(amiga_state, write_centronics_select)) + // real-time clock + MCFG_DEVICE_ADD("u190", RP5C01, XTAL_32_768kHz) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + // todo: zorro3 slots, super dmac, scsi +MACHINE_CONFIG_END - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") +static MACHINE_CONFIG_DERIVED_CLASS( a3000n, a3000, a3000_state ) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_NTSC / 4 * 2, 910, 186, 910, 262, 21, 262) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END - MCFG_SOUND_ADD("amiga", AMIGA, 3579545) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) - MCFG_SOUND_ROUTE(3, "lspeaker", 0.50) +static MACHINE_CONFIG_DERIVED_CLASS( a500p, amiga_base, a500p_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) + MCFG_CPU_PROGRAM_MAP(a500p_mem) - /* cia */ - MCFG_DEVICE_ADD("cia_0", LEGACY_MOS8520, AMIGA_68000_NTSC_CLOCK / 10) - MCFG_MOS6526_TOD(60) // jumper selectable TICK or VSYNC - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_0_irq)) - MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE("centronics", centronics_device, write_strobe)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(amiga_state, amiga_cia_0_portA_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, amiga_cia_0_portA_w)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_DEVICE_ADD("cia_1", LEGACY_MOS8520, AMIGA_68000_NTSC_CLOCK / 10) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, amiga_cia_1_irq)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(amiga_state, amiga_cia_1_porta_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("fdc", amiga_fdc, ciaaprb_w)) + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - /* fdc */ - MCFG_DEVICE_ADD("fdc", AMIGA_FDC, AMIGA_68000_NTSC_CLOCK) - MCFG_AMIGA_FDC_INDEX_CALLBACK(DEVWRITELINE("cia_1", legacy_mos6526_device, flag_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", amiga_floppies, "35dd", amiga_fdc::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", amiga_floppies, 0, amiga_fdc::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", amiga_floppies, 0, amiga_fdc::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:3", amiga_floppies, 0, amiga_fdc::floppy_formats) + // real-time clock + MCFG_DEVICE_ADD("u9", MSM6242, XTAL_32_768kHz) - MCFG_DEVICE_ADD("kbd", AMIGAKBD, 0) - MCFG_AMIGA_KEYBOARD_KCLK_CALLBACK(DEVWRITELINE("cia_0", legacy_mos6526_device, cnt_w)) - MCFG_AMIGA_KEYBOARD_KDAT_CALLBACK(DEVWRITELINE("cia_0", legacy_mos6526_device, sp_w)) + // cpu slot + MCFG_EXPANSION_SLOT_ADD("maincpu", a500_expansion_cards, NULL) +MACHINE_CONFIG_END - MCFG_SOFTWARE_LIST_ADD("flop_misc","amiga_flop") - MCFG_SOFTWARE_LIST_ADD("flop_ocs","amigaocs_flop") - MCFG_SOFTWARE_LIST_ADD("flop_ecs","amigaecs_flop") - MCFG_SOFTWARE_LIST_ADD("flop_list","amiga3000_flop") +static MACHINE_CONFIG_DERIVED_CLASS( a500pn, a500p, a500p_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_NTSC / 4 * 2, 910, 186, 910, 262, 21, 262) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( a3000, a3000n ) +static MACHINE_CONFIG_DERIVED_CLASS( a600, amiga_base, a600_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) + MCFG_CPU_PROGRAM_MAP(a600_mem) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_RAW_PARAMS(A3000_XTAL,228*4,214,228*4,312,34,312) -// MCFG_SCREEN_REFRESH_RATE(50) -// MCFG_SCREEN_SIZE(228*4, 312) -// MCFG_SCREEN_VISIBLE_AREA(214, (228*4)-1, 34, 312-1) + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + // todo: ide, pcmcia +MACHINE_CONFIG_END - /* cia */ +static MACHINE_CONFIG_DERIVED_CLASS( a600n, a600, a600_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_NTSC / 4 * 2, 910, 186, 910, 262, 21, 262) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(AMIGA_68000_PAL_CLOCK / 10) - MCFG_MOS6526_TOD(50) // jumper selectable TICK or VSYNC + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(AMIGA_68000_PAL_CLOCK / 10) - - /* fdc */ + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(AMIGA_68000_PAL_CLOCK) + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) MACHINE_CONFIG_END -/*************************************************************************** +static MACHINE_CONFIG_DERIVED_CLASS( a1200, amiga_base, a1200_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68EC020, amiga_state::CLK_28M_PAL / 2) + MCFG_CPU_PROGRAM_MAP(a1200_mem) - Amiga specific stuff + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_2mb_map32) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) -***************************************************************************/ + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) + MCFG_DEVICE_REMOVE("palette") -READ8_MEMBER( amiga_state::amiga_cia_0_portA_r ) -{ - UINT8 ret = space.machine().root_device().ioport("CIA0PORTA")->read() & 0xc0; /* Gameport 1 and 0 buttons */ - ret |= space.machine().device<amiga_fdc>("fdc")->ciaapra_r(); - return ret; -} + MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga_aga) + // todo: ide, pcmcia +MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED_CLASS( a1200n, a1200, a1200_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_28M_NTSC / 2) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_NTSC / 4 * 2, 910, 186, 910, 262, 21, 262) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END -WRITE8_MEMBER( amiga_state::amiga_cia_0_portA_w ) -{ - /* switch banks as appropriate */ - m_bank1->set_entry(data & 1); +static MACHINE_CONFIG_DERIVED_CLASS( a4000, amiga_base, a4000_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68040, XTAL_50MHz / 2) + MCFG_CPU_PROGRAM_MAP(a4000_mem) - /* swap the write handlers between ROM and bank 1 based on the bit */ - if ((data & 1) == 0) { - UINT32 mirror_mask = m_chip_ram.bytes(); + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_2mb_map32) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - while( (mirror_mask<<1) < 0x100000 ) { - mirror_mask |= ( mirror_mask << 1 ); - } + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) - /* overlay disabled, map RAM on 0x000000 */ - m_maincpu_program_space->install_write_bank(0x000000, m_chip_ram.bytes() - 1, 0, mirror_mask, "bank1"); + MCFG_DEVICE_REMOVE("palette") - /* if there is a cart region, check for cart overlay */ - if (space.machine().root_device().memregion("user2")->base() != NULL) - amiga_cart_check_overlay(space.machine()); - } - else - /* overlay enabled, map Amiga system ROM on 0x000000 */ - m_maincpu_program_space->unmap_write(0x000000, m_chip_ram.bytes() - 1); + MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga_aga) - set_led_status( space.machine(), 0, ( data & 2 ) ? 0 : 1 ); /* bit 2 = Power Led on Amiga */ - output_set_value("power_led", ( data & 2 ) ? 0 : 1); -} + // real-time clock + MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) -static UINT16 amiga_read_joy0dat(running_machine &machine) -{ - if ( machine.root_device().ioport("input")->read() & 0x20 ) { - /* Joystick */ - return machine.root_device().ioport("JOY0DAT")->read_safe(0xffff); - } else { - /* Mouse */ - int input; - input = ( machine.root_device().ioport("P0MOUSEX")->read() & 0xff ); - input |= ( machine.root_device().ioport("P0MOUSEY")->read() & 0xff ) << 8; - return input; - } -} + // todo: ide, zorro3 +MACHINE_CONFIG_END -static UINT16 amiga_read_joy1dat(running_machine &machine) -{ - if ( machine.root_device().ioport("input")->read() & 0x10 ) { - /* Joystick */ - return machine.root_device().ioport("JOY1DAT")->read_safe(0xffff); - } else { - /* Mouse */ - int input; - input = ( machine.root_device().ioport("P1MOUSEX")->read() & 0xff ); - input |= ( machine.root_device().ioport("P1MOUSEY")->read() & 0xff ) << 8; - return input; - } -} +static MACHINE_CONFIG_DERIVED_CLASS( a4000n, a4000, a4000_state ) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_NTSC / 4 * 2, 910, 186, 910, 262, 21, 262) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END -static void amiga_reset(running_machine &machine) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - if (machine.root_device().ioport("hardware")->read() & 0x08) - { - /* Install RTC */ - state->m_maincpu_program_space->install_readwrite_handler(0xdc0000, 0xdc003f, read16_delegate(FUNC(amiga_state::amiga_clock_r), state), write16_delegate(FUNC(amiga_state::amiga_clock_w), state)); - } - else - { - /* No RTC support */ - state->m_maincpu_program_space->unmap_readwrite(0xdc0000, 0xdc003f); - } -} +static MACHINE_CONFIG_DERIVED_CLASS( a400030, a4000, a4000_state ) + // main cpu + MCFG_DEVICE_REMOVE("maincpu") + MCFG_CPU_ADD("maincpu", M68EC030, XTAL_50MHz / 2) + MCFG_CPU_PROGRAM_MAP(a400030_mem) -DRIVER_INIT_MEMBER(amiga_state,amiga) -{ - static const amiga_machine_interface amiga_intf = - { - ANGUS_CHIP_RAM_MASK, - amiga_read_joy0dat, amiga_read_joy1dat, /* joy0dat_r & joy1dat_r */ - NULL, /* potgo_w */ - NULL, /* serdat_w */ - NULL, /* scanline0_callback */ - amiga_reset, /* reset_callback */ - amiga_cart_nmi, /* nmi_callback */ - 0 /* flags */ - }; + // todo: ide +MACHINE_CONFIG_END - amiga_machine_config(machine(), &amiga_intf); +static MACHINE_CONFIG_DERIVED_CLASS( a400030n, a400030, a4000_state ) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_NTSC / 4 * 2, 910, 186, 910, 262, 21, 262) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END - /* set up memory */ - m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, memregion("user1")->base()); +static MACHINE_CONFIG_DERIVED_CLASS( cd32, amiga_base, cd32_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68EC020, amiga_state::CLK_28M_PAL / 2) + MCFG_CPU_PROGRAM_MAP(cd32_mem) - /* initialize cartridge (if present) */ - amiga_cart_init(machine()); -} + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_2mb_map32) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + MCFG_I2CMEM_ADD("i2cmem") + MCFG_I2CMEM_PAGE_SIZE(16) + MCFG_I2CMEM_DATA_SIZE(1024) + MCFG_AKIKO_ADD("akiko", "maincpu") + MCFG_AKIKO_SCL_HANDLER(DEVWRITELINE("i2cmem", i2cmem_device, write_scl)) + MCFG_AKIKO_SDA_READ_HANDLER(DEVREADLINE("i2cmem", i2cmem_device, read_sda)) + MCFG_AKIKO_SDA_WRITE_HANDLER(DEVWRITELINE("i2cmem", i2cmem_device, write_sda)) -DRIVER_INIT_MEMBER(amiga_state,cdtv) -{ - static const amiga_machine_interface amiga_intf = - { - ECS_CHIP_RAM_MASK, - amiga_read_joy0dat, amiga_read_joy1dat, /* joy0dat_r & joy1dat_r */ - NULL, /* potgo_w */ - NULL, /* serdat_w */ - NULL, /* scanline0_callback */ - NULL, /* reset_callback */ - NULL, /* nmi_callback */ - 0 /* flags */ - }; + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) - amiga_machine_config(machine(), &amiga_intf); + MCFG_DEVICE_REMOVE("palette") - /* set up memory */ - m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, memregion("user1")->base()); -} + MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga_aga) -DRIVER_INIT_MEMBER(a1200_state,a1200) -{ - static const amiga_machine_interface cd32_intf = - { - AGA_CHIP_RAM_MASK, - amiga_read_joy0dat, amiga_read_joy1dat, /* joy0dat_r & joy1dat_r */ - NULL, /* potgo_w */ - NULL, /* serdat_w */ - NULL, /* scanline0_callback */ - NULL, /* reset_callback */ - NULL, /* nmi_callback */ - FLAGS_AGA_CHIPSET | FLAGS_IS_32BIT /* flags */ - }; + MCFG_SOUND_ADD("cdda", CDDA, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - /* configure our Amiga setup */ - amiga_machine_config(machine(), &cd32_intf); + MCFG_DEVICE_MODIFY("cia_0") + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(cd32_state, akiko_cia_0_port_a_write)) - /* set up memory */ - m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, memregion("user1")->base()); -} + MCFG_CDROM_ADD("cdrom") + MCFG_CDROM_INTERFACE("cd32_cdrom") -DRIVER_INIT_MEMBER(amiga_state,a3000) -{ - static const amiga_machine_interface a3000_intf = - { - ECS_CHIP_RAM_MASK, - amiga_read_joy0dat, amiga_read_joy1dat, /* joy0dat_r & joy1dat_r */ - NULL, /* potgo_w */ - NULL, /* serdat_w */ - NULL, /* scanline0_callback */ - NULL, /* reset_callback */ - NULL, /* nmi_callback */ - FLAGS_IS_32BIT, /* flags */ - }; + MCFG_DEVICE_REMOVE("kbd") +MACHINE_CONFIG_END - /* configure our Amiga setup */ - amiga_machine_config(machine(), &a3000_intf); +static MACHINE_CONFIG_DERIVED_CLASS( cd32n, cd32, cd32_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_28M_NTSC / 2) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_NTSC / 4 * 2, 910, 186, 910, 262, 21, 262) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END - /* set up memory */ - m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, memregion("user1")->base()); -} +static MACHINE_CONFIG_DERIVED_CLASS( a4000t, a4000, a4000_state ) + // main cpu + MCFG_DEVICE_REMOVE("maincpu") + MCFG_CPU_ADD("maincpu", M68040, XTAL_50MHz / 2) + MCFG_CPU_PROGRAM_MAP(a4000t_mem) + // todo: ide, zorro3, scsi, super dmac +MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED_CLASS( a4000tn, a4000, a4000_state ) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(amiga_state::CLK_28M_NTSC / 4 * 2, 910, 186, 910, 262, 21, 262) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ -ROM_START( a1000 ) - ROM_REGION16_BE(0x080000, "user1", 0) - ROM_LOAD16_BYTE("252179-01.u5n", 0x000000, 0x001000, CRC(42553bc4) SHA1(8855a97f7a44e3f62d1c88d938fee1f4c606af5b)) - ROM_LOAD16_BYTE("252180-01.u5p", 0x000001, 0x001000, CRC(8e5b9a37) SHA1(d10f1564b99f5ffe108fa042362e877f569de2c3)) +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** - /* Kickstart needed to be loaded from floppy */ +// Amiga 1000 +// +// Shipped with a small bootrom to load kickstart from disk because the +// Kickstart wasn't finished in time. - /* keyboard controller, mos 6500/1 mcu */ - ROM_REGION(0x800, "keyboard", 0) - ROM_LOAD("328191-01.bin", 0x000, 0x800, NO_DUMP) +ROM_START( a1000 ) + ROM_REGION16_BE(0x2000, "bootrom", 0) + ROM_LOAD16_BYTE("252179-01.u5n", 0x0000, 0x1000, CRC(42553bc4) SHA1(8855a97f7a44e3f62d1c88d938fee1f4c606af5b)) + ROM_LOAD16_BYTE("252180-01.u5p", 0x0001, 0x1000, CRC(8e5b9a37) SHA1(d10f1564b99f5ffe108fa042362e877f569de2c3)) + + // PALs, all of type PAL16L8 + ROM_REGION(0x104, "dpalen", 0) + ROM_LOAD("252128-01.u4t", 0, 0x104, CRC(28209ff2) SHA1(20c03b6b8e7254231f4b3014dc2c4d9274d469d2)) + ROM_REGION(0x104, "dpalcas", 0) + ROM_LOAD("252128-02.u6p", 0, 0x104, CRC(b928efd2) SHA1(430794a544d9160e1b786e97e0dec5f25502a00a)) + ROM_REGION(0x104, "daugen", 0) + ROM_LOAD("252128-03.u4s", 0, 0x104, CRC(87747964) SHA1(00d72ec707c582363525fde56176973c7327b1d7)) + ROM_REGION(0x104, "daugcas", 0) + ROM_LOAD("252128-04.u6n", 0, 0x104, CRC(f903adb4) SHA1(4c8fb696fd1aaf9bb8c9efddeac24bb36f119c5f)) ROM_END -#define rom_a1000n rom_a1000 +#define rom_a1000n rom_a1000 +// Amiga 2000 and Amiga 500 +// +// Early models shipped with Kickstart 1.2, later versions with Kickstart 1.3. +// Kickstart 2.04 and 3.1 upgrade available. The Kickstart 2.04 upgrade was also +// available as a special version that included a jumper wire, which was needed +// for some early motherboard revisions (P/N: 363968-01). - -ROM_START( a500 ) - ROM_REGION16_BE(0x080000, "user1", 0) +ROM_START( a2000 ) + ROM_REGION16_BE(0x80000, "kickstart", 0) ROM_DEFAULT_BIOS("kick13") - - /* early models had Kickstart 1.2 */ ROM_SYSTEM_BIOS(0, "kick12", "Kickstart 1.2 (33.180)") - ROMX_LOAD("315093-01.u6", 0x000000, 0x040000, CRC(a6ce1636) SHA1(11f9e62cf299f72184835b7b2a70a16333fc0d88), ROM_GROUPWORD | ROM_BIOS(1)) - /* most models had Kickstart 1.3 */ + ROMX_LOAD("315093-01.u2", 0x00000, 0x40000, CRC(a6ce1636) SHA1(11f9e62cf299f72184835b7b2a70a16333fc0d88), ROM_GROUPWORD | ROM_BIOS(1)) + ROM_COPY("kickstart", 0x00000, 0x40000, 0x40000) ROM_SYSTEM_BIOS(1, "kick13", "Kickstart 1.3 (34.5)") - ROMX_LOAD("315093-02.u6", 0x000000, 0x040000, CRC(c4f0f55f) SHA1(891e9a547772fe0c6c19b610baf8bc4ea7fcb785), ROM_GROUPWORD | ROM_BIOS(2)) - ROM_COPY("user1", 0x000000, 0x040000, 0x040000) - /* why would you run kick31 on an a500? */ - ROM_SYSTEM_BIOS(2, "kick31", "Kickstart 3.1 (40.63)") - ROMX_LOAD("kick40063.u6", 0x000000, 0x080000, CRC(fc24ae0d) SHA1(3b7f1493b27e212830f989f26ca76c02049f09ca), ROM_GROUPWORD | ROM_BIOS(4)) /* part number? */ + ROMX_LOAD("315093-02.u2", 0x00000, 0x40000, CRC(c4f0f55f) SHA1(891e9a547772fe0c6c19b610baf8bc4ea7fcb785), ROM_GROUPWORD | ROM_BIOS(2)) + ROM_COPY("kickstart", 0x00000, 0x40000, 0x40000) + ROM_SYSTEM_BIOS(2, "kick204", "Kickstart 2.04 (37.175)") + ROMX_LOAD("390979-01.u2", 0x00000, 0x80000, CRC(c3bdb240) SHA1(c5839f5cb98a7a8947065c3ed2f14f5f42e334a1), ROM_GROUPWORD | ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "kick31", "Kickstart 3.1 (40.63)") + ROMX_LOAD("kick40063.u2", 0x00000, 0x80000, CRC(fc24ae0d) SHA1(3b7f1493b27e212830f989f26ca76c02049f09ca), ROM_GROUPWORD | ROM_BIOS(4)) +ROM_END - /* action replay cartridge */ - ROM_REGION16_BE(0x080000, "user2", ROMREGION_ERASEFF ) - ROM_CART_LOAD("cart", 0x0000, 0x080000, ROM_NOMIRROR | ROM_OPTIONAL) +// Amiga 2000CR chip location: U500 +#define rom_a2000n rom_a2000 - /* keyboard controller, mos 6500/1 mcu */ - ROM_REGION(0x800, "keyboard", 0) - ROM_LOAD("328191-02.ic1", 0x000, 0x800, NO_DUMP) -ROM_END +// Amiga 500 chip location: U6 +#define rom_a500 rom_a2000 +#define rom_a500n rom_a2000 -#define rom_a500n rom_a500 +// Amiga 500+ +// +// Shipped with Kickstart 2.04. Kickstart 3.1 upgrade available. -ROM_START( a500pl ) - ROM_REGION16_BE(0x080000, "user1", 0) +ROM_START( a500p ) + ROM_REGION16_BE(0x80000, "kickstart", 0) ROM_DEFAULT_BIOS("kick204") - ROM_SYSTEM_BIOS(0, "kick204", "Kickstart 2.04 (37.175)") - ROMX_LOAD("390979-01.u6", 0x000000, 0x080000, CRC(c3bdb240) SHA1(c5839f5cb98a7a8947065c3ed2f14f5f42e334a1), ROM_GROUPWORD | ROM_BIOS(0)) /* identical to 363968.01 */ - - /* action replay cartridge */ - ROM_REGION16_BE(0x080000, "user2", ROMREGION_ERASEFF ) - ROM_CART_LOAD("cart", 0x0000, 0x080000, ROM_NOMIRROR | ROM_OPTIONAL) - - /* keyboard controller, mos 6500/1 mcu */ - ROM_REGION(0x800, "keyboard", 0) - ROM_LOAD("328191-02.ic1", 0x000, 0x800, NO_DUMP) + ROMX_LOAD("390979-01.u6", 0x00000, 0x80000, CRC(c3bdb240) SHA1(c5839f5cb98a7a8947065c3ed2f14f5f42e334a1), ROM_GROUPWORD | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "kick31", "Kickstart 3.1 (40.63)") + ROMX_LOAD("kick40063.u6", 0x00000, 0x80000, CRC(fc24ae0d) SHA1(3b7f1493b27e212830f989f26ca76c02049f09ca), ROM_GROUPWORD | ROM_BIOS(2)) ROM_END -#define rom_a500pln rom_a500pl +#define rom_a500pn rom_a500p -ROM_START( a600 ) - ROM_REGION16_BE(0x080000, "user1", 0) - ROM_DEFAULT_BIOS("kick205") +// Commodore CDTV +// +// Shipped with a standard Kickstart 1.3 and the needed additional drivers +// in two extra chips. - ROM_SYSTEM_BIOS(0, "kick205", "Kickstart 2.05 (37.299)") - ROMX_LOAD("kickstart v2.05 r37.299 (1991)(commodore)(a600)[!].rom", 0x000000, 0x080000, CRC(83028fb5) SHA1(87508de834dc7eb47359cede72d2e3c8a2e5d8db), ROM_GROUPWORD | ROM_BIOS(0)) +ROM_START( cdtv ) + // cd-rom driver + ROM_REGION16_BE(0x40000, "cdrom", 0) + ROM_LOAD16_BYTE("391008-01.u34", 0x00000, 0x20000, CRC(791cb14b) SHA1(277a1778924496353ffe56be68063d2a334360e4)) + ROM_LOAD16_BYTE("391009-01.u35", 0x00001, 0x20000, CRC(accbbc2e) SHA1(41b06d1679c6e6933c3378b7626025f7641ebc5c)) - // from A600HD (had HDD by default) - ROM_SYSTEM_BIOS(1, "kick205a", "Kickstart 2.05 (37.300)") - ROMX_LOAD("kickstart v2.05 r37.300 (1991)(commodore)(a600hd).rom", 0x000000, 0x080000, CRC(64466c2a) SHA1(f72d89148dac39c696e30b10859ebc859226637b), ROM_GROUPWORD | ROM_BIOS(1)) - ROM_SYSTEM_BIOS(2, "kick205b", "Kickstart 2.05 (37.300)") - ROMX_LOAD("kickstart v2.05 r37.350 (1992)(commodore)(a600hd)[!].rom", 0x000000, 0x080000, CRC(43b0df7b) SHA1(02843c4253bbd29aba535b0aa3bd9a85034ecde4), ROM_GROUPWORD | ROM_BIOS(2)) + // standard amiga kickstart 1.3 + ROM_REGION16_BE(0x80000, "kickstart", 0) + ROMX_LOAD("315093-02.u13", 0x00000, 0x40000, CRC(c4f0f55f) SHA1(891e9a547772fe0c6c19b610baf8bc4ea7fcb785), ROM_GROUPWORD) + ROM_COPY("kickstart", 0x00000, 0x40000, 0x40000) - /* action replay cartridge */ - ROM_REGION16_BE(0x080000, "user2", ROMREGION_ERASEFF ) - ROM_CART_LOAD("cart", 0x0000, 0x080000, ROM_NOMIRROR | ROM_OPTIONAL) + // remote control input converter, mos 6500/1 mcu + ROM_REGION(0x800, "rcmcu", 0) + ROM_LOAD("252609-02.u75", 0x000, 0x800, NO_DUMP) - /* keyboard controller, mos 6500/1 mcu */ - ROM_REGION(0x800, "keyboard", 0) - ROM_LOAD("328191-02.ic1", 0x000, 0x800, NO_DUMP) + // lcd controller, sanyo lc6554h + ROM_REGION(0x1000, "lcd", 0) + ROM_LOAD("252608-01.u62", 0x0000, 0x1000, NO_DUMP) ROM_END -#define rom_a600n rom_a600 - +#define rom_cdtvn rom_cdtv -ROM_START( a1200 ) - ROM_REGION32_BE(0x080000, "user1", 0) - ROM_DEFAULT_BIOS("kick31") - ROM_SYSTEM_BIOS(0, "kick30", "Kickstart 3.0 (39.106)") - ROMX_LOAD("391523-01.u6a", 0x000000, 0x040000, CRC(c742a412) SHA1(999eb81c65dfd07a71ee19315d99c7eb858ab186), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) - ROMX_LOAD("391524-01.u6b", 0x000002, 0x040000, CRC(d55c6ec6) SHA1(3341108d3a402882b5ef9d3b242cbf3c8ab1a3e9), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) -// ROMX_LOAD("kickstart v3.0 r39.106 (1992)(commodore)(a1200)[!].rom", 0x000000, 0x080000, CRC(6c9b07d2) SHA1(70033828182fffc7ed106e5373a8b89dda76faa5), ROM_BIOS(1)) +// Amiga 3000 +// +// Early models have Kickstart 1.4 Alpha in ROM and boot either +// Kickstart 1.3 or 2.0 from Hard Disk. Later versions have +// Kickstart 2.04 installed as ROM. Upgrade available for +// Kickstart 3.1. - ROM_SYSTEM_BIOS(1, "kick31", "Kickstart 3.1 (40.068)") - ROMX_LOAD("391773-01.u6a", 0x000000, 0x040000, CRC(08dbf275) SHA1(b8800f5f909298109ea69690b1b8523fa22ddb37), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) - ROMX_LOAD("391774-01.u6b", 0x000002, 0x040000, CRC(16c07bf8) SHA1(90e331be1970b0e53f53a9b0390b51b59b3869c2), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) - - // COMMODORE | 391508-01 REV0 | KEYBOARD MPU - ROM_REGION(0x1040, "keyboard", 0) - ROM_LOAD("391508-01.u13", 0x0000, 0x1040, NO_DUMP) - - // Amiga Tech REV1 Keyboard MPU - ROM_REGION(0x2f40, "keyboard_rev1", 0) - ROM_LOAD("391508-02.u13", 0x0000, 0x2f40, NO_DUMP) -ROM_END - -#define rom_a1200n rom_a1200 - -/* Note: I think those ROMs are correct, but they should be verified */ ROM_START( a3000 ) - ROM_REGION32_BE(0x80000, "user1", 0) + ROM_REGION32_BE(0x80000, "kickstart", 0) ROM_DEFAULT_BIOS("kick14") ROM_SYSTEM_BIOS(0, "kick14", "Kickstart 1.4 (36.16)") - /* COPYRIGHT 1990 CAI // ALL RIGHTS RESERVED // ALPHA 5 ROM 0 CS=9713 */ + // COPYRIGHT 1990 CAI // ALL RIGHTS RESERVED // ALPHA 5 ROM 0 CS=9713 ROMX_LOAD("390629-02.u182", 0x00000, 0x40000, CRC(58327536) SHA1(d1713d7f31474a5948e6d488e33686061cf3d1e2), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) - /* COPYRIGHT 1990 CAI // ALL RIGHTS RESERVED // ALPHA 5 ROM 1 CS=9B21 */ + // COPYRIGHT 1990 CAI // ALL RIGHTS RESERVED // ALPHA 5 ROM 1 CS=9B21 ROMX_LOAD("390630-02.u183", 0x00002, 0x40000, CRC(fe2f7fb9) SHA1(c05c9c52d014c66f9019152b3f2a2adc2c678794), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) ROM_SYSTEM_BIOS(1, "kick204", "Kickstart 2.04 (37.175)") ROMX_LOAD("390629-03.u182", 0x00000, 0x40000, CRC(a245dbdf) SHA1(83bab8e95d378b55b0c6ae6561385a96f638598f), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) @@ -1292,69 +1959,146 @@ ROM_START( a3000 ) ROM_SYSTEM_BIOS(2, "kick31", "Kickstart 3.1 (40.68)") ROMX_LOAD("kick31.u182", 0x00000, 0x40000, CRC(286b9a0d) SHA1(6763a2258ec493f7408cf663110dae9a17803ad1), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) ROMX_LOAD("kick31.u183", 0x00002, 0x40000, CRC(0b8cde6a) SHA1(5f02e97b48ebbba87d516a56b0400c6fc3434d8d), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) - - ROM_REGION(0x1040, "keyboard", 0) - ROM_LOAD("keyboard", 0x0000, 0x1040, NO_DUMP) -ROM_END - -#define rom_a3000n rom_a3000 - -ROM_START( cdtv ) - ROM_REGION16_BE(0x100000, "user1", 0) - ROM_LOAD16_BYTE("391008-01.u34", 0x000000, 0x020000, CRC(791cb14b) SHA1(277a1778924496353ffe56be68063d2a334360e4)) - ROM_LOAD16_BYTE("391009-01.u35", 0x000001, 0x020000, CRC(accbbc2e) SHA1(41b06d1679c6e6933c3378b7626025f7641ebc5c)) - ROM_COPY("user1", 0x000000, 0x040000, 0x040000) - ROMX_LOAD( "315093-02.u13", 0x080000, 0x040000, CRC(c4f0f55f) SHA1(891e9a547772fe0c6c19b610baf8bc4ea7fcb785), ROM_GROUPWORD) - ROM_COPY("user1", 0x080000, 0x0c0000, 0x040000) - - /* remote control input converter, mos 6500/1 mcu */ - ROM_REGION(0x800, "rcmcu", 0) - ROM_LOAD("252609-02.u75", 0x000, 0x800, NO_DUMP) - - /* lcd controller, sanyo lc6554h */ - ROM_REGION(0x1000, "lcd", 0) - ROM_LOAD("252608-01.u62", 0x000, 0x1000, NO_DUMP) ROM_END -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ +#define rom_a3000n rom_a3000 -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -/* High-end market line */ +// Amiga 600 +// +// According to Greg Donner's Workbench page, very early models shipped with +// Kickstart 2.04. +// +// Kickstart 2.05 differences: +// - 2.05 37.299: No HDD support +// - 2.05 37.300: HDD support +// - 2.05 37.350: HDD size limits removed +// +// Kickstart 3.1 upgrade available. +// +// The keyboard controller is included on the motherboard, still based on the +// 6500/1. -COMP( 1985, a1000, 0, 0, a1000, amiga, amiga_state, amiga, "Commodore Business Machines", "Amiga 1000 (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) -COMP( 1985, a1000n, a1000, 0, a1000n, amiga, amiga_state, amiga, "Commodore Business Machines", "Amiga 1000 (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +ROM_START( a600 ) + ROM_REGION16_BE(0x80000, "kickstart", 0) + ROM_DEFAULT_BIOS("kick205-350") + ROM_SYSTEM_BIOS(0, "kick204", "Kickstart 2.04 (37.175)") + ROMX_LOAD("390979-01.u6", 0x00000, 0x80000, CRC(c3bdb240) SHA1(c5839f5cb98a7a8947065c3ed2f14f5f42e334a1), ROM_GROUPWORD | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "kick205-299", "Kickstart 2.05 (37.299)") + ROMX_LOAD("391388-01.u6", 0x00000, 0x80000, CRC(83028fb5) SHA1(87508de834dc7eb47359cede72d2e3c8a2e5d8db), ROM_GROUPWORD | ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "kick205-300", "Kickstart 2.05 (37.300)") + ROMX_LOAD("391304-01.u6", 0x00000, 0x80000, CRC(64466c2a) SHA1(f72d89148dac39c696e30b10859ebc859226637b), ROM_GROUPWORD | ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "kick205-350", "Kickstart 2.05 (37.300)") + ROMX_LOAD("391304-02.u6", 0x00000, 0x80000, CRC(43b0df7b) SHA1(02843c4253bbd29aba535b0aa3bd9a85034ecde4), ROM_GROUPWORD | ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "kick31", "Kickstart 3.1 (40.63)") + ROMX_LOAD("kick40063.u6", 0x00000, 0x80000, CRC(fc24ae0d) SHA1(3b7f1493b27e212830f989f26ca76c02049f09ca), ROM_GROUPWORD | ROM_BIOS(5)) + ROM_REGION(0x800, "keyboard", 0) + ROM_LOAD("391079-01.u13", 0x000, 0x800, NO_DUMP) +ROM_END +#define rom_a600n rom_a600 -/* Low-end market line */ +// Amiga 1200 +// +// Early models shipped with Kickstart 3.0, later versions with +// Kickstart 3.1. Keyboard controller is included on the motherboard, +// but was changed to a 68HC05 core. -COMP( 1987, a500, 0, 0, a500, amiga, amiga_state, amiga, "Commodore Business Machines", "Amiga 500 (PAL, OCS)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) -COMP( 1987, a500n, a500, 0, a500n, amiga, amiga_state, amiga, "Commodore Business Machines", "Amiga 500 (NTSC, OCS)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +ROM_START( a1200 ) + ROM_REGION32_BE(0x80000, "kickstart", 0) + ROM_DEFAULT_BIOS("kick31") + ROM_SYSTEM_BIOS(0, "kick30", "Kickstart 3.0 (39.106)") + ROMX_LOAD("391523-01.u6a", 0x00000, 0x40000, CRC(c742a412) SHA1(999eb81c65dfd07a71ee19315d99c7eb858ab186), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD("391524-01.u6b", 0x00002, 0x40000, CRC(d55c6ec6) SHA1(3341108d3a402882b5ef9d3b242cbf3c8ab1a3e9), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "kick31", "Kickstart 3.1 (40.68)") + ROMX_LOAD("391773-01.u6a", 0x00000, 0x40000, CRC(08dbf275) SHA1(b8800f5f909298109ea69690b1b8523fa22ddb37), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) + ROMX_LOAD("391774-01.u6b", 0x00002, 0x40000, CRC(16c07bf8) SHA1(90e331be1970b0e53f53a9b0390b51b59b3869c2), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) + + ROM_REGION(0x4000, "keyboard", 0) + ROM_LOAD("391508-01.u13", 0x0000, 0x1040, NO_DUMP) // COMMODORE | 391508-01 REV0 | KEYBOARD MPU (MC68HC05C4AFN) + ROM_LOAD("391508-02.u13", 0x0000, 0x2f40, NO_DUMP) // Amiga Tech REV1 Keyboard MPU (MC68HC05C12FN) +ROM_END -COMP( 1991, a500pl, 0, 0, a500pls, amiga, amiga_state, amiga, "Commodore Business Machines", "Amiga 500+ (PAL, ECS)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) -COMP( 1991, a500pln, a500pl, 0, a500plsn, amiga, amiga_state, amiga, "Commodore Business Machines", "Amiga 500+ (NTSC, ECS)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +#define rom_a1200n rom_a1200 -COMP( 1992, a600, 0, 0, a600, amiga, amiga_state, amiga, "Commodore Business Machines", "Amiga 600 (PAL, ECS)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) -COMP( 1992, a600n, a600, 0, a600n, amiga, amiga_state, amiga, "Commodore Business Machines", "Amiga 600 (NTSC, ECS)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +// Amiga 4000 +// +// Shipped with Kickstart 3.0, upgradable to Kickstart 3.1. -COMP( 1992, a1200, 0, 0, a1200, amiga, a1200_state,a1200, "Commodore Business Machines", "Amiga 1200 (PAL, AGA)" , GAME_NOT_WORKING ) -COMP( 1992, a1200n, a1200, 0, a1200n, amiga, a1200_state,a1200, "Commodore Business Machines", "Amiga 1200 (NTSC, AGA)" , GAME_NOT_WORKING ) +ROM_START( a4000 ) + ROM_REGION32_BE(0x80000, "kickstart", 0) + ROM_DEFAULT_BIOS("kick30") + ROM_SYSTEM_BIOS(0, "kick30", "Kickstart 3.0 (39.106)") + ROMX_LOAD("391513-02.u175", 0x00000, 0x40000, CRC(36f64dd0) SHA1(196e9f3f9cad934e181c07da33083b1f0a3c702f), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD("391514-02.u176", 0x00002, 0x40000, CRC(17266a55) SHA1(42fbed3453d1f11ccbde89a9826f2d1175cca5cc), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "kick31-68", "Kickstart 3.1 (40.68)") + ROMX_LOAD("kick40068.u175", 0x00000, 0x40000, CRC(b2af34f8) SHA1(24e52b5efc02049517387ab7b1a1475fc540350e), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) + ROMX_LOAD("kick40068.u176", 0x00002, 0x40000, CRC(e65636a3) SHA1(313c7cbda5779e56f19a41d34e760f517626d882), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "kick31-70", "Kickstart 3.1 (40.70)") + ROMX_LOAD("kick40070.u175", 0x00000, 0x40000, CRC(f9cbecc9) SHA1(138d8cb43b8312fe16d69070de607469b3d4078e), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) + ROMX_LOAD("kick40070.u176", 0x00002, 0x40000, CRC(f8248355) SHA1(c23795479fae3910c185512ca268b82f1ae4fe05), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) +ROM_END -COMP( 1992, a3000, 0, 0, a3000, amiga, amiga_state, a3000, "Commodore Business Machines", "Amiga 3000 (PAL, ECS, 68030)" , GAME_NOT_WORKING ) -COMP( 1992, a3000n, a3000, 0, a3000n, amiga, amiga_state, a3000, "Commodore Business Machines", "Amiga 3000 (NTSC, ECS, 68030)" , GAME_NOT_WORKING ) +#define rom_a4000n rom_a4000 +#define rom_a400030 rom_a4000 +#define rom_a400030n rom_a4000 +// Amiga 4000T +// +// Shipped with Kickstart 3.1 (40.70). +ROM_START( a4000t ) + ROM_REGION32_BE(0x80000, "kickstart", 0) + ROMX_LOAD("391657-01.u175", 0x00000, 0x40000, CRC(0ca94f70) SHA1(b3806edacb3362fc16a154ce1eeec5bf5bc24789), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD("391658-01.u176", 0x00002, 0x40000, CRC(dfe03120) SHA1(cd7a706c431b04d87814d3a2d8b397100cf44c0c), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) +ROM_END -COMP( 1991, cdtv, 0, 0, cdtv, cdtv, amiga_state, cdtv, "Commodore Business Machines", "CDTV (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +#define rom_a4000tn rom_a4000t -/* other official models */ -/* Amiga 2000 - similar to 1000 */ -/* Amiga 1500 - Amiga 2000 with two floppy drives (2nd replacing the HDD) */ -/* Amiga 2500 - Amiga 2000 with 68020 accelerator card */ -/* Amiga 4000 - AGA chipset, 68040 / 68060 CPU */ +// Amiga CD32 +// +// Shipped with Kickstart 3.1 and additional software interleaved in a 1MB rom chip. +ROM_START( cd32 ) + ROM_REGION32_BE(0x100000, "kickstart", 0) +// ROM_LOAD16_WORD("391640-03.u6a", 0x000000, 0x100000, CRC(a4fbc94a) SHA1(816ce6c5077875850c7d43452230a9ba3a2902db)) // todo: this is the real dump + ROM_LOAD16_WORD("391640-03.u6a", 0x000000, 0x100000, CRC(d3837ae4) SHA1(06807db3181637455f4d46582d9972afec8956d9)) +ROM_END -/* CD32 - see cd32.c */ +#define rom_cd32n rom_cd32 + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// OCS Chipset +COMP( 1985, a1000, 0, 0, a1000, amiga, a1000_state, pal, "Commodore", "Amiga 1000 (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1985, a1000n, a1000, 0, a1000n, amiga, a1000_state, ntsc, "Commodore", "Amiga 1000 (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1987, a2000, 0, 0, a2000, amiga, a2000_state, pal, "Commodore", "Amiga 2000 (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1987, a2000n, a2000, 0, a2000n, amiga, a2000_state, ntsc, "Commodore", "Amiga 2000 (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1987, a500, 0, 0, a500, amiga, a500_state, pal, "Commodore", "Amiga 500 (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1987, a500n, a500, 0, a500n, amiga, a500_state, ntsc, "Commodore", "Amiga 500 (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1990, cdtv, 0, 0, cdtv, amiga, cdtv_state, pal, "Commodore", "CDTV (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1990, cdtvn, cdtv, 0, cdtvn, amiga, cdtv_state, ntsc, "Commodore", "CDTV (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) + +// ECS Chipset +COMP( 1990, a3000, 0, 0, a3000, amiga, a3000_state, pal, "Commodore", "Amiga 3000 (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1990, a3000n, a3000, 0, a3000n, amiga, a3000_state, ntsc, "Commodore", "Amiga 3000 (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1992, a500p, 0, 0, a500p, amiga, a500p_state, pal, "Commodore", "Amiga 500 Plus (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1992, a500pn, a500p, 0, a500pn, amiga, a500p_state, ntsc, "Commodore", "Amiga 500 Plus (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1992, a600, 0, 0, a600, amiga, a600_state, pal, "Commodore", "Amiga 600 (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1992, a600n, a600, 0, a600n, amiga, a600_state, ntsc, "Commodore", "Amiga 600 (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) + +// AGA Chipset +COMP( 1992, a1200, 0, 0, a1200, amiga, a1200_state, pal, "Commodore", "Amiga 1200 (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1992, a1200n, a1200, 0, a1200n, amiga, a1200_state, ntsc, "Commodore", "Amiga 1200 (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1992, a4000, 0, 0, a4000, amiga, a4000_state, pal, "Commodore", "Amiga 4000/040 (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1992, a4000n, a4000, 0, a4000n, amiga, a4000_state, ntsc, "Commodore", "Amiga 4000/040 (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1993, a400030, a4000, 0, a400030, amiga, a4000_state, pal, "Commodore", "Amiga 4000/030 (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1993, a400030n, a4000, 0, a400030n, amiga, a4000_state, ntsc, "Commodore", "Amiga 4000/030 (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1993, cd32, 0, 0, cd32, cd32, cd32_state, pal, "Commodore", "Amiga CD32 (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1993, cd32n, cd32, 0, cd32n, cd32, cd32_state, ntsc, "Commodore", "Amiga CD32 (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1994, a4000t, 0, 0, a4000t, amiga, a4000_state, pal, "Commodore", "Amiga 4000T (PAL)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) +COMP( 1994, a4000tn, a4000t, 0, a4000tn, amiga, a4000_state, ntsc, "Commodore", "Amiga 4000T (NTSC)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) diff --git a/src/mess/machine/amigacd.c b/src/mess/machine/amigacd.c deleted file mode 100644 index 165ecc60c60..00000000000 --- a/src/mess/machine/amigacd.c +++ /dev/null @@ -1,547 +0,0 @@ -/*************************************************************************** - - Amiga CD-ROM controller emulation - -Notes: -Many thanks to Toni Wilen for all the help and information about the -DMAC controller. - -***************************************************************************/ - - -#include "emu.h" -#include "includes/amiga.h" -#include "amigacd.h" -#include "machine/6525tpi.h" -#include "imagedev/chd_cd.h" -#include "machine/matsucd.h" - - -#define VERBOSE_DMAC 0 - -#define LOG(x) do { if (VERBOSE_DMAC) logerror x; } while (0) - -/* constants */ -#define CD_SECTOR_TIME (1000/((300*1024)/2048)) /* 2X CDROM sector time in msec (300KBps) */ - -/*************************************************************************** - - DMAC - -***************************************************************************/ - -/* - * value to go into DAWR - */ -#define DAWR_ATZSC 3 /* according to A3000T service-manual */ - -/* - * bits defined for CNTR - */ -#define CNTR_TCEN (1<<7) /* Terminal Count Enable */ -#define CNTR_PREST (1<<6) /* Perp Reset (not implemented :-((( ) */ -#define CNTR_PDMD (1<<5) /* Perp Device Mode Select (1=SCSI,0=XT/AT) */ -#define CNTR_INTEN (1<<4) /* Interrupt Enable */ -#define CNTR_DDIR (1<<3) /* Device Direction. 1==rd host, wr to perp */ - -/* - * bits defined for ISTR - */ -#define ISTR_INTX (1<<8) /* XT/AT Interrupt pending */ -#define ISTR_INT_F (1<<7) /* Interrupt Follow */ -#define ISTR_INTS (1<<6) /* SCSI Peripheral Interrupt */ -#define ISTR_E_INT (1<<5) /* End-Of-Process Interrupt */ -#define ISTR_INT_P (1<<4) /* Interrupt Pending */ -#define ISTR_UE_INT (1<<3) /* Under-Run FIFO Error Interrupt */ -#define ISTR_OE_INT (1<<2) /* Over-Run FIFO Error Interrupt */ -#define ISTR_FF_FLG (1<<1) /* FIFO-Full Flag */ -#define ISTR_FE_FLG (1<<0) /* FIFO-Empty Flag */ - -struct dmac_data_t -{ - UINT16 istr; /* Interrupt Status Register (R) */ - UINT16 cntr; /* Control Register (RW) */ - UINT32 wtc; /* Word Transfer Count Register (RW) */ - UINT32 acr; /* Address Count Register (RW) */ - UINT16 dawr; /* DACK Width Register (W) */ - emu_timer *dma_timer; -}; - -static dmac_data_t dmac_data; - -static void check_interrupts( running_machine &machine ) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - - /* if interrupts are disabled, bail */ - if ( (dmac_data.cntr & CNTR_INTEN) == 0 ) - return; - - /* if no interrupts are pending, bail */ - if ( (dmac_data.istr & ISTR_INT_P) == 0 ) - return; - - /* otherwise, generate the IRQ */ - state->amiga_custom_w(*state->m_maincpu_program_space, REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff); -} - -static TIMER_CALLBACK(dmac_dma_proc) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - while( dmac_data.wtc > 0 ) - { - UINT16 dat16; - UINT8 dat8; - - if ( matsucd_get_next_byte( &dat8 ) < 0 ) - break; - - dat16 = dat8; - - if ( matsucd_get_next_byte( &dat8 ) < 0 ) - break; - - dat16 <<= 8; - dat16 |= dat8; - - (*state->m_chip_ram_w)(state, dmac_data.acr, dat16); - - dmac_data.acr += 2; - dmac_data.wtc--; - } - - if ( dmac_data.wtc > 0 ) - { - matsucd_read_next_block(); - dmac_data.dma_timer->adjust(attotime::from_msec( CD_SECTOR_TIME )); - } - else - { - dmac_data.istr |= ISTR_INT_P | ISTR_E_INT; - check_interrupts( machine ); - } -} - -READ16_MEMBER( amiga_state::amiga_dmac_r ) -{ - offset &= 0xff; - - switch( offset ) - { - case 0x20: - { - UINT8 v = dmac_data.istr; - LOG(( "DMAC: PC=%08x - ISTR Read(%04x)\n", space.device().safe_pc(), dmac_data.istr )); - - dmac_data.istr &= ~0x0f; - return v; - } - break; - - case 0x21: - { - LOG(( "DMAC: PC=%08x - CNTR Read(%04x)\n", space.device().safe_pc(), dmac_data.cntr )); - return dmac_data.cntr; - } - break; - - case 0x40: /* wtc hi */ - { - LOG(( "DMAC: PC=%08x - WTC HI Read\n", space.device().safe_pc() )); - return (dmac_data.wtc >> 16); - } - break; - - case 0x41: /* wtc lo */ - { - LOG(( "DMAC: PC=%08x - WTC LO Read\n", space.device().safe_pc() )); - return dmac_data.wtc; - } - break; - - case 0x42: /* acr hi */ - { - LOG(( "DMAC: PC=%08x - ACR HI Read\n", space.device().safe_pc() )); - return (dmac_data.acr >> 16); - } - break; - - case 0x43: /* acr lo */ - { - LOG(( "DMAC: PC=%08x - ACR LO Read\n", space.device().safe_pc() )); - return dmac_data.acr; - } - break; - - case 0x48: /* wd33c93 SCSI expansion */ - case 0x49: - { - LOG(( "DMAC: PC=%08x - WD33C93 Read(%d)\n", space.device().safe_pc(), offset & 1 )); - return 0x00; /* Not available without SCSI expansion */ - } - break; - - case 0x50: - { - LOG(( "DMAC: PC=%08x - CDROM RESP Read\n", space.device().safe_pc() )); - return matsucd_response_r(space.machine()); - } - break; - - case 0x51: /* XT IO */ - case 0x52: - case 0x53: - { - LOG(( "DMAC: PC=%08x - XT IO Read(%d)\n", space.device().safe_pc(), (offset & 3)-1 )); - return 0xff; - } - break; - - case 0x58: /* TPI6525 */ - case 0x59: - case 0x5A: - case 0x5B: - case 0x5C: - case 0x5D: - case 0x5E: - case 0x5F: - case 0x60: - case 0x61: - case 0x62: - case 0x63: - case 0x64: - case 0x65: - case 0x66: - case 0x67: - { - tpi6525_device *tpi = space.machine().device<tpi6525_device>("tpi6525"); - LOG(( "DMAC: PC=%08x - TPI6525 Read(%d)\n", space.device().safe_pc(), (offset - 0x58) )); - return tpi->read(space, offset - 0x58); - } - break; - - case 0x70: /* DMA start strobe */ - { - LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", space.device().safe_pc() )); - dmac_data.dma_timer->adjust(attotime::from_msec( CD_SECTOR_TIME )); - } - break; - - case 0x71: /* DMA stop strobe */ - { - LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", space.device().safe_pc() )); - dmac_data.dma_timer->reset( ); - } - break; - - case 0x72: /* Clear IRQ strobe */ - { - LOG(( "DMAC: PC=%08x - IRQ Clear Strobe\n", space.device().safe_pc() )); - dmac_data.istr &= ~ISTR_INT_P; - } - break; - - case 0x74: /* Flush strobe */ - { - LOG(( "DMAC: PC=%08x - Flush Strobe\n", space.device().safe_pc() )); - dmac_data.istr |= ISTR_FE_FLG; - } - break; - - default: - logerror( "DMAC-READ: PC=%08x, offset = %02x\n", space.device().safe_pc(), offset ); - break; - } - - return 0; -} - -WRITE16_MEMBER( amiga_state::amiga_dmac_w ) -{ - offset &= 0xff; - - switch( offset ) - { - case 0x21: /* control write */ - { - LOG(( "DMAC: PC=%08x - CNTR Write(%04x)\n", space.device().safe_pc(), data )); - dmac_data.cntr = data; - check_interrupts(space.machine()); - } - break; - - case 0x40: /* wtc hi */ - { - LOG(( "DMAC: PC=%08x - WTC HI Write - data = %04x\n", space.device().safe_pc(), data )); - dmac_data.wtc &= 0x0000ffff; - dmac_data.wtc |= ((UINT32)data) << 16; - } - break; - - case 0x41: /* wtc lo */ - { - LOG(( "DMAC: PC=%08x - WTC LO Write - data = %04x\n", space.device().safe_pc(), data )); - dmac_data.wtc &= 0xffff0000; - dmac_data.wtc |= data; - } - break; - - case 0x42: /* acr hi */ - { - LOG(( "DMAC: PC=%08x - ACR HI Write - data = %04x\n", space.device().safe_pc(), data )); - dmac_data.acr &= 0x0000ffff; - dmac_data.acr |= ((UINT32)data) << 16; - } - break; - - case 0x43: /* acr lo */ - { - LOG(( "DMAC: PC=%08x - ACR LO Write - data = %04x\n", space.device().safe_pc(), data )); - dmac_data.acr &= 0xffff0000; - dmac_data.acr |= data; - } - break; - - case 0x47: /* dawr */ - { - LOG(( "DMAC: PC=%08x - DAWR Write - data = %04x\n", space.device().safe_pc(), data )); - dmac_data.dawr = data; - } - break; - - case 0x48: /* wd33c93 SCSI expansion */ - case 0x49: - { - LOG(( "DMAC: PC=%08x - WD33C93 Write(%d) - data = %04x\n", space.device().safe_pc(), offset & 1, data )); - /* Not available without SCSI expansion */ - } - break; - - case 0x50: - { - LOG(( "DMAC: PC=%08x - CDROM CMD Write - data = %04x\n", space.device().safe_pc(), data )); - matsucd_command_w(space.machine(), data ); - } - break; - - case 0x58: /* TPI6525 */ - case 0x59: - case 0x5A: - case 0x5B: - case 0x5C: - case 0x5D: - case 0x5E: - case 0x5F: - case 0x60: - case 0x61: - case 0x62: - case 0x63: - case 0x64: - case 0x65: - case 0x66: - case 0x67: - { - tpi6525_device *tpi = space.machine().device<tpi6525_device>("tpi6525"); - LOG(( "DMAC: PC=%08x - TPI6525 Write(%d) - data = %04x\n", space.device().safe_pc(), (offset - 0x58), data )); - tpi->write(space, offset - 0x58, data); - } - break; - - case 0x70: /* DMA start strobe */ - { - LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", space.device().safe_pc() )); - dmac_data.dma_timer->adjust(attotime::from_msec( CD_SECTOR_TIME )); - } - break; - - case 0x71: /* DMA stop strobe */ - { - LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", space.device().safe_pc() )); - dmac_data.dma_timer->reset( ); - } - break; - - case 0x72: /* Clear IRQ strobe */ - { - LOG(( "DMAC: PC=%08x - IRQ Clear Strobe\n", space.device().safe_pc() )); - dmac_data.istr &= ~ISTR_INT_P; - } - break; - - case 0x74: /* Flush Strobe */ - { - LOG(( "DMAC: PC=%08x - Flush Strobe\n", space.device().safe_pc() )); - dmac_data.istr |= ISTR_FE_FLG; - } - break; - - default: - logerror( "DMAC-WRITE: PC=%08x, offset = %02x, data = %04x\n", space.device().safe_pc(), offset, data ); - break; - } -} - -/*************************************************************************** - - Autoconfig - -***************************************************************************/ - -static void dmac_install(running_machine &machine, offs_t base) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - address_space &space = *state->m_maincpu_program_space; - space.install_read_handler(base, base + 0xFFFF, read16_delegate(FUNC(amiga_state::amiga_dmac_r),state)); - space.install_write_handler(base, base + 0xFFFF, write16_delegate(FUNC(amiga_state::amiga_dmac_w),state)); -} - -static void dmac_uninstall(running_machine &machine, offs_t base) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - address_space &space = *state->m_maincpu_program_space; - space.unmap_readwrite(base, base + 0xFFFF); -} - -static const amiga_autoconfig_device dmac_device = -{ - 0, /* link into free memory list */ - 0, /* ROM vector offset valid */ - 0, /* multiple devices on card */ - 1, /* number of 64k pages */ - 3, /* product number (DMAC) */ - 0, /* prefer 8MB address space */ - 0, /* can be shut up */ - 0x0202, /* manufacturers number (Commodore) */ - 0, /* serial number */ - 0, /* ROM vector offset */ - NULL, /* interrupt control read */ - NULL, /* interrupt control write */ - dmac_install, /* memory installation */ - dmac_uninstall /* memory uninstallation */ -}; - -/*************************************************************************** - - TPI6525 - -***************************************************************************/ - -READ8_MEMBER( amiga_state::amigacd_tpi6525_portc_r ) -{ - int ret = 0; - - tpi6525_device *tpi = space.machine().device<tpi6525_device>("tpi6525"); - - if ( (tpi->get_ddr_c() & 0x04) == 0 ) /* if pin 2 is set to input */ - { - ret |= matsucd_stch_r() ? 0x00 : 0x04; /* read status change signal */ - } - - if ( (tpi->get_ddr_c() & 0x08) == 0 ) /* if pin 3 is set to input */ - ret |= matsucd_sten_r() ? 0x08 : 0x00; /* read enable signal */ - - return ret; -} - -WRITE8_MEMBER( amiga_state::amigacd_tpi6525_portb_w ) -{ - tpi6525_device *tpi = space.machine().device<tpi6525_device>("tpi6525"); - - if ( tpi->get_ddr_b() & 0x01 ) /* if pin 0 is set to output */ - matsucd_cmd_w( data & 1 ); /* write to the /CMD signal */ - - if ( tpi->get_ddr_b() & 0x02 ) /* if pin 1 is set to output */ - matsucd_enable_w( data & 2 ); /* write to the /ENABLE signal */ -} - -static emu_timer *tp6525_delayed_timer; - -static TIMER_CALLBACK(tp6525_delayed_irq) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - (void)param; - - if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 ) - { - state->amiga_custom_w(*state->m_maincpu_program_space, REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff); - } - else - { - tp6525_delayed_timer->adjust(attotime::from_msec(1)); - } -} - -static void amigacd_tpi6525_irq_trampoline(device_t *device, int level) -{ - amiga_state *state = device->machine().driver_data<amiga_state>(); - LOG(( "TPI6525 Interrupt: level = %d\n", level )); - - if ( level ) - { - if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 ) - { - state->amiga_custom_w(*state->m_maincpu_program_space, REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff); - } - else - { - /* we *have to* deliver the irq, so if we can't, delay it and try again later */ - tp6525_delayed_timer->adjust(attotime::from_msec(1)); - } - } -} - -WRITE_LINE_MEMBER( amiga_state::amigacd_tpi6525_irq ) -{ - tpi6525_device *tpi = machine().device<tpi6525_device>("tpi6525"); - - amigacd_tpi6525_irq_trampoline(tpi, state); -} - -static void cdrom_status_enabled( running_machine &machine, int level ) -{ - tpi6525_device *tpi = machine.device<tpi6525_device>("tpi6525"); - - /* PC3 on the 6525 */ - tpi->i3_w(level); -} - -static void cdrom_status_change( running_machine &machine, int level ) -{ - tpi6525_device *tpi = machine.device<tpi6525_device>("tpi6525"); - - /* invert */ - level = level ? 0 : 1; - - /* PC2 on the 6525 */ - tpi->i2_w(level); -} - -static void cdrom_subcode_ready( running_machine &machine, int level ) -{ - tpi6525_device *tpi = machine.device<tpi6525_device>("tpi6525"); - - /* PC1 on the 6525 */ - tpi->i1_w(level); -} - -void amigacd_start(running_machine &machine) -{ - /* initialize the dmac */ - memset( &dmac_data, 0, sizeof( dmac_data ) ); - - dmac_data.dma_timer = machine.scheduler().timer_alloc(FUNC(dmac_dma_proc)); - tp6525_delayed_timer = machine.scheduler().timer_alloc(FUNC(tp6525_delayed_irq)); - - /* set up DMAC with autoconfig */ - amiga_add_autoconfig( machine, &dmac_device ); - - matsucd_init( machine.device<cdrom_image_device>("cdrom"), "cdda" ); -} - -void amigacd_reset(running_machine &machine) -{ - /* initialize the cdrom */ - matsucd_set_status_enabled_callback( cdrom_status_enabled ); - matsucd_set_status_changed_callback( cdrom_status_change ); - matsucd_set_subcode_ready_callback( cdrom_subcode_ready ); -} diff --git a/src/mess/machine/amigacd.h b/src/mess/machine/amigacd.h deleted file mode 100644 index 5cc820ef2a1..00000000000 --- a/src/mess/machine/amigacd.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __AMIGACD_H__ -#define __AMIGACD_H__ - - -void amigacd_start(running_machine &machine); -void amigacd_reset(running_machine &machine); - - -#endif /* __AMIGACD_H__ */ diff --git a/src/mess/machine/amigacrt.c b/src/mess/machine/amigacrt.c deleted file mode 100644 index dd1ab1bed0d..00000000000 --- a/src/mess/machine/amigacrt.c +++ /dev/null @@ -1,464 +0,0 @@ -/*************************************************************************** - - Amiga cartridge emulation - -TODO: -- Investigate why the AR2/3 sometimes garble the video on exit from the cart -- Add Nordic Power and similar carts -- Add HRTMon A1200 cart - -***************************************************************************/ - - -#include "emu.h" -#include "includes/amiga.h" -#include "cpu/m68000/m68000.h" -#include "machine/amigacrt.h" - -enum -{ - /* supported cartridges */ - ACTION_REPLAY = 0, - ACTION_REPLAY_MKII, - ACTION_REPLAY_MKIII -}; - -struct amigacrt_t -{ - int cart_type; - int ar1_spurious; - UINT16 ar23_mode; -}; -static amigacrt_t amigacrt; - -/*************************************************************************** - - Utilities - -***************************************************************************/ - -static int check_kickstart_12_13( running_machine &machine, const char *cart_name ) -{ - UINT16 * ksmem = (UINT16 *)(*machine.root_device().memregion( "user1" )); - - if ( ksmem[2] == 0x00FC ) - return 1; - - logerror( "%s requires Kickstart version 1.2 or 1.3 - Cart not installed\n", cart_name ); - - return 0; -} - -/*************************************************************************** - - Amiga Action Replay 1 - - Whenever you push the button, an NMI interrupt is generated. - - The cartridge protects itself from being removed from memory by - generating an interrupt whenever either the spurious interrupt - vector is written at $60, or the nmi interrupt vector is written at - $7c. If the spurious interrupt vector at $60 is written, then - a NMI is generated, and the spurious irq vector is restored. If the - NMI vector at $7c is written, then a spurious interrupt is generated, - and the NMI vector is restored. - - When breakpoints are set, the target address is replaced by a trap - instruction, and the original contents of the address are kept in - the cartridge's RAM. A trap handler is installed pointing to $40 - in RAM, where code that clears memory address $60 followed by two - nops are written. There seems to be a small delay between the write - to $60 and until the actual NMI is generated, since the cart expects - the PC to be at $46 (at the second nop). - -***************************************************************************/ - -IRQ_CALLBACK_MEMBER(amiga_state::amiga_ar1_irqack) -{ - if ( irqline == 7 && amigacrt.ar1_spurious ) - { - return M68K_INT_ACK_SPURIOUS; - } - - return (24+irqline); -} - -static TIMER_CALLBACK( amiga_ar1_delayed_nmi ) -{ - (void)param; - machine.device("maincpu")->execute().set_input_line(7, PULSE_LINE); -} - -static void amiga_ar1_nmi( running_machine &machine ) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - /* get the cart's built-in ram */ - UINT16 *ar_ram = (UINT16 *)(state->m_maincpu_program_space->get_write_ptr(0x9fc000)); - - if ( ar_ram != NULL ) - { - int i; - - /* copy custom register values */ - for( i = 0; i < 256; i++ ) - ar_ram[0x1800+i] = CUSTOM_REG(i); - - /* trigger NMI irq */ - amigacrt.ar1_spurious = 0; - machine.scheduler().timer_set(machine.device<cpu_device>("maincpu")->cycles_to_attotime(28), FUNC(amiga_ar1_delayed_nmi)); - } -} - -WRITE16_MEMBER( amiga_state::amiga_ar1_chipmem_w ) -{ - int pc = space.device().safe_pc(); - - /* see if we're inside the AR1 rom */ - if ( ((pc >> 16) & 0xff ) != 0xf0 ) - { - /* if we're not, see if either the Spurious IRQ vector - or the NMI vector are being overwritten */ - if ( offset == (0x60/2) || offset == (0x7c/2) ) - { - /* trigger an NMI or spurious irq */ - amigacrt.ar1_spurious = (offset == 0x60/2) ? 0 : 1; - space.machine().scheduler().timer_set(space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(28), FUNC(amiga_ar1_delayed_nmi)); - } - } - - (*m_chip_ram_w)(this, offset * 2, data ); -} - -static void amiga_ar1_check_overlay( running_machine &machine ) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - - state->m_maincpu_program_space->install_write_handler(0x000000, 0x00007f, write16_delegate(FUNC(amiga_state::amiga_ar1_chipmem_w),state)); -} - -static void amiga_ar1_init( running_machine &machine ) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - void *ar_ram; - - /* check kickstart version */ - if ( !check_kickstart_12_13( machine, "Amiga Action Replay" ) ) - { - amigacrt.cart_type = -1; - return; - } - - /* setup the cart ram */ - ar_ram = auto_alloc_array(machine, UINT8, 0x4000); - memset(ar_ram, 0, 0x4000); - - /* Install ROM */ - state->m_maincpu_program_space->install_read_bank(0xf00000, 0xf7ffff, "bank2"); - state->m_maincpu_program_space->unmap_write(0xf00000, 0xf7ffff); - - /* Install RAM */ - state->m_maincpu_program_space->install_readwrite_bank(0x9fc000, 0x9fffff, "bank3"); - - /* Configure Banks */ - state->membank("bank2")->set_base(machine.root_device().memregion("user2")->base()); - state->membank("bank3")->set_base(ar_ram); - - amigacrt.ar1_spurious = 0; - - /* Install IRQ ACK callback */ - device_execute_interface::static_set_irq_acknowledge_callback(*machine.device<cpu_device>("maincpu"), device_irq_acknowledge_delegate(FUNC(amiga_state::amiga_ar1_irqack), state)); -} - -/*************************************************************************** - - Amiga Action Replay MKII/MKIII - - Whenever you push the button, an overlay of the cartridge appears - in RAM and an NMI interrupt is generated. Only reads are overlayed. - Writes go directly to chipmem (so that the CPU can write the stack - information for the NMI). Once the interrupt is taken, the cart - disables the ROM overlay and checks it's internal mode register - to see why it was invoked. - - When a breakpoint is set the cart replaces the target instruction - with a trap, and adds a trap handler that it locates in the $100-$120 - area. The handler simply has one instruction: TST.B $BFE001. This cia - access is monitored, and the conditions match (PC < 120 and a previous - command requested the monitoring of the cia) then the cart is invoked. - -***************************************************************************/ - -static void amiga_ar23_freeze( running_machine &machine ); - -READ16_MEMBER( amiga_state::amiga_ar23_cia_r ) -{ - int pc = space.device().safe_pc(); - - if ( ACCESSING_BITS_0_7 && offset == 2048 && pc >= 0x40 && pc < 0x120 ) - { - amiga_ar23_freeze(space.machine()); - } - - return amiga_cia_r( space, offset, mem_mask ); -} - -WRITE16_MEMBER( amiga_state::amiga_ar23_mode_w ) -{ - if ( data & 2 ) - { - space.install_read_handler(0xbfd000, 0xbfefff, read16_delegate(FUNC(amiga_state::amiga_ar23_cia_r), this)); - } - else - { - space.install_read_handler(0xbfd000, 0xbfefff, read16_delegate(FUNC(amiga_state::amiga_cia_r), this)); - } - - amigacrt.ar23_mode = (data&0x3); - if ( amigacrt.ar23_mode == 0 ) - amigacrt.ar23_mode = 1; - -} - -READ16_MEMBER( amiga_state::amiga_ar23_mode_r ) -{ - amiga_state *state = space.machine().driver_data<amiga_state>(); - UINT16 *mem = (UINT16 *)(*state->memregion( "user2" )); - - if ( ACCESSING_BITS_0_7 ) - { - if ( offset < 2 ) - return (mem[offset] | (amigacrt.ar23_mode&3)); - - if ( offset == 0x03 ) /* disable cart overlay on chip mem */ - { - UINT32 mirror_mask = state->m_chip_ram.bytes(); - - state->membank("bank1")->set_entry(0); - - while( (mirror_mask<<1) < 0x100000 ) - { - mirror_mask |= ( mirror_mask << 1 ); - } - - /* overlay disabled, map RAM on 0x000000 */ - space.install_write_bank(0x000000, state->m_chip_ram.bytes() - 1, 0, mirror_mask, "bank1"); - } - } - - return mem[offset]; -} - -WRITE16_MEMBER( amiga_state::amiga_ar23_chipmem_w ) -{ - if ( offset == (0x08/2) ) - { - if ( amigacrt.ar23_mode & 1 ) - amiga_ar23_freeze(space.machine()); - } - - (*m_chip_ram_w)(this, offset * 2, data ); -} - -static void amiga_ar23_freeze( running_machine &machine ) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - int pc = machine.device("maincpu")->safe_pc(); - - /* only freeze if we're not inside the cart's ROM */ - if ( ((pc >> 16) & 0xfe ) != 0x40 ) - { - /* get the cart's built-in ram */ - UINT16 *ar_ram = (UINT16 *)state->m_maincpu_program_space->get_write_ptr(0x440000); - - if ( ar_ram != NULL ) - { - int i; - - for( i = 0; i < 0x100; i++ ) - ar_ram[0x7800+i] = CUSTOM_REG(i); - } - - /* overlay the cart rom's in chipram */ - state->membank("bank1")->set_entry(2); - - /* writes go to chipram */ - state->m_maincpu_program_space->install_write_handler(0x000000, state->m_chip_ram.bytes() - 1, write16_delegate(FUNC(amiga_state::amiga_ar23_chipmem_w),state)); - - /* trigger NMI irq */ - machine.device("maincpu")->execute().set_input_line(7, PULSE_LINE); - } -} - -static void amiga_ar23_nmi( running_machine &machine ) -{ - amigacrt.ar23_mode = 0; - amiga_ar23_freeze(machine); -} - -#if 0 -static WRITE16_HANDLER( amiga_ar23_custom_w ) -{ - int pc = space.device().safe_pc(); - - /* see if we're inside the AR2 rom */ - if ( ((pc >> 16) & 0xfe ) != 0x40 ) - { - /* get the cart's built-in ram */ - UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(0, AS_PROGRAM, 0x440000); - - if ( ar_ram != NULL ) - { - ar_ram[0x7800+offset] = data; - } - } - - amiga_custom_w( offset, data, mem_mask ); -} - -static READ16_HANDLER( amiga_ar23_custom_r ) -{ - UINT16 data = amiga_custom_r( offset, mem_mask ); - - int pc = space.device().safe_pc(); - - /* see if we're inside the AR2 rom */ - if ( ((pc >> 16) & 0xfe ) != 0x40 ) - { - /* get the cart's built-in ram */ - UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(0, AS_PROGRAM, 0x440000); - - if ( ar_ram != NULL ) - { - ar_ram[0x7800+offset] = data; - } - } - - return data; -} -#endif - -static void amiga_ar23_check_overlay( running_machine &machine ) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - amigacrt.ar23_mode = 3; - state->m_maincpu_program_space->install_write_handler(0x000000, 0x00000f, write16_delegate(FUNC(amiga_state::amiga_ar23_chipmem_w),state)); -} - -void amiga_state::amiga_ar23_init( running_machine &machine, int ar3 ) -{ - amiga_state *state = machine.driver_data<amiga_state>(); - UINT32 mirror = 0x20000, size = 0x1ffff; - void *ar_ram; - - /* check kickstart version */ - if ( !check_kickstart_12_13( machine, "Action Replay MKII or MKIII" ) ) - { - amigacrt.cart_type = -1; - return; - } - - /* setup the cart ram */ - ar_ram = auto_alloc_array_clear(machine, UINT8,0x10000); - - if ( ar3 ) - { - mirror = 0; - size = 0x3ffff; - } - - /* Install ROM */ - state->m_maincpu_program_space->install_read_bank(0x400000, 0x400000+size, 0, mirror, "bank2"); - state->m_maincpu_program_space->unmap_write(0x400000, 0x400000+size, 0, mirror); - - /* Install RAM */ - state->m_maincpu_program_space->install_read_bank(0x440000, 0x44ffff, "bank3"); - state->m_maincpu_program_space->install_write_bank(0x440000, 0x44ffff, "bank3"); - - /* Install Custom chip monitor */ -// state->m_maincpu_program_space->install_legacy_read_handler(0xdff000, 0xdff1ff, FUNC(amiga_ar23_custom_r)); -// state->m_maincpu_program_space->install_legacy_write_handler(0xdff000, 0xdff1ff, FUNC(amiga_ar23_custom_w)); - - /* Install status/mode handlers */ - state->m_maincpu_program_space->install_read_handler( 0x400000, 0x400007, 0, mirror, read16_delegate( FUNC(amiga_state::amiga_ar23_mode_r), this)); - state->m_maincpu_program_space->install_write_handler(0x400000, 0x400003, 0, mirror, write16_delegate(FUNC(amiga_state::amiga_ar23_mode_w), this)); - - /* Configure Banks */ - state->membank("bank2")->set_base(machine.root_device().memregion("user2")->base()); - state->membank("bank3")->set_base(ar_ram); - - state->membank("bank1")->configure_entries(0, 2, state->m_chip_ram, 0); - state->membank("bank1")->configure_entries(1, 2, machine.root_device().memregion("user1")->base(), 0); - state->membank("bank1")->configure_entries(2, 2, machine.root_device().memregion("user2")->base(), 0); - - amigacrt.ar23_mode = 3; -} - -/*************************************************************************** - - MAME/MESS hooks - -***************************************************************************/ - -void amiga_cart_init( running_machine &machine ) -{ - /* see what is there */ - UINT16 *mem = (UINT16 *)(*machine.root_device().memregion( "user2" )); - amiga_state *state = machine.driver_data<amiga_state>(); - - amigacrt.cart_type = -1; - - if ( mem != NULL ) - { - if ( mem[0x00] == 0x1111 ) - { - amigacrt.cart_type = ACTION_REPLAY; - amiga_ar1_init(machine); - } - else if ( mem[0x0C] == 0x4D6B ) - { - amigacrt.cart_type = ACTION_REPLAY_MKII; - state->amiga_ar23_init(machine, 0); - } - else if ( mem[0x0C] == 0x4D4B ) - { - amigacrt.cart_type = ACTION_REPLAY_MKIII; - state->amiga_ar23_init(machine, 1); - } - } -} - -void amiga_cart_check_overlay( running_machine &machine ) -{ - if ( amigacrt.cart_type < 0 ) - return; - - switch( amigacrt.cart_type ) - { - case ACTION_REPLAY: - amiga_ar1_check_overlay(machine); - break; - - case ACTION_REPLAY_MKII: - case ACTION_REPLAY_MKIII: - amiga_ar23_check_overlay(machine); - break; - } -} - -void amiga_cart_nmi( running_machine &machine ) -{ - if ( amigacrt.cart_type < 0 ) - return; - - switch( amigacrt.cart_type ) - { - case ACTION_REPLAY: - amiga_ar1_nmi(machine); - break; - - case ACTION_REPLAY_MKII: - case ACTION_REPLAY_MKIII: - amiga_ar23_nmi(machine); - break; - } -} diff --git a/src/mess/machine/amigacrt.h b/src/mess/machine/amigacrt.h deleted file mode 100644 index 6e603ed8b98..00000000000 --- a/src/mess/machine/amigacrt.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef AMIGACRT_H -#define AMIGACRT_H - -void amiga_cart_init( running_machine &machine ); -void amiga_cart_check_overlay( running_machine &machine ); -void amiga_cart_nmi( running_machine &machine ); - -#endif /* AMIGACRT_H */ diff --git a/src/mess/machine/amigakbd.c b/src/mess/machine/amigakbd.c index 5bd49545dab..f8f103e5cb2 100644 --- a/src/mess/machine/amigakbd.c +++ b/src/mess/machine/amigakbd.c @@ -21,7 +21,11 @@ const device_type AMIGAKBD = &device_creator<amigakbd_device>; amigakbd_device::amigakbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, AMIGAKBD, "Amiga Keyboard", tag, owner, clock, "amigakbd", __FILE__), m_write_kclk(*this), - m_write_kdat(*this) + m_write_kdat(*this), + m_buf(NULL), + m_buf_pos(0), + m_cur_pos(0), + m_timer(NULL) { } @@ -36,8 +40,6 @@ void amigakbd_device::device_start() /* allocate a keyboard buffer */ m_buf = auto_alloc_array(machine(), UINT8, KEYBOARD_BUFFER_SIZE); - m_buf_pos = 0; - m_cur_pos = 0; m_timer = timer_alloc(0); m_timer->reset(); } @@ -82,46 +84,33 @@ void amigakbd_device::device_timer(emu_timer &timer, device_timer_id id, int par } } -INPUT_CHANGED_MEMBER(amigakbd_device::kbd_update) +INPUT_CHANGED_MEMBER( amigakbd_device::kbd_update ) { int index = (int)(FPTR)param, i; UINT32 oldvalue = oldval * field.mask(), newvalue = newval * field.mask(); UINT32 delta = oldvalue ^ newvalue; - /* Special case Page UP, which we will use as Action Replay button */ - if ( (index == 3) && ( delta & 0x80000000 ) && ( newvalue & 0x80000000 ) ) - { - const amiga_machine_interface *amiga_intf = amiga_get_interface(machine()); + int key_buf_was_empty = ( m_buf_pos == m_cur_pos ) ? 1 : 0; - if ( amiga_intf != NULL && amiga_intf->nmi_callback ) - { - (*amiga_intf->nmi_callback)(machine()); - } - } - else + for( i = 0; i < 32; i++ ) { - int key_buf_was_empty = ( m_buf_pos == m_cur_pos ) ? 1 : 0; - - for( i = 0; i < 32; i++ ) + if ( delta & ( 1 << i ) ) { - if ( delta & ( 1 << i ) ) - { - int down = ( newvalue & ( 1 << i ) ) ? 0 : 1; - int scancode = ( ( (index*32)+i ) << 1 ) | down; - int amigacode = ~scancode; - - /* add the keycode to the buffer */ - m_buf[m_buf_pos++] = amigacode & 0xff; - m_buf_pos %= KEYBOARD_BUFFER_SIZE; - } - } + int down = ( newvalue & ( 1 << i ) ) ? 0 : 1; + int scancode = ( ( (index*32)+i ) << 1 ) | down; + int amigacode = ~scancode; - /* if the buffer was empty and we have new data, start a timer to send the keystrokes */ - if ( key_buf_was_empty && ( m_buf_pos != m_cur_pos ) ) - { - m_timer->adjust(machine().first_screen()->frame_period() / 4); + /* add the keycode to the buffer */ + m_buf[m_buf_pos++] = amigacode & 0xff; + m_buf_pos %= KEYBOARD_BUFFER_SIZE; } } + + /* if the buffer was empty and we have new data, start a timer to send the keystrokes */ + if ( key_buf_was_empty && ( m_buf_pos != m_cur_pos ) ) + { + m_timer->adjust(machine().first_screen()->frame_period() / 4); + } } /*********************************************************************************************/ @@ -274,3 +263,17 @@ ioport_constructor amigakbd_device::device_input_ports() const { return INPUT_PORTS_NAME( amiga_us_keyboard ); } + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +ROM_START( keyboard_mpu ) + ROM_REGION(0x800, "keyboard", 0) + ROM_LOAD("328191-01.ic1", 0x000, 0x800, NO_DUMP) +ROM_END + +const rom_entry *amigakbd_device::device_rom_region() const +{ + return ROM_NAME( keyboard_mpu ); +} diff --git a/src/mess/machine/amigakbd.h b/src/mess/machine/amigakbd.h index 904e3c61350..bec639c6c35 100644 --- a/src/mess/machine/amigakbd.h +++ b/src/mess/machine/amigakbd.h @@ -30,6 +30,7 @@ public: // optional information overrides virtual ioport_constructor device_input_ports() const; + virtual const rom_entry *device_rom_region() const; DECLARE_INPUT_CHANGED_MEMBER( kbd_update ); diff --git a/src/mess/mess.lst b/src/mess/mess.lst index 8d5b53777d6..97809d66ede 100644 --- a/src/mess/mess.lst +++ b/src/mess/mess.lst @@ -699,20 +699,30 @@ c128dcr_de c128dcr_se c128d81 -a1000 // Commodore Amiga 1000 -a1000n // -a500 // Commodore Amiga 500 -a500n // -a500pl // Commodore Amiga 500+ -a500pln // -a600 // Commodore Amiga 600 -a600n // -a3000 // Commodore Amiga 3000 -a3000n // -a1200 // Commodore Amiga 1200 -a1200n // -cdtv // Commodore CDTV -cd32 // Commodore Amiga CD32 +a1000 // Commodore Amiga 1000 +a1000n +a2000 // Commodore Amiga 2000 +a2000n +a500 // Commodore Amiga 500 +a500n +cdtv // Commodore CDTV +cdtvn +a3000 // Commodore Amiga 3000 +a3000n +a500p // Commodore Amiga 500 Plus +a500pn +a600 // Commodore Amiga 600 +a600n +a1200 // Commodore Amiga 1200 +a1200n +a4000 // Commodore Amiga 4000/040 +a4000n +a400030 // Commodore Amiga 4000/030 +a400030n +cd32 // Commodore Amiga CD32 +cd32n +a4000t // Commodore Amiga 4000T +a4000tn c65 // 1991 C65 / C64DX (Prototype, NTSC) c64dx // 1991 C65 / C64DX (Prototype, German PAL) diff --git a/src/mess/mess.mak b/src/mess/mess.mak index a1638fc85b0..e2ae5ac268a 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -163,6 +163,7 @@ SOUNDS += SN76496 SOUNDS += POKEY SOUNDS += TIA SOUNDS += NES_APU +SOUNDS += AMIGA SOUNDS += ASTROCADE #SOUNDS += NAMCO #SOUNDS += NAMCO_15XX @@ -324,6 +325,10 @@ VIDEOS += VIC4567 # specify available machine cores #------------------------------------------------- +MACHINES += AKIKO +MACHINES += AUTOCONFIG +MACHINES += CR511B +MACHINES += DMAC #MACHINES += NCR53C7XX #MACHINES += LSI53C810 MACHINES += 6522VIA @@ -610,6 +615,7 @@ BUSES += VIP BUSES += WANGPC BUSES += X68K BUSES += Z88 +BUSES += ZORRO #------------------------------------------------- # this is the list of driver libraries that @@ -812,8 +818,6 @@ $(MESSOBJ)/mame.a: \ $(MAME_VIDEO)/amiga.o \ $(MAME_VIDEO)/amigaaga.o \ $(MAME_MACHINE)/amiga.o \ - $(MAME_AUDIO)/amiga.o \ - $(MAME_MACHINE)/cd32.o \ $(MAME_VIDEO)/tia.o \ $(MAME_MACHINE)/atari.o \ $(MAME_VIDEO)/atari.o \ @@ -860,7 +864,6 @@ $(MESSOBJ)/mame.a: \ $(MAME_MACHINE)/cdicdic.o \ $(MAME_MACHINE)/cdislave.o \ $(MAME_VIDEO)/mcd212.o \ - $(MAME_DRIVERS)/cd32.o \ $(MAME_DRIVERS)/3do.o \ $(MAME_MACHINE)/3do.o \ $(MAME_DRIVERS)/vectrex.o \ @@ -928,8 +931,6 @@ $(MESSOBJ)/altos.a: \ $(MESS_DRIVERS)/altos5.o \ $(MESSOBJ)/amiga.a: \ - $(MESS_MACHINE)/amigacrt.o \ - $(MESS_MACHINE)/amigacd.o \ $(MESS_MACHINE)/amigakbd.o \ $(MESS_DRIVERS)/amiga.o \ |