diff options
-rw-r--r-- | scripts/src/lib.lua | 2 | ||||
-rw-r--r-- | src/lib/formats/x1_dsk.c | 41 | ||||
-rw-r--r-- | src/lib/formats/x1_dsk.h | 33 | ||||
-rw-r--r-- | src/mess/drivers/x1.c | 65 | ||||
-rw-r--r-- | src/mess/drivers/x1twin.c | 34 | ||||
-rw-r--r-- | src/mess/includes/x1.h | 14 |
6 files changed, 137 insertions, 52 deletions
diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index f7e2a2cba0a..6eca056a87f 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -391,6 +391,8 @@ project "formats" MAME_DIR .. "src/lib/formats/wd177x_dsk.h", MAME_DIR .. "src/lib/formats/x07_cas.c", MAME_DIR .. "src/lib/formats/x07_cas.h", + MAME_DIR .. "src/lib/formats/x1_dsk.c", + MAME_DIR .. "src/lib/formats/x1_dsk.h", MAME_DIR .. "src/lib/formats/x1_tap.c", MAME_DIR .. "src/lib/formats/x1_tap.h", MAME_DIR .. "src/lib/formats/xdf_dsk.c", diff --git a/src/lib/formats/x1_dsk.c b/src/lib/formats/x1_dsk.c new file mode 100644 index 00000000000..b6a5d1890da --- /dev/null +++ b/src/lib/formats/x1_dsk.c @@ -0,0 +1,41 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Sharp X1 + + Disk image format + +***************************************************************************/ + +#include "x1_dsk.h" + +x1_format::x1_format() : wd177x_format(formats) +{ +} + +const char *x1_format::name() const +{ + return "x1"; +} + +const char *x1_format::description() const +{ + return "Sharp X1 disk image"; +} + +const char *x1_format::extensions() const +{ + return "2d"; +} + +const x1_format::format x1_format::formats[] = +{ + { + floppy_image::FF_525, floppy_image::DSDD, floppy_image::MFM, + 2000, 16, 40, 2, 256, {}, 1, {}, 32, 22, 54 + }, + {} +}; + +const floppy_format_type FLOPPY_X1_FORMAT = &floppy_image_format_creator<x1_format>; diff --git a/src/lib/formats/x1_dsk.h b/src/lib/formats/x1_dsk.h new file mode 100644 index 00000000000..0774c6bf27e --- /dev/null +++ b/src/lib/formats/x1_dsk.h @@ -0,0 +1,33 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Sharp X1 + + Disk image format + +***************************************************************************/ + +#pragma once + +#ifndef __X1_DSK_H__ +#define __X1_DSK_H__ + +#include "wd177x_dsk.h" + +class x1_format : public wd177x_format +{ +public: + x1_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_X1_FORMAT; + +#endif // __X1_DSK_H__ diff --git a/src/mess/drivers/x1.c b/src/mess/drivers/x1.c index 577e8780f2d..8ed1dc743cd 100644 --- a/src/mess/drivers/x1.c +++ b/src/mess/drivers/x1.c @@ -206,6 +206,7 @@ ************************************************************************************************/ #include "includes/x1.h" +#include "formats/x1_dsk.h" #define MAIN_CLOCK XTAL_16MHz #define VDP_CLOCK XTAL_42_9545MHz @@ -1021,10 +1022,12 @@ READ8_MEMBER( x1_state::x1_fdc_r ) WRITE8_MEMBER( x1_state::x1_fdc_w ) { + floppy_image_device *floppy = NULL; + switch(offset+0xff8) { case 0x0ff8: - m_fdc->command_w(space, offset,data); + m_fdc->cmd_w(space, offset,data); break; case 0x0ff9: m_fdc->track_w(space, offset,data); @@ -1035,12 +1038,25 @@ WRITE8_MEMBER( x1_state::x1_fdc_w ) case 0x0ffb: m_fdc->data_w(space, offset,data); break; + case 0x0ffc: - m_fdc->set_drive(data & 3); - floppy_get_device(machine(), data & 3)->floppy_mon_w(!BIT(data, 7)); - floppy_get_device(machine(), data & 3)->floppy_drive_set_ready_state(data & 0x80,0); - m_fdc->set_side(BIT(data, 4)); + switch (data & 0x03) + { + case 0: floppy = m_floppy0->get_device(); break; + case 1: floppy = m_floppy1->get_device(); break; + case 2: floppy = m_floppy2->get_device(); break; + case 3: floppy = m_floppy3->get_device(); break; + } + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->ss_w(BIT(data, 4)); + floppy->mon_w(!BIT(data, 7)); + } break; + case 0x0ffd: case 0x0ffe: case 0x0fff: @@ -2414,21 +2430,13 @@ PALETTE_INIT_MEMBER(x1_state,x1) palette.set_pen_color(i,rgb_t(0x00,0x00,0x00)); } -static LEGACY_FLOPPY_OPTIONS_START( x1 ) - LEGACY_FLOPPY_OPTION( img2d, "2d", "2D disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, - HEADS([2]) - TRACKS([40]) - SECTORS([16]) - SECTOR_LENGTH([256]) - FIRST_SECTOR_ID([1])) -LEGACY_FLOPPY_OPTIONS_END +FLOPPY_FORMATS_MEMBER( x1_state::floppy_formats ) + FLOPPY_X1_FORMAT +FLOPPY_FORMATS_END -static const floppy_interface x1_floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSDD_40, - LEGACY_FLOPPY_OPTIONS_NAME(x1), - "floppy_5_25" -}; +static SLOT_INTERFACE_START( x1_floppies ) + SLOT_INTERFACE("dd", FLOPPY_525_DD) +SLOT_INTERFACE_END static MACHINE_CONFIG_START( x1, x1_state ) /* basic machine hardware */ @@ -2475,8 +2483,14 @@ static MACHINE_CONFIG_START( x1, x1_state ) MCFG_VIDEO_START_OVERRIDE(x1_state,x1) - MCFG_DEVICE_ADD("fdc", MB8877, 0) - MCFG_WD17XX_DEFAULT_DRIVE4_TAGS + MCFG_MB8877x_ADD("fdc", MAIN_CLOCK / 16) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", x1_floppies, "dd", x1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", x1_floppies, "dd", x1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", x1_floppies, "dd", x1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", x1_floppies, "dd", x1_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list","x1_flop") MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "x1_cart") MCFG_GENERIC_EXTENSIONS("bin,rom") @@ -2502,9 +2516,6 @@ static MACHINE_CONFIG_START( x1, x1_state ) MCFG_SOFTWARE_LIST_ADD("cass_list","x1_cass") - MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(x1_floppy_interface) - MCFG_SOFTWARE_LIST_ADD("flop_list","x1_flop") - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", x1_state, x1_keyboard_callback, attotime::from_hz(250)) MCFG_TIMER_DRIVER_ADD_PERIODIC("cmt_wind_timer", x1_state, x1_cmt_wind_timer, attotime::from_hz(16)) MACHINE_CONFIG_END @@ -2527,10 +2538,8 @@ static MACHINE_CONFIG_DERIVED( x1turbo, x1 ) MCFG_Z80DMA_IN_IORQ_CB(READ8(x1_state, io_read_byte)) MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(x1_state, io_write_byte)) - MCFG_DEVICE_REMOVE("fdc") - MCFG_DEVICE_ADD("fdc", MB8877, 0) - MCFG_WD17XX_DEFAULT_DRIVE4_TAGS - MCFG_WD17XX_DRQ_CALLBACK(WRITELINE(x1_state,fdc_drq_w)) + MCFG_DEVICE_MODIFY("fdc") + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(x1_state, fdc_drq_w)) MCFG_YM2151_ADD("ym", MAIN_CLOCK/8) //option board MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) diff --git a/src/mess/drivers/x1twin.c b/src/mess/drivers/x1twin.c index a0bfb2ad5b4..b89f5e757a4 100644 --- a/src/mess/drivers/x1twin.c +++ b/src/mess/drivers/x1twin.c @@ -15,6 +15,7 @@ ************************************************************************************************/ #include "includes/x1.h" +#include "formats/x1_dsk.h" #include "includes/pce.h" //#include "cpu/h6280/h6280.h" @@ -394,23 +395,9 @@ static const z80_daisy_config x1_daisy[] = { NULL } }; -static LEGACY_FLOPPY_OPTIONS_START( x1 ) - LEGACY_FLOPPY_OPTION( img2d, "2d", "2D disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, - HEADS([2]) - TRACKS([40]) - SECTORS([16]) - SECTOR_LENGTH([256]) - FIRST_SECTOR_ID([1])) -LEGACY_FLOPPY_OPTIONS_END - -static const floppy_interface x1_floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSDD_40, - LEGACY_FLOPPY_OPTIONS_NAME(x1), - "floppy_5_25" -}; - - +static SLOT_INTERFACE_START( x1_floppies ) + SLOT_INTERFACE("dd", FLOPPY_525_DD) +SLOT_INTERFACE_END static MACHINE_CONFIG_START( x1twin, x1twin_state ) /* basic machine hardware */ @@ -471,8 +458,14 @@ static MACHINE_CONFIG_START( x1twin, x1twin_state ) MCFG_VIDEO_START_OVERRIDE(x1twin_state,x1) - MCFG_DEVICE_ADD("fdc", MB8877, 0) - MCFG_WD17XX_DEFAULT_DRIVE4_TAGS + MCFG_MB8877x_ADD("fdc", MAIN_CLOCK / 16) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", x1_floppies, "dd", x1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", x1_floppies, "dd", x1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", x1_floppies, "dd", x1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", x1_floppies, "dd", x1_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list","x1_flop") MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "x1_cart") MCFG_GENERIC_EXTENSIONS("bin,rom") @@ -503,9 +496,6 @@ static MACHINE_CONFIG_START( x1twin, x1twin_state ) MCFG_SOFTWARE_LIST_ADD("cass_list","x1_cass") - MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(x1_floppy_interface) - MCFG_SOFTWARE_LIST_ADD("flop_list","x1_flop") - #if 0 MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6) MCFG_C6280_CPU("pce_cpu") diff --git a/src/mess/includes/x1.h b/src/mess/includes/x1.h index ba48f6ff043..ec286064412 100644 --- a/src/mess/includes/x1.h +++ b/src/mess/includes/x1.h @@ -15,7 +15,7 @@ #include "machine/z80ctc.h" #include "machine/z80dart.h" #include "machine/i8255.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" #include "machine/z80dma.h" #include "video/mc6845.h" #include "sound/2151intf.h" @@ -81,6 +81,10 @@ public: m_cassette(*this, "cassette"), m_cart(*this, "cartslot"), m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1"), + m_floppy2(*this, "fdc:2"), + m_floppy3(*this, "fdc:3"), m_crtc(*this, "crtc"), m_ctc(*this, "ctc"), m_gfxdecode(*this, "gfxdecode"), @@ -88,10 +92,16 @@ public: m_dma(*this, "dma") { } + DECLARE_FLOPPY_FORMATS(floppy_formats); + required_device<cpu_device> m_maincpu; required_device<cassette_image_device> m_cassette; required_device<generic_slot_device> m_cart; - required_device<mb8877_device> m_fdc; + required_device<mb8877_t> m_fdc; + required_device<floppy_connector> m_floppy0; + required_device<floppy_connector> m_floppy1; + required_device<floppy_connector> m_floppy2; + required_device<floppy_connector> m_floppy3; required_device<mc6845_device> m_crtc; required_device<z80ctc_device> m_ctc; |