diff --git a/.gitattributes b/.gitattributes index 364d34a5a1f..b3cf70dff06 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1906,6 +1906,8 @@ src/lib/formats/thom_dsk.c svneol=native#text/plain src/lib/formats/thom_dsk.h svneol=native#text/plain src/lib/formats/ti99_dsk.c svneol=native#text/plain src/lib/formats/ti99_dsk.h svneol=native#text/plain +src/lib/formats/tiki100_dsk.c svneol=native#text/plain +src/lib/formats/tiki100_dsk.h svneol=native#text/plain src/lib/formats/trd_dsk.c svneol=native#text/plain src/lib/formats/trd_dsk.h svneol=native#text/plain src/lib/formats/trs_cas.c svneol=native#text/plain diff --git a/src/lib/formats/tiki100_dsk.c b/src/lib/formats/tiki100_dsk.c new file mode 100644 index 00000000000..762ad0d12ae --- /dev/null +++ b/src/lib/formats/tiki100_dsk.c @@ -0,0 +1,87 @@ +/*************************************************************************** + + Copyright Olivier Galibert + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name 'MAME' nor the names of its contributors may be + used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +****************************************************************************/ + +/********************************************************************* + + formats/tiki100_dsk.c + + TIKI 100 disk image format + +*********************************************************************/ + +#include "emu.h" +#include "formats/tiki100_dsk.h" + +tiki100_format::tiki100_format() : wd177x_format(formats) +{ +} + +const char *tiki100_format::name() const +{ + return "tiki100"; +} + +const char *tiki100_format::description() const +{ + return "TIKI 100 disk image"; +} + +const char *tiki100_format::extensions() const +{ + return "dsk"; +} + +// Unverified gap sizes +// physical disks have 2:1 sector interleave +// double sided disks have t0s0,t0s1,t1s0,t1s1... format +const tiki100_format::format tiki100_format::formats[] = { + { // 90K 5 1/4 inch single density single sided + floppy_image::FF_525, floppy_image::SSSD, + 2000, 18, 40, 1, 128, {}, 1, {}, 80, 22, 20 + }, + { // 200K 5 1/4 inch double density single sided + floppy_image::FF_525, floppy_image::SSDD, + 2000, 10, 40, 1, 512, {}, 1, {}, 80, 22, 20 + }, + { // 400K 5 1/4 inch double density + floppy_image::FF_525, floppy_image::DSDD, + 2000, 10, 40, 2, 512, {}, 1, {}, 80, 22, 20 + }, + { // 800K 5 1/4 inch quad density + floppy_image::FF_525, floppy_image::DSQD, + 2000, 10, 80, 2, 512, {}, 1, {}, 80, 22, 20 + }, + {} +}; + +const floppy_format_type FLOPPY_TIKI100_FORMAT = &floppy_image_format_creator; diff --git a/src/lib/formats/tiki100_dsk.h b/src/lib/formats/tiki100_dsk.h new file mode 100644 index 00000000000..fc5feb37a3d --- /dev/null +++ b/src/lib/formats/tiki100_dsk.h @@ -0,0 +1,28 @@ +/********************************************************************* + + formats/tiki100_dsk.h + + TIKI 100 disk image format + +*********************************************************************/ + +#ifndef TIKI100_DSK_H_ +#define TIKI100_DSK_H_ + +#include "wd177x_dsk.h" + +class tiki100_format : public wd177x_format { +public: + tiki100_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_TIKI100_FORMAT; + +#endif diff --git a/src/lib/lib.mak b/src/lib/lib.mak index 6ccb29b7097..e13fd5c2dcd 100644 --- a/src/lib/lib.mak +++ b/src/lib/lib.mak @@ -169,6 +169,7 @@ FORMATSOBJS = \ $(LIBOBJ)/formats/thom_cas.o \ $(LIBOBJ)/formats/thom_dsk.o \ $(LIBOBJ)/formats/ti99_dsk.o \ + $(LIBOBJ)/formats/tiki100_dsk.o \ $(LIBOBJ)/formats/trd_dsk.o \ $(LIBOBJ)/formats/trs_cas.o \ $(LIBOBJ)/formats/trs_dsk.o \ diff --git a/src/mess/drivers/tiki100.c b/src/mess/drivers/tiki100.c index 732411c2b61..e39d11debbb 100644 --- a/src/mess/drivers/tiki100.c +++ b/src/mess/drivers/tiki100.c @@ -14,9 +14,7 @@ - floppy broken - palette RAM should be written during HBLANK - - double sided disks have t0s0,t0s1,t1s0,t1s1... format - DART clocks - - daisy chain order? - winchester hard disk - analog/digital I/O - light pen @@ -176,18 +174,19 @@ WRITE8_MEMBER( tiki100_state::system_w ) */ - /* drive select */ - if (BIT(data, 0)) wd17xx_set_drive(m_fdc, 0); - if (BIT(data, 1)) wd17xx_set_drive(m_fdc, 1); + // drive select + floppy_image_device *floppy = NULL; - /* density select */ - wd17xx_dden_w(m_fdc, BIT(data, 4)); + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); - /* floppy motor */ - floppy_mon_w(m_floppy0, !BIT(data, 6)); - floppy_mon_w(m_floppy1, !BIT(data, 6)); - floppy_drive_set_ready_state(m_floppy0, BIT(data, 6), 1); - floppy_drive_set_ready_state(m_floppy1, BIT(data, 6), 1); + m_fdc->set_floppy(floppy); + + // density select + m_fdc->dden_w(BIT(data, 4)); + + // floppy motor + if (floppy) floppy->mon_w(!BIT(data, 6)); /* GRAFIKK key led */ set_led_status(machine(), 1, BIT(data, 5)); @@ -218,13 +217,13 @@ static ADDRESS_MAP_START( tiki100_io, AS_IO, 8, tiki100_state ) AM_RANGE(0x04, 0x07) AM_DEVREADWRITE_LEGACY(Z80DART_TAG, z80dart_cd_ba_r, z80dart_cd_ba_w) AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x03) AM_WRITE(video_mode_w) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE_LEGACY(FD1797_TAG, wd17xx_r, wd17xx_w) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(FD1797_TAG, fd1797_t, read, write) AM_RANGE(0x14, 0x14) AM_MIRROR(0x01) AM_WRITE(palette_w) AM_RANGE(0x16, 0x16) AM_DEVWRITE_LEGACY(AY8912_TAG, ay8910_address_w) AM_RANGE(0x17, 0x17) AM_DEVREADWRITE_LEGACY(AY8912_TAG, ay8910_r, ay8910_data_w) AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) AM_RANGE(0x1c, 0x1c) AM_MIRROR(0x03) AM_WRITE(system_w) -// AM_RANGE(0x20, 0x27) winchester controller + AM_RANGE(0x20, 0x27) AM_NOP // winchester controller // AM_RANGE(0x60, 0x6f) analog I/O (SINTEF) // AM_RANGE(0x60, 0x67) digital I/O (RVO) // AM_RANGE(0x70, 0x77) analog/digital I/O @@ -499,20 +498,21 @@ WRITE_LINE_MEMBER( tiki100_state::ctc_z1_w ) static Z80CTC_INTERFACE( ctc_intf ) { DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0), /* interrupt handler */ - DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF,z80ctc_device, trg2), /* ZC/TO0 callback */ + DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF, z80ctc_device, trg2), /* ZC/TO0 callback */ DEVCB_DRIVER_LINE_MEMBER(tiki100_state, ctc_z1_w), /* ZC/TO1 callback */ - DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF,z80ctc_device, trg3) /* ZC/TO2 callback */ + DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF, z80ctc_device, trg3) /* ZC/TO2 callback */ }; /* FD1797 Interface */ -static const wd17xx_interface fdc_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - { FLOPPY_0, FLOPPY_1, NULL, NULL } -}; +FLOPPY_FORMATS_MEMBER( tiki100_state::floppy_formats ) + FLOPPY_TIKI100_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( tiki100_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) // Tead FD-55A + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) // Teac FD-55F +SLOT_INTERFACE_END /* AY-3-8912 Interface */ @@ -536,8 +536,8 @@ static const ay8910_interface ay8910_intf = static const z80_daisy_config tiki100_daisy_chain[] = { { Z80CTC_TAG }, - { Z80PIO_TAG }, { Z80DART_TAG }, + { Z80PIO_TAG }, { NULL } }; @@ -572,47 +572,6 @@ void tiki100_state::machine_start() save_item(NAME(m_keylatch)); } -// physical disks have 2:1 sector interleave -static LEGACY_FLOPPY_OPTIONS_START(tiki100) - LEGACY_FLOPPY_OPTION(tiki100, "dsk", "SSSD disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, - HEADS([1]) - TRACKS([40]) - SECTORS([18]) - SECTOR_LENGTH([128]) - FIRST_SECTOR_ID([1])) - LEGACY_FLOPPY_OPTION(tiki100, "dsk", "SSDD disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, - HEADS([1]) - TRACKS([40]) - SECTORS([10]) - SECTOR_LENGTH([512]) - FIRST_SECTOR_ID([1])) - LEGACY_FLOPPY_OPTION(tiki100, "dsk", "DSDD disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, - HEADS([2]) - TRACKS([40]) - SECTORS([10]) - SECTOR_LENGTH([512]) - FIRST_SECTOR_ID([1])) - LEGACY_FLOPPY_OPTION(tiki100, "dsk", "DSHD disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, - HEADS([2]) - TRACKS([80]) - SECTORS([10]) - SECTOR_LENGTH([512]) - FIRST_SECTOR_ID([1])) -LEGACY_FLOPPY_OPTIONS_END - -static const floppy_interface tiki100_floppy_interface = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(tiki100), - "floppy_5_25", - NULL -}; - /* Machine Driver */ static MACHINE_CONFIG_START( tiki100, tiki100_state ) @@ -638,8 +597,9 @@ static MACHINE_CONFIG_START( tiki100, tiki100_state ) MCFG_Z80PIO_ADD(Z80PIO_TAG, XTAL_8MHz/4, pio_intf) MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_8MHz/4, ctc_intf) MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", tiki100_state, ctc_tick, attotime::from_hz(XTAL_8MHz/4)) - MCFG_FD1797_ADD(FD1797_TAG, fdc_intf) // FD1767PL-02 or FD1797-PL - MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(tiki100_floppy_interface) + MCFG_FD1797x_ADD(FD1797_TAG, XTAL_8MHz/8) // FD1767PL-02 or FD1797-PL + MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":0", tiki100_floppies, "525dd", NULL, tiki100_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":1", tiki100_floppies, "525dd", NULL, tiki100_state::floppy_formats) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mess/includes/tiki100.h b/src/mess/includes/tiki100.h index d8a80ec765f..170022db235 100644 --- a/src/mess/includes/tiki100.h +++ b/src/mess/includes/tiki100.h @@ -7,13 +7,12 @@ #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/z80/z80daisy.h" -#include "formats/basicdsk.h" -#include "imagedev/flopdrv.h" +#include "formats/tiki100_dsk.h" #include "machine/ram.h" #include "machine/z80ctc.h" #include "machine/z80dart.h" #include "machine/z80pio.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" #include "sound/ay8910.h" #define SCREEN_TAG "screen" @@ -40,16 +39,16 @@ public: m_ctc(*this, Z80CTC_TAG), m_fdc(*this, FD1797_TAG), m_ram(*this, RAM_TAG), - m_floppy0(*this, FLOPPY_0), - m_floppy1(*this, FLOPPY_1) + m_floppy0(*this, FD1797_TAG":0"), + m_floppy1(*this, FD1797_TAG":1") { } required_device m_maincpu; required_device m_ctc; - required_device m_fdc; + required_device m_fdc; required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; + required_device m_floppy0; + required_device m_floppy1; virtual void machine_start(); @@ -64,6 +63,7 @@ public: DECLARE_WRITE8_MEMBER( system_w ); DECLARE_WRITE_LINE_MEMBER( ctc_z1_w ); DECLARE_WRITE8_MEMBER( video_scroll_w ); + DECLARE_FLOPPY_FORMATS( floppy_formats ); void bankswitch();