From 0afa6824566f59fc4d534060b8e81315cab840bf Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Sat, 30 May 2015 15:07:48 +0200 Subject: dgnalpha: updated to use the new wd fdc --- scripts/src/lib.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts/src/lib.lua') diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index 166ab4beddb..f7e2a2cba0a 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -373,6 +373,8 @@ project "formats" MAME_DIR .. "src/lib/formats/uef_cas.h", MAME_DIR .. "src/lib/formats/upd765_dsk.c", MAME_DIR .. "src/lib/formats/upd765_dsk.h", + MAME_DIR .. "src/lib/formats/vdk_dsk.c", + MAME_DIR .. "src/lib/formats/vdk_dsk.h", MAME_DIR .. "src/lib/formats/victor9k_dsk.c", MAME_DIR .. "src/lib/formats/victor9k_dsk.h", MAME_DIR .. "src/lib/formats/vg5k_cas.c", -- cgit v1.2.3-70-g09d2 From 2f7882fbff8a0fa3877fdfe9217d2ec57d875b1f Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Sun, 31 May 2015 10:40:18 +0200 Subject: x1/x1twin: updated to use the new wd fdc. bonus: formatting disks now works in hubasic. --- scripts/src/lib.lua | 2 ++ src/lib/formats/x1_dsk.c | 41 ++++++++++++++++++++++++++++++ src/lib/formats/x1_dsk.h | 33 ++++++++++++++++++++++++ src/mess/drivers/x1.c | 65 +++++++++++++++++++++++++++-------------------- src/mess/drivers/x1twin.c | 34 +++++++++---------------- src/mess/includes/x1.h | 14 ++++++++-- 6 files changed, 137 insertions(+), 52 deletions(-) create mode 100644 src/lib/formats/x1_dsk.c create mode 100644 src/lib/formats/x1_dsk.h (limited to 'scripts/src/lib.lua') 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; 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 m_maincpu; required_device m_cassette; required_device m_cart; - required_device m_fdc; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; required_device m_crtc; required_device m_ctc; -- cgit v1.2.3-70-g09d2 From 511762fa2d25965d05fc277efd29fb4a50d95420 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sun, 31 May 2015 13:20:42 +0200 Subject: Allow compiling with shared libraries [O. Galibert] Put SHLIB=1 in the main makefile, or on the command line. The idea is to get a *way* faster link with symbols. It works at least on linux, with one annoying caveat: you have to be in the build/projects/sdl/mame/gmake-linux directory to start mame afterwards. We're going to move some things around to be able to use LD_LIBRARY_PATH or have it start as-is from the root. --- makefile | 4 ++++ scripts/genie.lua | 21 ++++++++++++++++++ scripts/src/emu.lua | 9 ++++---- scripts/src/lib.lua | 6 ++++-- scripts/src/osd/osdmini.lua | 4 ++-- scripts/src/osd/sdl.lua | 6 ++++-- scripts/src/osd/windows.lua | 4 ++-- scripts/target/ldplayer/ldplayer.lua | 2 +- scripts/target/mame/arcade.lua | 2 +- scripts/target/mame/dummy.lua | 2 +- scripts/target/mame/mess.lua | 2 +- scripts/target/mame/tiny.lua | 2 +- src/emu/cpu/m6809/hd6309.c | 26 +++++++++++----------- src/emu/cpu/m6809/konami.c | 20 ++++++++--------- src/emu/cpu/m6809/m6809.c | 6 +++--- src/emu/cpu/m6809/m6809.h | 38 ++++++++++++++++---------------- src/emu/cpu/mcs96/i8xc196.c | 4 ++++ src/emu/cpu/mcs96/i8xc196.h | 1 - src/emu/cpu/pic16c62x/pic16c62x.c | 9 ++++++++ src/emu/machine/68561mpcc.c | 6 ------ src/emu/video/mc6847.c | 16 +++++++------- src/mess/video/gime.c | 42 ++++++++++++++++++------------------ 22 files changed, 134 insertions(+), 98 deletions(-) (limited to 'scripts/src/lib.lua') diff --git a/makefile b/makefile index 21c518506bd..e9b302c711a 100644 --- a/makefile +++ b/makefile @@ -393,6 +393,10 @@ ifdef OPTIMIZE PARAMS += --OPTIMIZE=$(OPTIMIZE) endif +ifdef SHLIB +PARAMS += --SHLIB=$(SHLIB) +endif + ifdef ARCHOPTS PARAMS += --ARCHOPTS='$(ARCHOPTS)' endif diff --git a/scripts/genie.lua b/scripts/genie.lua index 7b88a7d3ade..b4915406b25 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -311,6 +311,21 @@ newoption { } +newoption { + trigger = "SHLIB", + description = "Generate shared libs.", + allowed = { + { "0", "Static libs" }, + { "1", "Shared libs" }, + } +} + +if _OPTIONS["SHLIB"]=="1" then + LIBTYPE = "SharedLib" +else + LIBTYPE = "StaticLib" +end + PYTHON = "python" if _OPTIONS["PYTHON_EXECUTABLE"]~=nil then @@ -743,6 +758,12 @@ if _OPTIONS["OPTIMIZE"] then end end +if _OPTIONS["SHLIB"] then + buildoptions { + "-fPIC" + } +end + if _OPTIONS["SSE2"]=="1" then buildoptions { "-msse2", diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index 3b020839b14..2eb279377b5 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -2,8 +2,9 @@ -- copyright-holders:MAMEdev Team project ("emu") +targetsubdir(_OPTIONS["target"] .."_" .. _OPTIONS["subtarget"]) uuid ("e6fa15e4-a354-4526-acef-13c8e80fcacf") -kind "StaticLib" +kind (LIBTYPE) options { "ForceCPP", } @@ -358,7 +359,7 @@ function emuProject(_target, _subtarget) project ("optional") uuid (os.uuid("optional-" .. _target .."_" .. _subtarget)) - kind "StaticLib" + kind (LIBTYPE) targetsubdir(_target .."_" .. _subtarget) options { "ForceCPP", @@ -397,7 +398,7 @@ function emuProject(_target, _subtarget) project ("bus") uuid ("5d782c89-cf7e-4cfe-8f9f-0d4bfc16c91d") - kind "StaticLib" + kind (LIBTYPE) targetsubdir(_target .."_" .. _subtarget) options { "ForceCPP", @@ -428,7 +429,7 @@ function emuProject(_target, _subtarget) project ("dasm") uuid ("f2d28b0a-6da5-4f78-b629-d834aa00429d") - kind "StaticLib" + kind (LIBTYPE) targetsubdir(_target .."_" .. _subtarget) options { "ForceCPP", diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index 6eca056a87f..e24ff00f438 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -2,8 +2,9 @@ -- copyright-holders:MAMEdev Team project "utils" + targetsubdir(_OPTIONS["target"] .."_" .. _OPTIONS["subtarget"]) uuid "22489ad0-4cb2-4d91-ad81-24b0d80ca30a" - kind "StaticLib" + kind (LIBTYPE) options { "ForceCPP", @@ -94,8 +95,9 @@ project "utils" project "formats" + targetsubdir(_OPTIONS["target"] .."_" .. _OPTIONS["subtarget"]) uuid "f69636b1-fcce-45ce-b09a-113e371a2d7a" - kind "StaticLib" + kind (LIBTYPE) options { "ForceCPP", diff --git a/scripts/src/osd/osdmini.lua b/scripts/src/osd/osdmini.lua index a1b19f9cb2a..b4afaaa6532 100644 --- a/scripts/src/osd/osdmini.lua +++ b/scripts/src/osd/osdmini.lua @@ -7,7 +7,7 @@ end project ("osd_" .. _OPTIONS["osd"]) uuid (os.uuid("osd_" .. _OPTIONS["osd"])) - kind "StaticLib" + kind (LIBTYPE) removeflags { "SingleOutputDir", @@ -54,7 +54,7 @@ project ("osd_" .. _OPTIONS["osd"]) project ("ocore_" .. _OPTIONS["osd"]) uuid (os.uuid("ocore_" .. _OPTIONS["osd"])) - kind "StaticLib" + kind (LIBTYPE) options { "ForceCPP", diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 2c8e2ed51c5..0fc7d57d3b9 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -293,8 +293,9 @@ end project ("osd_" .. _OPTIONS["osd"]) + targetsubdir(_OPTIONS["target"] .."_" .._OPTIONS["subtarget"]) uuid (os.uuid("osd_" .. _OPTIONS["osd"])) - kind "StaticLib" + kind (LIBTYPE) dofile("sdl_cfg.lua") osdmodulesbuild() @@ -361,8 +362,9 @@ project ("osd_" .. _OPTIONS["osd"]) project ("ocore_" .. _OPTIONS["osd"]) + targetsubdir(_OPTIONS["target"] .."_" .. _OPTIONS["subtarget"]) uuid (os.uuid("ocore_" .. _OPTIONS["osd"])) - kind "StaticLib" + kind (LIBTYPE) options { "ForceCPP", diff --git a/scripts/src/osd/windows.lua b/scripts/src/osd/windows.lua index 33176ff43fc..e9965017933 100644 --- a/scripts/src/osd/windows.lua +++ b/scripts/src/osd/windows.lua @@ -90,7 +90,7 @@ end project ("osd_" .. _OPTIONS["osd"]) uuid (os.uuid("osd_" .. _OPTIONS["osd"])) - kind "StaticLib" + kind (LIBTYPE) dofile("windows_cfg.lua") osdmodulesbuild() @@ -153,7 +153,7 @@ project ("osd_" .. _OPTIONS["osd"]) project ("ocore_" .. _OPTIONS["osd"]) uuid (os.uuid("ocore_" .. _OPTIONS["osd"])) - kind "StaticLib" + kind (LIBTYPE) options { "ForceCPP", diff --git a/scripts/target/ldplayer/ldplayer.lua b/scripts/target/ldplayer/ldplayer.lua index 3660b87cba9..f12fad0c7db 100644 --- a/scripts/target/ldplayer/ldplayer.lua +++ b/scripts/target/ldplayer/ldplayer.lua @@ -54,7 +54,7 @@ BUSES["MIDI"] = true function createProjects_ldplayer_ldplayer(_target, _subtarget) project ("drvldplayer") targetsubdir(_target .."_" .. _subtarget) - kind "StaticLib" + kind (LIBTYPE) uuid (os.uuid("drvldplayer")) options { diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index eff03dac309..8d0346f3942 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -760,7 +760,7 @@ end function createMAMEProjects(_target, _subtarget, _name) project (_name) targetsubdir(_target .."_" .. _subtarget) - kind "StaticLib" + kind (LIBTYPE) uuid (os.uuid("drv-" .. _target .."_" .. _subtarget .. "_" .._name)) options { diff --git a/scripts/target/mame/dummy.lua b/scripts/target/mame/dummy.lua index bd207bf41c8..145862828d5 100644 --- a/scripts/target/mame/dummy.lua +++ b/scripts/target/mame/dummy.lua @@ -15,7 +15,7 @@ dofile("mess.lua") function createProjects_mame_dummy(_target, _subtarget) project ("mame_dummy") targetsubdir(_target .."_" .. _subtarget) - kind "StaticLib" + kind (LIBTYPE) uuid (os.uuid("drv-mame_dummy")) options { diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 84bed8d6c66..8db1d42aa81 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -859,7 +859,7 @@ end function createMESSProjects(_target, _subtarget, _name) project (_name) targetsubdir(_target .."_" .. _subtarget) - kind "StaticLib" + kind (LIBTYPE) uuid (os.uuid("drv-" .. _target .."_" .. _subtarget .. "_" .._name)) options { diff --git a/scripts/target/mame/tiny.lua b/scripts/target/mame/tiny.lua index 350dfd5847c..9dc18d31d9a 100644 --- a/scripts/target/mame/tiny.lua +++ b/scripts/target/mame/tiny.lua @@ -78,7 +78,7 @@ BUSES["CENTRONICS"] = true function createProjects_mame_tiny(_target, _subtarget) project ("mame_tiny") targetsubdir(_target .."_" .. _subtarget) - kind "StaticLib" + kind (LIBTYPE) uuid (os.uuid("drv-mame-tiny")) options { diff --git a/src/emu/cpu/m6809/hd6309.c b/src/emu/cpu/m6809/hd6309.c index 027c9b7511b..5b270d26c90 100644 --- a/src/emu/cpu/m6809/hd6309.c +++ b/src/emu/cpu/m6809/hd6309.c @@ -313,7 +313,7 @@ offs_t hd6309_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *o // read_operand //------------------------------------------------- -ATTR_FORCE_INLINE UINT8 hd6309_device::read_operand() +inline UINT8 hd6309_device::read_operand() { switch(m_addressing_mode) { @@ -332,7 +332,7 @@ ATTR_FORCE_INLINE UINT8 hd6309_device::read_operand() // read_operand //------------------------------------------------- -ATTR_FORCE_INLINE UINT8 hd6309_device::read_operand(int ordinal) +inline UINT8 hd6309_device::read_operand(int ordinal) { switch(m_addressing_mode) { @@ -356,7 +356,7 @@ ATTR_FORCE_INLINE UINT8 hd6309_device::read_operand(int ordinal) // write_operand //------------------------------------------------- -ATTR_FORCE_INLINE void hd6309_device::write_operand(UINT8 data) +inline void hd6309_device::write_operand(UINT8 data) { switch(m_addressing_mode) { @@ -375,7 +375,7 @@ ATTR_FORCE_INLINE void hd6309_device::write_operand(UINT8 data) // write_operand //------------------------------------------------- -ATTR_FORCE_INLINE void hd6309_device::write_operand(int ordinal, UINT8 data) +inline void hd6309_device::write_operand(int ordinal, UINT8 data) { switch(m_addressing_mode) { @@ -398,7 +398,7 @@ ATTR_FORCE_INLINE void hd6309_device::write_operand(int ordinal, UINT8 data) // bittest_register //------------------------------------------------- -ATTR_FORCE_INLINE UINT8 &hd6309_device::bittest_register() +inline UINT8 &hd6309_device::bittest_register() { switch(m_temp_im & 0xC0) { @@ -414,7 +414,7 @@ ATTR_FORCE_INLINE UINT8 &hd6309_device::bittest_register() // bittest_source //------------------------------------------------- -ATTR_FORCE_INLINE bool hd6309_device::bittest_source() +inline bool hd6309_device::bittest_source() { return (m_temp.b.l & (1 << ((m_temp_im >> 3) & 0x07))) ? true : false; } @@ -424,7 +424,7 @@ ATTR_FORCE_INLINE bool hd6309_device::bittest_source() // bittest_dest //------------------------------------------------- -ATTR_FORCE_INLINE bool hd6309_device::bittest_dest() +inline bool hd6309_device::bittest_dest() { return (bittest_register() & (1 << ((m_temp_im >> 0) & 0x07))) ? true : false; } @@ -434,7 +434,7 @@ ATTR_FORCE_INLINE bool hd6309_device::bittest_dest() // bittest_set //------------------------------------------------- -ATTR_FORCE_INLINE void hd6309_device::bittest_set(bool result) +inline void hd6309_device::bittest_set(bool result) { if (result) bittest_register() |= (1 << ((m_temp_im >> 0) & 0x07)); @@ -448,7 +448,7 @@ ATTR_FORCE_INLINE void hd6309_device::bittest_set(bool result) // read_exgtfr_register //------------------------------------------------- -ATTR_FORCE_INLINE m6809_base_device::exgtfr_register hd6309_device::read_exgtfr_register(UINT8 reg) +inline m6809_base_device::exgtfr_register hd6309_device::read_exgtfr_register(UINT8 reg) { UINT16 value = 0; @@ -486,7 +486,7 @@ ATTR_FORCE_INLINE m6809_base_device::exgtfr_register hd6309_device::read_exgtfr_ // write_exgtfr_register //------------------------------------------------- -ATTR_FORCE_INLINE void hd6309_device::write_exgtfr_register(UINT8 reg, m6809_base_device::exgtfr_register value) +inline void hd6309_device::write_exgtfr_register(UINT8 reg, m6809_base_device::exgtfr_register value) { switch(reg & 0x0F) { @@ -517,7 +517,7 @@ ATTR_FORCE_INLINE void hd6309_device::write_exgtfr_register(UINT8 reg, m6809_bas // tfr_read //------------------------------------------------- -ATTR_FORCE_INLINE bool hd6309_device::tfr_read(UINT8 opcode, UINT8 arg, UINT8 &data) +inline bool hd6309_device::tfr_read(UINT8 opcode, UINT8 arg, UINT8 &data) { PAIR16 *reg; @@ -550,7 +550,7 @@ ATTR_FORCE_INLINE bool hd6309_device::tfr_read(UINT8 opcode, UINT8 arg, UINT8 &d // tfr_write //------------------------------------------------- -ATTR_FORCE_INLINE bool hd6309_device::tfr_write(UINT8 opcode, UINT8 arg, UINT8 data) +inline bool hd6309_device::tfr_write(UINT8 opcode, UINT8 arg, UINT8 data) { PAIR16 *reg; @@ -789,7 +789,7 @@ bool hd6309_device::divd() // execute_one - try to execute a single instruction //------------------------------------------------- -ATTR_FORCE_INLINE void hd6309_device::execute_one() +inline void hd6309_device::execute_one() { switch(pop_state()) { diff --git a/src/emu/cpu/m6809/konami.c b/src/emu/cpu/m6809/konami.c index d86f44651d2..8dc2bf3ab78 100644 --- a/src/emu/cpu/m6809/konami.c +++ b/src/emu/cpu/m6809/konami.c @@ -120,7 +120,7 @@ offs_t konami_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT // read_operand //------------------------------------------------- -inline ATTR_FORCE_INLINE UINT8 konami_cpu_device::read_operand() +inline UINT8 konami_cpu_device::read_operand() { return super::read_operand(); } @@ -130,7 +130,7 @@ inline ATTR_FORCE_INLINE UINT8 konami_cpu_device::read_operand() // read_operand //------------------------------------------------- -inline ATTR_FORCE_INLINE UINT8 konami_cpu_device::read_operand(int ordinal) +inline UINT8 konami_cpu_device::read_operand(int ordinal) { switch(m_addressing_mode) { @@ -146,7 +146,7 @@ inline ATTR_FORCE_INLINE UINT8 konami_cpu_device::read_operand(int ordinal) // write_operand //------------------------------------------------- -ATTR_FORCE_INLINE void konami_cpu_device::write_operand(UINT8 data) +inline void konami_cpu_device::write_operand(UINT8 data) { super::write_operand(data); } @@ -157,7 +157,7 @@ ATTR_FORCE_INLINE void konami_cpu_device::write_operand(UINT8 data) // write_operand //------------------------------------------------- -ATTR_FORCE_INLINE void konami_cpu_device::write_operand(int ordinal, UINT8 data) +inline void konami_cpu_device::write_operand(int ordinal, UINT8 data) { switch(m_addressing_mode) { @@ -173,7 +173,7 @@ ATTR_FORCE_INLINE void konami_cpu_device::write_operand(int ordinal, UINT8 data) // ireg //------------------------------------------------- -ATTR_FORCE_INLINE UINT16 &konami_cpu_device::ireg() +inline UINT16 &konami_cpu_device::ireg() { switch(m_opcode & 0x70) { @@ -194,7 +194,7 @@ ATTR_FORCE_INLINE UINT16 &konami_cpu_device::ireg() // read_exgtfr_register //------------------------------------------------- -ATTR_FORCE_INLINE m6809_base_device::exgtfr_register konami_cpu_device::read_exgtfr_register(UINT8 reg) +inline m6809_base_device::exgtfr_register konami_cpu_device::read_exgtfr_register(UINT8 reg) { exgtfr_register result; result.word_value = 0x00FF; @@ -217,7 +217,7 @@ ATTR_FORCE_INLINE m6809_base_device::exgtfr_register konami_cpu_device::read_exg // write_exgtfr_register //------------------------------------------------- -ATTR_FORCE_INLINE void konami_cpu_device::write_exgtfr_register(UINT8 reg, m6809_base_device::exgtfr_register value) +inline void konami_cpu_device::write_exgtfr_register(UINT8 reg, m6809_base_device::exgtfr_register value) { switch(reg & 0x07) { @@ -287,7 +287,7 @@ template T konami_cpu_device::safe_shift_left(T value, UINT32 shift) // lmul //------------------------------------------------- -ATTR_FORCE_INLINE void konami_cpu_device::lmul() +inline void konami_cpu_device::lmul() { PAIR result; @@ -313,7 +313,7 @@ ATTR_FORCE_INLINE void konami_cpu_device::lmul() // divx //------------------------------------------------- -ATTR_FORCE_INLINE void konami_cpu_device::divx() +inline void konami_cpu_device::divx() { UINT16 result; UINT8 remainder; @@ -357,7 +357,7 @@ void konami_cpu_device::set_lines(UINT8 data) // execute_one - try to execute a single instruction //------------------------------------------------- -ATTR_FORCE_INLINE void konami_cpu_device::execute_one() +inline void konami_cpu_device::execute_one() { switch(pop_state()) { diff --git a/src/emu/cpu/m6809/m6809.c b/src/emu/cpu/m6809/m6809.c index 3b7fc33d94f..1b7b0e1e777 100644 --- a/src/emu/cpu/m6809/m6809.c +++ b/src/emu/cpu/m6809/m6809.c @@ -456,7 +456,7 @@ const char *m6809_base_device::inputnum_string(int inputnum) // read_exgtfr_register //------------------------------------------------- -ATTR_FORCE_INLINE m6809_base_device::exgtfr_register m6809_base_device::read_exgtfr_register(UINT8 reg) +m6809_base_device::exgtfr_register m6809_base_device::read_exgtfr_register(UINT8 reg) { exgtfr_register result; result.byte_value = 0xFF; @@ -483,7 +483,7 @@ ATTR_FORCE_INLINE m6809_base_device::exgtfr_register m6809_base_device::read_exg // write_exgtfr_register //------------------------------------------------- -ATTR_FORCE_INLINE void m6809_base_device::write_exgtfr_register(UINT8 reg, m6809_base_device::exgtfr_register value) +void m6809_base_device::write_exgtfr_register(UINT8 reg, m6809_base_device::exgtfr_register value) { switch(reg & 0x0F) { @@ -516,7 +516,7 @@ void m6809_base_device::log_illegal() // execute_one - try to execute a single instruction //------------------------------------------------- -ATTR_FORCE_INLINE void m6809_base_device::execute_one() +void m6809_base_device::execute_one() { switch(pop_state()) { diff --git a/src/emu/cpu/m6809/m6809.h b/src/emu/cpu/m6809/m6809.h index eb0633af44c..7b14a6882e5 100644 --- a/src/emu/cpu/m6809/m6809.h +++ b/src/emu/cpu/m6809/m6809.h @@ -147,27 +147,27 @@ protected: devcb_write_line m_lic_func; // LIC pin on the 6809E // eat cycles - ATTR_FORCE_INLINE void eat(int cycles) { m_icount -= cycles; } + inline void eat(int cycles) { m_icount -= cycles; } void eat_remaining(); // read a byte from given memory location - ATTR_FORCE_INLINE UINT8 read_memory(UINT16 address) { eat(1); return m_addrspace[AS_PROGRAM]->read_byte(address); } + inline UINT8 read_memory(UINT16 address) { eat(1); return m_addrspace[AS_PROGRAM]->read_byte(address); } // write a byte to given memory location - ATTR_FORCE_INLINE void write_memory(UINT16 address, UINT8 data) { eat(1); m_addrspace[AS_PROGRAM]->write_byte(address, data); } + inline void write_memory(UINT16 address, UINT8 data) { eat(1); m_addrspace[AS_PROGRAM]->write_byte(address, data); } // read_opcode() is like read_memory() except it is used for reading opcodes. In the case of a system // with memory mapped I/O, this function can be used to greatly speed up emulation. - ATTR_FORCE_INLINE UINT8 read_opcode(UINT16 address) { eat(1); return m_direct->read_decrypted_byte(address); } + inline UINT8 read_opcode(UINT16 address) { eat(1); return m_direct->read_decrypted_byte(address); } // read_opcode_arg() is identical to read_opcode() except it is used for reading opcode arguments. This // difference can be used to support systems that use different encoding mechanisms for opcodes // and opcode arguments. - ATTR_FORCE_INLINE UINT8 read_opcode_arg(UINT16 address) { eat(1); return m_direct->read_raw_byte(address); } + inline UINT8 read_opcode_arg(UINT16 address) { eat(1); return m_direct->read_raw_byte(address); } // read_opcode() and bump the program counter - ATTR_FORCE_INLINE UINT8 read_opcode() { return read_opcode(m_pc.w++); } - ATTR_FORCE_INLINE UINT8 read_opcode_arg() { return read_opcode_arg(m_pc.w++); } + inline UINT8 read_opcode() { return read_opcode(m_pc.w++); } + inline UINT8 read_opcode_arg() { return read_opcode_arg(m_pc.w++); } // state stack - implemented as a UINT32 void push_state(UINT8 state) { m_state = (m_state << 8) | state; } @@ -219,15 +219,15 @@ protected: template T set_flags(UINT8 mask, T r); // branch conditions - ATTR_FORCE_INLINE bool cond_hi() { return !(m_cc & CC_ZC); } // BHI/BLS - ATTR_FORCE_INLINE bool cond_cc() { return !(m_cc & CC_C); } // BCC/BCS - ATTR_FORCE_INLINE bool cond_ne() { return !(m_cc & CC_Z); } // BNE/BEQ - ATTR_FORCE_INLINE bool cond_vc() { return !(m_cc & CC_V); } // BVC/BVS - ATTR_FORCE_INLINE bool cond_pl() { return !(m_cc & CC_N); } // BPL/BMI - ATTR_FORCE_INLINE bool cond_ge() { return (m_cc & CC_N ? true : false) == (m_cc & CC_V ? true : false); } // BGE/BLT - ATTR_FORCE_INLINE bool cond_gt() { return cond_ge() && !(m_cc & CC_Z); } // BGT/BLE - ATTR_FORCE_INLINE void set_cond(bool cond) { m_cond = cond; } - ATTR_FORCE_INLINE bool branch_taken() { return m_cond; } + inline bool cond_hi() { return !(m_cc & CC_ZC); } // BHI/BLS + inline bool cond_cc() { return !(m_cc & CC_C); } // BCC/BCS + inline bool cond_ne() { return !(m_cc & CC_Z); } // BNE/BEQ + inline bool cond_vc() { return !(m_cc & CC_V); } // BVC/BVS + inline bool cond_pl() { return !(m_cc & CC_N); } // BPL/BMI + inline bool cond_ge() { return (m_cc & CC_N ? true : false) == (m_cc & CC_V ? true : false); } // BGE/BLT + inline bool cond_gt() { return cond_ge() && !(m_cc & CC_Z); } // BGT/BLE + inline void set_cond(bool cond) { m_cond = cond; } + inline bool branch_taken() { return m_cond; } // interrupt registers bool firq_saves_entire_state() { return false; } @@ -235,8 +235,8 @@ protected: UINT16 entire_state_registers() { return 0xFF; } // miscellaneous - exgtfr_register read_exgtfr_register(UINT8 reg); - void write_exgtfr_register(UINT8 reg, exgtfr_register value); + inline exgtfr_register read_exgtfr_register(UINT8 reg); + inline void write_exgtfr_register(UINT8 reg, exgtfr_register value); bool is_register_addressing_mode(); bool is_ea_addressing_mode() { return m_addressing_mode == ADDRESSING_MODE_EA; } UINT16 get_pending_interrupt(); @@ -255,7 +255,7 @@ private: int m_clock_divider; // functions - void execute_one(); + inline void execute_one(); const char *inputnum_string(int inputnum); }; diff --git a/src/emu/cpu/mcs96/i8xc196.c b/src/emu/cpu/mcs96/i8xc196.c index 8e80da19cdb..19553280de2 100644 --- a/src/emu/cpu/mcs96/i8xc196.c +++ b/src/emu/cpu/mcs96/i8xc196.c @@ -69,4 +69,8 @@ UINT16 i8xc196_device::io_r16(UINT8 adr) return data; } +void i8xc196_device::do_exec_partial() +{ +} + #include "cpu/mcs96/i8xc196.inc" diff --git a/src/emu/cpu/mcs96/i8xc196.h b/src/emu/cpu/mcs96/i8xc196.h index cb41e693fe8..299f6c9128d 100644 --- a/src/emu/cpu/mcs96/i8xc196.h +++ b/src/emu/cpu/mcs96/i8xc196.h @@ -23,7 +23,6 @@ public: virtual void do_exec_full(); virtual void do_exec_partial(); - virtual void next(int cycles); virtual void io_w8(UINT8 adr, UINT8 data); virtual void io_w16(UINT8 adr, UINT16 data); virtual UINT8 io_r8(UINT8 adr); diff --git a/src/emu/cpu/pic16c62x/pic16c62x.c b/src/emu/cpu/pic16c62x/pic16c62x.c index 42e92b0addf..1d2dae52b95 100644 --- a/src/emu/cpu/pic16c62x/pic16c62x.c +++ b/src/emu/cpu/pic16c62x/pic16c62x.c @@ -57,6 +57,15 @@ #include "pic16c62x.h" +const device_type PIC16C620 = &device_creator; +const device_type PIC16C620A = &device_creator; +const device_type PIC16C621 = &device_creator; +const device_type PIC16C621A = &device_creator; +const device_type PIC16C622 = &device_creator; +const device_type PIC16C622A = &device_creator; + + + /**************************************************************************** * Internal Memory Map ****************************************************************************/ diff --git a/src/emu/machine/68561mpcc.c b/src/emu/machine/68561mpcc.c index c894f4c96ba..1b8a8895fed 100644 --- a/src/emu/machine/68561mpcc.c +++ b/src/emu/machine/68561mpcc.c @@ -23,8 +23,6 @@ const device_type MPCC68561 = &device_creator; #define LOG_MPCC (1) -#if 0 // future - /*************************************************************************** IMPLEMENTATION ***************************************************************************/ @@ -481,7 +479,3 @@ WRITE8_MEMBER( mpcc68561_t::reg_w ) break; } } - -#else - -#endif diff --git a/src/emu/video/mc6847.c b/src/emu/video/mc6847.c index 44ae168b028..76c0dcb4c92 100644 --- a/src/emu/video/mc6847.c +++ b/src/emu/video/mc6847.c @@ -150,7 +150,7 @@ mc6847_friend_device::mc6847_friend_device(const machine_config &mconfig, device // to the clock //------------------------------------------------- -ATTR_FORCE_INLINE emu_timer *mc6847_friend_device::setup_timer(device_timer_id id, double offset, double period) +inline emu_timer *mc6847_friend_device::setup_timer(device_timer_id id, double offset, double period) { emu_timer *timer = timer_alloc(id); timer->adjust( @@ -228,7 +228,7 @@ void mc6847_friend_device::device_post_load(void) // update_field_sync_timer //------------------------------------------------- -ATTR_FORCE_INLINE void mc6847_friend_device::update_field_sync_timer(void) +void mc6847_friend_device::update_field_sync_timer(void) { // are we expecting field sync? bool expected_field_sync = (m_physical_scanline < m_field_sync_falling_edge_scanline) @@ -268,7 +268,7 @@ void mc6847_friend_device::device_timer(emu_timer &timer, device_timer_id id, in // new_frame //------------------------------------------------- -ATTR_FORCE_INLINE void mc6847_friend_device::new_frame(void) +inline void mc6847_friend_device::new_frame(void) { m_physical_scanline = 0; m_logical_scanline = 0; @@ -304,7 +304,7 @@ const char *mc6847_friend_device::scanline_zone_string(scanline_zone zone) // change_horizontal_sync //------------------------------------------------- -ATTR_FORCE_INLINE void mc6847_friend_device::change_horizontal_sync(bool line) +inline void mc6847_friend_device::change_horizontal_sync(bool line) { g_profiler.start(PROFILER_USER1); @@ -372,7 +372,7 @@ ATTR_FORCE_INLINE void mc6847_friend_device::change_horizontal_sync(bool line) // change_field_sync //------------------------------------------------- -ATTR_FORCE_INLINE void mc6847_friend_device::change_field_sync(bool line) +inline void mc6847_friend_device::change_field_sync(bool line) { /* output field sync */ if (line != m_field_sync) @@ -397,7 +397,7 @@ ATTR_FORCE_INLINE void mc6847_friend_device::change_field_sync(bool line) // next_scanline //------------------------------------------------- -ATTR_FORCE_INLINE void mc6847_friend_device::next_scanline(void) +inline void mc6847_friend_device::next_scanline(void) { /* advance to next scanline */ m_physical_scanline++; @@ -678,7 +678,7 @@ void mc6847_base_device::record_scanline_res(int scanline, INT32 start_pos, INT3 // record_body_scanline //------------------------------------------------- -ATTR_FORCE_INLINE void mc6847_base_device::record_body_scanline(UINT16 physical_scanline, UINT16 scanline, INT32 start_pos, INT32 end_pos) +inline void mc6847_base_device::record_body_scanline(UINT16 physical_scanline, UINT16 scanline, INT32 start_pos, INT32 end_pos) { // sanity checks assert(scanline < 192); @@ -780,7 +780,7 @@ void mc6847_base_device::field_sync_changed(bool line) // border_value //------------------------------------------------- -ATTR_FORCE_INLINE mc6847_base_device::pixel_t mc6847_base_device::border_value(UINT8 mode, const pixel_t *palette, bool is_mc6847t1) +inline mc6847_base_device::pixel_t mc6847_base_device::border_value(UINT8 mode, const pixel_t *palette, bool is_mc6847t1) { pixel_t result; switch(mc6847_friend_device::border_value(mode, is_mc6847t1)) diff --git a/src/mess/video/gime.c b/src/mess/video/gime.c index 93e06b149eb..83b78e92b25 100644 --- a/src/mess/video/gime.c +++ b/src/mess/video/gime.c @@ -201,7 +201,7 @@ void gime_base_device::device_start(void) // get_composite_color //------------------------------------------------- -ATTR_FORCE_INLINE gime_base_device::pixel_t gime_base_device::get_composite_color(int color) +inline gime_base_device::pixel_t gime_base_device::get_composite_color(int color) { /* CMP colors * @@ -313,7 +313,7 @@ ATTR_FORCE_INLINE gime_base_device::pixel_t gime_base_device::get_composite_colo // get_rgb_color //------------------------------------------------- -ATTR_FORCE_INLINE gime_base_device::pixel_t gime_base_device::get_rgb_color(int color) +inline gime_base_device::pixel_t gime_base_device::get_rgb_color(int color) { return (((color >> 4) & 2) | ((color >> 2) & 1)) * 0x550000 | (((color >> 3) & 2) | ((color >> 1) & 1)) * 0x005500 @@ -543,7 +543,7 @@ void gime_base_device::reset_timer(void) // update_memory //------------------------------------------------- -ATTR_FORCE_INLINE void gime_base_device::update_memory(void) +inline void gime_base_device::update_memory(void) { for (int bank = 0; bank <= 8; bank++) { @@ -701,7 +701,7 @@ UINT8 gime_base_device::read(offs_t offset) // read_gime_register //------------------------------------------------- -ATTR_FORCE_INLINE UINT8 gime_base_device::read_gime_register(offs_t offset) +inline UINT8 gime_base_device::read_gime_register(offs_t offset) { offset &= 0x0F; @@ -746,7 +746,7 @@ ATTR_FORCE_INLINE UINT8 gime_base_device::read_gime_register(offs_t offset) // read_mmu_register //------------------------------------------------- -ATTR_FORCE_INLINE UINT8 gime_base_device::read_mmu_register(offs_t offset) +inline UINT8 gime_base_device::read_mmu_register(offs_t offset) { return (m_mmu[offset & 0x0F] & 0x3F) | (read_floating_bus() & 0xC0); } @@ -757,7 +757,7 @@ ATTR_FORCE_INLINE UINT8 gime_base_device::read_mmu_register(offs_t offset) // read_palette_register //------------------------------------------------- -ATTR_FORCE_INLINE UINT8 gime_base_device::read_palette_register(offs_t offset) +inline UINT8 gime_base_device::read_palette_register(offs_t offset) { // Bits 7/6 are floating, and behave oddly. On a real CoCo 3 // @@ -775,7 +775,7 @@ ATTR_FORCE_INLINE UINT8 gime_base_device::read_palette_register(offs_t offset) // read_floating_bus //------------------------------------------------- -ATTR_FORCE_INLINE UINT8 gime_base_device::read_floating_bus(void) +inline UINT8 gime_base_device::read_floating_bus(void) { return m_read_floating_bus(0); } @@ -815,7 +815,7 @@ void gime_base_device::write(offs_t offset, UINT8 data) // write_gime_register //------------------------------------------------- -ATTR_FORCE_INLINE void gime_base_device::write_gime_register(offs_t offset, UINT8 data) +inline void gime_base_device::write_gime_register(offs_t offset, UINT8 data) { // this is needed for writes to FF95 bool timer_was_off = (m_gime_registers[0x04] == 0x00) && (m_gime_registers[0x05] == 0x00); @@ -1018,7 +1018,7 @@ ATTR_FORCE_INLINE void gime_base_device::write_gime_register(offs_t offset, UINT // write_mmu_register //------------------------------------------------- -ATTR_FORCE_INLINE void gime_base_device::write_mmu_register(offs_t offset, UINT8 data) +inline void gime_base_device::write_mmu_register(offs_t offset, UINT8 data) { offset &= 0x0F; @@ -1038,7 +1038,7 @@ ATTR_FORCE_INLINE void gime_base_device::write_mmu_register(offs_t offset, UINT8 // write_palette_register //------------------------------------------------- -ATTR_FORCE_INLINE void gime_base_device::write_palette_register(offs_t offset, UINT8 data) +inline void gime_base_device::write_palette_register(offs_t offset, UINT8 data) { offset &= 0x0F; @@ -1071,7 +1071,7 @@ ATTR_FORCE_INLINE void gime_base_device::write_palette_register(offs_t offset, U // write_sam_register //------------------------------------------------- -ATTR_FORCE_INLINE void gime_base_device::write_sam_register(offs_t offset) +inline void gime_base_device::write_sam_register(offs_t offset) { /* change the SAM state */ UINT16 xorval = alter_sam_state(offset); @@ -1145,7 +1145,7 @@ void gime_base_device::recalculate_firq(void) // John Kowalski confirms this behavior //------------------------------------------------- -ATTR_FORCE_INLINE offs_t gime_base_device::get_video_base(void) +inline offs_t gime_base_device::get_video_base(void) { offs_t result; UINT8 ff9d_mask, ff9e_mask; @@ -1282,7 +1282,7 @@ void gime_base_device::record_border_scanline(UINT16 physical_scanline) // get_lines_per_row //------------------------------------------------- -ATTR_FORCE_INLINE UINT16 gime_base_device::get_lines_per_row(void) +inline UINT16 gime_base_device::get_lines_per_row(void) { UINT16 lines_per_row; if (m_legacy_video) @@ -1361,7 +1361,7 @@ ATTR_FORCE_INLINE UINT16 gime_base_device::get_lines_per_row(void) //------------------------------------------------- template -ATTR_FORCE_INLINE UINT32 gime_base_device::record_scanline_res(int scanline) +inline UINT32 gime_base_device::record_scanline_res(int scanline) { int column; UINT32 base_offset = m_legacy_video ? 0 : (m_gime_registers[0x0F] & 0x7F) * 2; @@ -1639,7 +1639,7 @@ UINT32 gime_base_device::emit_dummy_samples(const scanline_record *scanline, int // emit_mc6847_samples //------------------------------------------------- -ATTR_FORCE_INLINE UINT32 gime_base_device::emit_mc6847_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) +inline UINT32 gime_base_device::emit_mc6847_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) { return super::emit_mc6847_samples<2>( scanline->m_mode[sample_start], @@ -1659,7 +1659,7 @@ ATTR_FORCE_INLINE UINT32 gime_base_device::emit_mc6847_samples(const scanline_re //------------------------------------------------- template -ATTR_FORCE_INLINE UINT32 gime_base_device::emit_gime_graphics_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) +inline UINT32 gime_base_device::emit_gime_graphics_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) { const UINT8 *data = &scanline->m_data[sample_start]; mc6847_friend_device::emit_graphics(data, sample_count, pixels, 0, palette); @@ -1673,7 +1673,7 @@ ATTR_FORCE_INLINE UINT32 gime_base_device::emit_gime_graphics_samples(const scan //------------------------------------------------- template -ATTR_FORCE_INLINE UINT32 gime_base_device::emit_gime_text_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) +inline UINT32 gime_base_device::emit_gime_text_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) { UINT8 attribute = scanline->m_mode[sample_start]; const UINT8 *data = &scanline->m_data[sample_start]; @@ -1733,7 +1733,7 @@ ATTR_FORCE_INLINE UINT32 gime_base_device::emit_gime_text_samples(const scanline //------------------------------------------------- template -ATTR_FORCE_INLINE void gime_base_device::render_scanline(const scanline_record *scanline, pixel_t *pixels, int min_x, int max_x, palette_resolver *resolver) +inline void gime_base_device::render_scanline(const scanline_record *scanline, pixel_t *pixels, int min_x, int max_x, palette_resolver *resolver) { int left_border, right_border; int x, x2, pixel_position; @@ -1934,7 +1934,7 @@ bool gime_base_device::update_rgb(bitmap_rgb32 &bitmap, const rectangle &cliprec // palette_resolver::palette_resolver //------------------------------------------------- -ATTR_FORCE_INLINE gime_base_device::palette_resolver::palette_resolver(gime_base_device *gime, const pixel_t *palette) +inline gime_base_device::palette_resolver::palette_resolver(gime_base_device *gime, const pixel_t *palette) { m_gime = gime; m_palette = palette; @@ -1948,7 +1948,7 @@ ATTR_FORCE_INLINE gime_base_device::palette_resolver::palette_resolver(gime_base // palette_resolver::get_palette //------------------------------------------------- -ATTR_FORCE_INLINE const gime_base_device::pixel_t *gime_base_device::palette_resolver::get_palette(UINT16 palette_rotation) +inline const gime_base_device::pixel_t *gime_base_device::palette_resolver::get_palette(UINT16 palette_rotation) { if (UNEXPECTED(m_current_resolved_palette != palette_rotation)) { @@ -1965,7 +1965,7 @@ ATTR_FORCE_INLINE const gime_base_device::pixel_t *gime_base_device::palette_res // palette_resolver::lookup //------------------------------------------------- -ATTR_FORCE_INLINE gime_base_device::pixel_t gime_base_device::palette_resolver::lookup(UINT8 color) +inline gime_base_device::pixel_t gime_base_device::palette_resolver::lookup(UINT8 color) { assert(color <= 63); return m_palette[color]; -- cgit v1.2.3-70-g09d2 From 75b15886e3d8ea223dd3674f0b5020231923a651 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Sun, 31 May 2015 18:10:58 +0200 Subject: pk8020: updated to use the new wd fdc. fixes regression booting cp/m. --- scripts/src/lib.lua | 2 ++ src/lib/formats/pk8020_dsk.c | 44 +++++++++++++++++++++++++++++++++ src/lib/formats/pk8020_dsk.h | 33 +++++++++++++++++++++++++ src/mess/drivers/pk8020.c | 40 ++++++++++++++---------------- src/mess/includes/pk8020.h | 14 +++++++++-- src/mess/machine/pk8020.c | 59 ++++++++++++++++++-------------------------- 6 files changed, 133 insertions(+), 59 deletions(-) create mode 100644 src/lib/formats/pk8020_dsk.c create mode 100644 src/lib/formats/pk8020_dsk.h (limited to 'scripts/src/lib.lua') diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index e24ff00f438..788aaf18e9d 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -313,6 +313,8 @@ project "formats" MAME_DIR .. "src/lib/formats/pc98fdi_dsk.h", MAME_DIR .. "src/lib/formats/phc25_cas.c", MAME_DIR .. "src/lib/formats/phc25_cas.h", + MAME_DIR .. "src/lib/formats/pk8020_dsk.c", + MAME_DIR .. "src/lib/formats/pk8020_dsk.h", MAME_DIR .. "src/lib/formats/pmd_cas.c", MAME_DIR .. "src/lib/formats/pmd_cas.h", MAME_DIR .. "src/lib/formats/primoptp.c", diff --git a/src/lib/formats/pk8020_dsk.c b/src/lib/formats/pk8020_dsk.c new file mode 100644 index 00000000000..e21fdbdb98e --- /dev/null +++ b/src/lib/formats/pk8020_dsk.c @@ -0,0 +1,44 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + PK-8020 + + Disk image format + + TODO: + - Verify gap sizes + +***************************************************************************/ + +#include "pk8020_dsk.h" + +pk8020_format::pk8020_format() : wd177x_format(formats) +{ +} + +const char *pk8020_format::name() const +{ + return "pk8020"; +} + +const char *pk8020_format::description() const +{ + return "PK-8020 disk image"; +} + +const char *pk8020_format::extensions() const +{ + return "kdi"; +} + +const pk8020_format::format pk8020_format::formats[] = +{ + { + floppy_image::FF_525, floppy_image::DSQD, floppy_image::MFM, + 2000, 5, 80, 2, 1024, {}, 1, {}, 60, 22, 24 + }, + {} +}; + +const floppy_format_type FLOPPY_PK8020_FORMAT = &floppy_image_format_creator; diff --git a/src/lib/formats/pk8020_dsk.h b/src/lib/formats/pk8020_dsk.h new file mode 100644 index 00000000000..1700530c781 --- /dev/null +++ b/src/lib/formats/pk8020_dsk.h @@ -0,0 +1,33 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + PK-8020 + + Disk image format + +***************************************************************************/ + +#pragma once + +#ifndef __PK8020_DSK_H__ +#define __PK8020_DSK_H__ + +#include "wd177x_dsk.h" + +class pk8020_format : public wd177x_format +{ +public: + pk8020_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_PK8020_FORMAT; + +#endif // __PK8020_DSK_H__ diff --git a/src/mess/drivers/pk8020.c b/src/mess/drivers/pk8020.c index e238baf7b3c..49d8faec173 100644 --- a/src/mess/drivers/pk8020.c +++ b/src/mess/drivers/pk8020.c @@ -14,7 +14,7 @@ #include "cpu/i8085/i8085.h" #include "machine/i8255.h" #include "imagedev/flopdrv.h" -#include "formats/basicdsk.h" +#include "formats/pk8020_dsk.h" #include "includes/pk8020.h" #include "machine/ram.h" @@ -141,21 +141,6 @@ static INPUT_PORTS_START( pk8020 ) PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) INPUT_PORTS_END -static LEGACY_FLOPPY_OPTIONS_START(pk8020) - LEGACY_FLOPPY_OPTION(pk8020, "kdi", "PK8020 disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, - HEADS([2]) - TRACKS([80]) - SECTORS([5]) - SECTOR_LENGTH([1024]) - FIRST_SECTOR_ID([1])) -LEGACY_FLOPPY_OPTIONS_END - -static const floppy_interface pk8020_floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(pk8020), - "floppy_5_25" -}; /* F4 Character Displayer */ static const gfx_layout pk8020_charlayout = @@ -176,6 +161,15 @@ static GFXDECODE_START( pk8020 ) GFXDECODE_END +FLOPPY_FORMATS_MEMBER( pk8020_state::floppy_formats ) + FLOPPY_PK8020_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( pk8020_floppies ) + SLOT_INTERFACE("qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + + /* Machine driver */ static MACHINE_CONFIG_START( pk8020, pk8020_state ) /* basic machine hardware */ @@ -221,9 +215,14 @@ static MACHINE_CONFIG_START( pk8020, pk8020_state ) MCFG_DEVICE_ADD("rs232", I8251, 0) MCFG_DEVICE_ADD("lan", I8251, 0) - MCFG_DEVICE_ADD("wd1793", FD1793, 0) - MCFG_WD17XX_DEFAULT_DRIVE4_TAGS - MCFG_WD17XX_DDEN_CALLBACK(VCC) + MCFG_FD1793x_ADD("wd1793", XTAL_20MHz / 20) + + MCFG_FLOPPY_DRIVE_ADD("wd1793:0", pk8020_floppies, "qd", pk8020_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1793:1", pk8020_floppies, "qd", pk8020_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1793:2", pk8020_floppies, "qd", pk8020_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1793:3", pk8020_floppies, "qd", pk8020_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list", "korvet_flop") /* audio hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -235,9 +234,6 @@ static MACHINE_CONFIG_START( pk8020, pk8020_state ) MCFG_CASSETTE_ADD( "cassette" ) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(pk8020_floppy_interface) - MCFG_SOFTWARE_LIST_ADD("flop_list","korvet_flop") - /* internal ram */ MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("258K") //64 + 4*48 + 2 diff --git a/src/mess/includes/pk8020.h b/src/mess/includes/pk8020.h index 63994d4a536..e73fa870187 100644 --- a/src/mess/includes/pk8020.h +++ b/src/mess/includes/pk8020.h @@ -13,7 +13,7 @@ #include "machine/pit8253.h" #include "machine/pic8259.h" #include "machine/i8251.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" #include "imagedev/cassette.h" #include "sound/speaker.h" #include "sound/wave.h" @@ -33,6 +33,10 @@ public: m_lan(*this, "lan"), m_ram(*this, RAM_TAG), m_wd1793(*this, "wd1793"), + m_floppy0(*this, "wd1793:0"), + m_floppy1(*this, "wd1793:1"), + m_floppy2(*this, "wd1793:2"), + m_floppy3(*this, "wd1793:3"), m_pit8253(*this, "pit8253"), m_pic8259(*this, "pic8259"), m_speaker(*this, "speaker"), @@ -40,6 +44,8 @@ public: m_region_gfx1(*this, "gfx1"), m_palette(*this, "palette") { } + DECLARE_FLOPPY_FORMATS(floppy_formats); + UINT8 m_color; UINT8 m_video_page; UINT8 m_wide; @@ -84,7 +90,11 @@ protected: required_device m_rs232; required_device m_lan; required_device m_ram; - required_device m_wd1793; + required_device m_wd1793; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; required_device m_pit8253; required_device m_pic8259; required_device m_speaker; diff --git a/src/mess/machine/pk8020.c b/src/mess/machine/pk8020.c index 21816e14f7f..d20ab196748 100644 --- a/src/mess/machine/pk8020.c +++ b/src/mess/machine/pk8020.c @@ -157,13 +157,7 @@ READ8_MEMBER(pk8020_state::devices_r) case 1 : return m_rs232->status_r(space,0); } break; - case 0x18: switch(offset & 3) { - case 0 : return m_wd1793->status_r(space, 0); - case 1 : return m_wd1793->track_r(space, 0); - case 2 : return m_wd1793->sector_r(space, 0); - case 3 : return m_wd1793->data_r(space, 0); - } - break; + case 0x18: return m_wd1793->read(space, offset & 0x03); case 0x20: switch(offset & 1) { case 0 : return m_lan->data_r(space,0); case 1 : return m_lan->status_r(space,0); @@ -187,13 +181,9 @@ WRITE8_MEMBER(pk8020_state::devices_w) case 1 : m_rs232->control_w(space,0,data); break; } break; - case 0x18: switch(offset & 3) { - case 0 : m_wd1793->command_w(space, 0,data);break; - case 1 : m_wd1793->track_w(space, 0,data);break; - case 2 : m_wd1793->sector_w(space, 0,data);break; - case 3 : m_wd1793->data_w(space, 0,data);break; - } - break; + case 0x18: + m_wd1793->write(space, offset & 0x03, data); + break; case 0x20: switch(offset & 1) { case 0 : m_lan->data_w(space,0,data); break; case 1 : m_lan->control_w(space,0,data); break; @@ -841,29 +831,28 @@ WRITE8_MEMBER(pk8020_state::pk8020_portc_w) WRITE8_MEMBER(pk8020_state::pk8020_portb_w) { + floppy_image_device *floppy = NULL; + // Turn all motors off - floppy_get_device(machine(), 0)->floppy_mon_w(1); - floppy_get_device(machine(), 1)->floppy_mon_w(1); - floppy_get_device(machine(), 2)->floppy_mon_w(1); - floppy_get_device(machine(), 3)->floppy_mon_w(1); - m_wd1793->set_side(BIT(data,4)); - if (BIT(data,0)) { - m_wd1793->set_drive(0); - floppy_get_device(machine(), 0)->floppy_mon_w(0); - floppy_get_device(machine(), 0)->floppy_drive_set_ready_state(1, 1); - } else if (BIT(data,1)) { - m_wd1793->set_drive(1); - floppy_get_device(machine(), 1)->floppy_mon_w(0); - floppy_get_device(machine(), 1)->floppy_drive_set_ready_state(1, 1); - } else if (BIT(data,2)) { - m_wd1793->set_drive(2); - floppy_get_device(machine(), 2)->floppy_mon_w(0); - floppy_get_device(machine(), 2)->floppy_drive_set_ready_state(1, 1); - } else if (BIT(data,3)) { - m_wd1793->set_drive(3); - floppy_get_device(machine(), 3)->floppy_mon_w(0); - floppy_get_device(machine(), 3)->floppy_drive_set_ready_state(1, 1); + if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(1); + if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(1); + if (m_floppy2->get_device()) m_floppy2->get_device()->mon_w(1); + if (m_floppy3->get_device()) m_floppy3->get_device()->mon_w(1); + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 2)) floppy = m_floppy2->get_device(); + if (BIT(data, 3)) floppy = m_floppy3->get_device(); + + m_wd1793->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(BIT(data, 4)); } + + // todo: at least bit 5 and bit 7 is connected to something too... } READ8_MEMBER(pk8020_state::pk8020_portc_r) -- cgit v1.2.3-70-g09d2 From 476d027582fd1fe1ce535e662161bed8f207ec65 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Mon, 1 Jun 2015 10:14:02 +0200 Subject: 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/2d_dsk.h | 33 +++++++++++++++ src/lib/formats/x1_dsk.c | 41 ------------------- src/lib/formats/x1_dsk.h | 33 --------------- src/mess/drivers/mz2000.c | 102 +++++++++++++++++++++++++++------------------- src/mess/drivers/x1.c | 4 +- src/mess/drivers/x1twin.c | 1 - 9 files changed, 152 insertions(+), 137 deletions(-) create mode 100644 src/lib/formats/2d_dsk.c create mode 100644 src/lib/formats/2d_dsk.h delete mode 100644 src/lib/formats/x1_dsk.c delete mode 100644 src/lib/formats/x1_dsk.h (limited to 'scripts/src/lib.lua') 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/2d_dsk.h b/src/lib/formats/2d_dsk.h new file mode 100644 index 00000000000..ab70b95f21a --- /dev/null +++ b/src/lib/formats/2d_dsk.h @@ -0,0 +1,33 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Sharp 2D + + Disk image format + +***************************************************************************/ + +#pragma once + +#ifndef __2D_DSK_H__ +#define __2D_DSK_H__ + +#include "wd177x_dsk.h" + +class _2d_format : public wd177x_format +{ +public: + _2d_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_2D_FORMAT; + +#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/lib/formats/x1_dsk.h b/src/lib/formats/x1_dsk.h deleted file mode 100644 index 0774c6bf27e..00000000000 --- a/src/lib/formats/x1_dsk.h +++ /dev/null @@ -1,33 +0,0 @@ -// 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/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" -- cgit v1.2.3-70-g09d2 From ada45f655ed1a726ca0c1f723a997112162f8d02 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Tue, 2 Jun 2015 13:36:22 +0200 Subject: hec2mdhrx: updated to use the new wd fdc. --- scripts/src/lib.lua | 2 + src/lib/formats/hect_dsk.c | 32 --------------- src/lib/formats/hector_minidisc.c | 41 ++++++++++++++++++++ src/lib/formats/hector_minidisc.h | 33 ++++++++++++++++ src/mess/drivers/hec2hrp.c | 24 ++++++------ src/mess/includes/hec2hrp.h | 20 ++++++---- src/mess/machine/hec2hrp.c | 82 ++++++--------------------------------- 7 files changed, 113 insertions(+), 121 deletions(-) create mode 100644 src/lib/formats/hector_minidisc.c create mode 100644 src/lib/formats/hector_minidisc.h (limited to 'scripts/src/lib.lua') diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index dcf4c44268e..611ed2ae9d9 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -257,6 +257,8 @@ project "formats" MAME_DIR .. "src/lib/formats/hect_dsk.h", MAME_DIR .. "src/lib/formats/hect_tap.c", MAME_DIR .. "src/lib/formats/hect_tap.h", + MAME_DIR .. "src/lib/formats/hector_minidisc.c", + MAME_DIR .. "src/lib/formats/hector_minidisc.h", MAME_DIR .. "src/lib/formats/iq151_dsk.c", MAME_DIR .. "src/lib/formats/iq151_dsk.h", MAME_DIR .. "src/lib/formats/imd_dsk.c", diff --git a/src/lib/formats/hect_dsk.c b/src/lib/formats/hect_dsk.c index 4e8794131f8..8dfe445e6e4 100644 --- a/src/lib/formats/hect_dsk.c +++ b/src/lib/formats/hect_dsk.c @@ -93,38 +93,6 @@ static FLOPPY_CONSTRUCT(hector_disc2_dsk800_construct) return basicdsk_construct(floppy, &geometry); } -/* For the 720Ko disk 3 1/2 inch disk for the mini disc unit !!: - 512 bytes per sectors, - 9 sector per track, - From sector =1 to sector 9, - 80 tracks, - 2 Head - This format can be extract from a real disc with anadisk (*.IMG format rename in *.HE7). -*/ - -static FLOPPY_IDENTIFY(hector_minidisc_dsk_identify) -{ - *vote = (floppy_image_size(floppy) == (2*70*9*512)) ? 100 : 0; - return FLOPPY_ERROR_SUCCESS; -} - -static FLOPPY_CONSTRUCT(hector_minidisc_dsk_construct) -{ - struct basicdsk_geometry geometry; - memset(&geometry, 0, sizeof(geometry)); // 635904 octets - geometry.heads = 2;//2 - geometry.first_sector_id = 1; - geometry.sector_length = 512; - geometry.tracks = 70;//69 - geometry.sectors = 9; - return basicdsk_construct(floppy, &geometry); -} - -/* Specific for the mini disc unit */ -LEGACY_FLOPPY_OPTIONS_START( hector_minidisc ) - LEGACY_FLOPPY_OPTION( hector_dsk, "HMD", "hector mini disc floppy disk image 360Ko", hector_minidisc_dsk_identify, hector_minidisc_dsk_construct, NULL, NULL) -LEGACY_FLOPPY_OPTIONS_END - LEGACY_FLOPPY_OPTIONS_START( hector_disc2 ) LEGACY_FLOPPY_OPTION( hector_dsk, "HE2", "hector disc2 floppy disk image 200K", hector_disc2_dsk200_identify, hector_disc2_dsk200_construct, NULL, NULL) LEGACY_FLOPPY_OPTION( hector_dsk, "HE7", "hector disc2 floppy disk image 720K", hector_disc2_dsk720_identify, hector_disc2_dsk720_construct, NULL, NULL) diff --git a/src/lib/formats/hector_minidisc.c b/src/lib/formats/hector_minidisc.c new file mode 100644 index 00000000000..fe4a7ee44b1 --- /dev/null +++ b/src/lib/formats/hector_minidisc.c @@ -0,0 +1,41 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Hector Minidisc + + Disk image format + +***************************************************************************/ + +#include "hector_minidisc.h" + +hmd_format::hmd_format() : upd765_format(formats) +{ +} + +const char *hmd_format::name() const +{ + return "hector_minidisc"; +} + +const char *hmd_format::description() const +{ + return "Hector Minidisc disk image"; +} + +const char *hmd_format::extensions() const +{ + return "hmd"; +} + +const hmd_format::format hmd_format::formats[] = +{ + { + floppy_image::FF_35, floppy_image::DSDD, floppy_image::MFM, + 2000, 9, 70, 2, 512, {}, 1, {}, 80, 50, 22, 54 + }, + {} +}; + +const floppy_format_type FLOPPY_HMD_FORMAT = &floppy_image_format_creator; diff --git a/src/lib/formats/hector_minidisc.h b/src/lib/formats/hector_minidisc.h new file mode 100644 index 00000000000..d850573f2b6 --- /dev/null +++ b/src/lib/formats/hector_minidisc.h @@ -0,0 +1,33 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Hector Minidisc + + Disk image format + +***************************************************************************/ + +#pragma once + +#ifndef __HMD_DSK_H__ +#define __HMD_DSK_H__ + +#include "upd765_dsk.h" + +class hmd_format : public upd765_format +{ +public: + hmd_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_HMD_FORMAT; + +#endif // __HMD_DSK_H__ diff --git a/src/mess/drivers/hec2hrp.c b/src/mess/drivers/hec2hrp.c index 0dc0547ad13..e1381d33a63 100644 --- a/src/mess/drivers/hec2hrp.c +++ b/src/mess/drivers/hec2hrp.c @@ -81,6 +81,7 @@ #include "machine/upd765.h" /* for floppy disc controller */ #include "cpu/z80/z80.h" #include "formats/hect_dsk.h" +#include "formats/hector_minidisc.h" #include "includes/hec2hrp.h" /*****************************************************************************/ @@ -176,7 +177,8 @@ static ADDRESS_MAP_START( hec2mdhrx_io , AS_IO, 8, hec2hrp_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) // Minidisc commands and changing the rom page !*/ - AM_RANGE(0x000,0x0EF) AM_READWRITE(hector_179x_register_r,hector_179x_register_w)/* 179x registers*/ + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("wd179x", fd1793_t, read, write) + AM_RANGE(0x08, 0x08) AM_WRITE(minidisc_control_w) AM_RANGE(0x0f0,0x0ff) AM_READWRITE(hector_io_8255_r, hector_io_8255_w ) ADDRESS_MAP_END @@ -356,7 +358,6 @@ MACHINE_START_MEMBER(hec2hrp_state,hec2mdhrx) m_hector_videoram.set_target(m_hector_videoram_hrx,m_hector_videoram.bytes()); hector_init(); - hector_minidisc_init(); } MACHINE_RESET_MEMBER(hec2hrp_state,hec2hrx) { @@ -385,12 +386,14 @@ MACHINE_RESET_MEMBER(hec2hrp_state,hec2mdhrx) /********* mini disque interface ***************************/ /***********************************************************/ -const floppy_interface minidisc_floppy_interface = -{ - FLOPPY_STANDARD_3_5_DSDD, - LEGACY_FLOPPY_OPTIONS_NAME(hector_minidisc), - NULL -}; +FLOPPY_FORMATS_MEMBER( hec2hrp_state::minidisc_formats ) + FLOPPY_HMD_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( minidisc_floppies ) + SLOT_INTERFACE("dd", FLOPPY_35_DD) +SLOT_INTERFACE_END + /******************************************************************************/ static MACHINE_CONFIG_START( hec2hr, hec2hrp_state ) @@ -567,10 +570,9 @@ static MACHINE_CONFIG_START( hec2mdhrx, hec2hrp_state ) MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2mdhrx) /* Mini Disc */ - MCFG_DEVICE_ADD("wd179x", FD1793, 0) - MCFG_WD17XX_DEFAULT_DRIVE1_TAGS + MCFG_FD1793x_ADD("wd179x", XTAL_1MHz) - MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, minidisc_floppy_interface) + MCFG_FLOPPY_DRIVE_ADD("wd179x:0", minidisc_floppies, "dd", hec2hrp_state::minidisc_formats) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mess/includes/hec2hrp.h b/src/mess/includes/hec2hrp.h index 36b3d93530e..c30b7bfccd3 100644 --- a/src/mess/includes/hec2hrp.h +++ b/src/mess/includes/hec2hrp.h @@ -40,7 +40,7 @@ */ #include "machine/upd765.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" #include "imagedev/flopdrv.h" #include "imagedev/cassette.h" #include "sound/sn76477.h" /* for sn sound*/ @@ -83,7 +83,12 @@ public: m_palette(*this, "palette"), m_videoram(*this,"videoram"), m_hector_videoram(*this,"hector_videoram") , - m_keyboard(*this, "KEY") { } + m_keyboard(*this, "KEY"), + m_minidisc_fdc(*this, "wd179x"), + m_floppy0(*this, "wd179x:0") + {} + + DECLARE_FLOPPY_FORMATS(minidisc_formats); required_device m_maincpu; optional_device m_disc2cpu; @@ -94,6 +99,9 @@ public: optional_shared_ptr m_hector_videoram; required_ioport_array<9> m_keyboard; + optional_device m_minidisc_fdc; + optional_device m_floppy0; + UINT8 m_hector_flag_hr; UINT8 m_hector_flag_80c; UINT8 m_hector_color[4]; @@ -131,8 +139,9 @@ public: int m_hector_flag_result; int m_print; UINT8 m_hector_videoram_hrx[0x04000]; - DECLARE_READ8_MEMBER(hector_179x_register_r); - DECLARE_WRITE8_MEMBER(hector_179x_register_w); + + DECLARE_WRITE8_MEMBER(minidisc_control_w); + DECLARE_WRITE8_MEMBER(hector_switch_bank_w); DECLARE_WRITE8_MEMBER(hector_keyboard_w); DECLARE_READ8_MEMBER(hector_keyboard_r); @@ -162,7 +171,6 @@ public: int isHectorWithMiniDisc(); int isHectorHR(); int isHectoreXtend(); - void hector_minidisc_init(); void Mise_A_Jour_Etat(int Adresse, int Value ); void Init_Value_SN76477_Hector(); void Update_Sound(address_space &space, UINT8 data); @@ -188,6 +196,4 @@ public: void hector_disc2_reset(); }; -extern const floppy_interface minidisc_floppy_interface; - MACHINE_CONFIG_EXTERN( hector_audio ); diff --git a/src/mess/machine/hec2hrp.c b/src/mess/machine/hec2hrp.c index a6ebb75c64c..55db5bdfe5f 100644 --- a/src/mess/machine/hec2hrp.c +++ b/src/mess/machine/hec2hrp.c @@ -102,85 +102,25 @@ TIMER_CALLBACK_MEMBER(hec2hrp_state::Callback_CK) m_CK_signal++; } -void hec2hrp_state::hector_minidisc_init() +WRITE8_MEMBER( hec2hrp_state::minidisc_control_w ) { - fd1793_device *fdc = machine().device("wd179x"); - //set density - fdc->dden_w(1);// density select => always 1 (0 ?a plante !) + floppy_image_device *floppy = NULL; - /* FDC Motor Control - Bit 0/1 defines the state of the FDD 0/1 motor */ - floppy_get_device(machine(), 0)->floppy_mon_w( 0); // Moteur floppy A: - //floppy_get_device(machine(), 1)->floppy_mon_w(BIT(data, 7)); // Moteur floppy B:, not implanted on the real machine + if (BIT(data, 6)) floppy = m_floppy0->get_device(); + // bit 7 = drive 2? - //Set the drive ready ! - floppy_get_device(machine(), 0)->floppy_drive_set_ready_state(FLOPPY_DRIVE_READY, 0);// Disc 0 ready ! + m_minidisc_fdc->set_floppy(floppy); -} - -READ8_MEMBER(hec2hrp_state::hector_179x_register_r) -{ -int data=0; -fd1793_device *fdc = machine().device("wd179x"); - - switch (offset & 0x0ff) + if (floppy) { - /* minidisc floppy disc interface */ - case 0x04: - data = fdc->status_r(space, 0); - break; - case 0x05: - data = fdc->track_r(space, 0); - break; - case 0x06: - data = fdc->sector_r(space, 0); - break; - case 0x07: - data = fdc->data_r(space, 0); - break; - default: - break; + // don't know where the motor on signal is + floppy->mon_w(0); + floppy->ss_w(BIT(data, 4)); } - return data; + membank("bank2")->set_entry(BIT(data, 5) ? HECTOR_BANK_BASE : HECTOR_BANK_DISC); } -WRITE8_MEMBER(hec2hrp_state::hector_179x_register_w) -{ -fd1793_device *fdc = machine().device("wd179x"); -switch (offset) - { - /* minidisc floppy disc interface */ - case 0x04: - fdc->command_w(space, 0, data); - break; - case 0x05: - fdc->track_w(space, 0, data); - break; - case 0x06: - fdc->sector_w(space, 0, data); - break; - case 0x07: - /*write into command register*/ - fdc->data_w(space, 0, data); - break; - case 0x08: - /*General purpose port (0x08) for the minidisk I/O */ - { - // Rom page bank switching - membank("bank2")->set_entry(BIT(data, 5) ? HECTOR_BANK_BASE : HECTOR_BANK_DISC ); - - // Set drive number - if (BIT(data, 6)) fdc->set_drive(0); // Set the correct drive number 0 - //if (BIT(data, 7)) fdc->set_drive(1);// Set the correct drive number 1,never here - // Set side - fdc->set_side(BIT(data, 4) ? 1 : 0);// side select - } - break; - - default: - break; - } -} WRITE8_MEMBER(hec2hrp_state::hector_switch_bank_w) { if (offset==0x00) { /* 0x800 et 0x000=> video page, HR*/ @@ -255,7 +195,7 @@ READ8_MEMBER(hec2hrp_state::hector_keyboard_r) /* floppy md master reset */ if (isHectorWithMiniDisc()) - machine().device("wd179x")->mr_w(1); + m_minidisc_fdc->reset(); } else /* aviable for BR machines */ -- cgit v1.2.3-70-g09d2 From 0ebc3e5033b3aa0284148ab5daf4d6ba41fad911 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Tue, 2 Jun 2015 17:15:15 +0200 Subject: vector06: updated to use the new wd fdc. system appears to be broken but loads some sectors from disk. --- scripts/src/lib.lua | 2 ++ src/lib/formats/vector06_dsk.c | 44 ++++++++++++++++++++++++++++++++++++++++++ src/lib/formats/vector06_dsk.h | 33 +++++++++++++++++++++++++++++++ src/mess/drivers/vector06.c | 40 ++++++++++++++++---------------------- src/mess/includes/vector06.h | 11 ++++++++--- src/mess/machine/vector06.c | 18 ++++++++++++++--- 6 files changed, 119 insertions(+), 29 deletions(-) create mode 100644 src/lib/formats/vector06_dsk.c create mode 100644 src/lib/formats/vector06_dsk.h (limited to 'scripts/src/lib.lua') diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index 611ed2ae9d9..5fc9603849e 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -383,6 +383,8 @@ project "formats" MAME_DIR .. "src/lib/formats/upd765_dsk.h", MAME_DIR .. "src/lib/formats/vdk_dsk.c", MAME_DIR .. "src/lib/formats/vdk_dsk.h", + MAME_DIR .. "src/lib/formats/vector06_dsk.c", + MAME_DIR .. "src/lib/formats/vector06_dsk.h", MAME_DIR .. "src/lib/formats/victor9k_dsk.c", MAME_DIR .. "src/lib/formats/victor9k_dsk.h", MAME_DIR .. "src/lib/formats/vg5k_cas.c", diff --git a/src/lib/formats/vector06_dsk.c b/src/lib/formats/vector06_dsk.c new file mode 100644 index 00000000000..b423f4b7154 --- /dev/null +++ b/src/lib/formats/vector06_dsk.c @@ -0,0 +1,44 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Vector 06 + + Disk image format + + TODO: + - Gap sizes + +***************************************************************************/ + +#include "vector06_dsk.h" + +vector06_format::vector06_format() : wd177x_format(formats) +{ +} + +const char *vector06_format::name() const +{ + return "vector06"; +} + +const char *vector06_format::description() const +{ + return "Vector 06 disk image"; +} + +const char *vector06_format::extensions() const +{ + return "fdd"; +} + +const vector06_format::format vector06_format::formats[] = +{ + { + floppy_image::FF_525, floppy_image::DSQD, floppy_image::MFM, + 2000, 5, 82, 2, 1024, {}, 1, {}, 80, 22, 24 + }, + {} +}; + +const floppy_format_type FLOPPY_VECTOR06_FORMAT = &floppy_image_format_creator; diff --git a/src/lib/formats/vector06_dsk.h b/src/lib/formats/vector06_dsk.h new file mode 100644 index 00000000000..cad2fa3ddf3 --- /dev/null +++ b/src/lib/formats/vector06_dsk.h @@ -0,0 +1,33 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Vector 06 + + Disk image format + +***************************************************************************/ + +#pragma once + +#ifndef __VECTOR06_DSK_H__ +#define __VECTOR06_DSK_H__ + +#include "wd177x_dsk.h" + +class vector06_format : public wd177x_format +{ +public: + vector06_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_VECTOR06_FORMAT; + +#endif // __VECTOR06_DSK_H__ diff --git a/src/mess/drivers/vector06.c b/src/mess/drivers/vector06.c index 208a5feb15c..444692617a5 100644 --- a/src/mess/drivers/vector06.c +++ b/src/mess/drivers/vector06.c @@ -9,6 +9,7 @@ ****************************************************************************/ #include "includes/vector06.h" +#include "formats/vector06_dsk.h" /* Address maps */ @@ -23,10 +24,10 @@ static ADDRESS_MAP_START(vector06_io, AS_IO, 8, vector06_state) AM_RANGE( 0x00, 0x03) AM_READWRITE(vector06_8255_1_r, vector06_8255_1_w ) AM_RANGE( 0x04, 0x07) AM_READWRITE(vector06_8255_2_r, vector06_8255_2_w ) AM_RANGE( 0x0C, 0x0C) AM_WRITE(vector06_color_set) - AM_RANGE( 0x18, 0x18) AM_DEVREADWRITE("wd1793", fd1793_device, data_r, data_w) - AM_RANGE( 0x19, 0x19) AM_DEVREADWRITE("wd1793", fd1793_device, sector_r, sector_w) - AM_RANGE( 0x1A, 0x1A) AM_DEVREADWRITE("wd1793", fd1793_device, track_r, track_w) - AM_RANGE( 0x1B, 0x1B) AM_DEVREADWRITE("wd1793", fd1793_device, status_r, command_w) + AM_RANGE( 0x18, 0x18) AM_DEVREADWRITE("wd1793", fd1793_t, data_r, data_w) + AM_RANGE( 0x19, 0x19) AM_DEVREADWRITE("wd1793", fd1793_t, sector_r, sector_w) + AM_RANGE( 0x1a, 0x1a) AM_DEVREADWRITE("wd1793", fd1793_t, track_r, track_w) + AM_RANGE( 0x1b, 0x1b) AM_DEVREADWRITE("wd1793", fd1793_t, status_r, cmd_w) AM_RANGE( 0x1C, 0x1C) AM_WRITE(vector06_disc_w) ADDRESS_MAP_END @@ -119,21 +120,15 @@ static INPUT_PORTS_START( vector06 ) INPUT_PORTS_END -static LEGACY_FLOPPY_OPTIONS_START(vector) - LEGACY_FLOPPY_OPTION(vector, "fdd", "Vector disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, - HEADS([2]) - TRACKS([82]) - SECTORS([5]) - SECTOR_LENGTH([1024]) - FIRST_SECTOR_ID([1])) -LEGACY_FLOPPY_OPTIONS_END - -static const floppy_interface vector_floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(vector), - NULL -}; + +FLOPPY_FORMATS_MEMBER( vector06_state::floppy_formats ) + FLOPPY_VECTOR06_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( vector06_floppies ) + SLOT_INTERFACE("qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + /* Machine driver */ static MACHINE_CONFIG_START( vector06, vector06_state ) @@ -176,11 +171,10 @@ static MACHINE_CONFIG_START( vector06, vector06_state ) MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_DEVICE_ADD("wd1793", FD1793, 0) - MCFG_WD17XX_DEFAULT_DRIVE2_TAGS - MCFG_WD17XX_DDEN_CALLBACK(VCC) + MCFG_FD1793x_ADD("wd1793", XTAL_1MHz) - MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(vector_floppy_interface) + MCFG_FLOPPY_DRIVE_ADD("wd1793:0", vector06_floppies, "qd", vector06_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1793:1", vector06_floppies, "qd", vector06_state::floppy_formats) /* cartridge */ MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vector06_cart") diff --git a/src/mess/includes/vector06.h b/src/mess/includes/vector06.h index a35e1467509..970965465ef 100644 --- a/src/mess/includes/vector06.h +++ b/src/mess/includes/vector06.h @@ -15,10 +15,9 @@ #include "sound/wave.h" #include "machine/i8255.h" #include "machine/ram.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" #include "imagedev/cassette.h" #include "imagedev/flopdrv.h" -#include "formats/basicdsk.h" #include "bus/generic/slot.h" #include "bus/generic/carts.h" @@ -32,16 +31,22 @@ public: m_cassette(*this, "cassette"), m_cart(*this, "cartslot"), m_fdc(*this, "wd1793"), + m_floppy0(*this, "wd1793:0"), + m_floppy1(*this, "wd1793:1"), m_ppi(*this, "ppi8255"), m_ppi2(*this, "ppi8255_2"), m_ram(*this, RAM_TAG), m_palette(*this, "palette") { } + DECLARE_FLOPPY_FORMATS(floppy_formats); + required_device m_maincpu; required_device m_cassette; required_device m_cart; - required_device m_fdc; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; required_device m_ppi; required_device m_ppi2; required_device m_ram; diff --git a/src/mess/machine/vector06.c b/src/mess/machine/vector06.c index e0c436a6239..b6f4e353fed 100644 --- a/src/mess/machine/vector06.c +++ b/src/mess/machine/vector06.c @@ -138,10 +138,22 @@ TIMER_CALLBACK_MEMBER(vector06_state::reset_check_callback) WRITE8_MEMBER( vector06_state::vector06_disc_w ) { -// something here needs to turn the motor on + floppy_image_device *floppy = NULL; - m_fdc->set_side (BIT(data, 2) ^ 1); - m_fdc->set_drive(BIT(data, 0)); + switch (data & 0x01) + { + case 0: floppy = m_floppy0->get_device(); break; + case 1: floppy = m_floppy1->get_device(); break; + } + + m_fdc->set_floppy(floppy); + + if (floppy) + { + // something here needs to turn the motor on + floppy->mon_w(0); + floppy->ss_w(!BIT(data, 2)); + } } void vector06_state::machine_start() -- cgit v1.2.3-70-g09d2 From 3a571779c0c0a47aeebde26256ac6f0e5c7223c3 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Thu, 4 Jun 2015 08:33:26 +0200 Subject: trs80: updated to use the new wd fdc --- scripts/src/lib.lua | 4 +- src/lib/formats/trs80_dsk.c | 55 +++++++++++++++++++++++ src/lib/formats/trs80_dsk.h | 36 +++++++++++++++ src/lib/formats/trs_dsk.c | 80 --------------------------------- src/lib/formats/trs_dsk.h | 20 --------- src/mess/drivers/trs80.c | 67 +++++++++++++++------------- src/mess/includes/trs80.h | 17 +++++-- src/mess/machine/trs80.c | 106 ++++++++++++-------------------------------- 8 files changed, 171 insertions(+), 214 deletions(-) create mode 100644 src/lib/formats/trs80_dsk.c create mode 100644 src/lib/formats/trs80_dsk.h delete mode 100644 src/lib/formats/trs_dsk.c delete mode 100644 src/lib/formats/trs_dsk.h (limited to 'scripts/src/lib.lua') diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index 5fc9603849e..49cfc2bc2f2 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -369,8 +369,8 @@ project "formats" MAME_DIR .. "src/lib/formats/trd_dsk.h", MAME_DIR .. "src/lib/formats/trs_cas.c", MAME_DIR .. "src/lib/formats/trs_cas.h", - MAME_DIR .. "src/lib/formats/trs_dsk.c", - MAME_DIR .. "src/lib/formats/trs_dsk.h", + MAME_DIR .. "src/lib/formats/trs80_dsk.c", + MAME_DIR .. "src/lib/formats/trs80_dsk.h", MAME_DIR .. "src/lib/formats/tvc_cas.c", MAME_DIR .. "src/lib/formats/tvc_cas.h", MAME_DIR .. "src/lib/formats/tvc_dsk.c", diff --git a/src/lib/formats/trs80_dsk.c b/src/lib/formats/trs80_dsk.c new file mode 100644 index 00000000000..acd122144d1 --- /dev/null +++ b/src/lib/formats/trs80_dsk.c @@ -0,0 +1,55 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + TRS-80 + + JV1 disk image format + + Used by Jeff Vavasour's TRS-80 Emulators + + TODO: + - Gap sizes unverified + +***************************************************************************/ + +#include "trs80_dsk.h" + +trs80_format::trs80_format() : wd177x_format(formats) +{ +} + +const char *trs80_format::name() const +{ + return "trs80"; +} + +const char *trs80_format::description() const +{ + return "TRS-80 JV1 disk image"; +} + +const char *trs80_format::extensions() const +{ + return "dsk"; +} + +int trs80_format::get_track_dam_fm(const format &f, int head, int track) +{ + return (track == 17 && head == 0) ? FM_DDAM : FM_DAM; +} + +const trs80_format::format trs80_format::formats[] = +{ + { + floppy_image::FF_525, floppy_image::SSSD, floppy_image::FM, + 4000, 10, 35, 1, 256, {}, 0, {}, 14, 11, 12 + }, + { + floppy_image::FF_525, floppy_image::SSSD, floppy_image::FM, + 4000, 10, 40, 1, 256, {}, 0, {}, 14, 11, 12 + }, + {} +}; + +const floppy_format_type FLOPPY_TRS80_FORMAT = &floppy_image_format_creator; diff --git a/src/lib/formats/trs80_dsk.h b/src/lib/formats/trs80_dsk.h new file mode 100644 index 00000000000..988d7ee2a7d --- /dev/null +++ b/src/lib/formats/trs80_dsk.h @@ -0,0 +1,36 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + TRS-80 + + JV1 disk image format + +***************************************************************************/ + +#pragma once + +#ifndef __TRS80_DSK_H__ +#define __TRS80_DSK_H__ + +#include "wd177x_dsk.h" + +class trs80_format : public wd177x_format +{ +public: + trs80_format(); + + virtual const char *name() const; + virtual const char *description() const; + virtual const char *extensions() const; + +protected: + virtual int get_track_dam_fm(const format &f, int head, int track); + +private: + static const format formats[]; +}; + +extern const floppy_format_type FLOPPY_TRS80_FORMAT; + +#endif // __TRS80_DSK_H__ diff --git a/src/lib/formats/trs_dsk.c b/src/lib/formats/trs_dsk.c deleted file mode 100644 index 2bb87173167..00000000000 --- a/src/lib/formats/trs_dsk.c +++ /dev/null @@ -1,80 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -#include -#include -#include "trs_dsk.h" -#include "basicdsk.h" -#include "coco_dsk.h" - -/* ----------------------------------------------------------------------- - * JV1 (Jeff Vavasour 1) format - * - * Used by Jeff Vavasour's TRS-80 Emulators - * - * Very straight basic disk; 1 head, 10 sectors, 256 sector length - * ----------------------------------------------------------------------- */ - -#define TRS80_JV1_HEADS 1 -#define TRS80_JV1_SECTORS 10 -#define TRS80_JV1_SECTORLENGTH 256 -#define TRS80_JV1_FIRSTSECTORID 0 - -static FLOPPY_IDENTIFY( trs80_jv1_identify ) -{ - UINT64 size; - size = floppy_image_size(floppy); - *vote = (size % (TRS80_JV1_HEADS * TRS80_JV1_SECTORS * TRS80_JV1_SECTORLENGTH)) - ? 0 : 100; - return FLOPPY_ERROR_SUCCESS; -} - - -static UINT64 trs80_jv1_get_ddam(floppy_image_legacy *floppy, const struct basicdsk_geometry *geom, int track, int head, int sector) -{ - // directory track is protected - if ((track==17) && (head==0)) { - return ID_FLAG_DELETED_DATA; - } - return 0; -} - -static FLOPPY_CONSTRUCT( trs80_jv1_construct ) -{ - struct basicdsk_geometry geometry; - - memset(&geometry, 0, sizeof(geometry)); - geometry.heads = TRS80_JV1_HEADS; - geometry.sectors = TRS80_JV1_SECTORS; - geometry.first_sector_id = TRS80_JV1_FIRSTSECTORID; - geometry.sector_length = TRS80_JV1_SECTORLENGTH; - geometry.get_ddam = trs80_jv1_get_ddam; - - if (params) - { - /* create */ - geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - } - else - { - /* load */ - geometry.tracks = (int) (floppy_image_size(floppy) / geometry.heads - / geometry.sectors / geometry.sector_length); - } - return basicdsk_construct(floppy, &geometry); -} - - - -/* ----------------------------------------------------------------------- */ - -LEGACY_FLOPPY_OPTIONS_START( trs80 ) - LEGACY_FLOPPY_OPTION( trs80_jv1, "dsk", "TRS-80 JV1 disk image", trs80_jv1_identify, trs80_jv1_construct, NULL, - TRACKS([35]-255)) - LEGACY_FLOPPY_OPTION( trs80_dmk, "dsk,dmk", "TRS-80 DMK disk image", coco_dmk_identify, coco_dmk_construct, NULL, - HEADS([1]-2) - TRACKS([35]-255) - SECTORS(1-[10]-18) - SECTOR_LENGTH(128/[256]/512/1024/2048/4096/8192) - INTERLEAVE(0-[6]-17) - FIRST_SECTOR_ID([0]-1)) -LEGACY_FLOPPY_OPTIONS_END diff --git a/src/lib/formats/trs_dsk.h b/src/lib/formats/trs_dsk.h deleted file mode 100644 index a33cec6872b..00000000000 --- a/src/lib/formats/trs_dsk.h +++ /dev/null @@ -1,20 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/********************************************************************* - - formats/trs_dsk.h - - TRS-80 disk images - -*********************************************************************/ - -#ifndef TRS_DSK_H -#define TRS_DSK_H - -#include "flopimg.h" - -/**************************************************************************/ - -LEGACY_FLOPPY_OPTIONS_EXTERN( trs80 ); - -#endif /* TRS_DSK_H */ diff --git a/src/mess/drivers/trs80.c b/src/mess/drivers/trs80.c index c57784bedc1..cccffe4f349 100644 --- a/src/mess/drivers/trs80.c +++ b/src/mess/drivers/trs80.c @@ -136,6 +136,8 @@ There don't seem to be any JV1 boot disks for Model III/4. ***************************************************************************/ #include "includes/trs80.h" +#include "formats/trs80_dsk.h" +#include "formats/dmk_dsk.h" static ADDRESS_MAP_START( trs80_map, AS_PROGRAM, 8, trs80_state ) @@ -158,10 +160,10 @@ static ADDRESS_MAP_START( model1_map, AS_PROGRAM, 8, trs80_state ) AM_RANGE(0x37e4, 0x37e7) AM_WRITE(trs80_cassunit_w) AM_RANGE(0x37e8, 0x37eb) AM_READWRITE(trs80_printer_r, trs80_printer_w) AM_RANGE(0x37ec, 0x37ec) AM_READ(trs80_wd179x_r) - AM_RANGE(0x37ec, 0x37ec) AM_DEVWRITE("wd179x", fd1793_device, command_w) - AM_RANGE(0x37ed, 0x37ed) AM_DEVREADWRITE("wd179x", fd1793_device, track_r, track_w) - AM_RANGE(0x37ee, 0x37ee) AM_DEVREADWRITE("wd179x", fd1793_device, sector_r, sector_w) - AM_RANGE(0x37ef, 0x37ef) AM_DEVREADWRITE("wd179x", fd1793_device, data_r, data_w) + AM_RANGE(0x37ec, 0x37ec) AM_DEVWRITE("fdc", fd1793_t, cmd_w) + AM_RANGE(0x37ed, 0x37ed) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) + AM_RANGE(0x37ee, 0x37ee) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) + AM_RANGE(0x37ef, 0x37ef) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) AM_RANGE(0x3800, 0x38ff) AM_MIRROR(0x300) AM_READ(trs80_keyboard_r) AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(trs80_videoram_r, trs80_videoram_w) AM_SHARE("p_videoram") AM_RANGE(0x4000, 0xffff) AM_RAM @@ -208,10 +210,10 @@ static ADDRESS_MAP_START( model3_io, AS_IO, 8, trs80_state ) AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) AM_RANGE(0xec, 0xef) AM_READWRITE(trs80m4_ec_r, trs80m4_ec_w) AM_RANGE(0xf0, 0xf0) AM_READ(trs80_wd179x_r) - AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("wd179x", fd1793_device, command_w) - AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("wd179x", fd1793_device, track_r, track_w) - AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("wd179x", fd1793_device, sector_r, sector_w) - AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("wd179x", fd1793_device, data_r, data_w) + AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("fdc", fd1793_t, cmd_w) + AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) + AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) + AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w) @@ -230,10 +232,10 @@ static ADDRESS_MAP_START( model4_io, AS_IO, 8, trs80_state ) AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) AM_RANGE(0xec, 0xef) AM_READWRITE(trs80m4_ec_r, trs80m4_ec_w) AM_RANGE(0xf0, 0xf0) AM_READ(trs80_wd179x_r) - AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("wd179x", fd1793_device, command_w) - AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("wd179x", fd1793_device, track_r, track_w) - AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("wd179x", fd1793_device, sector_r, sector_w) - AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("wd179x", fd1793_device, data_r, data_w) + AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("fdc", fd1793_t, cmd_w) + AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) + AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) + AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w) @@ -253,10 +255,10 @@ static ADDRESS_MAP_START( model4p_io, AS_IO, 8, trs80_state ) AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) AM_RANGE(0xec, 0xef) AM_READWRITE(trs80m4_ec_r, trs80m4_ec_w) AM_RANGE(0xf0, 0xf0) AM_READ(trs80_wd179x_r) - AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("wd179x", fd1793_device, command_w) - AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("wd179x", fd1793_device, track_r, track_w) - AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("wd179x", fd1793_device, sector_r, sector_w) - AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("wd179x", fd1793_device, data_r, data_w) + AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("fdc", fd1793_t, cmd_w) + AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) + AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) + AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w) @@ -277,10 +279,10 @@ static ADDRESS_MAP_START( meritum_io, AS_IO, 8, trs80_state ) // eg. port F0 should be 5, port F2 should have bit 3 set. //AM_RANGE(0x03, 0x03) unknown AM_RANGE(0xf0, 0xf0) AM_READ(trs80_wd179x_r) - AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("wd179x", fd1793_device, command_w) - AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("wd179x", fd1793_device, track_r, track_w) - AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("wd179x", fd1793_device, sector_r, sector_w) - AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("wd179x", fd1793_device, data_r, data_w) + AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("fdc", fd1793_t, cmd_w) + AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) + AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) + AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) //AM_RANGE(0xfc, 0xfd) unknown @@ -545,12 +547,15 @@ static GFXDECODE_START(meritum) GFXDECODE_END -static const floppy_interface trs80_floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(trs80), - NULL -}; +FLOPPY_FORMATS_MEMBER( trs80_state::floppy_formats ) + FLOPPY_TRS80_FORMAT, + FLOPPY_DMK_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( trs80_floppies ) + SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) +SLOT_INTERFACE_END + static MACHINE_CONFIG_START( trs80, trs80_state ) // the original model I, level I, with no extras /* basic machine hardware */ @@ -595,11 +600,13 @@ static MACHINE_CONFIG_DERIVED( model1, trs80 ) // model I, level II MCFG_QUICKLOAD_ADD("quickload", trs80_state, trs80_cmd, "cmd", 0.5) - MCFG_DEVICE_ADD("wd179x", FD1793, 0) // should be FD1771 or FD1791 but inverted data lines are too tricky to fix now - MCFG_WD17XX_DEFAULT_DRIVE4_TAGS - MCFG_WD17XX_INTRQ_CALLBACK(WRITELINE(trs80_state,trs80_fdc_intrq_w)) + MCFG_FD1793x_ADD("fdc", XTAL_1MHz) // todo: should be fd1771 + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(trs80_state,trs80_fdc_intrq_w)) - MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(trs80_floppy_interface) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", trs80_floppies, "sssd", trs80_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", trs80_floppies, "sssd", trs80_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", trs80_floppies, "", trs80_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", trs80_floppies, "", trs80_state::floppy_formats) MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) diff --git a/src/mess/includes/trs80.h b/src/mess/includes/trs80.h index 62925ff3a7c..e4ced5999ab 100644 --- a/src/mess/includes/trs80.h +++ b/src/mess/includes/trs80.h @@ -16,12 +16,11 @@ #include "machine/ay31015.h" #include "machine/buffer.h" #include "bus/centronics/ctronics.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" #include "imagedev/cassette.h" #include "imagedev/flopdrv.h" #include "imagedev/snapquik.h" #include "formats/trs_cas.h" -#include "formats/trs_dsk.h" class trs80_state : public driver_device @@ -34,7 +33,11 @@ public: m_cent_data_out(*this, "cent_data_out"), m_cent_status_in(*this, "cent_status_in"), m_ay31015(*this, "tr1602"), - m_fdc(*this, "wd179x"), + 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_speaker(*this, "speaker"), m_cassette(*this, "cassette"), m_p_videoram(*this, "p_videoram"), @@ -67,12 +70,18 @@ public: m_bank18(NULL), m_bank19(NULL) { } + DECLARE_FLOPPY_FORMATS(floppy_formats); + required_device m_maincpu; optional_device m_centronics; optional_device m_cent_data_out; optional_device m_cent_status_in; optional_device m_ay31015; - optional_device m_fdc; + optional_device m_fdc; + optional_device m_floppy0; + optional_device m_floppy1; + optional_device m_floppy2; + optional_device m_floppy3; required_device m_speaker; required_device m_cassette; DECLARE_WRITE8_MEMBER ( trs80_ff_w ); diff --git a/src/mess/machine/trs80.c b/src/mess/machine/trs80.c index e87ece1c1d1..980176e109e 100644 --- a/src/mess/machine/trs80.c +++ b/src/mess/machine/trs80.c @@ -490,8 +490,6 @@ WRITE8_MEMBER( trs80_state::trs80m4_ec_w ) m_port_ec = data & 0x7e; } -WRITE8_MEMBER( trs80_state::trs80m4_f4_w ) -{ /* Selection of drive and parameters - d6..d5 not emulated. A write also causes the selected drive motor to turn on for about 3 seconds. When the motor turns off, the drive is deselected. @@ -503,36 +501,24 @@ WRITE8_MEMBER( trs80_state::trs80m4_f4_w ) d2 1=select drive 2 d1 1=select drive 1 d0 1=select drive 0 */ +WRITE8_MEMBER( trs80_state::trs80m4_f4_w ) +{ + floppy_image_device *floppy = NULL; - UINT8 drive = 255; + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 2)) floppy = m_floppy2->get_device(); + if (BIT(data, 3)) floppy = m_floppy3->get_device(); - if (data & 1) - drive = 0; - else - if (data & 2) - drive = 1; - else - if (data & 4) - drive = 2; - else - if (data & 8) - drive = 3; + m_fdc->set_floppy(floppy); - m_head = (data & 16) ? 1 : 0; - - if (drive < 4) + if (floppy) { - m_fdc->set_drive(drive); - m_fdc->set_side(m_head); + floppy->mon_w(0); + floppy->ss_w(BIT(data, 4)); } m_fdc->dden_w(!BIT(data, 7)); - - /* CLEAR_LINE means to turn motors on */ - floppy_get_device(machine(), 0)->floppy_mon_w((data & 0x0f) ? CLEAR_LINE : ASSERT_LINE); - floppy_get_device(machine(), 1)->floppy_mon_w((data & 0x0f) ? CLEAR_LINE : ASSERT_LINE); - floppy_get_device(machine(), 2)->floppy_mon_w((data & 0x0f) ? CLEAR_LINE : ASSERT_LINE); - floppy_get_device(machine(), 3)->floppy_mon_w((data & 0x0f) ? CLEAR_LINE : ASSERT_LINE); } WRITE8_MEMBER( trs80_state::sys80_f8_w ) @@ -578,10 +564,10 @@ WRITE8_MEMBER( trs80_state::lnw80_fe_w ) mem.install_readwrite_handler (0x37e0, 0x37e3, read8_delegate(FUNC(trs80_state::trs80_irq_status_r), this), write8_delegate(FUNC(trs80_state::trs80_motor_w), this)); mem.install_readwrite_handler (0x37e8, 0x37eb, read8_delegate(FUNC(trs80_state::trs80_printer_r), this), write8_delegate(FUNC(trs80_state::trs80_printer_w), this)); mem.install_read_handler (0x37ec, 0x37ec, read8_delegate(FUNC(trs80_state::trs80_wd179x_r), this)); - mem.install_write_handler (0x37ec, 0x37ec, write8_delegate(FUNC(fd1793_device::command_w),(fd1793_device*)m_fdc)); - mem.install_readwrite_handler (0x37ed, 0x37ed, read8_delegate(FUNC(fd1793_device::track_r),(fd1793_device*)m_fdc), write8_delegate(FUNC(fd1793_device::track_w),(fd1793_device*)m_fdc)); - mem.install_readwrite_handler (0x37ee, 0x37ee, read8_delegate(FUNC(fd1793_device::sector_r),(fd1793_device*)m_fdc), write8_delegate(FUNC(fd1793_device::sector_w),(fd1793_device*)m_fdc)); - mem.install_readwrite_handler (0x37ef, 0x37ef, read8_delegate(FUNC(fd1793_device::data_r),(fd1793_device*)m_fdc),write8_delegate( FUNC(fd1793_device::data_w),(fd1793_device*)m_fdc)); + mem.install_write_handler (0x37ec, 0x37ec, write8_delegate(FUNC(fd1793_t::cmd_w),(fd1793_t*)m_fdc)); + mem.install_readwrite_handler (0x37ed, 0x37ed, read8_delegate(FUNC(fd1793_t::track_r),(fd1793_t*)m_fdc), write8_delegate(FUNC(fd1793_t::track_w),(fd1793_t*)m_fdc)); + mem.install_readwrite_handler (0x37ee, 0x37ee, read8_delegate(FUNC(fd1793_t::sector_r),(fd1793_t*)m_fdc), write8_delegate(FUNC(fd1793_t::sector_w),(fd1793_t*)m_fdc)); + mem.install_readwrite_handler (0x37ef, 0x37ef, read8_delegate(FUNC(fd1793_t::data_r),(fd1793_t*)m_fdc),write8_delegate( FUNC(fd1793_t::data_w),(fd1793_t*)m_fdc)); mem.install_read_handler (0x3800, 0x38ff, 0, 0x0300, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this)); mem.install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this)); } @@ -745,59 +731,23 @@ READ8_MEMBER( trs80_state::trs80_irq_status_r ) WRITE8_MEMBER( trs80_state::trs80_motor_w ) { - UINT8 drive = 255; + floppy_image_device *floppy = NULL; - switch (data) - { - case 1: - drive = 0; - m_head = 0; - break; - case 2: - drive = 1; - m_head = 0; - break; - case 4: - drive = 2; - m_head = 0; - break; - case 8: - drive = 3; - m_head = 0; - break; - /* These 3 combinations aren't official. Some manufacturers of double-sided disks - used drive select 4 to indicate the other side. */ - case 9: - drive = 0; - m_head = 1; - break; - case 10: - drive = 1; - m_head = 1; - break; - case 12: - drive = 2; - m_head = 1; - break; - } + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 2)) floppy = m_floppy2->get_device(); + if (BIT(data, 3)) floppy = m_floppy3->get_device(); - if (drive > 3) - { /* Turn motors off */ - floppy_get_device(machine(), 0)->floppy_mon_w(ASSERT_LINE); - floppy_get_device(machine(), 1)->floppy_mon_w(ASSERT_LINE); - floppy_get_device(machine(), 2)->floppy_mon_w(ASSERT_LINE); - floppy_get_device(machine(), 3)->floppy_mon_w(ASSERT_LINE); - return; - } + m_fdc->set_floppy(floppy); - m_fdc->set_drive(drive); - m_fdc->set_side(m_head); + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(BIT(data, 4)); + } - /* Turn motors on */ - floppy_get_device(machine(), 0)->floppy_mon_w(CLEAR_LINE); - floppy_get_device(machine(), 1)->floppy_mon_w(CLEAR_LINE); - floppy_get_device(machine(), 2)->floppy_mon_w(CLEAR_LINE); - floppy_get_device(machine(), 3)->floppy_mon_w(CLEAR_LINE); + // switch to fm + m_fdc->dden_w(1); } /************************************* -- cgit v1.2.3-70-g09d2 From a444bc8e2514cf581f0ec077dfdcf191bd3883d8 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Thu, 4 Jun 2015 16:55:13 +0200 Subject: coco: updated to use the new wd fdc --- scripts/src/lib.lua | 2 + src/emu/bus/coco/coco_fdc.c | 85 +++++++++++++--------- src/emu/bus/coco/coco_fdc.h | 8 +- src/lib/formats/jvc_dsk.c | 174 ++++++++++++++++++++++++++++++++++++++++++++ src/lib/formats/jvc_dsk.h | 50 +++++++++++++ 5 files changed, 283 insertions(+), 36 deletions(-) create mode 100644 src/lib/formats/jvc_dsk.c create mode 100644 src/lib/formats/jvc_dsk.h (limited to 'scripts/src/lib.lua') diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index 49cfc2bc2f2..f562b98c3b1 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -265,6 +265,8 @@ project "formats" MAME_DIR .. "src/lib/formats/imd_dsk.h", MAME_DIR .. "src/lib/formats/ipf_dsk.c", MAME_DIR .. "src/lib/formats/ipf_dsk.h", + MAME_DIR .. "src/lib/formats/jvc_dsk.c", + MAME_DIR .. "src/lib/formats/jvc_dsk.h", MAME_DIR .. "src/lib/formats/kaypro_dsk.c", MAME_DIR .. "src/lib/formats/kaypro_dsk.h", MAME_DIR .. "src/lib/formats/kc_cas.c", diff --git a/src/emu/bus/coco/coco_fdc.c b/src/emu/bus/coco/coco_fdc.c index 49da5302b22..9be9039516d 100644 --- a/src/emu/bus/coco/coco_fdc.c +++ b/src/emu/bus/coco/coco_fdc.c @@ -73,7 +73,9 @@ #include "imagedev/flopdrv.h" #include "includes/coco.h" #include "imagedev/flopdrv.h" -#include "formats/coco_dsk.h" +#include "formats/dmk_dsk.h" +#include "formats/jvc_dsk.h" +#include "formats/vdk_dsk.h" /*************************************************************************** @@ -94,12 +96,15 @@ LOCAL VARIABLES ***************************************************************************/ -static const floppy_interface coco_floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(coco), - "floppy_5_25" -}; +FLOPPY_FORMATS_MEMBER( coco_fdc_device::floppy_formats ) + FLOPPY_DMK_FORMAT, + FLOPPY_JVC_FORMAT, + FLOPPY_VDK_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( coco_fdc_floppies ) + SLOT_INTERFACE("qd", FLOPPY_525_QD) +SLOT_INTERFACE_END /*************************************************************************** @@ -149,15 +154,17 @@ WRITE_LINE_MEMBER( coco_fdc_device::fdc_drq_w ) //************************************************************************** static MACHINE_CONFIG_FRAGMENT(coco_fdc) - MCFG_DEVICE_ADD(WD_TAG, WD1773, 0) - MCFG_WD17XX_DEFAULT_DRIVE4_TAGS - MCFG_WD17XX_INTRQ_CALLBACK(WRITELINE(coco_fdc_device, fdc_intrq_w)) - MCFG_WD17XX_DRQ_CALLBACK(WRITELINE(coco_fdc_device, fdc_drq_w)) + MCFG_WD1773x_ADD(WD_TAG, XTAL_8MHz) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(coco_fdc_device, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(coco_fdc_device, fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD(WD_TAG ":0", coco_fdc_floppies, "qd", coco_fdc_device::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD_TAG ":1", coco_fdc_floppies, "qd", coco_fdc_device::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD_TAG ":2", coco_fdc_floppies, "", coco_fdc_device::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD_TAG ":3", coco_fdc_floppies, "", coco_fdc_device::floppy_formats) MCFG_DEVICE_ADD(DISTO_TAG, MSM6242, XTAL_32_768kHz) MCFG_DS1315_ADD(CLOUD9_TAG) - - MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(coco_floppy_interface) MACHINE_CONFIG_END ROM_START( coco_fdc ) @@ -291,16 +298,17 @@ void coco_fdc_device::dskreg_w(UINT8 data) else if (data & 0x40) drive = 3; - legacy_floppy_image_device *floppy[4]; + floppy_image_device *floppy[4]; - floppy[0] = subdevice(FLOPPY_0); - floppy[1] = subdevice(FLOPPY_1); - floppy[2] = subdevice(FLOPPY_2); - floppy[3] = subdevice(FLOPPY_3); + floppy[0] = subdevice(WD_TAG ":0")->get_device(); + floppy[1] = subdevice(WD_TAG ":1")->get_device(); + floppy[2] = subdevice(WD_TAG ":2")->get_device(); + floppy[3] = subdevice(WD_TAG ":3")->get_device(); for (int i = 0; i < 4; i++) { - floppy[i]->floppy_mon_w(i == drive ? CLEAR_LINE : ASSERT_LINE); + if (floppy[i]) + floppy[i]->mon_w(i == drive ? CLEAR_LINE : ASSERT_LINE); } head = ((data & 0x40) && (drive != 3)) ? 1 : 0; @@ -309,8 +317,11 @@ void coco_fdc_device::dskreg_w(UINT8 data) update_lines(); - m_wd17xx->set_drive(drive); - m_wd17xx->set_side(head); + m_wd17xx->set_floppy(floppy[drive]); + + if (floppy[drive]) + floppy[drive]->ss_w(head); + m_wd17xx->dden_w(!BIT(m_dskreg, 5)); } @@ -379,7 +390,7 @@ WRITE8_MEMBER(coco_fdc_device::write) dskreg_w(data); break; case 8: - m_wd17xx->command_w(space, 0, data); + m_wd17xx->cmd_w(space, 0, data); break; case 9: m_wd17xx->track_w(space, 0, data); @@ -388,6 +399,7 @@ WRITE8_MEMBER(coco_fdc_device::write) m_wd17xx->sector_w(space, 0, data); break; case 11: + //printf("data w %02x\n", data); m_wd17xx->data_w(space, 0, data); break; }; @@ -413,10 +425,12 @@ WRITE8_MEMBER(coco_fdc_device::write) //************************************************************************** static MACHINE_CONFIG_FRAGMENT(dragon_fdc) - MCFG_DEVICE_ADD(WD2797_TAG, WD2797, 0) - MCFG_WD17XX_DEFAULT_DRIVE4_TAGS + MCFG_WD2797x_ADD(WD2797_TAG, XTAL_1MHz) - MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(coco_floppy_interface) + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":0", coco_fdc_floppies, "qd", coco_fdc_device::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":1", coco_fdc_floppies, "qd", coco_fdc_device::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":2", coco_fdc_floppies, "", coco_fdc_device::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":3", coco_fdc_floppies, "", coco_fdc_device::floppy_formats) MACHINE_CONFIG_END @@ -511,10 +525,20 @@ void dragon_fdc_device::dskreg_w(UINT8 data) data); } - if (data & 0x04) - m_wd2797->set_drive(data & 0x03); + floppy_image_device *floppy = NULL; + + switch (data & 0x03) + { + case 0: floppy = subdevice(WD2797_TAG ":0")->get_device(); break; + case 1: floppy = subdevice(WD2797_TAG ":1")->get_device(); break; + case 2: floppy = subdevice(WD2797_TAG ":2")->get_device(); break; + case 3: floppy = subdevice(WD2797_TAG ":3")->get_device(); break; + } + + m_wd2797->set_floppy(floppy); m_wd2797->dden_w(BIT(data, 3)); + m_dskreg = data; } @@ -556,12 +580,7 @@ WRITE8_MEMBER(dragon_fdc_device::write) switch(offset & 0xEF) { case 0: - m_wd2797->command_w(space, 0, data); - - /* disk head is encoded in the command byte */ - /* Only for type 3 & 4 commands */ - if (data & 0x80) - m_wd2797->set_side((data & 0x02) ? 1 : 0); + m_wd2797->cmd_w(space, 0, data); break; case 1: m_wd2797->track_w(space, 0, data); diff --git a/src/emu/bus/coco/coco_fdc.h b/src/emu/bus/coco/coco_fdc.h index 3456b00054f..8773a48bea4 100644 --- a/src/emu/bus/coco/coco_fdc.h +++ b/src/emu/bus/coco/coco_fdc.h @@ -9,7 +9,7 @@ #include "cococart.h" #include "machine/msm6242.h" #include "machine/ds1315.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" //************************************************************************** @@ -37,6 +37,8 @@ public: coco_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); coco_fdc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + DECLARE_FLOPPY_FORMATS(floppy_formats); + // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; virtual const rom_entry *device_rom_region() const; @@ -66,8 +68,8 @@ protected: UINT8 m_drq : 1; UINT8 m_intrq : 1; - optional_device m_wd17xx; /* WD17xx */ - optional_device m_wd2797; /* WD2797 */ + optional_device m_wd17xx; /* WD17xx */ + optional_device m_wd2797; /* WD2797 */ optional_device m_ds1315; /* DS1315 */ /* Disto RTC */ diff --git a/src/lib/formats/jvc_dsk.c b/src/lib/formats/jvc_dsk.c new file mode 100644 index 00000000000..20ee3508ee9 --- /dev/null +++ b/src/lib/formats/jvc_dsk.c @@ -0,0 +1,174 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + JVC + + Disk image format + + Named after its creator, Jeff Vavasour + + TODO: + - Support writing unusal formats? + +***************************************************************************/ + +#include "emu.h" +#include "jvc_dsk.h" + +jvc_format::jvc_format() +{ +} + +const char *jvc_format::name() const +{ + return "jvc"; +} + +const char *jvc_format::description() const +{ + return "JVC disk image"; +} + +const char *jvc_format::extensions() const +{ + return "jvc,dsk"; +} + +bool jvc_format::parse_header(io_generic *io, int &header_size, int &tracks, int &heads, int §ors, int §or_size, int &base_sector_id) +{ + UINT64 size = io_generic_size(io); + header_size = size % 256; + UINT8 header[5]; + + if (header_size > 0) + io_generic_read(io, header, 0, header_size); + + if (header_size > 5) + return false; + + // default values + heads = 1; + sectors = 18; + sector_size = 256; + base_sector_id = 1; + + switch (header_size) + { + case 5: emu_fatalerror("jvc_format: sector attribute flag unsupported\n"); + break; + case 4: base_sector_id = header[3]; + // no break + case 3: sector_size = 128 << header[2]; + // no break + case 2: heads = header[1]; + // no break + case 1: sectors = header[0]; + // no break + case 0: tracks = (size - header_size) / sector_size / sectors; + break; + } + + return tracks * heads * sectors * sector_size == (size - header_size); +} + +int jvc_format::identify(io_generic *io, UINT32 form_factor) +{ + int header_size, tracks, heads, sectors, sector_size, sector_base_id; + return parse_header(io, header_size, tracks, heads, sectors, sector_size, sector_base_id) ? 50 : 0; +} + +bool jvc_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) +{ + int header_size, track_count, head_count, sector_count, sector_size, sector_base_id; + + if (!parse_header(io, header_size, track_count, head_count, sector_count, sector_size, sector_base_id)) + return false; + + // safety check + if (sector_count * sector_size > 10000) + emu_fatalerror("jvc_format: incorrect track layout\n"); + + int file_offset = header_size; + + for (int track = 0; track < track_count; track++) + { + for (int head = 0; head < head_count ; head++) + { + desc_pc_sector sectors[256]; + UINT8 sector_data[10000]; + int sector_offset = 0; + + for (int i = 0; i < sector_count; i++) + { + sectors[i].track = track; + sectors[i].head = head; + sectors[i].sector = sector_base_id + i; + sectors[i].actual_size = sector_size; + sectors[i].size = sector_size >> 8; + sectors[i].deleted = false; + sectors[i].bad_crc = false; + sectors[i].data = §or_data[sector_offset]; + + io_generic_read(io, sectors[i].data, file_offset, sector_size); + + sector_offset += sector_size; + file_offset += sector_size; + } + + build_wd_track_mfm(track, head, image, 100000, sector_count, sectors, 22, 32, 24); + } + } + + return true; +} + +bool jvc_format::save(io_generic *io, floppy_image *image) +{ + UINT8 bitstream[500000/8]; + UINT8 sector_data[50000]; + desc_xs sectors[256]; + UINT64 file_offset = 0; + + int track_count, head_count; + image->get_actual_geometry(track_count, head_count); + + // we'll write a header if the disk is two-sided + if (head_count == 2) + { + UINT8 header[2]; + header[0] = 18; + header[1] = 2; + io_generic_write(io, header, file_offset, sizeof(header)); + file_offset += sizeof(header); + } + + // write disk data + for (int track = 0; track < track_count; track++) + { + for (int head = 0; head < head_count; head++) + { + int track_size; + generate_bitstream_from_track(track, head, 2000, bitstream, track_size, image); + extract_sectors_from_bitstream_mfm_pc(bitstream, track_size, sectors, sector_data, sizeof(sector_data)); + + for (int i = 0; i < 18; i++) + { + if (sectors[1 + i].size != 256) + emu_fatalerror("jvc_format: invalid sector size: %d\n", sectors[1 + i].size); + + io_generic_write(io, sectors[1 + i].data, file_offset, sectors[1 + i].size); + file_offset += sectors[1 + i].size; + } + } + } + + return true; +} + +bool jvc_format::supports_save() const +{ + return true; +} + +const floppy_format_type FLOPPY_JVC_FORMAT = &floppy_image_format_creator; diff --git a/src/lib/formats/jvc_dsk.h b/src/lib/formats/jvc_dsk.h new file mode 100644 index 00000000000..eaeeefb84aa --- /dev/null +++ b/src/lib/formats/jvc_dsk.h @@ -0,0 +1,50 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + JVC + + Disk image format + + Named after its creator, Jeff Vavasour + +***************************************************************************/ + +#pragma once + +#ifndef __JVC_DSK_H__ +#define __JVC_DSK_H__ + +#include "flopimg.h" + +class jvc_format : public floppy_image_format_t +{ +public: + jvc_format(); + + struct jvc_header + { + UINT8 sectors_per_track; + UINT8 side_count; + UINT8 sector_size; + UINT8 first_sector_id; + UINT8 sector_attribute_flag; + int header_size; + }; + + virtual const char *name() const; + virtual const char *description() const; + virtual const char *extensions() const; + + virtual int identify(io_generic *io, UINT32 form_factor); + virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image); + virtual bool save(io_generic *io, floppy_image *image); + virtual bool supports_save() const; + +private: + bool parse_header(io_generic *io, int &header_size, int &tracks, int &heads, int §ors, int §or_size, int &base_sector_id); +}; + +extern const floppy_format_type FLOPPY_JVC_FORMAT; + +#endif // __JVC_DSK_H__ -- cgit v1.2.3-70-g09d2 From c414fffc306da58f69d8d1c8ee0253603b31c553 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Fri, 5 Jun 2015 10:21:08 +0200 Subject: 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 (limited to 'scripts/src/lib.lua') 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: -- cgit v1.2.3-70-g09d2 From 9027ce95756981dc2efa87a91049d5273ea34c8a Mon Sep 17 00:00:00 2001 From: Julian Sikorski Date: Sat, 6 Jun 2015 23:39:24 +0200 Subject: Added the ability to use system flac, jpeg, lua, sqlite3, portmidi and zlib based on wallyweek's work --- 3rdparty/lsqlite3/lsqlite3.c | 4 + makefile | 36 +++++ scripts/genie.lua | 56 +++++++- scripts/src/3rdparty.lua | 42 +++++- scripts/src/emu.lua | 48 +++++-- scripts/src/lib.lua | 13 +- scripts/src/main.lua | 41 +++++- scripts/src/tools.lua | 264 +++++++++++++++++++++++++++++++---- scripts/target/ldplayer/ldplayer.lua | 10 +- scripts/target/mame/arcade.lua | 7 +- scripts/target/mame/dummy.lua | 10 +- scripts/target/mame/mess.lua | 6 +- scripts/target/mame/nl.lua | 9 +- scripts/target/mame/tiny.lua | 8 +- src/osd/modules/midi/portmidi.c | 4 + 15 files changed, 504 insertions(+), 54 deletions(-) (limited to 'scripts/src/lib.lua') diff --git a/3rdparty/lsqlite3/lsqlite3.c b/3rdparty/lsqlite3/lsqlite3.c index 415e9d84776..1026af451c9 100644 --- a/3rdparty/lsqlite3/lsqlite3.c +++ b/3rdparty/lsqlite3/lsqlite3.c @@ -47,7 +47,11 @@ #define luaL_openlib(L,name,reg,nup) luaL_setfuncs(L,reg,nup) #endif +#ifndef USE_SYSTEM_SQLITE #include "sqlite3/sqlite3.h" +#else +#include +#endif /* compile time features */ #if !defined(SQLITE_OMIT_PROGRESS_CALLBACK) diff --git a/makefile b/makefile index e96640a0d05..90dc6760c2d 100644 --- a/makefile +++ b/makefile @@ -53,6 +53,12 @@ # LDOPTS = # USE_SYSTEM_LIB_EXPAT = 1 +# USE_SYSTEM_LIB_ZLIB = 1 +# USE_SYSTEM_LIB_JPEG = 1 +# USE_SYSTEM_LIB_FLAC = 1 +# USE_SYSTEM_LIB_LUA = 1 +# USE_SYSTEM_LIB_SQLITE3 = 1 +# USE_SYSTEM_LIB_PORTMIDI = 1 # MESA_INSTALL_ROOT = /opt/mesa # SDL_INSTALL_ROOT = /opt/sdl2 @@ -294,6 +300,30 @@ ifndef USE_SYSTEM_LIB_EXPAT PARAMS += --with-bundled-expat endif +ifndef USE_SYSTEM_LIB_ZLIB +PARAMS += --with-bundled-zlib +endif + +ifndef USE_SYSTEM_LIB_JPEG +PARAMS += --with-bundled-jpeg +endif + +ifndef USE_SYSTEM_LIB_FLAC +PARAMS += --with-bundled-flac +endif + +ifndef USE_SYSTEM_LIB_LUA +PARAMS += --with-bundled-lua +endif + +ifndef USE_SYSTEM_LIB_SQLITE3 +PARAMS += --with-bundled-sqlite3 +endif + +ifndef USE_SYSTEM_LIB_PORTMIDI +PARAMS += --with-bundled-portmidi +endif + #------------------------------------------------- # distribution may change things #------------------------------------------------- @@ -1048,8 +1078,12 @@ CPPCHECK_PARAMS += -Isrc/osd/modules/render CPPCHECK_PARAMS += -Isrc/osd/windows CPPCHECK_PARAMS += -Isrc/emu/cpu/m68000 CPPCHECK_PARAMS += -I3rdparty +ifndef USE_SYSTEM_LIB_LUA CPPCHECK_PARAMS += -I3rdparty/lua/src +endif +ifndef USE_SYSTEM_LIB_ZLIB CPPCHECK_PARAMS += -I3rdparty/zlib +endif CPPCHECK_PARAMS += -I3rdparty/bgfx/include CPPCHECK_PARAMS += -I3rdparty/bx/include CPPCHECK_PARAMS += -Ibuild/generated/emu @@ -1062,7 +1096,9 @@ CPPCHECK_PARAMS += -DMAME_DEBUG CPPCHECK_PARAMS += -DMAME_PROFILER CPPCHECK_PARAMS += -DCRLF=3 CPPCHECK_PARAMS += -DLSB_FIRST +ifndef USE_SYSTEM_LIB_FLAC CPPCHECK_PARAMS += -DFLAC__NO_DLL +endif CPPCHECK_PARAMS += -DNATIVE_DRC=drcbe_x64 CPPCHECK_PARAMS += -DLUA_COMPAT_APIINTCASTS CPPCHECK_PARAMS += -DWIN32 diff --git a/scripts/genie.lua b/scripts/genie.lua index 702ae917064..7a591db050b 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -98,6 +98,36 @@ newoption { description = 'Build bundled Expat library', } +newoption { + trigger = 'with-bundled-zlib', + description = 'Build bundled Zlib library', +} + +newoption { + trigger = 'with-bundled-jpeg', + description = 'Build bundled JPEG library', +} + +newoption { + trigger = 'with-bundled-flac', + description = 'Build bundled FLAC library', +} + +newoption { + trigger = 'with-bundled-lua', + description = 'Build bundled LUA library', +} + +newoption { + trigger = 'with-bundled-sqlite3', + description = 'Build bundled SQLite library', +} + +newoption { + trigger = 'with-bundled-portmidi', + description = 'Build bundled PortMidi library', +} + newoption { trigger = "distro", description = "Choose distribution", @@ -596,9 +626,29 @@ else end -- need to ensure FLAC functions are statically linked -defines { - "FLAC__NO_DLL", -} +if _OPTIONS["with-bundled-flac"] then + defines { + "FLAC__NO_DLL", + } + end + +if not _OPTIONS["with-bundled-jpeg"] then + defines { + "USE_SYSTEM_JPEGLIB", + } + end + +if not _OPTIONS["with-bundled-portmidi"] then + defines { + "USE_SYSTEM_PORTMIDI", + } + end + +if not _OPTIONS["with-bundled-sqlite3"] then + defines { + "USE_SYSTEM_SQLITE", + } + end if _OPTIONS["NOASM"]=="1" then defines { diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 34c9a14599c..c2808c55dc5 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -34,6 +34,7 @@ end -- zlib library objects -------------------------------------------------- +if _OPTIONS["with-bundled-zlib"] then project "zlib" uuid "3d78bd2a-2bd0-4449-8087-42ddfaef7ec9" kind "StaticLib" @@ -71,6 +72,11 @@ project "zlib" "-Wshadow" } end +else +links { + "z", +} +end -------------------------------------------------- -- SoftFloat library objects @@ -112,6 +118,7 @@ project "softfloat" -- libJPEG library objects -------------------------------------------------- +if _OPTIONS["with-bundled-jpeg"] then project "jpeg" uuid "447c6800-dcfd-4c48-b72a-a8223bb409ca" kind "StaticLib" @@ -169,11 +176,17 @@ project "jpeg" "-Wshadow" } end +else +links { + "jpeg", +} +end -------------------------------------------------- -- libflac library objects -------------------------------------------------- +if _OPTIONS["with-bundled-flac"] then project "flac" uuid "b6fc19e8-073a-4541-bb7b-d24b548d424a" kind "StaticLib" @@ -223,6 +236,11 @@ project "flac" "-Wshadow" } end +else +links { + "FLAC", +} +end -------------------------------------------------- -- lib7z library objects @@ -268,6 +286,7 @@ project "7z" -- LUA library objects -------------------------------------------------- +if _OPTIONS["with-bundled-lua"] then project "lua" uuid "d9e2eed1-f1ab-4737-a6ac-863700b1a5a9" kind "StaticLib" @@ -342,6 +361,11 @@ project "lua" "-Wshadow" } end +else +links { + "lua", +} +end -------------------------------------------------- -- sqlite3 lua library objects @@ -362,8 +386,12 @@ project "lsqlite3" includedirs { MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/lua/src", } + if _OPTIONS["with-bundled-lua"] then + includedirs { + MAME_DIR .. "3rdparty/lua/src", + } + end files { MAME_DIR .. "3rdparty/lsqlite3/lsqlite3.c", @@ -435,6 +463,7 @@ project "jsoncpp" -- SQLite3 library objects -------------------------------------------------- +if _OPTIONS["with-bundled-sqlite3"] then project "sqllite3" uuid "5cb3d495-57ed-461c-81e5-80dc0857517d" kind "StaticLib" @@ -455,11 +484,17 @@ project "sqllite3" "-Wshadow" } end +else +links { + "sqlite3", +} +end -------------------------------------------------- -- portmidi library objects -------------------------------------------------- if _OPTIONS["NO_USE_MIDI"]~="1" then +if _OPTIONS["with-bundled-portmidi"] then project "portmidi" uuid "587f2da6-3274-4a65-86a2-f13ea315bb98" kind "StaticLib" @@ -514,6 +549,11 @@ project "portmidi" "-Wshadow" } end +else +links { + "portmidi", +} +end end -------------------------------------------------- -- BGFX library objects diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index f81ca07af5c..2cd14d3cac4 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -15,8 +15,6 @@ includedirs { MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/lua/src", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. "emu", GEN_DIR .. "emu/layout", } @@ -25,6 +23,16 @@ if _OPTIONS["with-bundled-expat"] then MAME_DIR .. "3rdparty/expat/lib", } end +if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } +end +if _OPTIONS["with-bundled-lua"] then + includedirs { + MAME_DIR .. "3rdparty/lua/src", + } +end files { MAME_DIR .. "src/emu/emu.h", @@ -371,8 +379,6 @@ function emuProject(_target, _subtarget) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/lua/src", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. "emu", GEN_DIR .. "emu/layout", MAME_DIR .. "src/emu/cpu/m68000", @@ -382,6 +388,16 @@ function emuProject(_target, _subtarget) MAME_DIR .. "3rdparty/expat/lib", } end + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end + if _OPTIONS["with-bundled-lua"] then + includedirs { + MAME_DIR .. "3rdparty/lua/src", + } + end dofile(path.join("src", "cpu.lua")) @@ -410,8 +426,6 @@ function emuProject(_target, _subtarget) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/lua/src", - MAME_DIR .. "3rdparty/zlib", MAME_DIR .. "src/mess", -- some mess bus devices need this MAME_DIR .. "src/mame", -- used for nes bus devices GEN_DIR .. "emu", @@ -422,6 +436,16 @@ function emuProject(_target, _subtarget) MAME_DIR .. "3rdparty/expat/lib", } end + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end + if _OPTIONS["with-bundled-lua"] then + includedirs { + MAME_DIR .. "3rdparty/lua/src", + } + end dofile(path.join("src", "bus.lua")) @@ -440,8 +464,6 @@ function emuProject(_target, _subtarget) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/lua/src", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. "emu", } if _OPTIONS["with-bundled-expat"] then @@ -449,6 +471,16 @@ function emuProject(_target, _subtarget) MAME_DIR .. "3rdparty/expat/lib", } end + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end + if _OPTIONS["with-bundled-lua"] then + includedirs { + MAME_DIR .. "3rdparty/lua/src", + } + end files { disasm_files diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index 774e674db1a..dab7f0dc9c4 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -14,13 +14,17 @@ project "utils" MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/zlib", } if _OPTIONS["with-bundled-expat"] then includedirs { MAME_DIR .. "3rdparty/expat/lib", } end + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end files { MAME_DIR .. "src/lib/util/bitstream.h", @@ -110,9 +114,14 @@ project "formats" MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/zlib", } + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end + files { MAME_DIR .. "src/lib/formats/2d_dsk.c", MAME_DIR .. "src/lib/formats/2d_dsk.h", diff --git a/scripts/src/main.lua b/scripts/src/main.lua index 809a18be70a..6bbdc01833c 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -95,16 +95,44 @@ function mainProject(_target, _subtarget) "expat", "softfloat", "jpeg", - "flac", "7z", "formats", "lua", "lsqlite3", - "sqllite3", - "zlib", "jsoncpp", "mongoose", } + + if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } + else + links { + "z", + } + end + + if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } + else + links { + "FLAC", + } + end + + if _OPTIONS["with-bundled-sqlite3"] then + links { + "sqllite3", + } + else + links { + "sqlite3", + } + end + if _OPTIONS["NO_USE_MIDI"]~="1" then links { "portmidi", @@ -130,11 +158,16 @@ function mainProject(_target, _subtarget) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. _target .. "/layout", GEN_DIR .. "resource", } + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end + if _OPTIONS["targetos"]=="macosx" and (not override_resources) then linkoptions { "-sectcreate __TEXT __info_plist " .. GEN_DIR .. "/resource/" .. _subtarget .. "-Info.plist" diff --git a/scripts/src/tools.lua b/scripts/src/tools.lua index b7a88f038f7..4f58b12d641 100644 --- a/scripts/src/tools.lua +++ b/scripts/src/tools.lua @@ -24,10 +24,19 @@ end links { "utils", "expat", - "zlib", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -60,12 +69,30 @@ end links { "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -100,10 +127,19 @@ end links { "utils", "expat", - "zlib", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -138,12 +174,30 @@ links { "emu", "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/emu", @@ -179,12 +233,30 @@ end links { "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -218,12 +290,30 @@ end links { "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -257,10 +347,19 @@ end links { "utils", "expat", - "zlib", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -293,10 +392,19 @@ end links { "utils", "expat", - "zlib", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -329,10 +437,19 @@ end links { "utils", "expat", - "zlib", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -365,12 +482,30 @@ end links { "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -403,10 +538,19 @@ end links { "utils", "expat", - "zlib", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -439,13 +583,31 @@ end links { "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], "netlist", } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -480,12 +642,30 @@ links { "formats", "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib", @@ -521,12 +701,30 @@ links { "emu", "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib", @@ -562,12 +760,30 @@ links { "emu", "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib", diff --git a/scripts/target/ldplayer/ldplayer.lua b/scripts/target/ldplayer/ldplayer.lua index f12fad0c7db..c8435c4a8ab 100644 --- a/scripts/target/ldplayer/ldplayer.lua +++ b/scripts/target/ldplayer/ldplayer.lua @@ -68,9 +68,13 @@ function createProjects_ldplayer_ldplayer(_target, _subtarget) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. "mame/layout", - } + } + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end files{ MAME_DIR .. "src/emu/drivers/emudummy.c", @@ -89,4 +93,4 @@ function linkProjects_ldplayer_ldplayer(_target, _subtarget) links { "drvldplayer", } -end \ No newline at end of file +end diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 3b178ee8c15..7204ce91985 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -774,9 +774,14 @@ function createMAMEProjects(_target, _subtarget, _name) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. "mame/layout", } + + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } +end end function createProjects_mame_arcade(_target, _subtarget) diff --git a/scripts/target/mame/dummy.lua b/scripts/target/mame/dummy.lua index 145862828d5..dba163b35f8 100644 --- a/scripts/target/mame/dummy.lua +++ b/scripts/target/mame/dummy.lua @@ -29,9 +29,13 @@ function createProjects_mame_dummy(_target, _subtarget) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. "mess/layout", - } + } + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end files{ MAME_DIR .. "src/mess/drivers/coleco.c", @@ -43,4 +47,4 @@ function linkProjects_mame_dummy(_target, _subtarget) links { "mame_dummy", } -end \ No newline at end of file +end diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index e414158ea77..0533932f8bd 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -874,11 +874,15 @@ function createMESSProjects(_target, _subtarget, _name) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. "mess/layout", GEN_DIR .. "mame/layout", MAME_DIR .. "src/emu/cpu/m68000", } + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end end function createProjects_mame_mess(_target, _subtarget) diff --git a/scripts/target/mame/nl.lua b/scripts/target/mame/nl.lua index 2ed0cae3e19..0ba36789c5b 100644 --- a/scripts/target/mame/nl.lua +++ b/scripts/target/mame/nl.lua @@ -96,9 +96,14 @@ function createProjects_mame_nl(_target, _subtarget) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. "mame/layout", - } + } + + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end files{ MAME_DIR .. "src/mame/drivers/pong.c", diff --git a/scripts/target/mame/tiny.lua b/scripts/target/mame/tiny.lua index 9dc18d31d9a..5594593d113 100644 --- a/scripts/target/mame/tiny.lua +++ b/scripts/target/mame/tiny.lua @@ -92,9 +92,13 @@ function createProjects_mame_tiny(_target, _subtarget) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. "mame/layout", - } + } + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end files{ MAME_DIR .. "src/mame/machine/ticket.c", diff --git a/src/osd/modules/midi/portmidi.c b/src/osd/modules/midi/portmidi.c index 78ac990d2b0..02dad28ffc1 100644 --- a/src/osd/modules/midi/portmidi.c +++ b/src/osd/modules/midi/portmidi.c @@ -10,7 +10,11 @@ #ifndef NO_USE_MIDI +#ifndef USE_SYSTEM_PORTMIDI #include "portmidi/pm_common/portmidi.h" +#else +#include +#endif #include "osdcore.h" #include "corealloc.h" #include "modules/osdmodule.h" -- cgit v1.2.3-70-g09d2 From 126f95c7860165e16bb8f5611a38a32c7e5d8dd6 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Mon, 8 Jun 2015 11:24:49 +0200 Subject: atarist_dsk: remove, no longer used --- scripts/src/lib.lua | 2 - src/lib/formats/atarist_dsk.c | 86 ------------------------------------------- src/lib/formats/atarist_dsk.h | 20 ---------- 3 files changed, 108 deletions(-) delete mode 100644 src/lib/formats/atarist_dsk.c delete mode 100644 src/lib/formats/atarist_dsk.h (limited to 'scripts/src/lib.lua') diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index dab7f0dc9c4..4639f86fdb8 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -167,8 +167,6 @@ project "formats" MAME_DIR .. "src/lib/formats/asst128_dsk.h", MAME_DIR .. "src/lib/formats/atari_dsk.c", MAME_DIR .. "src/lib/formats/atari_dsk.h", - MAME_DIR .. "src/lib/formats/atarist_dsk.c", - MAME_DIR .. "src/lib/formats/atarist_dsk.h", MAME_DIR .. "src/lib/formats/atom_tap.c", MAME_DIR .. "src/lib/formats/atom_tap.h", MAME_DIR .. "src/lib/formats/bbc_dsk.c", diff --git a/src/lib/formats/atarist_dsk.c b/src/lib/formats/atarist_dsk.c deleted file mode 100644 index eb559a940c4..00000000000 --- a/src/lib/formats/atarist_dsk.c +++ /dev/null @@ -1,86 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/********************************************************************* - - formats/atarist_dsk.c - - Atari ST disk images - -*********************************************************************/ - -#include - -#include "formats/atarist_dsk.h" -#include "formats/basicdsk.h" - -/* - - TODO: - - - MSA format - - STT format - - DIM format - -*/ - -/*************************************************************************** - CONSTANTS / MACROS -***************************************************************************/ - -#define LOG 0 - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - -/*------------------------------------------------- - FLOPPY_IDENTIFY( atarist_st_identify ) --------------------------------------------------*/ - -static FLOPPY_IDENTIFY( atarist_st_identify ) -{ - *vote = 100; - - return FLOPPY_ERROR_SUCCESS; -} - -/*------------------------------------------------- - FLOPPY_CONSTRUCT( atarist_st_construct ) --------------------------------------------------*/ - -static FLOPPY_CONSTRUCT( atarist_st_construct ) -{ - int heads = 0; - int tracks = 0; - int sectors = 0; - UINT8 bootsector[512]; - - floppy_image_read(floppy, bootsector, 0, 512); - sectors = bootsector[0x18]; - heads = bootsector[0x1a]; - tracks = (bootsector[0x13] | (bootsector[0x14] << 8)) / sectors / heads; - - struct basicdsk_geometry geometry; - memset(&geometry, 0, sizeof(geometry)); - - geometry.heads = heads; - geometry.first_sector_id = 1; - geometry.sector_length = 512; - geometry.tracks = tracks; - geometry.sectors = sectors; - - if (LOG) LOG_FORMATS("ST Heads %d Tracks %d Sectors %d\n", heads, tracks, sectors); - - return basicdsk_construct(floppy, &geometry); -} - -/*------------------------------------------------- - FLOPPY_CONSTRUCT(atarist_dsk_construct) --------------------------------------------------*/ - -LEGACY_FLOPPY_OPTIONS_START( atarist ) - LEGACY_FLOPPY_OPTION( atarist, "st", "Atari ST floppy disk image", atarist_st_identify, atarist_st_construct, NULL, NULL ) -/* LEGACY_FLOPPY_OPTION( atarist, "stt", "Atari ST floppy disk image", atarist_stt_identify, atarist_stt_construct, NULL, NULL ) - LEGACY_FLOPPY_OPTION( atarist, "msa", "Atari ST floppy disk image", atarist_msa_identify, atarist_msa_construct, NULL, NULL ) - LEGACY_FLOPPY_OPTION( atarist, "dim", "Atari ST floppy disk image", atarist_dim_identify, atarist_dim_construct, NULL, NULL )*/ -LEGACY_FLOPPY_OPTIONS_END diff --git a/src/lib/formats/atarist_dsk.h b/src/lib/formats/atarist_dsk.h deleted file mode 100644 index 6c86e456a5b..00000000000 --- a/src/lib/formats/atarist_dsk.h +++ /dev/null @@ -1,20 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/********************************************************************* - - formats/atarist_dsk.h - - atarist disk images - -*********************************************************************/ - -#ifndef ATARIST_DSK_H -#define ATARIST_DSK_H - -#include "flopimg.h" - -/**************************************************************************/ - -LEGACY_FLOPPY_OPTIONS_EXTERN(atarist); - -#endif /* ATARIST_DSK_H */ -- cgit v1.2.3-70-g09d2 From 6ba157cb67285370974259af715b18efa5097f15 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Mon, 8 Jun 2015 13:15:03 +0200 Subject: vtech1_dsk: remove, no longer used --- scripts/src/lib.lua | 2 -- src/emu/bus/vtech/memexp/floppy.c | 2 +- src/lib/formats/vtech1_dsk.c | 41 --------------------------------------- src/lib/formats/vtech1_dsk.h | 18 ----------------- 4 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 src/lib/formats/vtech1_dsk.c delete mode 100644 src/lib/formats/vtech1_dsk.h (limited to 'scripts/src/lib.lua') diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index 4639f86fdb8..996478276a6 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -404,8 +404,6 @@ project "formats" MAME_DIR .. "src/lib/formats/vt_cas.h", MAME_DIR .. "src/lib/formats/vt_dsk.c", MAME_DIR .. "src/lib/formats/vt_dsk.h", - MAME_DIR .. "src/lib/formats/vtech1_dsk.c", - MAME_DIR .. "src/lib/formats/vtech1_dsk.h", MAME_DIR .. "src/lib/formats/wavfile.c", MAME_DIR .. "src/lib/formats/wavfile.h", MAME_DIR .. "src/lib/formats/wd177x_dsk.c", diff --git a/src/emu/bus/vtech/memexp/floppy.c b/src/emu/bus/vtech/memexp/floppy.c index dccba3f09b5..201f91d8a92 100644 --- a/src/emu/bus/vtech/memexp/floppy.c +++ b/src/emu/bus/vtech/memexp/floppy.c @@ -10,7 +10,7 @@ ***************************************************************************/ #include "floppy.h" -#include "formats/vtech1_dsk.h" + //************************************************************************** // DEVICE DEFINITIONS diff --git a/src/lib/formats/vtech1_dsk.c b/src/lib/formats/vtech1_dsk.c deleted file mode 100644 index c0771ea7227..00000000000 --- a/src/lib/formats/vtech1_dsk.c +++ /dev/null @@ -1,41 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/********************************************************************* - - formats/vtech1_dsk.c - - VTech1 disk images - -*********************************************************************/ - -#include - -#include "formats/vtech1_dsk.h" - -static FLOPPY_IDENTIFY( vtech1_dsk_identify ) -{ - *vote = 100; - return FLOPPY_ERROR_SUCCESS; -} - - -static FLOPPY_CONSTRUCT( vtech1_dsk_construct ) -{ - return FLOPPY_ERROR_SUCCESS; -} - -LEGACY_FLOPPY_OPTIONS_START( vtech1_only ) - LEGACY_FLOPPY_OPTION( - vtech1_dsk, - "dsk", - "Laser floppy disk image", - vtech1_dsk_identify, - vtech1_dsk_construct, - NULL, - HEADS([1]) - TRACKS([40]) - SECTORS([16]) - SECTOR_LENGTH([154]) - FIRST_SECTOR_ID([0]) - ) -LEGACY_FLOPPY_OPTIONS_END0 diff --git a/src/lib/formats/vtech1_dsk.h b/src/lib/formats/vtech1_dsk.h deleted file mode 100644 index 338faf452e3..00000000000 --- a/src/lib/formats/vtech1_dsk.h +++ /dev/null @@ -1,18 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/********************************************************************* - - formats/vtech1_dsk.h - - VTech1 disk images - -*********************************************************************/ - -#ifndef VTECH1_DSK_H -#define VTECH1_DSK_H - -#include "flopimg.h" - -LEGACY_FLOPPY_OPTIONS_EXTERN(vtech1_only); - -#endif /* VTECH1_DSK_H */ -- cgit v1.2.3-70-g09d2 From 1c1860499f41efcf7df6fee3adda6d1557c31c35 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Wed, 10 Jun 2015 12:28:33 +0200 Subject: move some legacy formats over to imgtool since it's now the only user --- scripts/src/lib.lua | 4 - scripts/src/tools.lua | 4 + src/lib/formats/coco_dsk.c | 1194 ----------------------------- src/lib/formats/coco_dsk.h | 24 - src/lib/formats/vt_dsk.c | 57 -- src/lib/formats/vt_dsk.h | 18 - src/mess/tools/imgtool/formats/coco_dsk.c | 1194 +++++++++++++++++++++++++++++ src/mess/tools/imgtool/formats/coco_dsk.h | 24 + src/mess/tools/imgtool/formats/vt_dsk.c | 57 ++ src/mess/tools/imgtool/formats/vt_dsk.h | 18 + src/mess/tools/imgtool/modules/amiga.c | 1 - 11 files changed, 1297 insertions(+), 1298 deletions(-) delete mode 100644 src/lib/formats/coco_dsk.c delete mode 100644 src/lib/formats/coco_dsk.h delete mode 100644 src/lib/formats/vt_dsk.c delete mode 100644 src/lib/formats/vt_dsk.h create mode 100644 src/mess/tools/imgtool/formats/coco_dsk.c create mode 100644 src/mess/tools/imgtool/formats/coco_dsk.h create mode 100644 src/mess/tools/imgtool/formats/vt_dsk.c create mode 100644 src/mess/tools/imgtool/formats/vt_dsk.h (limited to 'scripts/src/lib.lua') diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index 996478276a6..d081ef6665f 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -197,8 +197,6 @@ project "formats" MAME_DIR .. "src/lib/formats/cgenie_dsk.h", MAME_DIR .. "src/lib/formats/coco_cas.c", MAME_DIR .. "src/lib/formats/coco_cas.h", - MAME_DIR .. "src/lib/formats/coco_dsk.c", - MAME_DIR .. "src/lib/formats/coco_dsk.h", MAME_DIR .. "src/lib/formats/comx35_dsk.c", MAME_DIR .. "src/lib/formats/comx35_dsk.h", MAME_DIR .. "src/lib/formats/concept_dsk.c", @@ -402,8 +400,6 @@ project "formats" MAME_DIR .. "src/lib/formats/vg5k_cas.h", MAME_DIR .. "src/lib/formats/vt_cas.c", MAME_DIR .. "src/lib/formats/vt_cas.h", - MAME_DIR .. "src/lib/formats/vt_dsk.c", - MAME_DIR .. "src/lib/formats/vt_dsk.h", MAME_DIR .. "src/lib/formats/wavfile.c", MAME_DIR .. "src/lib/formats/wavfile.h", MAME_DIR .. "src/lib/formats/wd177x_dsk.c", diff --git a/scripts/src/tools.lua b/scripts/src/tools.lua index 4f58b12d641..55f966eed2e 100644 --- a/scripts/src/tools.lua +++ b/scripts/src/tools.lua @@ -805,6 +805,10 @@ files { MAME_DIR .. "src/mess/tools/imgtool/imgterrs.c", MAME_DIR .. "src/mess/tools/imgtool/imghd.c", MAME_DIR .. "src/mess/tools/imgtool/charconv.c", + MAME_DIR .. "src/mess/tools/imgtool/formats/vt_dsk.c", + MAME_DIR .. "src/mess/tools/imgtool/formats/vt_dsk.h", + MAME_DIR .. "src/mess/tools/imgtool/formats/coco_dsk.c", + MAME_DIR .. "src/mess/tools/imgtool/formats/coco_dsk.h", MAME_DIR .. "src/mess/tools/imgtool/modules/amiga.c", MAME_DIR .. "src/mess/tools/imgtool/modules/macbin.c", MAME_DIR .. "src/mess/tools/imgtool/modules/rsdos.c", diff --git a/src/lib/formats/coco_dsk.c b/src/lib/formats/coco_dsk.c deleted file mode 100644 index 1fa8c09ac22..00000000000 --- a/src/lib/formats/coco_dsk.c +++ /dev/null @@ -1,1194 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/********************************************************************* - - formats/coco_dsk.c - - Tandy Color Computer / Dragon disk images - -*********************************************************************/ - -#include -#include -#include - -#include "formats/coco_dsk.h" -#include "formats/basicdsk.h" -#include "imageutl.h" -#include "coretmpl.h" - -/* ----------------------------------------------------------------------- - * JVC (Jeff Vavasour CoCo) format - * - * Used by Jeff Vavasour's CoCo Emulators - * - * Documentation taken from Tim Linder's web site: - * http://home.netcom.com/~tlindner/JVC.html - * - * A. Header length - * The header length is determined by the file length modulo 256: - * headerSize = fileLength % 256; - * This means that the header is variable length and the minimum size - * is zero bytes, and the maximum size of 255 bytes. - * - * B. Header - * Here is a description of the header bytes: - * Byte Offset Description Default - * ----------- ----------------- ------- - * 0 Sectors per track 18 - * 1 Side count 1 - * 2 Sector size code 1 - * 3 First sector ID 1 - * 4 Sector attribute flag 0 - * - * If the sector attribute flag is zero then the track count is determined - * by the formula: - * - * (fileLength - headerSize) / (sectorsPerTrack * (128 << - * sectorSizeCode)) / sideCount - * - * If the sector attribute flag is non zero then the track count is - * determined by the more complex formula: - * - * (fileLength - headerSize) / (sectorsPerTrack * ((128 << - * sectorSizeCode) + 1) ) / sideCount - * - * If the length of the header is to short to contain the geometry desired, - * then the default values are assumed. If the header length is zero the all - * of the geometry is assumed. When creating disk images it is desirable to - * make the header length as short as possible. The header should only be - * used to deviate from the default values. - * - * The sector data begins immediately after the header. If the header length - * is zero then the sector data is at the beginning file. - * - * C. Sectors per track - * This is the number of sectors per track (ones based). A value of 18 - * means there are 18 sectors per track - * - * D. Side Count - * This is the number of sides in the disk image. Values of 1 or 2 are - * acceptable. If there are two sides then the tracks are interleaved. - * The first track in the image file is track zero side 1, the second - * track in the image file is track zero side 2. - * - * E. Sector size - * The is the same value that is stored in the wd179x ID field to - * determine sector size: - * - * 0x00 128 bytes - * 0x01 256 bytes - * 0x02 512 bytes - * 0x03 1024 bytes - * - * Other values are undefined. Every sector in the disk image must be the - * same size. - * - * F. First sector ID - * This determines the first sector ID for each track. Each successive - * sector adds one to the previous ID. If the first sector ID is 1, then - * the second sector has an ID of 2, and the third has an ID of 3. - * - * G. Sector Attribute Flag - * If this byte is non zero, then each sector contains an additional - * byte prepended to the sector data. If the attribute flag is zero then - * there are no extra bytes in front of the sector data. - * - * H. Sector attribute byte - * This byte is put at the beginning of every sector if the header flag - * is turned on. The information this byte contains is the same as the - * status register (of the wd179x) would contain when a 'Read Sector' - * command was issued. The bit fields are defined as: - * - * Bit position: - * --------------- - * 7 6 5 4 3 2 1 0 - * | | | | | | | | - * | | | | | | | +--- Not used. Set to zero. - * | | | | | | +----- Not used. Set to zero. - * | | | | | +------- Not used. Set to zero. - * | | | | +--------- Set on CRC error. - * | | | +----------- Set if sector not found. - * | | +------------- Record type: 1 - Deleted Data Mark, 0 - Data Mark. - * | +--------------- Not Used. Set to zero. - * +----------------- Not Used. Set to zero. - * - * ----------------------------------------------------------------------- */ - -static int coco_jvc_decode_header(floppy_image_legacy *floppy, UINT64 size, - struct basicdsk_geometry *geometry) -{ - UINT8 header[256]; - UINT8 sector_attribute_flag; - UINT16 physical_bytes_per_sector; - UINT32 header_size, file_size; - struct basicdsk_geometry dummy_geometry; - - if (geometry) - memset(geometry, 0, sizeof(*geometry)); - else - geometry = &dummy_geometry; - - if (size > 0xFFFFFFFF) - return -1; - file_size = (UINT32) size; - - /* read the header */ - header_size = (UINT32) file_size % 0x100; - floppy_image_read(floppy, header, 0, header_size); - geometry->offset = header_size; - - /* byte offset 0 - sectors per track */ - geometry->sectors = (header_size > 0) ? header[0] : 18; - if (geometry->sectors <= 0) - return -1; - - /* byte offset 1 - side count */ - geometry->heads = (header_size > 1) ? header[1] : 1; - if (geometry->heads <= 0) - return -1; - - /* byte offset 2 - sector size code */ - geometry->sector_length = 128 << ((header_size > 2) ? header[2] : 1); - if (geometry->sector_length <= 0) - return -1; - - /* byte offset 3 - first sector ID */ - geometry->first_sector_id = (header_size > 3) ? header[3] : 1; - - /* byte offset 4 - sector attribute flag */ - sector_attribute_flag = (header_size > 4) ? header[4] : 0; - if (sector_attribute_flag != 0) - return -1; /* we do not support sector attribute flags */ - - physical_bytes_per_sector = geometry->sector_length; - if (sector_attribute_flag) - physical_bytes_per_sector++; - - geometry->tracks = (file_size - header_size) / geometry->sectors / geometry->heads / physical_bytes_per_sector; - - /* do we have an oddball size? reject this file if not */ - if ((file_size - header_size) % physical_bytes_per_sector) - return -1; - - /* minimum of 35 tracks; support degenerate JVC files */ - if (geometry->tracks < 35) - geometry->tracks = 35; - - return 0; -} - - - -static FLOPPY_IDENTIFY(coco_jvc_identify) -{ - UINT64 size; - size = floppy_image_size(floppy); - *vote = coco_jvc_decode_header(floppy, size, NULL) ? 0 : 100; - return FLOPPY_ERROR_SUCCESS; -} - - - -static FLOPPY_CONSTRUCT(coco_jvc_construct) -{ - struct basicdsk_geometry geometry; - UINT8 header[5]; - size_t header_size; - - if (params) - { - /* create */ - memset(&geometry, 0, sizeof(geometry)); - geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); - geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); - geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); - geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); - - header[0] = (UINT8) geometry.sectors; - header[1] = (UINT8) geometry.heads; - header[2] = (UINT8) compute_log2(geometry.sector_length) - 7; - header[3] = (UINT8) geometry.first_sector_id; - header[4] = 0; - - /* now that we have the header computed, figure out the header size */ - header_size = 0; - if (header[0] != 18) - header_size = 1; - if (header[1] != 1) - header_size = 2; - if (header[2] != 1) - header_size = 3; - if (header[3] != 1) - header_size = 4; - if (header[4] != 0) - header_size = 5; - - geometry.offset = header_size; - - floppy_image_write(floppy, header, 0, header_size); - } - else - { - /* load */ - if (coco_jvc_decode_header(floppy, floppy_image_size(floppy), &geometry)) - return FLOPPY_ERROR_INVALIDIMAGE; - } - return basicdsk_construct(floppy, &geometry); -} - - -/* ----------------------------------------------------------------------- - * OS-9 file format - * - * This file format is largely a hack because there are a large amount of - * disk images that do not have geometry image separate from the disk image - * itself. So we support OS-9 images with are simply basic disks whose - * geometry is determined by the disk image. - * - * OS-9 images identified by an LSN; which are simply blocks of 256 bytes - * - * LSN0 - * Byte size use - * $00 3 sectors on disk - * $03 1 track size in sectors - * $04 2 bytes in allocation bit map; typically 1bit/sector so for - * 35 tracks of 18 sectors each that's $4E (single sided disk) - * 40 tracks per side, 18 sectors each = $B4 - * $06 2 sectors per bit in allocation map; normally 1 - * $08 3 LSN of root directory; normally 2 but depends on size of - * $04 value - * $0B 2 owner's user number; normally 0 - * $0D 1 disk attributes; normally $FF - * $0E 2 psuedo random number for identification - * $10 1 disk format; typical is 3 - * %00000001 0=single side 1=double side - * %00000010 0=single density (non Coco) 1=double density - * %00000100 0=48tracks/inch 1=96tracks/inch - * $11 2 sectors per track; normal is $12 skip several not needed - * for Format - * $1A 5 date of creation Y:M:D:H:M - * $1F 32 ASCII name of disk, last letter has $80 added to it, - * the full 32 bytes do not need to be used. - * - * Allocation bit map, fill with zeros and set bits from low to high as - * sectors are used. So, for a fresh disk sectors LSN0,LSN1,LSN2, and LSN3 - * will be in use so the first byte will be $FF $C0 and all others - * in the map are $00 - * - * Root directory LSN2 - * Byte size use - * $00 1 attributes will be $BF - * $01 2 owners ID will be $0000 - * $03 5 date last modified will be creation date Y:M:D:H:M - * $08 1 link count; set to $02 - * $09 4 file size in bytes, set to $40 - * $0D 3 date created Y:M:D - * $10 3 block LSN set to current sector number+1 ie $03 in this case - * $13 2 size in sectors of directory block, set to $07 - * All other bytes in sector set to $00 - * LSN3 first sector of directory with names - * Fill sector with all $00 and then set listed bytes - * $00 2 value $2EAE which is .. with last byte+$80 - * $1F 1 value $02 LSN for start of this directory as there is - * none higher in tree - * $20 1 value $AE which is . with $80 added - * $3F 1 value $02 LSN for start of this directory - * ----------------------------------------------------------------------- */ - -static floperr_t coco_os9_readheader(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry) -{ - UINT8 header[0x20]; - int total_sectors; - - floppy_image_read(floppy, header, 0, sizeof(header)); - - total_sectors = (header[0x00] << 16) | (header[0x01] << 8) | header[0x02]; - - memset(geometry, 0, sizeof(*geometry)); - geometry->first_sector_id = 1; - geometry->sector_length = 256; - geometry->sectors = (header[0x11] << 8) + header[0x12]; - geometry->heads = (header[0x10] & 0x01) ? 2 : 1; - - if (!geometry->sectors) - return FLOPPY_ERROR_INVALIDIMAGE; - - geometry->tracks = total_sectors / geometry->sectors / geometry->heads; - - if (total_sectors != geometry->tracks * geometry->sectors * geometry->heads) - return FLOPPY_ERROR_INVALIDIMAGE; - - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t coco_os9_post_format(floppy_image_legacy *floppy, option_resolution *params) -{ - UINT8 header[0x0400]; - floperr_t err; - time_t t; - struct tm *ltime; - int heads, tracks, sectors, total_sectors; - - heads = option_resolution_lookup_int(params, PARAM_HEADS); - tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - sectors = option_resolution_lookup_int(params, PARAM_SECTORS); - total_sectors = heads * tracks * sectors; - - /* write the initial header */ - time(&t); - ltime = localtime(&t); - - memset(&header, 0, sizeof(header)); - header[0x0000] = (UINT8) (total_sectors >> 16); - header[0x0001] = (UINT8) (total_sectors >> 8); - header[0x0002] = (UINT8) (total_sectors >> 0); - header[0x0003] = (UINT8) sectors; - header[0x0004] = (UINT8) (((total_sectors + 7) / 8) >> 8); - header[0x0005] = (UINT8) (((total_sectors + 7) / 8) >> 0); - header[0x0006] = 0x00; - header[0x0007] = 0x01; - header[0x0008] = 0x00; - header[0x0009] = 0x00; - header[0x000a] = 0x02; - header[0x000b] = 0x00; - header[0x000c] = 0x00; - header[0x000d] = 0xff; - header[0x000e] = floppy_random_byte(floppy); - header[0x000f] = floppy_random_byte(floppy); - header[0x0010] = (heads == 2) ? 3 : 2; - header[0x0011] = (UINT8) (sectors >> 8); - header[0x0012] = (UINT8) (sectors >> 0); - header[0x001A] = (UINT8) ltime->tm_year; - header[0x001B] = (UINT8) ltime->tm_mon + 1; - header[0x001C] = (UINT8) ltime->tm_mday; - header[0x001D] = (UINT8) ltime->tm_hour; - header[0x001E] = (UINT8) ltime->tm_min; - header[0x001F] = 0xA0; - header[0x0100] = 0xFF; - header[0x0101] = 0xC0; - header[0x0200] = 0xBF; - header[0x0201] = 0x00; - header[0x0202] = 0x00; - header[0x0203] = (UINT8) ltime->tm_year; - header[0x0204] = (UINT8) ltime->tm_mon + 1; - header[0x0205] = (UINT8) ltime->tm_mday; - header[0x0206] = (UINT8) ltime->tm_hour; - header[0x0207] = (UINT8) ltime->tm_min; - header[0x0208] = 0x02; - header[0x0209] = 0x00; - header[0x020A] = 0x00; - header[0x020B] = 0x00; - header[0x020C] = 0x40; - header[0x020D] = (UINT8) (ltime->tm_year % 100); - header[0x020E] = (UINT8) ltime->tm_mon; - header[0x020F] = (UINT8) ltime->tm_mday; - header[0x0210] = 0x00; - header[0x0211] = 0x00; - header[0x0212] = 0x03; - header[0x0213] = 0x00; - header[0x0214] = 0x07; - header[0x0300] = 0x2E; - header[0x0301] = 0xAE; - header[0x031F] = 0x02; - header[0x0320] = 0xAE; - header[0x033F] = 0x02; - - if (total_sectors % 8) - header[0x0100 + (total_sectors / 8)] = 0xFF >> (total_sectors % 8); - - err = floppy_write_sector(floppy, 0, 0, 1, 0, &header[0x0000], 256, 0); - if (err) - return err; - - err = floppy_write_sector(floppy, 0, 0, 2, 0, &header[0x0100], 256, 0); - if (err) - return err; - - err = floppy_write_sector(floppy, 0, 0, 3, 0, &header[0x0200], 256, 0); - if (err) - return err; - - err = floppy_write_sector(floppy, 0, 0, 4, 0, &header[0x0300], 256, 0); - if (err) - return err; - - return FLOPPY_ERROR_SUCCESS; -} - - - -static FLOPPY_IDENTIFY(coco_os9_identify) -{ - struct basicdsk_geometry geometry; - *vote = coco_os9_readheader(floppy, &geometry) ? 0 : 100; - return FLOPPY_ERROR_SUCCESS; -} - - - -static FLOPPY_CONSTRUCT(coco_os9_construct) -{ - floperr_t err; - struct basicdsk_geometry geometry; - - if (params) - { - /* create */ - memset(&geometry, 0, sizeof(geometry)); - geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); - geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); - geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); - geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); - } - else - { - /* open */ - err = coco_os9_readheader(floppy, &geometry); - if (err) - return err; - } - - /* actually construct the image */ - err = basicdsk_construct(floppy, &geometry); - floppy_callbacks(floppy)->post_format = coco_os9_post_format; - return err; -} - - - -/* ----------------------------------------------------------------------- - * VDK file format - * - * Used by Paul Burgin's PC-Dragon emulator - * - * Offset Bytes Field Description - * ------ ----- ------------ ----------- - * 0 1 magic1 Signature byte 1 ('d') - * 1 1 magic2 Signature byte 2 ('k') - * 2 2 header_len Total header length (little endian) - * 4 1 ver_actual Version of the VDK format (0x10) - * 5 1 ver_compat Backwards compatibility version (0x10) - * 6 1 source_id Identify of the file source - * 7 1 source_ver Version of the file source - * 8 1 tracks Number of tracks - * 9 1 sides Number of sides (1-2) - * 10 1 flags Various flags - * bit 0: Write protect - * bit 1: A Lock - * bit 2: F Lock - * bit 3: Disk set - * 11 1 compression Compression flags (bits 0-2) and name length - * ----------------------------------------------------------------------- */ - - - -static int coco_vdk_decode_header(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry) -{ - UINT8 header[12]; - UINT8 heads, tracks, sectors; - UINT16 sector_length, offset; - UINT64 size; - - size = floppy_image_size(floppy); - - floppy_image_read(floppy, header, 0, sizeof(header)); - - if (header[0] != 'd') - return -1; - if (header[1] != 'k') - return -1; - if (header[5] != 0x10) - return -1; - if (header[11] & 0x07) - return -1; - - heads = header[9]; - tracks = header[8]; - sectors = 18; - sector_length = 0x100; - - offset = header[3] * 0x100 + header[2]; - - if (size != ((UINT32) heads * tracks * sectors * sector_length + offset)) - return -1; - - if (geometry) - { - memset(geometry, 0, sizeof(*geometry)); - geometry->heads = heads; - geometry->tracks = tracks; - geometry->sectors = sectors; - geometry->first_sector_id = 1; - geometry->sector_length = sector_length; - geometry->offset = offset; - } - return 0; -} - - - -static FLOPPY_IDENTIFY(coco_vdk_identify) -{ - *vote = coco_vdk_decode_header(floppy, NULL) ? 0 : 100; - return FLOPPY_ERROR_SUCCESS; -} - - - -static FLOPPY_CONSTRUCT(coco_vdk_construct) -{ - struct basicdsk_geometry geometry; - UINT8 header[12]; - - if (params) - { - /* create */ - memset(&geometry, 0, sizeof(geometry)); - geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); - geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - geometry.sectors = 18; - geometry.first_sector_id = 1; - geometry.sector_length = 256; - geometry.offset = sizeof(header); - - memset(&header, 0, sizeof(header)); - header[0] = 'd'; - header[1] = 'k'; - header[2] = (UINT8) (sizeof(header) >> 0); - header[3] = (UINT8) (sizeof(header) >> 8); - header[4] = 0x10; - header[5] = 0x10; - header[8] = (UINT8) geometry.tracks; - header[9] = (UINT8) geometry.heads; - - floppy_image_write(floppy, header, 0, sizeof(header)); - } - else - { - /* load */ - if (coco_vdk_decode_header(floppy, &geometry)) - return FLOPPY_ERROR_INVALIDIMAGE; - } - return basicdsk_construct(floppy, &geometry); -} - - - -/* ----------------------------------------------------------------------- - * DMK file format - * - * David M. Keil's disk image format is aptly called an 'on disk' image - * format. This means that whatever written to the disk is enocded into - * the image file. IDAMS, sector headers, traling CRCs, and intra sector - * spacing. * - * - * HEADER DESCRIPTION: - * - * Offset Bytes Field Description - * ------ ----- ------------ ----------- - * 0 1 write_prot 0xff = Writed Protected, 0x00 = R/W - * 1 1 tracks Number of tracks - * 2 2 track_length Bytes per track (little endian) - * 4 1 disk_options Miscellaneous flags - * bit 0-3: Unused - * bit 4: 1=single sided 0=dbl - * bit 5: Unused - * bit 6: Single density? - * bit 6: Ignore density flags? - * 5 7 reserved Reserved for future use - * 12 4 real_disk_code If this is 0x12345678 (little endian) - * then access a real disk drive - * (unsupported) - * - * Each track begins with a track TOC, consisting of 64 little endian 16-bit - * integers. Each integer has the following format: - * bit 0-13: Offset from beginning of track to 'FE' byte of IDAM - * Note these are always sorted from first to last. All empty - * entries are 0x00 - * bit 14: Undefined (reserved) - * bit 15: Sector double density (0=SD 1=DD) - * ----------------------------------------------------------------------- */ - -struct dmk_tag -{ - int heads; - int tracks; - UINT32 track_size; -}; - -#define DMK_HEADER_LEN 16 -#define DMK_TOC_LEN 64 -#define DMK_IDAM_LENGTH 7 -#define DMK_DATA_GAP 80 -#define DMK_LEAD_IN 32 -#define DMK_EXTRA_TRACK_LENGTH 156 - -#define dmk_idam_type(x) (x)[0] -#define dmk_idam_track(x) (x)[1] -#define dmk_idam_side(x) (x)[2] -#define dmk_idam_sector(x) (x)[3] -#define dmk_idam_sectorlength(x) (x)[4] -#define dmk_idam_crc(x) (((x)[5] << 8) + (x)[6]) -#define dmk_idam_set_crc(x, crc) (x)[5] = ((crc) >> 8); (x)[6] = ((crc) >> 0); - - -static struct dmk_tag *get_dmk_tag(floppy_image_legacy *floppy) -{ - return (dmk_tag *)floppy_tag(floppy); -} - - -static floperr_t coco_dmk_get_offset(floppy_image_legacy *floppy, int head, int track, UINT64 *offset) -{ - struct dmk_tag *tag = get_dmk_tag(floppy); - - if ((head < 0) || (head >= tag->heads) || (track < 0) || (track >= tag->tracks)) - return FLOPPY_ERROR_SEEKERROR; - - *offset = track; - *offset *= tag->heads; - *offset += head; - *offset *= tag->track_size; - *offset += DMK_HEADER_LEN; - return FLOPPY_ERROR_SUCCESS; -} - - - -static UINT32 coco_dmk_min_track_size(int sectors, int sector_length) -{ - int sector_physical_length; - sector_physical_length = 8 + 3 + DMK_IDAM_LENGTH + 22 + 12 + 3 + 1 + sector_length + 2 + 24; - return DMK_TOC_LEN * 2 + DMK_LEAD_IN + (sectors * sector_physical_length); -} - - - -static floperr_t coco_dmk_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen) -{ - floperr_t err; - UINT64 track_offset; - - err = coco_dmk_get_offset(floppy, head, track, &track_offset); - if (err) - return err; - - floppy_image_read(floppy, buffer, offset + track_offset, buflen); - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t coco_dmk_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen) -{ - floperr_t err; - UINT64 track_offset; - - err = coco_dmk_get_offset(floppy, head, track, &track_offset); - if (err) - return err; - - floppy_image_write(floppy, buffer, offset + track_offset, buflen); - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t coco_dmk_get_track_data_offset(floppy_image_legacy *floppy, int head, int track, UINT64 *offset) -{ - *offset = DMK_TOC_LEN + 1; - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t coco_dmk_format_track(floppy_image_legacy *floppy, int head, int track, option_resolution *params) -{ - int sectors; - int sector_length; - int interleave; - int first_sector_id; - floperr_t err; - int physical_sector; - int logical_sector; - int track_position; - UINT16 idam_offset; - UINT16 crc; - UINT8 *track_data; - void *track_data_v; - UINT32 max_track_size; - std::vector sector_map; - - sectors = option_resolution_lookup_int(params, PARAM_SECTORS); - sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); - interleave = option_resolution_lookup_int(params, PARAM_INTERLEAVE); - first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); - - max_track_size = get_dmk_tag(floppy)->track_size; - - if (sectors > DMK_TOC_LEN) - { - err = FLOPPY_ERROR_INTERNAL; - goto done; - } - - if (max_track_size < coco_dmk_min_track_size(sectors, sector_length)) - { - err = FLOPPY_ERROR_NOSPACE; - goto done; - } - - err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, NULL); - if (err) - goto done; - track_data = (UINT8 *) track_data_v; - - /* set up sector map */ - memset(§or_map[0], 0xff, sectors*sizeof(int)); - - physical_sector = 0; - for (logical_sector = 0; logical_sector < sectors; logical_sector++) - { - while(sector_map[physical_sector] >= 0) - { - physical_sector++; - physical_sector %= sectors; - } - - sector_map[physical_sector] = logical_sector + first_sector_id; - physical_sector += interleave + 1; - physical_sector %= sectors; - } - - /* set up track table of contents */ - physical_sector = 0; - track_position = DMK_TOC_LEN * 2 + DMK_LEAD_IN; - while(physical_sector < DMK_TOC_LEN) - { - if (physical_sector >= sectors) - { - /* no more sectors */ - idam_offset = 0; - } - else - { - /* this is a sector */ - logical_sector = sector_map[physical_sector]; - - /* write the sector */ - memset(&track_data[track_position], 0x00, 8); - track_position += 8; - - memset(&track_data[track_position], 0xA1, 3); - track_position += 3; - - idam_offset = track_position | 0x8000; - dmk_idam_type( &track_data[track_position]) = 0xFE; - dmk_idam_track( &track_data[track_position]) = track; - dmk_idam_side( &track_data[track_position]) = head; - dmk_idam_sector( &track_data[track_position]) = logical_sector; - dmk_idam_sectorlength( &track_data[track_position]) = compute_log2(sector_length / 128); - crc = ccitt_crc16(0xcdb4, &track_data[track_position], DMK_IDAM_LENGTH - 2); - dmk_idam_set_crc( &track_data[track_position], crc); - track_position += DMK_IDAM_LENGTH; - - memset(&track_data[track_position], 0x4E, 22); - track_position += 22; - - memset(&track_data[track_position], 0x00, 12); - track_position += 12; - - memset(&track_data[track_position], 0xA1, 3); - track_position += 3; - - /* write sector body */ - track_data[track_position] = 0xFB; - memset(&track_data[track_position + 1], floppy_get_filler(floppy), sector_length); - crc = ccitt_crc16(0xcdb4, &track_data[track_position], sector_length + 1); - track_data[track_position + sector_length + 1] = (UINT8) (crc >> 8); - track_data[track_position + sector_length + 2] = (UINT8) (crc >> 0); - track_position += sector_length + 3; - - /* write sector footer */ - memset(&track_data[track_position], 0x4E, 24); - track_position += 24; - } - - /* write the TOC entry */ - track_data[physical_sector * 2 + 0] = (UINT8) (idam_offset >> 0); - track_data[physical_sector * 2 + 1] = (UINT8) (idam_offset >> 8); - - physical_sector++; - } - - /* write track lead in */ - memset(&track_data[physical_sector * 2], 0x4e, DMK_LEAD_IN); - - /* write track footer */ - assert(max_track_size >= (UINT32)track_position); - memset(&track_data[track_position], 0x4e, max_track_size - track_position); - -done: - return err; -} - - - -static int coco_dmk_get_heads_per_disk(floppy_image_legacy *floppy) -{ - return get_dmk_tag(floppy)->heads; -} - - - -static int coco_dmk_get_tracks_per_disk(floppy_image_legacy *floppy) -{ - return get_dmk_tag(floppy)->tracks; -} - - - -static UINT32 coco_dmk_get_track_size(floppy_image_legacy *floppy, int head, int track) -{ - return get_dmk_tag(floppy)->track_size; -} - - - -static floperr_t coco_dmk_seek_sector_in_track(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, int dirtify, UINT8 **sector_data, UINT32 *sector_length) -{ - struct dmk_tag *tag = get_dmk_tag(floppy); - floperr_t err; - UINT32 idam_offset = 0; - UINT16 calculated_crc; - size_t i; - size_t offs; - int state; - UINT8 *track_data; - void *track_data_v; - size_t track_length; - size_t sec_len; - - err = floppy_load_track(floppy, head, track, dirtify, &track_data_v, &track_length); - if (err) - return err; - track_data = (UINT8 *) track_data_v; - - /* search for matching IDAM */ - for (i = 0; i < DMK_TOC_LEN; i++) - { - idam_offset = track_data[i * 2 + 1]; - idam_offset <<= 8; - idam_offset |= track_data[i * 2 + 0]; - idam_offset &= 0x3FFF; - - if (idam_offset == 0) - { - /* we've reached the end of the road */ - i = DMK_TOC_LEN; - break; - } - - if ((idam_offset + DMK_IDAM_LENGTH) >= tag->track_size) - continue; - - calculated_crc = ccitt_crc16(0xCDB4, &track_data[idam_offset], DMK_IDAM_LENGTH - 2); - - if (calculated_crc == dmk_idam_crc(&track_data[idam_offset])) - { - if (sector_is_index) - { - /* the sector is indexed; decrement the index and go */ - if (sector-- == 0) - break; - } - else - { - /* check IDAM integrity and check for matching sector */ - if (sector == dmk_idam_sector(&track_data[idam_offset]) -/* && (track == dmk_idam_track(&track_data[idam_offset])) */ -/* && (head == dmk_idam_side(&track_data[idam_offset])) */ - ) - break; - } - } - } - - if (i >= DMK_TOC_LEN) - return FLOPPY_ERROR_SEEKERROR; - - /* we found a matching sector ID */ - state = 0; - offs = idam_offset + DMK_IDAM_LENGTH; - - /* find pattern 0xA1A1FB; this represents the start of a data sector */ - for (i = 0; i < DMK_DATA_GAP; i++) - { - /* overflowing the track? */ - if ((i + offs) >= tag->track_size) - return FLOPPY_ERROR_SEEKERROR; - - if (track_data[offs + i] == 0xA1) - state++; - else if ((track_data[offs + i] == 0xFB) && state) - break; - else - state = 0; - } - if (i >= DMK_DATA_GAP) - return FLOPPY_ERROR_SEEKERROR; - - offs += i + 1; - sec_len = 128 << dmk_idam_sectorlength(&track_data[idam_offset]); - - if ((offs + sec_len) > track_length) - return FLOPPY_ERROR_INVALIDIMAGE; - - if (sector_data) - *sector_data = track_data + offs; - if (sector_length) - *sector_length = sec_len; - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t coco_dmk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length) -{ - return coco_dmk_seek_sector_in_track(floppy, head, track, sector, FALSE, FALSE, NULL, sector_length); -} - - - -static floperr_t coco_dmk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags) -{ - floperr_t err; - UINT32 idam_offset; - const UINT8 *track_data; - void *track_data_v; - - if (sector_index*2 >= DMK_TOC_LEN) - return FLOPPY_ERROR_SEEKERROR; - - err = floppy_load_track(floppy, head, track, FALSE, &track_data_v, NULL); - if (err) - return err; - track_data = (UINT8 *) track_data_v; - - idam_offset = track_data[sector_index * 2 + 1]; - idam_offset <<= 8; - idam_offset |= track_data[sector_index * 2 + 0]; - idam_offset &= 0x3FFF; - - if (idam_offset == 0) - return FLOPPY_ERROR_SEEKERROR; - - if (cylinder) - *cylinder = dmk_idam_track(&track_data[idam_offset]); - if (side) - *side = dmk_idam_side(&track_data[idam_offset]); - if (sector) - *sector = dmk_idam_sector(&track_data[idam_offset]); - if (sector_length) - *sector_length = 128 << dmk_idam_sectorlength(&track_data[idam_offset]); - if (flags) - /* TODO: read DAM or DDAM and determine flags */ - *flags = 0; - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t internal_coco_dmk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen) -{ - floperr_t err; - UINT32 sector_length; - UINT16 crc_on_disk; - UINT16 calculated_crc; - UINT8 *sector_data; - - err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, FALSE, §or_data, §or_length); - if (err) - return err; - - crc_on_disk = sector_data[sector_length + 0]; - crc_on_disk <<= 8; - crc_on_disk += sector_data[sector_length + 1]; - - calculated_crc = ccitt_crc16(0xE295, sector_data, sector_length); - if (calculated_crc != crc_on_disk) - return FLOPPY_ERROR_INVALIDIMAGE; - - memcpy(buffer, sector_data, MIN(sector_length, buflen)); - - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t internal_coco_dmk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam) -{ - floperr_t err; - UINT32 sector_length; - UINT8 *sector_data; - UINT16 crc; - - err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, TRUE, §or_data, §or_length); - if (err) - return err; - - if (buflen > sector_length) - return FLOPPY_ERROR_INTERNAL; - - memcpy(sector_data, buffer, buflen); - - crc = ccitt_crc16(0xE295, sector_data, sector_length); - sector_data[sector_length + 0] = crc >> 8; - sector_data[sector_length + 1] = crc >> 0; - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t coco_dmk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen) -{ - return internal_coco_dmk_read_sector(floppy, head, track, sector, FALSE, buffer, buflen); -} - -static floperr_t coco_dmk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam) -{ - return internal_coco_dmk_write_sector(floppy, head, track, sector, FALSE, buffer, buflen, ddam); -} - -static floperr_t coco_dmk_read_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen) -{ - return internal_coco_dmk_read_sector(floppy, head, track, sector, TRUE, buffer, buflen); -} - -static floperr_t coco_dmk_write_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam) -{ - return internal_coco_dmk_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam); -} - - - -static void coco_dmk_interpret_header(floppy_image_legacy *floppy, int *heads, int *tracks, int *track_size) -{ - UINT8 header[DMK_HEADER_LEN]; - - floppy_image_read(floppy, header, 0, DMK_HEADER_LEN); - - if (tracks) - *tracks = header[1]; - if (heads) - *heads = (header[4] & 0x10) ? 1 : 2; - if (track_size) - *track_size = ((int) header[3]) * 0x100 + header[2]; -} - - - -FLOPPY_CONSTRUCT(coco_dmk_construct) -{ - struct FloppyCallbacks *callbacks; - struct dmk_tag *tag; - UINT8 header[DMK_HEADER_LEN]; - int heads, tracks, track_size, sectors, sector_length; - - if (params) - { - heads = option_resolution_lookup_int(params, PARAM_HEADS); - tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - sectors = option_resolution_lookup_int(params, PARAM_SECTORS); - sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); - - track_size = coco_dmk_min_track_size(sectors, sector_length) + DMK_EXTRA_TRACK_LENGTH; - - memset(header, 0, sizeof(header)); - header[1] = tracks; - header[2] = track_size >> 0; - header[3] = track_size >> 8; - header[4] = (heads == 2) ? 0x00 : 0x10; - - floppy_image_write(floppy, header, 0, sizeof(header)); - } - else - { - coco_dmk_interpret_header(floppy, &heads, &tracks, &track_size); - } - - tag = (dmk_tag *)floppy_create_tag(floppy, sizeof(struct dmk_tag)); - if (!tag) - return FLOPPY_ERROR_OUTOFMEMORY; - tag->heads = heads; - tag->track_size = track_size; - tag->tracks = tracks; - - callbacks = floppy_callbacks(floppy); - callbacks->read_track = coco_dmk_read_track; - callbacks->write_track = coco_dmk_write_track; - callbacks->get_track_data_offset = coco_dmk_get_track_data_offset; - callbacks->format_track = coco_dmk_format_track; - callbacks->get_heads_per_disk = coco_dmk_get_heads_per_disk; - callbacks->get_tracks_per_disk = coco_dmk_get_tracks_per_disk; - callbacks->get_track_size = coco_dmk_get_track_size; - callbacks->get_sector_length = coco_dmk_get_sector_length; - callbacks->get_indexed_sector_info = coco_dmk_get_indexed_sector_info; - callbacks->read_sector = coco_dmk_read_sector; - callbacks->write_sector = coco_dmk_write_sector; - callbacks->read_indexed_sector = coco_dmk_read_indexed_sector; - callbacks->write_indexed_sector = coco_dmk_write_indexed_sector; - - return FLOPPY_ERROR_SUCCESS; -} - - - -FLOPPY_IDENTIFY(coco_dmk_identify) -{ - int heads, tracks, track_size; - UINT64 size, expected_size; - - size = floppy_image_size(floppy); - coco_dmk_interpret_header(floppy, &heads, &tracks, &track_size); - expected_size = DMK_HEADER_LEN + (heads * tracks * track_size); - *vote = (size == expected_size) ? 100 : 0; - return FLOPPY_ERROR_SUCCESS; -} - - - -/* ----------------------------------------------------------------------- */ - -LEGACY_FLOPPY_OPTIONS_START( coco ) - LEGACY_FLOPPY_OPTION( coco_jvc, "dsk", "CoCo JVC disk image", coco_jvc_identify, coco_jvc_construct, NULL, - HEADS([1]-2) - TRACKS([35]-255) - SECTORS(1-[18]-255) - SECTOR_LENGTH(128/[256]/512/1024) - FIRST_SECTOR_ID(0-[1])) - LEGACY_FLOPPY_OPTION( coco_os9, "os9", "CoCo OS-9 disk image", coco_os9_identify, coco_os9_construct, NULL, - HEADS([1]-2) - TRACKS([35]-255) - SECTORS(1-[18]-255) - SECTOR_LENGTH([256]) - FIRST_SECTOR_ID([1])) - LEGACY_FLOPPY_OPTION( coco_vdk, "vdk", "CoCo VDK disk image", coco_vdk_identify, coco_vdk_construct, NULL, - HEADS([1]-2) - TRACKS([35]-255) - SECTORS([18]) - SECTOR_LENGTH([256]) - FIRST_SECTOR_ID([1])) - LEGACY_FLOPPY_OPTION( coco_dmk, "dsk,dmk", "CoCo DMK disk image", coco_dmk_identify, coco_dmk_construct, NULL, - HEADS([1]-2) - TRACKS([35]-255) - SECTORS(1-[18]) - SECTOR_LENGTH(128/[256]/512/1024/2048/4096/8192) - INTERLEAVE(0-[6]-17) - FIRST_SECTOR_ID(0-[1])) -LEGACY_FLOPPY_OPTIONS_END diff --git a/src/lib/formats/coco_dsk.h b/src/lib/formats/coco_dsk.h deleted file mode 100644 index b190390d0cc..00000000000 --- a/src/lib/formats/coco_dsk.h +++ /dev/null @@ -1,24 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/********************************************************************* - - formats/coco_dsk.h - - Tandy Color Computer / Dragon disk images - -*********************************************************************/ - -#ifndef COCO_DSK_H -#define COCO_DSK_H - -#include "flopimg.h" - - -/**************************************************************************/ - -LEGACY_FLOPPY_OPTIONS_EXTERN(coco); - -FLOPPY_IDENTIFY(coco_dmk_identify); -FLOPPY_CONSTRUCT(coco_dmk_construct); - -#endif /* COCO_DSK_H */ diff --git a/src/lib/formats/vt_dsk.c b/src/lib/formats/vt_dsk.c deleted file mode 100644 index 4e75e843d28..00000000000 --- a/src/lib/formats/vt_dsk.c +++ /dev/null @@ -1,57 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/********************************************************************* - - formats/vt_dsk.c - - VTech Laser/VZ disk images - -*********************************************************************/ - -#include -#include -#include -#include "formats/vt_dsk.h" -#include "formats/basicdsk.h" - -static FLOPPY_IDENTIFY(vz_identify) -{ - UINT64 size = floppy_image_size(floppy); - *vote = ((size == 98560) || (size == 99200) || (size == 99184)) ? 100 : 0; - return FLOPPY_ERROR_SUCCESS; -} - -static FLOPPY_CONSTRUCT(vz_construct) -{ - struct basicdsk_geometry geometry; - memset(&geometry, 0, sizeof(geometry)); - - if (params) - { - geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); - geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); - geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); - geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); - } - else - { - geometry.heads = 1; - geometry.tracks = 40; - geometry.sectors = 16; - geometry.first_sector_id = 0; - geometry.sector_length = floppy_image_size(floppy)/geometry.tracks/geometry.sectors; - } - - return basicdsk_construct(floppy, &geometry); -} - - -LEGACY_FLOPPY_OPTIONS_START(vz) - LEGACY_FLOPPY_OPTION(vtech1, "dsk", "Laser/VZ disk image", vz_identify, vz_construct, NULL, - HEADS([1]) - TRACKS([40]) - SECTORS([16]) - SECTOR_LENGTH([154]) - FIRST_SECTOR_ID([0])) -LEGACY_FLOPPY_OPTIONS_END diff --git a/src/lib/formats/vt_dsk.h b/src/lib/formats/vt_dsk.h deleted file mode 100644 index 7b5f1fe4098..00000000000 --- a/src/lib/formats/vt_dsk.h +++ /dev/null @@ -1,18 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/********************************************************************* - - formats/vt_dsk.h - - Tandy Color Computer / Dragon disk images - -*********************************************************************/ - -#ifndef VT_DSK_H -#define VT_DSK_H - -#include "flopimg.h" - -LEGACY_FLOPPY_OPTIONS_EXTERN(vz); - -#endif /* VT_DSK_H */ diff --git a/src/mess/tools/imgtool/formats/coco_dsk.c b/src/mess/tools/imgtool/formats/coco_dsk.c new file mode 100644 index 00000000000..9674ed9de11 --- /dev/null +++ b/src/mess/tools/imgtool/formats/coco_dsk.c @@ -0,0 +1,1194 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/********************************************************************* + + formats/coco_dsk.c + + Tandy Color Computer / Dragon disk images + +*********************************************************************/ + +#include +#include +#include + +#include "formats/coco_dsk.h" +#include "formats/basicdsk.h" +#include "formats/imageutl.h" +#include "coretmpl.h" + +/* ----------------------------------------------------------------------- + * JVC (Jeff Vavasour CoCo) format + * + * Used by Jeff Vavasour's CoCo Emulators + * + * Documentation taken from Tim Linder's web site: + * http://home.netcom.com/~tlindner/JVC.html + * + * A. Header length + * The header length is determined by the file length modulo 256: + * headerSize = fileLength % 256; + * This means that the header is variable length and the minimum size + * is zero bytes, and the maximum size of 255 bytes. + * + * B. Header + * Here is a description of the header bytes: + * Byte Offset Description Default + * ----------- ----------------- ------- + * 0 Sectors per track 18 + * 1 Side count 1 + * 2 Sector size code 1 + * 3 First sector ID 1 + * 4 Sector attribute flag 0 + * + * If the sector attribute flag is zero then the track count is determined + * by the formula: + * + * (fileLength - headerSize) / (sectorsPerTrack * (128 << + * sectorSizeCode)) / sideCount + * + * If the sector attribute flag is non zero then the track count is + * determined by the more complex formula: + * + * (fileLength - headerSize) / (sectorsPerTrack * ((128 << + * sectorSizeCode) + 1) ) / sideCount + * + * If the length of the header is to short to contain the geometry desired, + * then the default values are assumed. If the header length is zero the all + * of the geometry is assumed. When creating disk images it is desirable to + * make the header length as short as possible. The header should only be + * used to deviate from the default values. + * + * The sector data begins immediately after the header. If the header length + * is zero then the sector data is at the beginning file. + * + * C. Sectors per track + * This is the number of sectors per track (ones based). A value of 18 + * means there are 18 sectors per track + * + * D. Side Count + * This is the number of sides in the disk image. Values of 1 or 2 are + * acceptable. If there are two sides then the tracks are interleaved. + * The first track in the image file is track zero side 1, the second + * track in the image file is track zero side 2. + * + * E. Sector size + * The is the same value that is stored in the wd179x ID field to + * determine sector size: + * + * 0x00 128 bytes + * 0x01 256 bytes + * 0x02 512 bytes + * 0x03 1024 bytes + * + * Other values are undefined. Every sector in the disk image must be the + * same size. + * + * F. First sector ID + * This determines the first sector ID for each track. Each successive + * sector adds one to the previous ID. If the first sector ID is 1, then + * the second sector has an ID of 2, and the third has an ID of 3. + * + * G. Sector Attribute Flag + * If this byte is non zero, then each sector contains an additional + * byte prepended to the sector data. If the attribute flag is zero then + * there are no extra bytes in front of the sector data. + * + * H. Sector attribute byte + * This byte is put at the beginning of every sector if the header flag + * is turned on. The information this byte contains is the same as the + * status register (of the wd179x) would contain when a 'Read Sector' + * command was issued. The bit fields are defined as: + * + * Bit position: + * --------------- + * 7 6 5 4 3 2 1 0 + * | | | | | | | | + * | | | | | | | +--- Not used. Set to zero. + * | | | | | | +----- Not used. Set to zero. + * | | | | | +------- Not used. Set to zero. + * | | | | +--------- Set on CRC error. + * | | | +----------- Set if sector not found. + * | | +------------- Record type: 1 - Deleted Data Mark, 0 - Data Mark. + * | +--------------- Not Used. Set to zero. + * +----------------- Not Used. Set to zero. + * + * ----------------------------------------------------------------------- */ + +static int coco_jvc_decode_header(floppy_image_legacy *floppy, UINT64 size, + struct basicdsk_geometry *geometry) +{ + UINT8 header[256]; + UINT8 sector_attribute_flag; + UINT16 physical_bytes_per_sector; + UINT32 header_size, file_size; + struct basicdsk_geometry dummy_geometry; + + if (geometry) + memset(geometry, 0, sizeof(*geometry)); + else + geometry = &dummy_geometry; + + if (size > 0xFFFFFFFF) + return -1; + file_size = (UINT32) size; + + /* read the header */ + header_size = (UINT32) file_size % 0x100; + floppy_image_read(floppy, header, 0, header_size); + geometry->offset = header_size; + + /* byte offset 0 - sectors per track */ + geometry->sectors = (header_size > 0) ? header[0] : 18; + if (geometry->sectors <= 0) + return -1; + + /* byte offset 1 - side count */ + geometry->heads = (header_size > 1) ? header[1] : 1; + if (geometry->heads <= 0) + return -1; + + /* byte offset 2 - sector size code */ + geometry->sector_length = 128 << ((header_size > 2) ? header[2] : 1); + if (geometry->sector_length <= 0) + return -1; + + /* byte offset 3 - first sector ID */ + geometry->first_sector_id = (header_size > 3) ? header[3] : 1; + + /* byte offset 4 - sector attribute flag */ + sector_attribute_flag = (header_size > 4) ? header[4] : 0; + if (sector_attribute_flag != 0) + return -1; /* we do not support sector attribute flags */ + + physical_bytes_per_sector = geometry->sector_length; + if (sector_attribute_flag) + physical_bytes_per_sector++; + + geometry->tracks = (file_size - header_size) / geometry->sectors / geometry->heads / physical_bytes_per_sector; + + /* do we have an oddball size? reject this file if not */ + if ((file_size - header_size) % physical_bytes_per_sector) + return -1; + + /* minimum of 35 tracks; support degenerate JVC files */ + if (geometry->tracks < 35) + geometry->tracks = 35; + + return 0; +} + + + +static FLOPPY_IDENTIFY(coco_jvc_identify) +{ + UINT64 size; + size = floppy_image_size(floppy); + *vote = coco_jvc_decode_header(floppy, size, NULL) ? 0 : 100; + return FLOPPY_ERROR_SUCCESS; +} + + + +static FLOPPY_CONSTRUCT(coco_jvc_construct) +{ + struct basicdsk_geometry geometry; + UINT8 header[5]; + size_t header_size; + + if (params) + { + /* create */ + memset(&geometry, 0, sizeof(geometry)); + geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); + geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); + geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); + geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); + geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); + + header[0] = (UINT8) geometry.sectors; + header[1] = (UINT8) geometry.heads; + header[2] = (UINT8) compute_log2(geometry.sector_length) - 7; + header[3] = (UINT8) geometry.first_sector_id; + header[4] = 0; + + /* now that we have the header computed, figure out the header size */ + header_size = 0; + if (header[0] != 18) + header_size = 1; + if (header[1] != 1) + header_size = 2; + if (header[2] != 1) + header_size = 3; + if (header[3] != 1) + header_size = 4; + if (header[4] != 0) + header_size = 5; + + geometry.offset = header_size; + + floppy_image_write(floppy, header, 0, header_size); + } + else + { + /* load */ + if (coco_jvc_decode_header(floppy, floppy_image_size(floppy), &geometry)) + return FLOPPY_ERROR_INVALIDIMAGE; + } + return basicdsk_construct(floppy, &geometry); +} + + +/* ----------------------------------------------------------------------- + * OS-9 file format + * + * This file format is largely a hack because there are a large amount of + * disk images that do not have geometry image separate from the disk image + * itself. So we support OS-9 images with are simply basic disks whose + * geometry is determined by the disk image. + * + * OS-9 images identified by an LSN; which are simply blocks of 256 bytes + * + * LSN0 + * Byte size use + * $00 3 sectors on disk + * $03 1 track size in sectors + * $04 2 bytes in allocation bit map; typically 1bit/sector so for + * 35 tracks of 18 sectors each that's $4E (single sided disk) + * 40 tracks per side, 18 sectors each = $B4 + * $06 2 sectors per bit in allocation map; normally 1 + * $08 3 LSN of root directory; normally 2 but depends on size of + * $04 value + * $0B 2 owner's user number; normally 0 + * $0D 1 disk attributes; normally $FF + * $0E 2 psuedo random number for identification + * $10 1 disk format; typical is 3 + * %00000001 0=single side 1=double side + * %00000010 0=single density (non Coco) 1=double density + * %00000100 0=48tracks/inch 1=96tracks/inch + * $11 2 sectors per track; normal is $12 skip several not needed + * for Format + * $1A 5 date of creation Y:M:D:H:M + * $1F 32 ASCII name of disk, last letter has $80 added to it, + * the full 32 bytes do not need to be used. + * + * Allocation bit map, fill with zeros and set bits from low to high as + * sectors are used. So, for a fresh disk sectors LSN0,LSN1,LSN2, and LSN3 + * will be in use so the first byte will be $FF $C0 and all others + * in the map are $00 + * + * Root directory LSN2 + * Byte size use + * $00 1 attributes will be $BF + * $01 2 owners ID will be $0000 + * $03 5 date last modified will be creation date Y:M:D:H:M + * $08 1 link count; set to $02 + * $09 4 file size in bytes, set to $40 + * $0D 3 date created Y:M:D + * $10 3 block LSN set to current sector number+1 ie $03 in this case + * $13 2 size in sectors of directory block, set to $07 + * All other bytes in sector set to $00 + * LSN3 first sector of directory with names + * Fill sector with all $00 and then set listed bytes + * $00 2 value $2EAE which is .. with last byte+$80 + * $1F 1 value $02 LSN for start of this directory as there is + * none higher in tree + * $20 1 value $AE which is . with $80 added + * $3F 1 value $02 LSN for start of this directory + * ----------------------------------------------------------------------- */ + +static floperr_t coco_os9_readheader(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry) +{ + UINT8 header[0x20]; + int total_sectors; + + floppy_image_read(floppy, header, 0, sizeof(header)); + + total_sectors = (header[0x00] << 16) | (header[0x01] << 8) | header[0x02]; + + memset(geometry, 0, sizeof(*geometry)); + geometry->first_sector_id = 1; + geometry->sector_length = 256; + geometry->sectors = (header[0x11] << 8) + header[0x12]; + geometry->heads = (header[0x10] & 0x01) ? 2 : 1; + + if (!geometry->sectors) + return FLOPPY_ERROR_INVALIDIMAGE; + + geometry->tracks = total_sectors / geometry->sectors / geometry->heads; + + if (total_sectors != geometry->tracks * geometry->sectors * geometry->heads) + return FLOPPY_ERROR_INVALIDIMAGE; + + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t coco_os9_post_format(floppy_image_legacy *floppy, option_resolution *params) +{ + UINT8 header[0x0400]; + floperr_t err; + time_t t; + struct tm *ltime; + int heads, tracks, sectors, total_sectors; + + heads = option_resolution_lookup_int(params, PARAM_HEADS); + tracks = option_resolution_lookup_int(params, PARAM_TRACKS); + sectors = option_resolution_lookup_int(params, PARAM_SECTORS); + total_sectors = heads * tracks * sectors; + + /* write the initial header */ + time(&t); + ltime = localtime(&t); + + memset(&header, 0, sizeof(header)); + header[0x0000] = (UINT8) (total_sectors >> 16); + header[0x0001] = (UINT8) (total_sectors >> 8); + header[0x0002] = (UINT8) (total_sectors >> 0); + header[0x0003] = (UINT8) sectors; + header[0x0004] = (UINT8) (((total_sectors + 7) / 8) >> 8); + header[0x0005] = (UINT8) (((total_sectors + 7) / 8) >> 0); + header[0x0006] = 0x00; + header[0x0007] = 0x01; + header[0x0008] = 0x00; + header[0x0009] = 0x00; + header[0x000a] = 0x02; + header[0x000b] = 0x00; + header[0x000c] = 0x00; + header[0x000d] = 0xff; + header[0x000e] = floppy_random_byte(floppy); + header[0x000f] = floppy_random_byte(floppy); + header[0x0010] = (heads == 2) ? 3 : 2; + header[0x0011] = (UINT8) (sectors >> 8); + header[0x0012] = (UINT8) (sectors >> 0); + header[0x001A] = (UINT8) ltime->tm_year; + header[0x001B] = (UINT8) ltime->tm_mon + 1; + header[0x001C] = (UINT8) ltime->tm_mday; + header[0x001D] = (UINT8) ltime->tm_hour; + header[0x001E] = (UINT8) ltime->tm_min; + header[0x001F] = 0xA0; + header[0x0100] = 0xFF; + header[0x0101] = 0xC0; + header[0x0200] = 0xBF; + header[0x0201] = 0x00; + header[0x0202] = 0x00; + header[0x0203] = (UINT8) ltime->tm_year; + header[0x0204] = (UINT8) ltime->tm_mon + 1; + header[0x0205] = (UINT8) ltime->tm_mday; + header[0x0206] = (UINT8) ltime->tm_hour; + header[0x0207] = (UINT8) ltime->tm_min; + header[0x0208] = 0x02; + header[0x0209] = 0x00; + header[0x020A] = 0x00; + header[0x020B] = 0x00; + header[0x020C] = 0x40; + header[0x020D] = (UINT8) (ltime->tm_year % 100); + header[0x020E] = (UINT8) ltime->tm_mon; + header[0x020F] = (UINT8) ltime->tm_mday; + header[0x0210] = 0x00; + header[0x0211] = 0x00; + header[0x0212] = 0x03; + header[0x0213] = 0x00; + header[0x0214] = 0x07; + header[0x0300] = 0x2E; + header[0x0301] = 0xAE; + header[0x031F] = 0x02; + header[0x0320] = 0xAE; + header[0x033F] = 0x02; + + if (total_sectors % 8) + header[0x0100 + (total_sectors / 8)] = 0xFF >> (total_sectors % 8); + + err = floppy_write_sector(floppy, 0, 0, 1, 0, &header[0x0000], 256, 0); + if (err) + return err; + + err = floppy_write_sector(floppy, 0, 0, 2, 0, &header[0x0100], 256, 0); + if (err) + return err; + + err = floppy_write_sector(floppy, 0, 0, 3, 0, &header[0x0200], 256, 0); + if (err) + return err; + + err = floppy_write_sector(floppy, 0, 0, 4, 0, &header[0x0300], 256, 0); + if (err) + return err; + + return FLOPPY_ERROR_SUCCESS; +} + + + +static FLOPPY_IDENTIFY(coco_os9_identify) +{ + struct basicdsk_geometry geometry; + *vote = coco_os9_readheader(floppy, &geometry) ? 0 : 100; + return FLOPPY_ERROR_SUCCESS; +} + + + +static FLOPPY_CONSTRUCT(coco_os9_construct) +{ + floperr_t err; + struct basicdsk_geometry geometry; + + if (params) + { + /* create */ + memset(&geometry, 0, sizeof(geometry)); + geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); + geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); + geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); + geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); + geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); + } + else + { + /* open */ + err = coco_os9_readheader(floppy, &geometry); + if (err) + return err; + } + + /* actually construct the image */ + err = basicdsk_construct(floppy, &geometry); + floppy_callbacks(floppy)->post_format = coco_os9_post_format; + return err; +} + + + +/* ----------------------------------------------------------------------- + * VDK file format + * + * Used by Paul Burgin's PC-Dragon emulator + * + * Offset Bytes Field Description + * ------ ----- ------------ ----------- + * 0 1 magic1 Signature byte 1 ('d') + * 1 1 magic2 Signature byte 2 ('k') + * 2 2 header_len Total header length (little endian) + * 4 1 ver_actual Version of the VDK format (0x10) + * 5 1 ver_compat Backwards compatibility version (0x10) + * 6 1 source_id Identify of the file source + * 7 1 source_ver Version of the file source + * 8 1 tracks Number of tracks + * 9 1 sides Number of sides (1-2) + * 10 1 flags Various flags + * bit 0: Write protect + * bit 1: A Lock + * bit 2: F Lock + * bit 3: Disk set + * 11 1 compression Compression flags (bits 0-2) and name length + * ----------------------------------------------------------------------- */ + + + +static int coco_vdk_decode_header(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry) +{ + UINT8 header[12]; + UINT8 heads, tracks, sectors; + UINT16 sector_length, offset; + UINT64 size; + + size = floppy_image_size(floppy); + + floppy_image_read(floppy, header, 0, sizeof(header)); + + if (header[0] != 'd') + return -1; + if (header[1] != 'k') + return -1; + if (header[5] != 0x10) + return -1; + if (header[11] & 0x07) + return -1; + + heads = header[9]; + tracks = header[8]; + sectors = 18; + sector_length = 0x100; + + offset = header[3] * 0x100 + header[2]; + + if (size != ((UINT32) heads * tracks * sectors * sector_length + offset)) + return -1; + + if (geometry) + { + memset(geometry, 0, sizeof(*geometry)); + geometry->heads = heads; + geometry->tracks = tracks; + geometry->sectors = sectors; + geometry->first_sector_id = 1; + geometry->sector_length = sector_length; + geometry->offset = offset; + } + return 0; +} + + + +static FLOPPY_IDENTIFY(coco_vdk_identify) +{ + *vote = coco_vdk_decode_header(floppy, NULL) ? 0 : 100; + return FLOPPY_ERROR_SUCCESS; +} + + + +static FLOPPY_CONSTRUCT(coco_vdk_construct) +{ + struct basicdsk_geometry geometry; + UINT8 header[12]; + + if (params) + { + /* create */ + memset(&geometry, 0, sizeof(geometry)); + geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); + geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); + geometry.sectors = 18; + geometry.first_sector_id = 1; + geometry.sector_length = 256; + geometry.offset = sizeof(header); + + memset(&header, 0, sizeof(header)); + header[0] = 'd'; + header[1] = 'k'; + header[2] = (UINT8) (sizeof(header) >> 0); + header[3] = (UINT8) (sizeof(header) >> 8); + header[4] = 0x10; + header[5] = 0x10; + header[8] = (UINT8) geometry.tracks; + header[9] = (UINT8) geometry.heads; + + floppy_image_write(floppy, header, 0, sizeof(header)); + } + else + { + /* load */ + if (coco_vdk_decode_header(floppy, &geometry)) + return FLOPPY_ERROR_INVALIDIMAGE; + } + return basicdsk_construct(floppy, &geometry); +} + + + +/* ----------------------------------------------------------------------- + * DMK file format + * + * David M. Keil's disk image format is aptly called an 'on disk' image + * format. This means that whatever written to the disk is enocded into + * the image file. IDAMS, sector headers, traling CRCs, and intra sector + * spacing. * + * + * HEADER DESCRIPTION: + * + * Offset Bytes Field Description + * ------ ----- ------------ ----------- + * 0 1 write_prot 0xff = Writed Protected, 0x00 = R/W + * 1 1 tracks Number of tracks + * 2 2 track_length Bytes per track (little endian) + * 4 1 disk_options Miscellaneous flags + * bit 0-3: Unused + * bit 4: 1=single sided 0=dbl + * bit 5: Unused + * bit 6: Single density? + * bit 6: Ignore density flags? + * 5 7 reserved Reserved for future use + * 12 4 real_disk_code If this is 0x12345678 (little endian) + * then access a real disk drive + * (unsupported) + * + * Each track begins with a track TOC, consisting of 64 little endian 16-bit + * integers. Each integer has the following format: + * bit 0-13: Offset from beginning of track to 'FE' byte of IDAM + * Note these are always sorted from first to last. All empty + * entries are 0x00 + * bit 14: Undefined (reserved) + * bit 15: Sector double density (0=SD 1=DD) + * ----------------------------------------------------------------------- */ + +struct dmk_tag +{ + int heads; + int tracks; + UINT32 track_size; +}; + +#define DMK_HEADER_LEN 16 +#define DMK_TOC_LEN 64 +#define DMK_IDAM_LENGTH 7 +#define DMK_DATA_GAP 80 +#define DMK_LEAD_IN 32 +#define DMK_EXTRA_TRACK_LENGTH 156 + +#define dmk_idam_type(x) (x)[0] +#define dmk_idam_track(x) (x)[1] +#define dmk_idam_side(x) (x)[2] +#define dmk_idam_sector(x) (x)[3] +#define dmk_idam_sectorlength(x) (x)[4] +#define dmk_idam_crc(x) (((x)[5] << 8) + (x)[6]) +#define dmk_idam_set_crc(x, crc) (x)[5] = ((crc) >> 8); (x)[6] = ((crc) >> 0); + + +static struct dmk_tag *get_dmk_tag(floppy_image_legacy *floppy) +{ + return (dmk_tag *)floppy_tag(floppy); +} + + +static floperr_t coco_dmk_get_offset(floppy_image_legacy *floppy, int head, int track, UINT64 *offset) +{ + struct dmk_tag *tag = get_dmk_tag(floppy); + + if ((head < 0) || (head >= tag->heads) || (track < 0) || (track >= tag->tracks)) + return FLOPPY_ERROR_SEEKERROR; + + *offset = track; + *offset *= tag->heads; + *offset += head; + *offset *= tag->track_size; + *offset += DMK_HEADER_LEN; + return FLOPPY_ERROR_SUCCESS; +} + + + +static UINT32 coco_dmk_min_track_size(int sectors, int sector_length) +{ + int sector_physical_length; + sector_physical_length = 8 + 3 + DMK_IDAM_LENGTH + 22 + 12 + 3 + 1 + sector_length + 2 + 24; + return DMK_TOC_LEN * 2 + DMK_LEAD_IN + (sectors * sector_physical_length); +} + + + +static floperr_t coco_dmk_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen) +{ + floperr_t err; + UINT64 track_offset; + + err = coco_dmk_get_offset(floppy, head, track, &track_offset); + if (err) + return err; + + floppy_image_read(floppy, buffer, offset + track_offset, buflen); + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t coco_dmk_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen) +{ + floperr_t err; + UINT64 track_offset; + + err = coco_dmk_get_offset(floppy, head, track, &track_offset); + if (err) + return err; + + floppy_image_write(floppy, buffer, offset + track_offset, buflen); + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t coco_dmk_get_track_data_offset(floppy_image_legacy *floppy, int head, int track, UINT64 *offset) +{ + *offset = DMK_TOC_LEN + 1; + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t coco_dmk_format_track(floppy_image_legacy *floppy, int head, int track, option_resolution *params) +{ + int sectors; + int sector_length; + int interleave; + int first_sector_id; + floperr_t err; + int physical_sector; + int logical_sector; + int track_position; + UINT16 idam_offset; + UINT16 crc; + UINT8 *track_data; + void *track_data_v; + UINT32 max_track_size; + std::vector sector_map; + + sectors = option_resolution_lookup_int(params, PARAM_SECTORS); + sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); + interleave = option_resolution_lookup_int(params, PARAM_INTERLEAVE); + first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); + + max_track_size = get_dmk_tag(floppy)->track_size; + + if (sectors > DMK_TOC_LEN) + { + err = FLOPPY_ERROR_INTERNAL; + goto done; + } + + if (max_track_size < coco_dmk_min_track_size(sectors, sector_length)) + { + err = FLOPPY_ERROR_NOSPACE; + goto done; + } + + err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, NULL); + if (err) + goto done; + track_data = (UINT8 *) track_data_v; + + /* set up sector map */ + memset(§or_map[0], 0xff, sectors*sizeof(int)); + + physical_sector = 0; + for (logical_sector = 0; logical_sector < sectors; logical_sector++) + { + while(sector_map[physical_sector] >= 0) + { + physical_sector++; + physical_sector %= sectors; + } + + sector_map[physical_sector] = logical_sector + first_sector_id; + physical_sector += interleave + 1; + physical_sector %= sectors; + } + + /* set up track table of contents */ + physical_sector = 0; + track_position = DMK_TOC_LEN * 2 + DMK_LEAD_IN; + while(physical_sector < DMK_TOC_LEN) + { + if (physical_sector >= sectors) + { + /* no more sectors */ + idam_offset = 0; + } + else + { + /* this is a sector */ + logical_sector = sector_map[physical_sector]; + + /* write the sector */ + memset(&track_data[track_position], 0x00, 8); + track_position += 8; + + memset(&track_data[track_position], 0xA1, 3); + track_position += 3; + + idam_offset = track_position | 0x8000; + dmk_idam_type( &track_data[track_position]) = 0xFE; + dmk_idam_track( &track_data[track_position]) = track; + dmk_idam_side( &track_data[track_position]) = head; + dmk_idam_sector( &track_data[track_position]) = logical_sector; + dmk_idam_sectorlength( &track_data[track_position]) = compute_log2(sector_length / 128); + crc = ccitt_crc16(0xcdb4, &track_data[track_position], DMK_IDAM_LENGTH - 2); + dmk_idam_set_crc( &track_data[track_position], crc); + track_position += DMK_IDAM_LENGTH; + + memset(&track_data[track_position], 0x4E, 22); + track_position += 22; + + memset(&track_data[track_position], 0x00, 12); + track_position += 12; + + memset(&track_data[track_position], 0xA1, 3); + track_position += 3; + + /* write sector body */ + track_data[track_position] = 0xFB; + memset(&track_data[track_position + 1], floppy_get_filler(floppy), sector_length); + crc = ccitt_crc16(0xcdb4, &track_data[track_position], sector_length + 1); + track_data[track_position + sector_length + 1] = (UINT8) (crc >> 8); + track_data[track_position + sector_length + 2] = (UINT8) (crc >> 0); + track_position += sector_length + 3; + + /* write sector footer */ + memset(&track_data[track_position], 0x4E, 24); + track_position += 24; + } + + /* write the TOC entry */ + track_data[physical_sector * 2 + 0] = (UINT8) (idam_offset >> 0); + track_data[physical_sector * 2 + 1] = (UINT8) (idam_offset >> 8); + + physical_sector++; + } + + /* write track lead in */ + memset(&track_data[physical_sector * 2], 0x4e, DMK_LEAD_IN); + + /* write track footer */ + assert(max_track_size >= (UINT32)track_position); + memset(&track_data[track_position], 0x4e, max_track_size - track_position); + +done: + return err; +} + + + +static int coco_dmk_get_heads_per_disk(floppy_image_legacy *floppy) +{ + return get_dmk_tag(floppy)->heads; +} + + + +static int coco_dmk_get_tracks_per_disk(floppy_image_legacy *floppy) +{ + return get_dmk_tag(floppy)->tracks; +} + + + +static UINT32 coco_dmk_get_track_size(floppy_image_legacy *floppy, int head, int track) +{ + return get_dmk_tag(floppy)->track_size; +} + + + +static floperr_t coco_dmk_seek_sector_in_track(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, int dirtify, UINT8 **sector_data, UINT32 *sector_length) +{ + struct dmk_tag *tag = get_dmk_tag(floppy); + floperr_t err; + UINT32 idam_offset = 0; + UINT16 calculated_crc; + size_t i; + size_t offs; + int state; + UINT8 *track_data; + void *track_data_v; + size_t track_length; + size_t sec_len; + + err = floppy_load_track(floppy, head, track, dirtify, &track_data_v, &track_length); + if (err) + return err; + track_data = (UINT8 *) track_data_v; + + /* search for matching IDAM */ + for (i = 0; i < DMK_TOC_LEN; i++) + { + idam_offset = track_data[i * 2 + 1]; + idam_offset <<= 8; + idam_offset |= track_data[i * 2 + 0]; + idam_offset &= 0x3FFF; + + if (idam_offset == 0) + { + /* we've reached the end of the road */ + i = DMK_TOC_LEN; + break; + } + + if ((idam_offset + DMK_IDAM_LENGTH) >= tag->track_size) + continue; + + calculated_crc = ccitt_crc16(0xCDB4, &track_data[idam_offset], DMK_IDAM_LENGTH - 2); + + if (calculated_crc == dmk_idam_crc(&track_data[idam_offset])) + { + if (sector_is_index) + { + /* the sector is indexed; decrement the index and go */ + if (sector-- == 0) + break; + } + else + { + /* check IDAM integrity and check for matching sector */ + if (sector == dmk_idam_sector(&track_data[idam_offset]) +/* && (track == dmk_idam_track(&track_data[idam_offset])) */ +/* && (head == dmk_idam_side(&track_data[idam_offset])) */ + ) + break; + } + } + } + + if (i >= DMK_TOC_LEN) + return FLOPPY_ERROR_SEEKERROR; + + /* we found a matching sector ID */ + state = 0; + offs = idam_offset + DMK_IDAM_LENGTH; + + /* find pattern 0xA1A1FB; this represents the start of a data sector */ + for (i = 0; i < DMK_DATA_GAP; i++) + { + /* overflowing the track? */ + if ((i + offs) >= tag->track_size) + return FLOPPY_ERROR_SEEKERROR; + + if (track_data[offs + i] == 0xA1) + state++; + else if ((track_data[offs + i] == 0xFB) && state) + break; + else + state = 0; + } + if (i >= DMK_DATA_GAP) + return FLOPPY_ERROR_SEEKERROR; + + offs += i + 1; + sec_len = 128 << dmk_idam_sectorlength(&track_data[idam_offset]); + + if ((offs + sec_len) > track_length) + return FLOPPY_ERROR_INVALIDIMAGE; + + if (sector_data) + *sector_data = track_data + offs; + if (sector_length) + *sector_length = sec_len; + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t coco_dmk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length) +{ + return coco_dmk_seek_sector_in_track(floppy, head, track, sector, FALSE, FALSE, NULL, sector_length); +} + + + +static floperr_t coco_dmk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags) +{ + floperr_t err; + UINT32 idam_offset; + const UINT8 *track_data; + void *track_data_v; + + if (sector_index*2 >= DMK_TOC_LEN) + return FLOPPY_ERROR_SEEKERROR; + + err = floppy_load_track(floppy, head, track, FALSE, &track_data_v, NULL); + if (err) + return err; + track_data = (UINT8 *) track_data_v; + + idam_offset = track_data[sector_index * 2 + 1]; + idam_offset <<= 8; + idam_offset |= track_data[sector_index * 2 + 0]; + idam_offset &= 0x3FFF; + + if (idam_offset == 0) + return FLOPPY_ERROR_SEEKERROR; + + if (cylinder) + *cylinder = dmk_idam_track(&track_data[idam_offset]); + if (side) + *side = dmk_idam_side(&track_data[idam_offset]); + if (sector) + *sector = dmk_idam_sector(&track_data[idam_offset]); + if (sector_length) + *sector_length = 128 << dmk_idam_sectorlength(&track_data[idam_offset]); + if (flags) + /* TODO: read DAM or DDAM and determine flags */ + *flags = 0; + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t internal_coco_dmk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen) +{ + floperr_t err; + UINT32 sector_length; + UINT16 crc_on_disk; + UINT16 calculated_crc; + UINT8 *sector_data; + + err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, FALSE, §or_data, §or_length); + if (err) + return err; + + crc_on_disk = sector_data[sector_length + 0]; + crc_on_disk <<= 8; + crc_on_disk += sector_data[sector_length + 1]; + + calculated_crc = ccitt_crc16(0xE295, sector_data, sector_length); + if (calculated_crc != crc_on_disk) + return FLOPPY_ERROR_INVALIDIMAGE; + + memcpy(buffer, sector_data, MIN(sector_length, buflen)); + + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t internal_coco_dmk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam) +{ + floperr_t err; + UINT32 sector_length; + UINT8 *sector_data; + UINT16 crc; + + err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, TRUE, §or_data, §or_length); + if (err) + return err; + + if (buflen > sector_length) + return FLOPPY_ERROR_INTERNAL; + + memcpy(sector_data, buffer, buflen); + + crc = ccitt_crc16(0xE295, sector_data, sector_length); + sector_data[sector_length + 0] = crc >> 8; + sector_data[sector_length + 1] = crc >> 0; + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t coco_dmk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen) +{ + return internal_coco_dmk_read_sector(floppy, head, track, sector, FALSE, buffer, buflen); +} + +static floperr_t coco_dmk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam) +{ + return internal_coco_dmk_write_sector(floppy, head, track, sector, FALSE, buffer, buflen, ddam); +} + +static floperr_t coco_dmk_read_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen) +{ + return internal_coco_dmk_read_sector(floppy, head, track, sector, TRUE, buffer, buflen); +} + +static floperr_t coco_dmk_write_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam) +{ + return internal_coco_dmk_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam); +} + + + +static void coco_dmk_interpret_header(floppy_image_legacy *floppy, int *heads, int *tracks, int *track_size) +{ + UINT8 header[DMK_HEADER_LEN]; + + floppy_image_read(floppy, header, 0, DMK_HEADER_LEN); + + if (tracks) + *tracks = header[1]; + if (heads) + *heads = (header[4] & 0x10) ? 1 : 2; + if (track_size) + *track_size = ((int) header[3]) * 0x100 + header[2]; +} + + + +FLOPPY_CONSTRUCT(coco_dmk_construct) +{ + struct FloppyCallbacks *callbacks; + struct dmk_tag *tag; + UINT8 header[DMK_HEADER_LEN]; + int heads, tracks, track_size, sectors, sector_length; + + if (params) + { + heads = option_resolution_lookup_int(params, PARAM_HEADS); + tracks = option_resolution_lookup_int(params, PARAM_TRACKS); + sectors = option_resolution_lookup_int(params, PARAM_SECTORS); + sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); + + track_size = coco_dmk_min_track_size(sectors, sector_length) + DMK_EXTRA_TRACK_LENGTH; + + memset(header, 0, sizeof(header)); + header[1] = tracks; + header[2] = track_size >> 0; + header[3] = track_size >> 8; + header[4] = (heads == 2) ? 0x00 : 0x10; + + floppy_image_write(floppy, header, 0, sizeof(header)); + } + else + { + coco_dmk_interpret_header(floppy, &heads, &tracks, &track_size); + } + + tag = (dmk_tag *)floppy_create_tag(floppy, sizeof(struct dmk_tag)); + if (!tag) + return FLOPPY_ERROR_OUTOFMEMORY; + tag->heads = heads; + tag->track_size = track_size; + tag->tracks = tracks; + + callbacks = floppy_callbacks(floppy); + callbacks->read_track = coco_dmk_read_track; + callbacks->write_track = coco_dmk_write_track; + callbacks->get_track_data_offset = coco_dmk_get_track_data_offset; + callbacks->format_track = coco_dmk_format_track; + callbacks->get_heads_per_disk = coco_dmk_get_heads_per_disk; + callbacks->get_tracks_per_disk = coco_dmk_get_tracks_per_disk; + callbacks->get_track_size = coco_dmk_get_track_size; + callbacks->get_sector_length = coco_dmk_get_sector_length; + callbacks->get_indexed_sector_info = coco_dmk_get_indexed_sector_info; + callbacks->read_sector = coco_dmk_read_sector; + callbacks->write_sector = coco_dmk_write_sector; + callbacks->read_indexed_sector = coco_dmk_read_indexed_sector; + callbacks->write_indexed_sector = coco_dmk_write_indexed_sector; + + return FLOPPY_ERROR_SUCCESS; +} + + + +FLOPPY_IDENTIFY(coco_dmk_identify) +{ + int heads, tracks, track_size; + UINT64 size, expected_size; + + size = floppy_image_size(floppy); + coco_dmk_interpret_header(floppy, &heads, &tracks, &track_size); + expected_size = DMK_HEADER_LEN + (heads * tracks * track_size); + *vote = (size == expected_size) ? 100 : 0; + return FLOPPY_ERROR_SUCCESS; +} + + + +/* ----------------------------------------------------------------------- */ + +LEGACY_FLOPPY_OPTIONS_START( coco ) + LEGACY_FLOPPY_OPTION( coco_jvc, "dsk", "CoCo JVC disk image", coco_jvc_identify, coco_jvc_construct, NULL, + HEADS([1]-2) + TRACKS([35]-255) + SECTORS(1-[18]-255) + SECTOR_LENGTH(128/[256]/512/1024) + FIRST_SECTOR_ID(0-[1])) + LEGACY_FLOPPY_OPTION( coco_os9, "os9", "CoCo OS-9 disk image", coco_os9_identify, coco_os9_construct, NULL, + HEADS([1]-2) + TRACKS([35]-255) + SECTORS(1-[18]-255) + SECTOR_LENGTH([256]) + FIRST_SECTOR_ID([1])) + LEGACY_FLOPPY_OPTION( coco_vdk, "vdk", "CoCo VDK disk image", coco_vdk_identify, coco_vdk_construct, NULL, + HEADS([1]-2) + TRACKS([35]-255) + SECTORS([18]) + SECTOR_LENGTH([256]) + FIRST_SECTOR_ID([1])) + LEGACY_FLOPPY_OPTION( coco_dmk, "dsk,dmk", "CoCo DMK disk image", coco_dmk_identify, coco_dmk_construct, NULL, + HEADS([1]-2) + TRACKS([35]-255) + SECTORS(1-[18]) + SECTOR_LENGTH(128/[256]/512/1024/2048/4096/8192) + INTERLEAVE(0-[6]-17) + FIRST_SECTOR_ID(0-[1])) +LEGACY_FLOPPY_OPTIONS_END diff --git a/src/mess/tools/imgtool/formats/coco_dsk.h b/src/mess/tools/imgtool/formats/coco_dsk.h new file mode 100644 index 00000000000..797911d40a1 --- /dev/null +++ b/src/mess/tools/imgtool/formats/coco_dsk.h @@ -0,0 +1,24 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/********************************************************************* + + formats/coco_dsk.h + + Tandy Color Computer / Dragon disk images + +*********************************************************************/ + +#ifndef COCO_DSK_H +#define COCO_DSK_H + +#include "formats/flopimg.h" + + +/**************************************************************************/ + +LEGACY_FLOPPY_OPTIONS_EXTERN(coco); + +FLOPPY_IDENTIFY(coco_dmk_identify); +FLOPPY_CONSTRUCT(coco_dmk_construct); + +#endif /* COCO_DSK_H */ diff --git a/src/mess/tools/imgtool/formats/vt_dsk.c b/src/mess/tools/imgtool/formats/vt_dsk.c new file mode 100644 index 00000000000..4e75e843d28 --- /dev/null +++ b/src/mess/tools/imgtool/formats/vt_dsk.c @@ -0,0 +1,57 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/********************************************************************* + + formats/vt_dsk.c + + VTech Laser/VZ disk images + +*********************************************************************/ + +#include +#include +#include +#include "formats/vt_dsk.h" +#include "formats/basicdsk.h" + +static FLOPPY_IDENTIFY(vz_identify) +{ + UINT64 size = floppy_image_size(floppy); + *vote = ((size == 98560) || (size == 99200) || (size == 99184)) ? 100 : 0; + return FLOPPY_ERROR_SUCCESS; +} + +static FLOPPY_CONSTRUCT(vz_construct) +{ + struct basicdsk_geometry geometry; + memset(&geometry, 0, sizeof(geometry)); + + if (params) + { + geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); + geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); + geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); + geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); + geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); + } + else + { + geometry.heads = 1; + geometry.tracks = 40; + geometry.sectors = 16; + geometry.first_sector_id = 0; + geometry.sector_length = floppy_image_size(floppy)/geometry.tracks/geometry.sectors; + } + + return basicdsk_construct(floppy, &geometry); +} + + +LEGACY_FLOPPY_OPTIONS_START(vz) + LEGACY_FLOPPY_OPTION(vtech1, "dsk", "Laser/VZ disk image", vz_identify, vz_construct, NULL, + HEADS([1]) + TRACKS([40]) + SECTORS([16]) + SECTOR_LENGTH([154]) + FIRST_SECTOR_ID([0])) +LEGACY_FLOPPY_OPTIONS_END diff --git a/src/mess/tools/imgtool/formats/vt_dsk.h b/src/mess/tools/imgtool/formats/vt_dsk.h new file mode 100644 index 00000000000..a3f9a86b44e --- /dev/null +++ b/src/mess/tools/imgtool/formats/vt_dsk.h @@ -0,0 +1,18 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/********************************************************************* + + formats/vt_dsk.h + + Tandy Color Computer / Dragon disk images + +*********************************************************************/ + +#ifndef VT_DSK_H +#define VT_DSK_H + +#include "formats/flopimg.h" + +LEGACY_FLOPPY_OPTIONS_EXTERN(vz); + +#endif /* VT_DSK_H */ diff --git a/src/mess/tools/imgtool/modules/amiga.c b/src/mess/tools/imgtool/modules/amiga.c index d0a970fae66..7723748cbd2 100644 --- a/src/mess/tools/imgtool/modules/amiga.c +++ b/src/mess/tools/imgtool/modules/amiga.c @@ -21,7 +21,6 @@ #include "imgtool.h" #include "iflopimg.h" #include "formats/imageutl.h" -#include "formats/ami_dsk.h" -- cgit v1.2.3-70-g09d2 From c5c718beb8b41ade55349a6da7f7412b0e1bb99b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 22 Jun 2015 17:57:50 +0200 Subject: no need for subdir for these projects, those are same for all mame builds (nw) --- scripts/src/lib.lua | 2 -- scripts/src/netlist.lua | 1 - 2 files changed, 3 deletions(-) (limited to 'scripts/src/lib.lua') diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index d081ef6665f..f5a54f0dd68 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -2,7 +2,6 @@ -- copyright-holders:MAMEdev Team project "utils" - targetsubdir(_OPTIONS["target"] .."_" .. _OPTIONS["subtarget"]) uuid "22489ad0-4cb2-4d91-ad81-24b0d80ca30a" kind (LIBTYPE) @@ -99,7 +98,6 @@ project "utils" project "formats" - targetsubdir(_OPTIONS["target"] .."_" .. _OPTIONS["subtarget"]) uuid "f69636b1-fcce-45ce-b09a-113e371a2d7a" kind (LIBTYPE) diff --git a/scripts/src/netlist.lua b/scripts/src/netlist.lua index a0dec61dc1e..1a0cca92a99 100644 --- a/scripts/src/netlist.lua +++ b/scripts/src/netlist.lua @@ -2,7 +2,6 @@ -- copyright-holders:MAMEdev Team project "netlist" - targetsubdir(_OPTIONS["target"] .."_" .. _OPTIONS["subtarget"]) uuid "665ef8ac-2a4c-4c3e-a05f-fd1e5db11de9" kind (LIBTYPE) -- cgit v1.2.3-70-g09d2 From 08c7ed6ffb8fb06d0265633d084fe8a2c47223d4 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Thu, 9 Jul 2015 12:57:52 +0200 Subject: guab: Updated driver to use the standard wd floppy controller. This also means that it now uses the software list system instead of loading the floppy disk image into a memory region. To run the driver use: "mame guab -flop guab3" now. You may also just start the driver, then choose a floppy disk image from the builtin file manager. --- hash/guab.xml | 127 ++++++++++++ scripts/src/lib.lua | 2 + src/lib/formats/guab_dsk.c | 42 ++++ src/lib/formats/guab_dsk.h | 33 ++++ src/mame/arcade.lst | 8 - src/mame/drivers/guab.c | 483 ++++++--------------------------------------- 6 files changed, 261 insertions(+), 434 deletions(-) create mode 100644 hash/guab.xml create mode 100644 src/lib/formats/guab_dsk.c create mode 100644 src/lib/formats/guab_dsk.h (limited to 'scripts/src/lib.lua') diff --git a/hash/guab.xml b/hash/guab.xml new file mode 100644 index 00000000000..038f337375d --- /dev/null +++ b/hash/guab.xml @@ -0,0 +1,127 @@ + + + + + + + Give us a Break (3rd edition) + 1986 + JPM + + + + + + + + + Give us a Break (3rd edition alt?) + 1986 + JPM + + + + + + + + + Give us a Break (4th edition) + 1986 + JPM + + + + + + + + + Give us a Break (6th edition) + 1986 + JPM + + + + + + + + + Give us a Break (6th edition alt?) + 1986 + JPM + + + + + + + + + Give us a Break (7th edition) + 1986 + JPM + + + + + + + + + Give us a Break (21st edition) + 1986 + JPM + + + + + + + + + Give us a Break (43rd edition) + 1986 + JPM + + + + + + + + + Criss Cross (Sweden) + 1986 + JPM + + + + + + + + + Ten Up (compendium 17) + 1988 + JPM + + + + + + + + + Ten Up (compendium 3) + 1988 + JPM + + + + + + + + diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index f5a54f0dd68..b445f71a994 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -258,6 +258,8 @@ project "formats" MAME_DIR .. "src/lib/formats/g64_dsk.h", MAME_DIR .. "src/lib/formats/gtp_cas.c", MAME_DIR .. "src/lib/formats/gtp_cas.h", + MAME_DIR .. "src/lib/formats/guab_dsk.c", + MAME_DIR .. "src/lib/formats/guab_dsk.h", MAME_DIR .. "src/lib/formats/hect_dsk.c", MAME_DIR .. "src/lib/formats/hect_dsk.h", MAME_DIR .. "src/lib/formats/hect_tap.c", diff --git a/src/lib/formats/guab_dsk.c b/src/lib/formats/guab_dsk.c new file mode 100644 index 00000000000..4c92362251a --- /dev/null +++ b/src/lib/formats/guab_dsk.c @@ -0,0 +1,42 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + JPM Give us a Break + + Disk image format + +***************************************************************************/ + +#include "guab_dsk.h" + +guab_format::guab_format() : wd177x_format(formats) +{ +} + +const char *guab_format::name() const +{ + return "guab"; +} + +const char *guab_format::description() const +{ + return "JPM Give us a Break disk image"; +} + +const char *guab_format::extensions() const +{ + return "dsk"; +} + +// gap sizes unverified +const guab_format::format guab_format::formats[] = +{ + { + floppy_image::FF_35, floppy_image::DSDD, floppy_image::MFM, + 2000, 18, 80, 2, 256, {}, 0, {}, 80, 22, 24 + }, + {} +}; + +const floppy_format_type FLOPPY_GUAB_FORMAT = &floppy_image_format_creator; diff --git a/src/lib/formats/guab_dsk.h b/src/lib/formats/guab_dsk.h new file mode 100644 index 00000000000..36280ddd88f --- /dev/null +++ b/src/lib/formats/guab_dsk.h @@ -0,0 +1,33 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + JPM Give us a Break + + Disk image format + +***************************************************************************/ + +#pragma once + +#ifndef __GUAB_DSK_H__ +#define __GUAB_DSK_H__ + +#include "wd177x_dsk.h" + +class guab_format : public wd177x_format +{ +public: + guab_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_GUAB_FORMAT; + +#endif // __GUAB_DSK_H__ diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 26010bebe7b..500c4447684 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -13465,16 +13465,8 @@ j2sset // JPM Give us a Break hardware guab // (c) 1986 -guab3a // (c) 1986 -guab4 // (c) 1986 -guab6 // (c) 1986 -guab6a // (c) 1986 -guab7 // (c) 1986 -guab21 // (c) 1986 -guab43 // (c) 1986 crisscrs // (c) 1986 tenup // (c) 1988 -tenup3 // (c) 1988 // JPM System 5 diff --git a/src/mame/drivers/guab.c b/src/mame/drivers/guab.c index 789fe6cf960..048937140b4 100644 --- a/src/mame/drivers/guab.c +++ b/src/mame/drivers/guab.c @@ -22,6 +22,7 @@ count gets updated in the code. Each game requires a unique security PAL - maybe this is related? I'm poking the coin values directly into RAM for now. + * Verify WD FDC type ***************************************************************************/ @@ -30,6 +31,8 @@ #include "machine/6840ptm.h" #include "video/tms34061.h" #include "sound/sn76496.h" +#include "machine/wd_fdc.h" +#include "formats/guab_dsk.h" /************************************* @@ -38,9 +41,6 @@ * *************************************/ -#define LOG_FDC_COMMANDS 0 -#define FDC_LOG(x) do { if (LOG_FDC_COMMANDS) osd_printf_debug x; } while(0) - enum int_levels { @@ -61,19 +61,6 @@ struct ef9369 }; -struct wd1770 -{ - UINT32 status; - UINT8 cmd; - UINT8 data; - - UINT32 side; - INT32 track; - INT32 sector; - UINT32 sptr; -}; - - class guab_state : public driver_device { public: @@ -82,32 +69,37 @@ public: m_maincpu(*this, "maincpu"), m_tms34061(*this, "tms34061"), m_sn(*this, "snsnd"), + m_fdc(*this, "fdc"), + m_floppy(*this, "fdc:0"), m_palette(*this, "palette") { } - /* devices */ - required_device m_maincpu; - required_device m_tms34061; - required_device m_sn; - required_device m_palette; - - struct ef9369 m_pal; - emu_timer *m_fdc_timer; - struct wd1770 m_fdc; DECLARE_WRITE_LINE_MEMBER(generate_tms34061_interrupt); DECLARE_WRITE16_MEMBER(guab_tms34061_w); DECLARE_READ16_MEMBER(guab_tms34061_r); DECLARE_WRITE16_MEMBER(ef9369_w); DECLARE_READ16_MEMBER(ef9369_r); - DECLARE_WRITE16_MEMBER(wd1770_w); - DECLARE_READ16_MEMBER(wd1770_r); + DECLARE_READ16_MEMBER(wd1773_r); + DECLARE_WRITE16_MEMBER(wd1773_w); DECLARE_READ16_MEMBER(io_r); DECLARE_WRITE16_MEMBER(io_w); DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); DECLARE_WRITE_LINE_MEMBER(ptm_irq); - virtual void machine_start(); - virtual void machine_reset(); UINT32 screen_update_guab(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(fdc_data_callback); + + DECLARE_FLOPPY_FORMATS(floppy_formats); + +protected: + virtual void machine_start(); + +private: + required_device m_maincpu; + required_device m_tms34061; + required_device m_sn; + required_device m_fdc; + required_device m_floppy; + required_device m_palette; + + struct ef9369 m_pal; }; @@ -275,285 +267,6 @@ UINT32 guab_state::screen_update_guab(screen_device &screen, bitmap_ind16 &bitma } -/************************************* - * - * WD1770 floppy disk controller - * (just enough to get by...) - * - *************************************/ - -#define USEC_DELAY 40 -#define DISK_SIDES 2 -#define DISK_TRACKS 80 -#define DISK_SECTORS 18 - -#define DISK_SECTOR_SIZE 256 -#define DISK_TRACK_SIZE (DISK_SECTOR_SIZE * DISK_SECTORS) -#define DISK_SIDE_SIZE (DISK_TRACK_SIZE * DISK_TRACKS) - -enum wd1770_status -{ - BUSY = 1 << 0, - DATA_REQUEST = 1 << 1, - INDEX = 1 << 1, - LOST_DATA = 1 << 2, - TRACK_00 = 1 << 2, - CRC_ERROR = 1 << 3, - RECORD_NOT_FOUND = 1 << 4, - RECORD_TYPE = 1 << 5, - SPIN_UP = 1 << 5, - WRITE_PROTECT = 1 << 6, - MOTOR_ON = 1 << 7 -}; - - -TIMER_CALLBACK_MEMBER(guab_state::fdc_data_callback) -{ - struct wd1770 &fdc = m_fdc; - UINT8* disk = (UINT8*)memregion("user1")->base(); - int more_data = 0; - - /* - Disk dumps are organised as: - - Side 0, Track 0: Sectors 0 - 17 - Side 1, Track 0: Sectors 0 - 17 - Side 0, Track 1: Sectors 0 - 17 - Side 1, Track 1: Sectors 0 - 17 - etc. - */ - - int idx = 2 * fdc.track * (DISK_TRACK_SIZE) + (fdc.side ? DISK_TRACK_SIZE : 0)+ - fdc.sector * (DISK_SECTOR_SIZE) + - fdc.sptr; - - /* Write or read? */ - if (fdc.cmd & 0x20) - disk[idx] = fdc.data; - else - fdc.data = disk[idx]; - - fdc.sptr++; - - if (fdc.sptr < DISK_SECTOR_SIZE) - { - more_data = 1; - } - else - { - fdc.sptr = 0; - - /* Multi-sector read */ - if (fdc.cmd & 0x10) - { - ++fdc.sector; - - /* Keep going */ - if (fdc.sector < DISK_SECTORS) - more_data = 1; - } - } - - if (more_data) - { - m_fdc_timer->adjust(attotime::from_usec(USEC_DELAY)); - } - else - { - /* Hack!*/ - fdc.cmd = 0; - fdc.status &= ~BUSY; - } - - fdc.status |= DATA_REQUEST; - m_maincpu->set_input_line(INT_FLOPPYCTRL, ASSERT_LINE); -} - - -WRITE16_MEMBER(guab_state::wd1770_w) -{ - struct wd1770 &fdc = m_fdc; - data &= 0xff; - - switch (offset) - { - case 0: - { - UINT8 cmd = (data >> 4) & 0xf; - - FDC_LOG(("Command: %x:: ", data)); - - switch (cmd) - { - /**** Type I ****/ - case 0: - { - FDC_LOG(("Restore\n")); - fdc.track = 0; - break; - } - - case 1: - { - FDC_LOG(("Seek to track %d\n", fdc.data)); - fdc.track = fdc.data; - break; - } - - /* Step */ - case 2: - case 3: - { - FDC_LOG(("Step (not implemented)\n")); - break; - } - - case 4: case 5: - { - if (++fdc.track >= DISK_TRACKS) - fdc.track = DISK_TRACKS - 1; - - FDC_LOG(("Step-in to track %d\n", fdc.track)); - break; - } - - case 6: case 7: - { - if (--fdc.track > 0) - fdc.track = 0; - - FDC_LOG(("Step-out to track %d\n", fdc.track)); - break; - } - - - /**** Type II ****/ - case 8: - case 9: - { - fdc.cmd = data; - fdc.status |= BUSY; - - if (data & 0x10) - FDC_LOG(("Multi ")); - - FDC_LOG(("Sector read: H%d T%d S%d\n", fdc.side, - fdc.track, - fdc.sector)); - - /* Set the data read timer */ - m_fdc_timer->adjust(attotime::from_usec(USEC_DELAY)); - - break; - } - - case 10: - case 11: - { - fdc.cmd = data; - fdc.status |= BUSY; - - if (data & 0x10) - FDC_LOG(("Multi ")); - - FDC_LOG(("Sector write: H%d T%d S%d\n", fdc.side, - fdc.track, - fdc.sector)); - - /* Trigger a DRQ interrupt on the CPU */ - m_maincpu->set_input_line(INT_FLOPPYCTRL, ASSERT_LINE); - fdc.status |= DATA_REQUEST; - break; - } - - /**** Type III ****/ - case 12: /* Read address */ - case 14: /* Read track */ - case 15: /* Write track */ - { - FDC_LOG(("Unsupported TYPE III operation\n")); - break; - } - - /**** Type IV ****/ - case 13: - { - /* Stop any operation in progress */ - m_fdc_timer->reset(); - fdc.status &= ~BUSY; - FDC_LOG(("Force Interrupt\n")); - break; - } - } - - break; - } - case 1: - { - FDC_LOG(("Set track: %d\n", data)); - fdc.track = data; - break; - } - case 2: - { - FDC_LOG(("Set sector: %d\n", data)); - fdc.sector = data; - fdc.sptr = 0; - break; - } - case 3: - { - fdc.data = data; - - /* Clear the DRQ */ - m_maincpu->set_input_line(INT_FLOPPYCTRL, CLEAR_LINE); - - /* Queue an event to write the data if write command was specified */ - if (fdc.cmd & 0x20) - m_fdc_timer->adjust(attotime::from_usec(USEC_DELAY)); - - break; - } - } -} - -READ16_MEMBER(guab_state::wd1770_r) -{ - struct wd1770 &fdc = m_fdc; - UINT16 retval = 0; - - switch (offset) - { - case 0: - { - retval = fdc.status; - break; - } - case 1: - { - retval = fdc.track; - break; - } - case 2: - { - retval = fdc.sector; - break; - } - case 3: - { - retval = fdc.data; - - /* Clear the DRQ */ - m_maincpu->set_input_line(INT_FLOPPYCTRL, CLEAR_LINE); - fdc.status &= ~DATA_REQUEST; - break; - } - } - - return retval; -} - - /**************************************** * * Hardware inputs (coins, buttons etc) @@ -604,9 +317,18 @@ INPUT_CHANGED_MEMBER(guab_state::coin_inserted) * ****************************************/ +READ16_MEMBER( guab_state::wd1773_r ) +{ + return m_fdc->read(space, offset); +} + +WRITE16_MEMBER( guab_state::wd1773_w ) +{ + m_fdc->write(space, offset, data & 0xff); +} + WRITE16_MEMBER(guab_state::io_w) { - struct wd1770 &fdc = m_fdc; switch (offset) { case 0x10: @@ -647,7 +369,10 @@ WRITE16_MEMBER(guab_state::io_w) case 0x31: { /* Only JPM knows about the other bits... */ - fdc.side = (data >> 3) & 1; + m_floppy->get_device()->ss_w(BIT(data, 3)); + + // one of those bits will probably control the motor, we just let it run all the time for now + m_floppy->get_device()->mon_w(0); break; } case 0x32: @@ -681,7 +406,7 @@ static ADDRESS_MAP_START( guab_map, AS_PROGRAM, 16, guab_state ) AM_RANGE(0x0c0080, 0x0c0083) AM_NOP /* ACIA 1 */ AM_RANGE(0x0c00a0, 0x0c00a3) AM_NOP /* ACIA 2 */ AM_RANGE(0x0c00c0, 0x0c00cf) AM_DEVREADWRITE8("6840ptm", ptm6840_device, read, write, 0xff) - AM_RANGE(0x0c00e0, 0x0c00e7) AM_READWRITE(wd1770_r, wd1770_w) + AM_RANGE(0x0c00e0, 0x0c00e7) AM_READWRITE(wd1773_r, wd1773_w) AM_RANGE(0x080000, 0x080fff) AM_RAM AM_RANGE(0x100000, 0x100003) AM_READWRITE(ef9369_r, ef9369_w) AM_RANGE(0x800000, 0xb0ffff) AM_READWRITE(guab_tms34061_r, guab_tms34061_w) @@ -770,20 +495,22 @@ INPUT_PORTS_END void guab_state::machine_start() { - m_fdc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(guab_state::fdc_data_callback),this)); + m_fdc->set_floppy(m_floppy->get_device()); } -void guab_state::machine_reset() -{ - memset(&m_fdc, 0, sizeof(m_fdc)); -} +FLOPPY_FORMATS_MEMBER( guab_state::floppy_formats ) + FLOPPY_GUAB_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( guab_floppies ) + SLOT_INTERFACE("dd", FLOPPY_35_DD) +SLOT_INTERFACE_END static MACHINE_CONFIG_START( guab, guab_state ) /* TODO: Verify clock */ MCFG_CPU_ADD("maincpu", M68000, 8000000) MCFG_CPU_PROGRAM_MAP(guab_map) - /* TODO: Use real video timings */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -811,6 +538,15 @@ static MACHINE_CONFIG_START( guab, guab_state ) MCFG_PTM6840_INTERNAL_CLOCK(1000000) MCFG_PTM6840_EXTERNAL_CLOCKS(0, 0, 0) MCFG_PTM6840_IRQ_CB(WRITELINE(guab_state, ptm_irq)) + + // floppy + MCFG_WD1773_ADD("fdc", 8000000) + MCFG_WD_FDC_DRQ_CALLBACK(INPUTLINE("maincpu", INT_FLOPPYCTRL)) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", guab_floppies, "dd", guab_state::floppy_formats) + MCFG_SLOT_FIXED(true) + + MCFG_SOFTWARE_LIST_ADD("floppy_list", "guab") MACHINE_CONFIG_END @@ -826,95 +562,12 @@ ROM_START( guab ) ROM_LOAD16_BYTE( "guab1b1.rom", 0x00001, 0x8000, CRC(af3b5492) SHA1(6fd7f29e6ed2fadccc9246f1ebd049c3f9aeff13) ) ROM_LOAD16_BYTE( "guab2a1.rom", 0x10000, 0x8000, CRC(ae7a162c) SHA1(d69721818b8e4daba776a678b62bc7f44f371a3f) ) ROM_LOAD16_BYTE( "guab2b1.rom", 0x10001, 0x8000, CRC(29aa26a0) SHA1(8d425ad845ccfcd8995dbf6adc1ca17989a5d3ea) ) - - ROM_REGION( 0xb4000, "user1", 0 ) - ROM_LOAD( "guab3.dsk", 0x00000, 0xb4000, CRC(ecb41e06) SHA1(2900a95046b38312c6035ea394b04b62c1d29f42) ) -ROM_END - -ROM_START( guab3a ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "guab1a1.rom", 0x00000, 0x8000, CRC(f23a9d7d) SHA1(f933e131bdcf21cfa6001c8e20fd11d94c7a9450) ) - ROM_LOAD16_BYTE( "guab1b1.rom", 0x00001, 0x8000, CRC(af3b5492) SHA1(6fd7f29e6ed2fadccc9246f1ebd049c3f9aeff13) ) - ROM_LOAD16_BYTE( "guab2a1.rom", 0x10000, 0x8000, CRC(ae7a162c) SHA1(d69721818b8e4daba776a678b62bc7f44f371a3f) ) - ROM_LOAD16_BYTE( "guab2b1.rom", 0x10001, 0x8000, CRC(29aa26a0) SHA1(8d425ad845ccfcd8995dbf6adc1ca17989a5d3ea) ) - - ROM_REGION( 0xb4000, "user1", 0 ) - ROM_LOAD( "guab7c.dsk", 0x00000, 0xb4000, CRC(f5f10f87) SHA1(80e540339efbfe59b656d6cd4f466a17df84c123) ) -ROM_END - -ROM_START( guab4 ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "guab1a1.rom", 0x00000, 0x8000, CRC(f23a9d7d) SHA1(f933e131bdcf21cfa6001c8e20fd11d94c7a9450) ) - ROM_LOAD16_BYTE( "guab1b1.rom", 0x00001, 0x8000, CRC(af3b5492) SHA1(6fd7f29e6ed2fadccc9246f1ebd049c3f9aeff13) ) - ROM_LOAD16_BYTE( "guab2a1.rom", 0x10000, 0x8000, CRC(ae7a162c) SHA1(d69721818b8e4daba776a678b62bc7f44f371a3f) ) - ROM_LOAD16_BYTE( "guab2b1.rom", 0x10001, 0x8000, CRC(29aa26a0) SHA1(8d425ad845ccfcd8995dbf6adc1ca17989a5d3ea) ) - - ROM_REGION( 0xb4000, "user1", 0 ) - ROM_LOAD( "guab8d.dsk", 0x00000, 0xb4000, CRC(b87c55ce) SHA1(20debbefae194276b0813518634cf52bed093e73) ) -ROM_END - -ROM_START( guab6 ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "guab1a1.rom", 0x00000, 0x8000, CRC(f23a9d7d) SHA1(f933e131bdcf21cfa6001c8e20fd11d94c7a9450) ) - ROM_LOAD16_BYTE( "guab1b1.rom", 0x00001, 0x8000, CRC(af3b5492) SHA1(6fd7f29e6ed2fadccc9246f1ebd049c3f9aeff13) ) - ROM_LOAD16_BYTE( "guab2a1.rom", 0x10000, 0x8000, CRC(ae7a162c) SHA1(d69721818b8e4daba776a678b62bc7f44f371a3f) ) - ROM_LOAD16_BYTE( "guab2b1.rom", 0x10001, 0x8000, CRC(29aa26a0) SHA1(8d425ad845ccfcd8995dbf6adc1ca17989a5d3ea) ) - - ROM_REGION( 0xb4000, "user1", 0 ) - ROM_LOAD( "guabf6.dsk", 0x00000, 0xb4000, CRC(08804c28) SHA1(608d89d598b7acb133814540dba98cea29c6cad6) ) -ROM_END - -ROM_START( guab6a ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "guab1a1.rom", 0x00000, 0x8000, CRC(f23a9d7d) SHA1(f933e131bdcf21cfa6001c8e20fd11d94c7a9450) ) - ROM_LOAD16_BYTE( "guab1b1.rom", 0x00001, 0x8000, CRC(af3b5492) SHA1(6fd7f29e6ed2fadccc9246f1ebd049c3f9aeff13) ) - ROM_LOAD16_BYTE( "guab2a1.rom", 0x10000, 0x8000, CRC(ae7a162c) SHA1(d69721818b8e4daba776a678b62bc7f44f371a3f) ) - ROM_LOAD16_BYTE( "guab2b1.rom", 0x10001, 0x8000, CRC(29aa26a0) SHA1(8d425ad845ccfcd8995dbf6adc1ca17989a5d3ea) ) - - ROM_REGION( 0xb4000, "user1", 0 ) - ROM_LOAD( "guab9f.dsk", 0x00000, 0xb4000, CRC(85329fe9) SHA1(f5ca1956c37b786fa0a4f8f0607a0a2b19d3fbb0) ) -ROM_END - -ROM_START( guab7 ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "guab1a1.rom", 0x00000, 0x8000, CRC(f23a9d7d) SHA1(f933e131bdcf21cfa6001c8e20fd11d94c7a9450) ) - ROM_LOAD16_BYTE( "guab1b1.rom", 0x00001, 0x8000, CRC(af3b5492) SHA1(6fd7f29e6ed2fadccc9246f1ebd049c3f9aeff13) ) - ROM_LOAD16_BYTE( "guab2a1.rom", 0x10000, 0x8000, CRC(ae7a162c) SHA1(d69721818b8e4daba776a678b62bc7f44f371a3f) ) - ROM_LOAD16_BYTE( "guab2b1.rom", 0x10001, 0x8000, CRC(29aa26a0) SHA1(8d425ad845ccfcd8995dbf6adc1ca17989a5d3ea) ) - - ROM_REGION( 0xb4000, "user1", 0 ) - ROM_LOAD( "guab9g.dsk", 0x00000, 0xb4000, CRC(6b8c36f9) SHA1(1d9f4d943f2962603bbe39e5b58befe15954a6d6) ) -ROM_END - -ROM_START( guab21 ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "guab1a1.rom", 0x00000, 0x8000, CRC(f23a9d7d) SHA1(f933e131bdcf21cfa6001c8e20fd11d94c7a9450) ) - ROM_LOAD16_BYTE( "guab1b1.rom", 0x00001, 0x8000, CRC(af3b5492) SHA1(6fd7f29e6ed2fadccc9246f1ebd049c3f9aeff13) ) - ROM_LOAD16_BYTE( "guab2a1.rom", 0x10000, 0x8000, CRC(ae7a162c) SHA1(d69721818b8e4daba776a678b62bc7f44f371a3f) ) - ROM_LOAD16_BYTE( "guab2b1.rom", 0x10001, 0x8000, CRC(29aa26a0) SHA1(8d425ad845ccfcd8995dbf6adc1ca17989a5d3ea) ) - - ROM_REGION( 0xb4000, "user1", 0 ) - ROM_LOAD( "guab21.dsk", 0x00000, 0xb4000, CRC(558ee009) SHA1(d2a02662216e10f80a215044f1929df7255b6136) ) -ROM_END - -ROM_START( guab43 ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "guab1a1.rom", 0x00000, 0x8000, CRC(f23a9d7d) SHA1(f933e131bdcf21cfa6001c8e20fd11d94c7a9450) ) - ROM_LOAD16_BYTE( "guab1b1.rom", 0x00001, 0x8000, CRC(af3b5492) SHA1(6fd7f29e6ed2fadccc9246f1ebd049c3f9aeff13) ) - ROM_LOAD16_BYTE( "guab2a1.rom", 0x10000, 0x8000, CRC(ae7a162c) SHA1(d69721818b8e4daba776a678b62bc7f44f371a3f) ) - ROM_LOAD16_BYTE( "guab2b1.rom", 0x10001, 0x8000, CRC(29aa26a0) SHA1(8d425ad845ccfcd8995dbf6adc1ca17989a5d3ea) ) - - ROM_REGION( 0xb4000, "user1", 0 ) - ROM_LOAD( "guab43.dsk", 0x00000, 0xb3f00, CRC(96167357) SHA1(9d5f66e05ed1086be9699c4149071038f6986e0c) ) ROM_END ROM_START( crisscrs ) ROM_REGION( 0x20000, "maincpu", 0 ) ROM_LOAD16_BYTE( "crisscross_swe_2a1.ic49", 0x00000, 0x8000, CRC(a7ca8828) SHA1(a28482bb2bc1248a9b5c0b57904c382246a632cc) ) ROM_LOAD16_BYTE( "crisscross_swe_2b1.ic48", 0x00001, 0x8000, CRC(7e280cae) SHA1(18c76459e39549ddba5f0cd7921013ef4f816826) ) - - ROM_REGION( 0xb4000, "user1", 0 ) - ROM_LOAD( "crisscrs.dsk", 0x00000, 0xb4000, NO_DUMP ) ROM_END ROM_START( tenup ) @@ -923,20 +576,6 @@ ROM_START( tenup ) ROM_LOAD16_BYTE( "tu-12.bin", 0x00001, 0x8000, CRC(1c7f32b1) SHA1(2b14e2206695ae53909ae838a5c036248d9ab940) ) ROM_LOAD16_BYTE( "tu-13.bin", 0x10000, 0x8000, CRC(d19e2bf7) SHA1(76a9cbd4f604ad39eb0e319a9a6d5a6739b0ed8c) ) ROM_LOAD16_BYTE( "tu-14.bin", 0x10001, 0x8000, CRC(fd8a0c3c) SHA1(f87289ce6f0d2bc9b7d3a0b6deff38ba3aadf391) ) - - ROM_REGION( 0xb4000, "user1", 0 ) - ROM_LOAD( "10up17.dsk", 0x00000, 0xb4000, CRC(7bc328df) SHA1(5f8e40d8ffc370fb19be9e386befa5fcd1f35a75) ) -ROM_END - -ROM_START( tenup3 ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "tu-11.bin", 0x00000, 0x8000, CRC(01843086) SHA1(106a226900e8cf929f89edf801c627f02e4afce3) ) - ROM_LOAD16_BYTE( "tu-12.bin", 0x00001, 0x8000, CRC(1c7f32b1) SHA1(2b14e2206695ae53909ae838a5c036248d9ab940) ) - ROM_LOAD16_BYTE( "tu-13.bin", 0x10000, 0x8000, CRC(d19e2bf7) SHA1(76a9cbd4f604ad39eb0e319a9a6d5a6739b0ed8c) ) - ROM_LOAD16_BYTE( "tu-14.bin", 0x10001, 0x8000, CRC(fd8a0c3c) SHA1(f87289ce6f0d2bc9b7d3a0b6deff38ba3aadf391) ) - - ROM_REGION( 0xb4000, "user1", 0 ) - ROM_LOAD( "10up3.dsk", 0x00000, 0xb4000, CRC(2767f017) SHA1(1c6551b089c3e3df48e0c03bd502b91fd88f0e94) ) ROM_END @@ -946,14 +585,6 @@ ROM_END * *************************************/ -GAME( 1986, guab, 0, guab, guab, driver_device, 0, ROT0, "JPM", "Give us a Break (3rd edition)", 0 ) -GAME( 1986, guab3a, guab, guab, guab, driver_device, 0, ROT0, "JPM", "Give us a Break (3rd edition alt?)", 0 ) -GAME( 1986, guab4, guab, guab, guab, driver_device, 0, ROT0, "JPM", "Give us a Break (4th edition)", 0 ) -GAME( 1986, guab6, guab, guab, guab, driver_device, 0, ROT0, "JPM", "Give us a Break (6th edition)", 0 ) -GAME( 1986, guab6a, guab, guab, guab, driver_device, 0, ROT0, "JPM", "Give us a Break (6th edition alt?)", 0 ) -GAME( 1986, guab7, guab, guab, guab, driver_device, 0, ROT0, "JPM", "Give us a Break (7th edition)", 0 ) -GAME( 1986, guab21, guab, guab, guab, driver_device, 0, ROT0, "JPM", "Give us a Break (21st edition)", 0 ) -GAME( 1986, guab43, guab, guab, guab, driver_device, 0, ROT0, "JPM", "Give us a Break (43rd edition)", 0 ) -GAME( 1986, crisscrs, 0, guab, guab, driver_device, 0, ROT0, "JPM", "Criss Cross (Sweden)", GAME_NOT_WORKING ) -GAME( 1988, tenup, 0, guab, tenup, driver_device, 0, ROT0, "JPM", "Ten Up (compendium 17)", 0 ) -GAME( 1988, tenup3, tenup, guab, tenup, driver_device, 0, ROT0, "JPM", "Ten Up (compendium 3)", 0 ) +GAME( 1986, guab, 0, guab, guab, driver_device, 0, ROT0, "JPM", "Give us a Break", 0 ) +GAME( 1986, crisscrs, 0, guab, guab, driver_device, 0, ROT0, "JPM", "Criss Cross (Sweden)", GAME_NOT_WORKING ) +GAME( 1988, tenup, 0, guab, tenup, driver_device, 0, ROT0, "JPM", "Ten Up", 0 ) -- cgit v1.2.3-70-g09d2