From 4b256022305843b93bfd39e2fce3f3fed4c17b52 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Fri, 11 Apr 2014 19:21:50 +0000 Subject: [PATCH] Added first step in adding floppy hook-up to Acorn Archimedes, removed old device implementation in favor of new device core. --- src/mame/includes/archimds.h | 10 +++++++--- src/mame/machine/archimds.c | 33 +++++++++++++++++++++------------ src/mess/drivers/a310.c | 29 ++++++++++++++++------------- 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/src/mame/includes/archimds.h b/src/mame/includes/archimds.h index 66a963bd7ae..7966418849b 100644 --- a/src/mame/includes/archimds.h +++ b/src/mame/includes/archimds.h @@ -10,7 +10,7 @@ #include "machine/aakart.h" #include "sound/dac.h" #include "machine/i2cmem.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" // interrupt definitions. these are for the real Archimedes computer - arcade // and gambling knockoffs likely are a bit different. @@ -47,7 +47,9 @@ public: m_kart(*this, "kart"), m_maincpu(*this, "maincpu"), m_i2cmem(*this, "i2cmem"), - m_wd1772(*this, "wd1772"), + m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1"), m_region_maincpu(*this, "maincpu"), m_region_vram(*this, "vram"), m_screen(*this, "screen"), @@ -92,7 +94,9 @@ public: protected: required_device m_maincpu; optional_device m_i2cmem; - optional_device m_wd1772; + optional_device m_fdc; + optional_device m_floppy0; + optional_device m_floppy1; required_memory_region m_region_maincpu; required_memory_region m_region_vram; required_device m_screen; diff --git a/src/mame/machine/archimds.c b/src/mame/machine/archimds.c index e586b901e5f..4369bde266b 100644 --- a/src/mame/machine/archimds.c +++ b/src/mame/machine/archimds.c @@ -685,9 +685,9 @@ READ32_MEMBER(archimedes_state::archimedes_ioc_r) { case 0: return ioc_ctrl_r(space,offset,mem_mask); case 1: - if (m_wd1772) { + if (m_fdc) { logerror("17XX: R @ addr %x mask %08x\n", offset*4, mem_mask); - return m_wd1772->data_r(space, offset&0xf); + return m_fdc->data_r(space, offset&0xf); } else { logerror("Read from FDC device?\n"); return 0; @@ -702,7 +702,7 @@ READ32_MEMBER(archimedes_state::archimedes_ioc_r) logerror("IOC: Internal Podule Read\n"); return 0xffff; case 5: - if (m_wd1772) { + if (m_fdc) { switch(ioc_addr & 0xfffc) { case 0x50: return 0; //fdc type, new model returns 5 here @@ -740,9 +740,9 @@ WRITE32_MEMBER(archimedes_state::archimedes_ioc_w) { case 0: ioc_ctrl_w(space,offset,data,mem_mask); return; case 1: - if (m_wd1772) { + if (m_fdc) { logerror("17XX: %x to addr %x mask %08x\n", data, offset*4, mem_mask); - m_wd1772->data_w(space, offset&0xf, data&0xff); + m_fdc->data_w(space, offset&0xf, data&0xff); } else { logerror("Write to FDC device?\n"); } @@ -757,20 +757,28 @@ WRITE32_MEMBER(archimedes_state::archimedes_ioc_w) logerror("IOC: Internal Podule Write\n"); return; case 5: - if (m_wd1772) { + if (m_fdc) { switch(ioc_addr & 0xfffc) { case 0x18: // latch B - m_wd1772->dden_w(BIT(data, 1)); + m_fdc->dden_w(BIT(data, 1)); return; case 0x40: // latch A - if (data & 1) { m_wd1772->set_drive(0); } - if (data & 2) { m_wd1772->set_drive(1); } - if (data & 4) { m_wd1772->set_drive(2); } - if (data & 8) { m_wd1772->set_drive(3); } + floppy_image_device *floppy = NULL; - m_wd1772->set_side((data & 0x10)>>4); + if (data & 1) { floppy = m_floppy0->get_device(); } + if (data & 2) { floppy = m_floppy1->get_device(); } + //if (data & 4) { m_fdc->set_drive(2); } + //if (data & 8) { m_fdc->set_drive(3); } + + m_fdc->set_floppy(floppy); + + if(floppy) + { + floppy->mon_w(BIT(data, 5)); + m_fdc->dden_w(BIT(data, 4)); + } //bit 5 is motor on return; } @@ -920,6 +928,7 @@ WRITE32_MEMBER(archimedes_state::archimedes_vidc_w) //#ifdef MAME_DEBUG + if(0) logerror("VIDC: %s = %d\n", vrnames[(reg-0x80)/4], m_vidc_regs[reg]); //#endif diff --git a/src/mess/drivers/a310.c b/src/mess/drivers/a310.c index fa67bde4a1d..ede4d993800 100644 --- a/src/mess/drivers/a310.c +++ b/src/mess/drivers/a310.c @@ -15,6 +15,7 @@ * \- some subtle memory paging fault * \- missing RAM max size * \- ARM bug? + * - 38776b8 * * ======================================================================================= @@ -58,14 +59,14 @@ #include "emu.h" -#include "machine/wd17xx.h" -#include "imagedev/flopdrv.h" #include "cpu/arm/arm.h" #include "sound/dac.h" #include "includes/archimds.h" #include "machine/i2cmem.h" //#include "machine/aakart.h" #include "machine/ram.h" +#include "machine/wd_fdc.h" +#include "formats/applix_dsk.h" class a310_state : public archimedes_state @@ -87,6 +88,7 @@ public: virtual void machine_start(); virtual void machine_reset(); DECLARE_INPUT_CHANGED_MEMBER(key_stroke); + DECLARE_FLOPPY_FORMATS( floppy_formats ); protected: @@ -296,13 +298,13 @@ static INPUT_PORTS_START( a310 ) PORT_BIT (0xf8, 0x80, IPT_UNUSED) INPUT_PORTS_END -static const wd17xx_interface a310_wd17xx_interface = -{ - DEVCB_NULL, - DEVCB_DRIVER_LINE_MEMBER(a310_state, a310_wd177x_intrq_w), - DEVCB_DRIVER_LINE_MEMBER(a310_state, a310_wd177x_drq_w), - {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} -}; +FLOPPY_FORMATS_MEMBER( a310_state::floppy_formats ) + FLOPPY_APPLIX_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( a310_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END WRITE_LINE_MEMBER( archimedes_state::a310_kart_tx_w ) { @@ -331,13 +333,14 @@ static ARM_INTERFACE( a310_config ) ARM_COPRO_TYPE_VL86C020 }; + static MACHINE_CONFIG_START( a310, a310_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", ARM, 8000000) /* 8 MHz */ MCFG_CPU_PROGRAM_MAP(a310_mem) MCFG_CPU_CONFIG(a310_config) - MCFG_AAKART_ADD("kart", 8000000/256, kart_interface) // TODO: frequency + MCFG_AAKART_ADD("kart", 8000000/256, kart_interface) MCFG_I2CMEM_ADD("i2cmem") MCFG_I2CMEM_DATA_SIZE(0x100) @@ -356,9 +359,9 @@ static MACHINE_CONFIG_START( a310, a310_state ) MCFG_RAM_DEFAULT_SIZE("2M") MCFG_RAM_EXTRA_OPTIONS("512K, 1M, 4M, 8M, 16M") - MCFG_WD1772_ADD("wd1772", a310_wd17xx_interface ) - - //MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(a310_floppy_interface) + MCFG_WD1772x_ADD("fdc", 8000000 / 2) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", a310_floppies, "35dd", a310_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", a310_floppies, "35dd", a310_state::floppy_formats) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("dac0", DAC, 0)