From 97e4fd9c6db783a5d7b457be1f2f3b8a8de7560a Mon Sep 17 00:00:00 2001 From: Robbbert Date: Wed, 29 May 2013 09:34:06 +0000 Subject: [PATCH] (MESS) Applix: Added floppy disk drives --- .gitattributes | 2 + src/lib/formats/applix_dsk.c | 73 ++++++++++++++++++++++++++++++++++++ src/lib/formats/applix_dsk.h | 28 ++++++++++++++ src/lib/lib.mak | 5 ++- src/mess/drivers/applix.c | 40 ++++++++++++++------ 5 files changed, 135 insertions(+), 13 deletions(-) create mode 100644 src/lib/formats/applix_dsk.c create mode 100644 src/lib/formats/applix_dsk.h diff --git a/.gitattributes b/.gitattributes index a79e094683f..3c4e9b0b9ed 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1940,6 +1940,8 @@ src/lib/formats/apf_apt.c svneol=native#text/plain src/lib/formats/apf_apt.h svneol=native#text/plain src/lib/formats/apollo_dsk.c svneol=native#text/plain src/lib/formats/apollo_dsk.h svneol=native#text/plain +src/lib/formats/applix_dsk.c svneol=native#text/plain +src/lib/formats/applix_dsk.h svneol=native#text/plain src/lib/formats/apridisk.c svneol=native#text/plain src/lib/formats/apridisk.h svneol=native#text/plain src/lib/formats/asst128_dsk.c svneol=native#text/plain diff --git a/src/lib/formats/applix_dsk.c b/src/lib/formats/applix_dsk.c new file mode 100644 index 00000000000..fba25e9b8de --- /dev/null +++ b/src/lib/formats/applix_dsk.c @@ -0,0 +1,73 @@ +/*************************************************************************** + + Copyright Olivier Galibert + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name 'MAME' nor the names of its contributors may be + used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +****************************************************************************/ + +/********************************************************************* + + formats/applix_dsk.c + + Applix disk image format + +*********************************************************************/ + +#include "emu.h" +#include "formats/applix_dsk.h" + +applix_format::applix_format() : wd177x_format(formats) +{ +} + +const char *applix_format::name() const +{ + return "applix"; +} + +const char *applix_format::description() const +{ + return "Applix disk image"; +} + +const char *applix_format::extensions() const +{ + return "dsk"; +} + +// Unverified gap sizes +const applix_format::format applix_format::formats[] = { + { /* 800K 3 1/2 inch double density */ + floppy_image::FF_35, floppy_image::DSDD, floppy_image::MFM, + 2000, 5, 80, 2, 1024, {}, 1, {}, 100, 22, 84 + }, + {} +}; + +const floppy_format_type FLOPPY_APPLIX_FORMAT = &floppy_image_format_creator; diff --git a/src/lib/formats/applix_dsk.h b/src/lib/formats/applix_dsk.h new file mode 100644 index 00000000000..5648fd25172 --- /dev/null +++ b/src/lib/formats/applix_dsk.h @@ -0,0 +1,28 @@ +/********************************************************************* + + formats/applix_dsk.h + + Applix disk image format + +*********************************************************************/ + +#ifndef APPLIX_DSK_H_ +#define APPLIX_DSK_H_ + +#include "wd177x_dsk.h" + +class applix_format : public wd177x_format { +public: + applix_format(); + + virtual const char *name() const; + virtual const char *description() const; + virtual const char *extensions() const; + +private: + static const format formats[]; +}; + +extern const floppy_format_type FLOPPY_APPLIX_FORMAT; + +#endif diff --git a/src/lib/lib.mak b/src/lib/lib.mak index d52a130b211..b78436634d7 100644 --- a/src/lib/lib.mak +++ b/src/lib/lib.mak @@ -104,11 +104,12 @@ FORMATSOBJS = \ $(LIBOBJ)/formats/apridisk.o \ $(LIBOBJ)/formats/apollo_dsk.o \ $(LIBOBJ)/formats/ap_dsk35.o \ + $(LIBOBJ)/formats/applix_dsk.o \ $(LIBOBJ)/formats/asst128_dsk.o \ $(LIBOBJ)/formats/atari_dsk.o \ $(LIBOBJ)/formats/atarist_dsk.o \ $(LIBOBJ)/formats/atom_tap.o \ - $(LIBOBJ)/formats/bw2_dsk.o \ + $(LIBOBJ)/formats/bw2_dsk.o \ $(LIBOBJ)/formats/bw12_dsk.o \ $(LIBOBJ)/formats/cbm_tap.o \ $(LIBOBJ)/formats/cgen_cas.o \ @@ -143,7 +144,7 @@ FORMATSOBJS = \ $(LIBOBJ)/formats/kc85_dsk.o \ $(LIBOBJ)/formats/kim1_cas.o \ $(LIBOBJ)/formats/lviv_lvt.o \ - $(LIBOBJ)/formats/m20_dsk.o \ + $(LIBOBJ)/formats/m20_dsk.o \ $(LIBOBJ)/formats/m5_dsk.o \ $(LIBOBJ)/formats/mm_dsk.o \ $(LIBOBJ)/formats/msx_dsk.o \ diff --git a/src/mess/drivers/applix.c b/src/mess/drivers/applix.c index 3024801b26b..0c3e51f0e89 100644 --- a/src/mess/drivers/applix.c +++ b/src/mess/drivers/applix.c @@ -31,13 +31,14 @@ #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" +#include "cpu/mcs51/mcs51.h" #include "video/mc6845.h" #include "machine/6522via.h" -#include "machine/wd_fdc.h" -#include "cpu/mcs51/mcs51.h" #include "sound/dac.h" -#include "imagedev/cassette.h" #include "sound/wave.h" +#include "machine/wd_fdc.h" +#include "formats/applix_dsk.h" +#include "imagedev/cassette.h" @@ -50,6 +51,8 @@ public: m_crtc(*this, "crtc"), m_via(*this, "via6522"), m_fdc(*this, "wd1772"), + m_floppy0(*this, "wd1772:0"), + m_floppy1(*this, "wd1772:1"), m_dacl(*this, "dacl"), m_dacr(*this, "dacr"), m_cass(*this, "cassette"), @@ -130,6 +133,8 @@ public: required_device m_crtc; required_device m_via; required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; required_device m_dacl; required_device m_dacr; required_device m_cass; @@ -348,6 +353,18 @@ WRITE8_MEMBER( applix_state::port08_w ) { m_port08 = data; membank("bank1")->set_entry(BIT(data, 6)); + + floppy_image_device *floppy = NULL; + if (BIT(data, 2)) floppy = m_floppy0->get_device(); + if (BIT(data, 3)) floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(BIT(data, 5)); + } } READ8_MEMBER( applix_state::port10_r ) @@ -715,13 +732,13 @@ void applix_state::machine_reset() m_maincpu->reset(); } -//FLOPPY_FORMATS_MEMBER( applix_state::floppy_formats ) -// FLOPPY_APPLIX_FORMAT -//FLOPPY_FORMATS_END +FLOPPY_FORMATS_MEMBER( applix_state::floppy_formats ) + FLOPPY_APPLIX_FORMAT +FLOPPY_FORMATS_END -//static SLOT_INTERFACE_START( applix_floppies ) -// SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -//SLOT_INTERFACE_END +static SLOT_INTERFACE_START( applix_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END void applix_state::palette_init() @@ -800,7 +817,7 @@ static MC6845_UPDATE_ROW( applix_update_row ) static MC6845_INTERFACE( applix_crtc ) { "screen", /* name of screen */ - false, + false, // should show a border 8, /* number of dots per character */ NULL, applix_update_row, /* handler to display a scanline */ @@ -894,7 +911,8 @@ static MACHINE_CONFIG_START( applix, applix_state ) MCFG_VIA6522_ADD("via6522", 0, applix_via) MCFG_CASSETTE_ADD("cassette", applix_cassette_interface) MCFG_WD1772x_ADD("wd1772", XTAL_16MHz / 2) //connected to Z80H clock pin - //MCFG_FLOPPY_DRIVE_ADD("wd1772:0", applix_floppies, "35dd", 0, applix_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1772:0", applix_floppies, "35dd", 0, applix_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1772:1", applix_floppies, "35dd", 0, applix_state::floppy_formats) MCFG_TIMER_DRIVER_ADD_PERIODIC("applix_c", applix_state, cass_timer, attotime::from_hz(100000)) MACHINE_CONFIG_END