From 476d027582fd1fe1ce535e662161bed8f207ec65 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Mon, 1 Jun 2015 10:14:02 +0200 Subject: [PATCH] mz2000: updated to use new wd fdc. fix softlist to use the correct interface. change x1_dsk to 2d_dsk and use it for the mz2000 as well. --- hash/mz2000_flop.xml | 30 ++++---- scripts/src/lib.lua | 4 +- src/lib/formats/2d_dsk.c | 41 ++++++++++ src/lib/formats/{x1_dsk.h => 2d_dsk.h} | 14 ++-- src/lib/formats/x1_dsk.c | 41 ---------- src/mess/drivers/mz2000.c | 100 ++++++++++++++----------- src/mess/drivers/x1.c | 4 +- src/mess/drivers/x1twin.c | 1 - 8 files changed, 125 insertions(+), 110 deletions(-) create mode 100644 src/lib/formats/2d_dsk.c rename src/lib/formats/{x1_dsk.h => 2d_dsk.h} (70%) delete mode 100644 src/lib/formats/x1_dsk.c diff --git a/hash/mz2000_flop.xml b/hash/mz2000_flop.xml index 694cd60c0dd..9740d9cc175 100644 --- a/hash/mz2000_flop.xml +++ b/hash/mz2000_flop.xml @@ -18,14 +18,14 @@ 2002 Toshio Fukui - + - + @@ -48,14 +48,14 @@ 2011? Toshio Fukui - + - + @@ -67,7 +67,7 @@ TF-DOS Ver2.1C (TF) 200? Toshio Fukui - + @@ -79,14 +79,14 @@ TF-DOS Ver2.1 (TF) 200? Toshio Fukui - + - + @@ -97,13 +97,13 @@ TF-DOS Ver2.0B (TS) 200? Toshio Fukui - + - + @@ -114,7 +114,7 @@ Graphic Editor III "Art Magic" 200? Toshio Fukui - + @@ -125,7 +125,7 @@ Brave 200? Toshio Fukui - + @@ -136,7 +136,7 @@ Lilas 200? Toshio Fukui - + @@ -147,7 +147,7 @@ TF-DOS Programs 1 200? Toshio Fukui - + @@ -158,7 +158,7 @@ TF-DOS Programs 2 200? Toshio Fukui - + @@ -170,7 +170,7 @@ Sharp BASIC Programs 1 200? <unknown> - + diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index 788aaf18e9d..dcf4c44268e 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -114,6 +114,8 @@ project "formats" } files { + MAME_DIR .. "src/lib/formats/2d_dsk.c", + MAME_DIR .. "src/lib/formats/2d_dsk.h", MAME_DIR .. "src/lib/formats/cassimg.c", MAME_DIR .. "src/lib/formats/cassimg.h", MAME_DIR .. "src/lib/formats/flopimg.c", @@ -395,8 +397,6 @@ 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/2d_dsk.c b/src/lib/formats/2d_dsk.c new file mode 100644 index 00000000000..7f304b4eaa0 --- /dev/null +++ b/src/lib/formats/2d_dsk.c @@ -0,0 +1,41 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + 2D + + Disk image format used by early Sharp computers + +***************************************************************************/ + +#include "2d_dsk.h" + +_2d_format::_2d_format() : wd177x_format(formats) +{ +} + +const char *_2d_format::name() const +{ + return "2d"; +} + +const char *_2d_format::description() const +{ + return "2D disk image"; +} + +const char *_2d_format::extensions() const +{ + return "2d"; +} + +const _2d_format::format _2d_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_2D_FORMAT = &floppy_image_format_creator<_2d_format>; diff --git a/src/lib/formats/x1_dsk.h b/src/lib/formats/2d_dsk.h similarity index 70% rename from src/lib/formats/x1_dsk.h rename to src/lib/formats/2d_dsk.h index 0774c6bf27e..ab70b95f21a 100644 --- a/src/lib/formats/x1_dsk.h +++ b/src/lib/formats/2d_dsk.h @@ -2,7 +2,7 @@ // copyright-holders:Dirk Best /*************************************************************************** - Sharp X1 + Sharp 2D Disk image format @@ -10,15 +10,15 @@ #pragma once -#ifndef __X1_DSK_H__ -#define __X1_DSK_H__ +#ifndef __2D_DSK_H__ +#define __2D_DSK_H__ #include "wd177x_dsk.h" -class x1_format : public wd177x_format +class _2d_format : public wd177x_format { public: - x1_format(); + _2d_format(); virtual const char *name() const; virtual const char *description() const; @@ -28,6 +28,6 @@ private: static const format formats[]; }; -extern const floppy_format_type FLOPPY_X1_FORMAT; +extern const floppy_format_type FLOPPY_2D_FORMAT; -#endif // __X1_DSK_H__ +#endif // __2D_DSK_H__ diff --git a/src/lib/formats/x1_dsk.c b/src/lib/formats/x1_dsk.c deleted file mode 100644 index b6a5d1890da..00000000000 --- a/src/lib/formats/x1_dsk.c +++ /dev/null @@ -1,41 +0,0 @@ -// 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; diff --git a/src/mess/drivers/mz2000.c b/src/mess/drivers/mz2000.c index 63c04d3b04b..7f86fd940a0 100644 --- a/src/mess/drivers/mz2000.c +++ b/src/mess/drivers/mz2000.c @@ -21,15 +21,14 @@ #include "cpu/z80/z80.h" #include "machine/z80pio.h" #include "machine/i8255.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" #include "machine/pit8253.h" #include "sound/beep.h" #include "sound/wave.h" #include "machine/rp5c15.h" - #include "imagedev/cassette.h" #include "imagedev/flopdrv.h" -#include "formats/basicdsk.h" +#include "formats/2d_dsk.h" #include "formats/mz_cas.h" #define MASTER_CLOCK XTAL_17_73447MHz/5 /* TODO: was 4 MHz, but otherwise cassette won't work due of a bug with MZF support ... */ @@ -41,8 +40,13 @@ public: mz2000_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_cass(*this, "cassette"), + m_floppy(NULL), m_maincpu(*this, "maincpu"), m_mb8877a(*this, "mb8877a"), + m_floppy0(*this, "mb8877a:0"), + m_floppy1(*this, "mb8877a:1"), + m_floppy2(*this, "mb8877a:2"), + m_floppy3(*this, "mb8877a:3"), m_pit8253(*this, "pit"), m_beeper(*this, "beeper"), m_region_tvram(*this, "tvram"), @@ -68,8 +72,12 @@ public: m_io_config(*this, "CONFIG"), m_palette(*this, "palette") { } + DECLARE_FLOPPY_FORMATS(floppy_formats); + required_device m_cass; + floppy_image_device *m_floppy; + UINT8 m_ipl_enable; UINT8 m_tvram_enable; UINT8 m_gvram_enable; @@ -98,15 +106,16 @@ public: DECLARE_READ8_MEMBER(mz2000_mem_r); DECLARE_WRITE8_MEMBER(mz2000_mem_w); DECLARE_WRITE8_MEMBER(mz2000_gvram_bank_w); - DECLARE_WRITE8_MEMBER(mz2000_fdc_w); + DECLARE_WRITE8_MEMBER(floppy_select_w); + DECLARE_WRITE8_MEMBER(floppy_side_w); DECLARE_WRITE8_MEMBER(timer_w); DECLARE_WRITE8_MEMBER(mz2000_tvram_attr_w); DECLARE_WRITE8_MEMBER(mz2000_gvram_mask_w); virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_mz2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ8_MEMBER(mz2000_wd17xx_r); - DECLARE_WRITE8_MEMBER(mz2000_wd17xx_w); + DECLARE_READ8_MEMBER(fdc_r); + DECLARE_WRITE8_MEMBER(fdc_w); DECLARE_READ8_MEMBER(mz2000_porta_r); DECLARE_READ8_MEMBER(mz2000_portb_r); DECLARE_READ8_MEMBER(mz2000_portc_r); @@ -119,7 +128,11 @@ public: protected: required_device m_maincpu; - required_device m_mb8877a; + required_device m_mb8877a; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; required_device m_pit8253; required_device m_beeper; required_memory_region m_region_tvram; @@ -339,7 +352,7 @@ WRITE8_MEMBER(mz2000_state::mz2000_gvram_bank_w) m_gvram_bank = data & 3; } -READ8_MEMBER(mz2000_state::mz2000_wd17xx_r) +READ8_MEMBER(mz2000_state::fdc_r) { if(m_has_fdc) return m_mb8877a->read(space, offset) ^ 0xff; @@ -347,25 +360,34 @@ READ8_MEMBER(mz2000_state::mz2000_wd17xx_r) return 0xff; } -WRITE8_MEMBER(mz2000_state::mz2000_wd17xx_w) +WRITE8_MEMBER(mz2000_state::fdc_w) { if(m_has_fdc) m_mb8877a->write(space, offset, data ^ 0xff); } -WRITE8_MEMBER(mz2000_state::mz2000_fdc_w) +WRITE8_MEMBER(mz2000_state::floppy_select_w) { - switch(offset+0xdc) + switch (data & 0x03) { - case 0xdc: - m_mb8877a->set_drive(data & 3); - floppy_get_device(machine(), data & 3)->floppy_mon_w((data & 0x80) ? CLEAR_LINE : ASSERT_LINE); - floppy_get_device(machine(), data & 3)->floppy_drive_set_ready_state(1,0); - break; - case 0xdd: - m_mb8877a->set_side((data & 1)); - break; + case 0: m_floppy = m_floppy0->get_device(); break; + case 1: m_floppy = m_floppy1->get_device(); break; + case 2: m_floppy = m_floppy2->get_device(); break; + case 3: m_floppy = m_floppy3->get_device(); break; } + + m_mb8877a->set_floppy(m_floppy); + + // todo: bit 2 is connected to something too... + + if (m_floppy) + m_floppy->mon_w(!BIT(data, 7)); +} + +WRITE8_MEMBER(mz2000_state::floppy_side_w) +{ + if (m_floppy) + m_floppy->ss_w(BIT(data, 0)); } WRITE8_MEMBER(mz2000_state::timer_w) @@ -396,8 +418,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START(mz2000_io, AS_IO, 8, mz2000_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xd8, 0xdb) AM_READWRITE(mz2000_wd17xx_r, mz2000_wd17xx_w) - AM_RANGE(0xdc, 0xdd) AM_WRITE(mz2000_fdc_w) + AM_RANGE(0xd8, 0xdb) AM_READWRITE(fdc_r, fdc_w) + AM_RANGE(0xdc, 0xdc) AM_WRITE(floppy_select_w) + AM_RANGE(0xdd, 0xdd) AM_WRITE(floppy_side_w) AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE("i8255_0", i8255_device, read, write) AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE("pit", pit8253_device, read, write) AM_RANGE(0xe8, 0xeb) AM_DEVREADWRITE("z80pio_1", z80pio_device, read_alt, write_alt) @@ -775,23 +798,15 @@ READ8_MEMBER(mz2000_state::mz2000_pio1_porta_r) return m_porta_latch; } -#if 0 -static LEGACY_FLOPPY_OPTIONS_START( mz2000 ) - LEGACY_FLOPPY_OPTION( img2d, "2d", "2D disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, - HEADS([2]) - TRACKS([80]) - SECTORS([16]) - SECTOR_LENGTH([256]) - FIRST_SECTOR_ID([1])) -LEGACY_FLOPPY_OPTIONS_END -#endif -static const floppy_interface mz2000_floppy_interface = -{ - FLOPPY_STANDARD_3_5_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(default), - NULL -}; +FLOPPY_FORMATS_MEMBER( mz2000_state::floppy_formats ) + FLOPPY_2D_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( mz2000_floppies ) + SLOT_INTERFACE("dd", FLOPPY_525_DD) +SLOT_INTERFACE_END + static MACHINE_CONFIG_START( mz2000, mz2000_state ) /* basic machine hardware */ @@ -818,12 +833,14 @@ static MACHINE_CONFIG_START( mz2000, mz2000_state ) MCFG_PIT8253_CLK1(31250) /* needed by "Art Magic" to boot */ MCFG_PIT8253_CLK2(31250) - MCFG_DEVICE_ADD("mb8877a", MB8877, 0) - MCFG_WD17XX_DEFAULT_DRIVE4_TAGS + MCFG_MB8877x_ADD("mb8877a", XTAL_1MHz) - MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(mz2000_floppy_interface) + MCFG_FLOPPY_DRIVE_ADD("mb8877a:0", mz2000_floppies, "dd", mz2000_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("mb8877a:1", mz2000_floppies, "dd", mz2000_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("mb8877a:2", mz2000_floppies, "dd", mz2000_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("mb8877a:3", mz2000_floppies, "dd", mz2000_state::floppy_formats) - MCFG_SOFTWARE_LIST_ADD("flop_list","mz2000_flop") + MCFG_SOFTWARE_LIST_ADD("flop_list", "mz2000_flop") MCFG_CASSETTE_ADD( "cassette" ) MCFG_CASSETTE_FORMATS(mz700_cassette_formats) @@ -844,7 +861,6 @@ static MACHINE_CONFIG_START( mz2000, mz2000_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", mz2000) MCFG_PALETTE_ADD("palette", 8) - MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") diff --git a/src/mess/drivers/x1.c b/src/mess/drivers/x1.c index 8ed1dc743cd..753783ff436 100644 --- a/src/mess/drivers/x1.c +++ b/src/mess/drivers/x1.c @@ -206,7 +206,7 @@ ************************************************************************************************/ #include "includes/x1.h" -#include "formats/x1_dsk.h" +#include "formats/2d_dsk.h" #define MAIN_CLOCK XTAL_16MHz #define VDP_CLOCK XTAL_42_9545MHz @@ -2431,7 +2431,7 @@ PALETTE_INIT_MEMBER(x1_state,x1) } FLOPPY_FORMATS_MEMBER( x1_state::floppy_formats ) - FLOPPY_X1_FORMAT + FLOPPY_2D_FORMAT FLOPPY_FORMATS_END static SLOT_INTERFACE_START( x1_floppies ) diff --git a/src/mess/drivers/x1twin.c b/src/mess/drivers/x1twin.c index b89f5e757a4..c6a14a5ac36 100644 --- a/src/mess/drivers/x1twin.c +++ b/src/mess/drivers/x1twin.c @@ -15,7 +15,6 @@ ************************************************************************************************/ #include "includes/x1.h" -#include "formats/x1_dsk.h" #include "includes/pce.h" //#include "cpu/h6280/h6280.h"