From c414fffc306da58f69d8d1c8ee0253603b31c553 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Fri, 5 Jun 2015 10:21:08 +0200 Subject: [PATCH] thompson: updated to use the new wd fdc. same deal with as bbc: drives 0 and 1 are used for the controller with the wd, other legacy drives for other controllers (needs slotification). --- scripts/src/lib.lua | 2 ++ src/lib/formats/cd90_640_dsk.c | 56 ++++++++++++++++++++++++++++++++++ src/lib/formats/cd90_640_dsk.h | 33 ++++++++++++++++++++ src/mess/drivers/thomson.c | 20 ++++++++++-- src/mess/includes/thomson.h | 3 ++ src/mess/machine/thomflop.c | 36 +++++++--------------- 6 files changed, 122 insertions(+), 28 deletions(-) create mode 100644 src/lib/formats/cd90_640_dsk.c create mode 100644 src/lib/formats/cd90_640_dsk.h diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index f562b98c3b1..774e674db1a 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -182,6 +182,8 @@ project "formats" MAME_DIR .. "src/lib/formats/cbm_tap.h", MAME_DIR .. "src/lib/formats/ccvf_dsk.c", MAME_DIR .. "src/lib/formats/ccvf_dsk.h", + MAME_DIR .. "src/lib/formats/cd90_640_dsk.c", + MAME_DIR .. "src/lib/formats/cd90_640_dsk.h", MAME_DIR .. "src/lib/formats/cgen_cas.c", MAME_DIR .. "src/lib/formats/cgen_cas.h", MAME_DIR .. "src/lib/formats/cgenie_dsk.c", diff --git a/src/lib/formats/cd90_640_dsk.c b/src/lib/formats/cd90_640_dsk.c new file mode 100644 index 00000000000..1654d5d8c99 --- /dev/null +++ b/src/lib/formats/cd90_640_dsk.c @@ -0,0 +1,56 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Thompson CD90-640 FDC + + Disk image format + + TODO: + - Gap sizes unverified for FM + +***************************************************************************/ + +#include "cd90_640_dsk.h" + +cd90_640_format::cd90_640_format() : wd177x_format(formats) +{ +} + +const char *cd90_640_format::name() const +{ + return "cd90_640"; +} + +const char *cd90_640_format::description() const +{ + return "CD90-640 disk image"; +} + +const char *cd90_640_format::extensions() const +{ + return "fd"; +} + +const cd90_640_format::format cd90_640_format::formats[] = +{ + { + floppy_image::FF_525, floppy_image::SSSD, floppy_image::FM, + 4000, 16, 40, 1, 128, {}, 1, {}, 14, 11, 12 + }, + { + floppy_image::FF_525, floppy_image::SSDD, floppy_image::MFM, + 2000, 16, 40, 1, 256, {}, 1, {}, 31, 22, 44 + }, + { + floppy_image::FF_525, floppy_image::DSSD, floppy_image::FM, + 4000, 16, 40, 2, 128, {}, 1, {}, 14, 11, 12 + }, + { + floppy_image::FF_525, floppy_image::DSDD, floppy_image::MFM, + 2000, 16, 40, 2, 256, {}, 1, {}, 31, 22, 44 + }, + {} +}; + +const floppy_format_type FLOPPY_CD90_640_FORMAT = &floppy_image_format_creator; diff --git a/src/lib/formats/cd90_640_dsk.h b/src/lib/formats/cd90_640_dsk.h new file mode 100644 index 00000000000..ccf80508047 --- /dev/null +++ b/src/lib/formats/cd90_640_dsk.h @@ -0,0 +1,33 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Thompson CD90-640 FDC + + Disk image format + +***************************************************************************/ + +#pragma once + +#ifndef __CD90_640_DSK_H__ +#define __CD90_640_DSK_H__ + +#include "wd177x_dsk.h" + +class cd90_640_format : public wd177x_format +{ +public: + cd90_640_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_CD90_640_FORMAT; + +#endif // __CD90_640_DSK_H__ diff --git a/src/mess/drivers/thomson.c b/src/mess/drivers/thomson.c index 93730444be8..f68b45762f6 100644 --- a/src/mess/drivers/thomson.c +++ b/src/mess/drivers/thomson.c @@ -73,10 +73,11 @@ #include "includes/thomson.h" #include "bus/rs232/rs232.h" #include "machine/6821pia.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" #include "machine/clock.h" #include "bus/centronics/ctronics.h" #include "imagedev/flopdrv.h" +#include "formats/cd90_640_dsk.h" #include "formats/basicdsk.h" #include "machine/ram.h" @@ -593,6 +594,17 @@ static const floppy_interface thomson_floppy_interface = NULL }; +FLOPPY_FORMATS_MEMBER( thomson_state::cd90_640_formats ) + FLOPPY_CD90_640_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( cd90_640_floppies ) + SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) + SLOT_INTERFACE("sd", FLOPPY_525_SD) + SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) + SLOT_INTERFACE("dd", FLOPPY_525_DD) +SLOT_INTERFACE_END + /* ------------ driver ------------ */ @@ -649,8 +661,10 @@ static MACHINE_CONFIG_START( to7, thomson_state ) /* floppy */ MCFG_DEVICE_ADD("mc6843", MC6843, 0) - MCFG_DEVICE_ADD("wd2793", WD2793, 0) - MCFG_WD17XX_DEFAULT_DRIVE4_TAGS + MCFG_WD2793x_ADD("wd2793", XTAL_1MHz) + + MCFG_FLOPPY_DRIVE_ADD("wd2793:0", cd90_640_floppies, "dd", thomson_state::cd90_640_formats) + MCFG_FLOPPY_DRIVE_ADD("wd2793:1", cd90_640_floppies, "dd", thomson_state::cd90_640_formats) MCFG_DEVICE_ADD(FLOPPY_0, LEGACY_FLOPPY, 0) MCFG_DEVICE_CONFIG(thomson_floppy_interface) diff --git a/src/mess/includes/thomson.h b/src/mess/includes/thomson.h index ec24c79ea22..7aac073fa2a 100644 --- a/src/mess/includes/thomson.h +++ b/src/mess/includes/thomson.h @@ -28,6 +28,7 @@ #include "formats/thom_cas.h" #include "formats/thom_dsk.h" #include "machine/thomflop.h" +#include "imagedev/floppy.h" #include "machine/ram.h" #include "bus/generic/slot.h" @@ -116,6 +117,8 @@ public: { } + DECLARE_FLOPPY_FORMATS(cd90_640_formats); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( to7_cartridge ); DECLARE_DEVICE_IMAGE_LOAD_MEMBER( mo5_cartridge ); diff --git a/src/mess/machine/thomflop.c b/src/mess/machine/thomflop.c index e418ed04e6b..bc84715d253 100644 --- a/src/mess/machine/thomflop.c +++ b/src/mess/machine/thomflop.c @@ -9,7 +9,7 @@ **********************************************************************/ #include "includes/thomson.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" #define VERBOSE 0 /* 0, 1 or 2 */ @@ -275,7 +275,7 @@ static UINT8 to7_5p14_select; READ8_MEMBER( thomson_state::to7_5p14_r ) { - wd2793_device *fdc = machine().device("wd2793"); + wd2793_t *fdc = machine().device("wd2793"); if ( offset < 4 ) return fdc->read(space, offset ); @@ -290,37 +290,24 @@ READ8_MEMBER( thomson_state::to7_5p14_r ) WRITE8_MEMBER( thomson_state::to7_5p14_w ) { - wd2793_device *fdc = machine().device("wd2793"); + wd2793_t *fdc = machine().device("wd2793"); if ( offset < 4 ) fdc->write(space, offset, data ); else if ( offset == 8 ) { /* drive select */ - int drive = -1, side = 0; + floppy_image_device *floppy = NULL; - switch ( data & 7 ) - { - case 0: break; - case 2: drive = 0; side = 0; break; - case 3: drive = 1; side = 1; break; - case 4: drive = 2; side = 0; break; - case 5: drive = 3; side = 1; break; - default: - logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", machine().time().as_double(), m_maincpu->pc(), data ); - } + if (BIT(data, 1)) floppy = fdc->subdevice("0")->get_device(); + if (BIT(data, 2)) floppy = fdc->subdevice("1")->get_device(); - fdc->dden_w(BIT(data, 7)); + fdc->set_floppy(floppy); - to7_5p14_select = data; - - if ( drive != -1 ) + if (floppy) { thom_floppy_active( 0 ); - fdc->set_drive( drive ); - fdc->set_side( side ); - LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n", - machine().time().as_double(), m_maincpu->pc(), - data, drive, side, (BIT(data, 7) ? "FM" : "MFM"))); + floppy->mon_w(0); + floppy->ss_w(BIT(data, 0)); } } else @@ -332,7 +319,7 @@ WRITE8_MEMBER( thomson_state::to7_5p14_w ) void thomson_state::to7_5p14_reset() { - wd2793_device *fdc = machine().device("wd2793"); + wd2793_t *fdc = machine().device("wd2793"); LOG(( "to7_5p14_reset: CD 90-640 controller\n" )); fdc->reset(); } @@ -1911,7 +1898,6 @@ void thomson_state::thomson_index_callback(legacy_floppy_image_device *device, i break; case 2: - machine().device("wd2793")->index_pulse_callback(device, state); break; case 3: