summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/lib/formats/smx_dsk.c191
-rw-r--r--src/lib/formats/smx_dsk.h24
-rw-r--r--src/mess/drivers/special.c12
-rw-r--r--src/mess/includes/special.h2
4 files changed, 80 insertions, 149 deletions
diff --git a/src/lib/formats/smx_dsk.c b/src/lib/formats/smx_dsk.c
index 0e198c13f90..4938be8ff22 100644
--- a/src/lib/formats/smx_dsk.c
+++ b/src/lib/formats/smx_dsk.c
@@ -1,159 +1,74 @@
+/***************************************************************************
+
+ 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/smx_dsk.c
- Specialist MX disk images
+ Specialist MX format
*********************************************************************/
-#include <string.h>
-
-#include "smx_dsk.h"
-#include "basicdsk.h"
-
-static FLOPPY_IDENTIFY(smx_dsk_identify)
-{
- *vote = (floppy_image_size(floppy) == 819200) ? 100 : 0;
- return FLOPPY_ERROR_SUCCESS;
-}
-
-static int smx_get_heads_per_disk(floppy_image_legacy *floppy)
-{
- return 2;
-}
+#include "emu.h"
+#include "formats/smx_dsk.h"
-static int smx_get_tracks_per_disk(floppy_image_legacy *floppy)
+smx_format::smx_format() : wd177x_format(formats)
{
- return 80;
}
-static UINT64 smx_translate_offset(floppy_image_legacy *floppy,
- int track, int head, int sector)
+const char *smx_format::name() const
{
- return (track * 1024 * 5 * 2) + (head * 1024 * 5) + 1024 * sector;
+ return "smx";
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+const char *smx_format::description() const
{
- UINT64 offs;
- /* translate the sector to a raw sector */
- if (!sector_is_index)
- {
- sector -= 1;
- }
- /* check to see if we are out of range */
- if ((head < 0) || (head >= 2) || (track < 0) || (track >= 80)
- || (sector < 0) || (sector >= 6))
- return FLOPPY_ERROR_SEEKERROR;
-
- offs = smx_translate_offset(floppy, track, head, sector);
- if (offset)
- *offset = offs;
- return FLOPPY_ERROR_SUCCESS;
+ return "Specialist MX disk image";
}
-
-
-static floperr_t internal_smx_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
+const char *smx_format::extensions() const
{
- UINT64 offset;
- floperr_t err;
- err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
- if (err)
- return err;
-
- floppy_image_read(floppy, buffer, offset, buflen);
- return FLOPPY_ERROR_SUCCESS;
+ return "odi";
}
-
-
-static floperr_t internal_smx_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam)
+// Unverified gap sizes
+const smx_format::format smx_format::formats[] =
{
- UINT64 offset;
- floperr_t err;
-
- err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
- if (err)
- return err;
-
- floppy_image_write(floppy, buffer, offset, buflen);
- return FLOPPY_ERROR_SUCCESS;
-}
-
-
-
-static floperr_t smx_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
-{
- return internal_smx_read_sector(floppy, head, track, sector, FALSE, buffer, buflen);
-}
-
-static floperr_t smx_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
-{
- return internal_smx_write_sector(floppy, head, track, sector, FALSE, buffer, buflen, ddam);
-}
-
-static floperr_t smx_read_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
-{
- return internal_smx_read_sector(floppy, head, track, sector, TRUE, buffer, buflen);
-}
-
-static floperr_t smx_write_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
-{
- return internal_smx_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam);
-}
-
-static floperr_t smx_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
-{
- floperr_t err;
- err = get_offset(floppy, head, track, sector, FALSE, NULL);
- if (err)
- return err;
-
- if (sector_length) {
- *sector_length = 1024;
- }
- return FLOPPY_ERROR_SUCCESS;
-}
-
-
-
-static floperr_t smx_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)
-{
- sector_index += 1;
- if (cylinder)
- *cylinder = track;
- if (side)
- *side = head;
- if (sector)
- *sector = sector_index;
- if (flags)
- /* TODO: read DAM or DDAM and determine flags */
- *flags = 0;
- return smx_get_sector_length(floppy, head, track, sector_index, sector_length);
-}
-
-
-static FLOPPY_CONSTRUCT(smx_dsk_construct)
-{
- struct FloppyCallbacks *callbacks;
- callbacks = floppy_callbacks(floppy);
- callbacks->read_sector = smx_read_sector;
- callbacks->write_sector = smx_write_sector;
- callbacks->read_indexed_sector = smx_read_indexed_sector;
- callbacks->write_indexed_sector = smx_write_indexed_sector;
- callbacks->get_sector_length = smx_get_sector_length;
- callbacks->get_heads_per_disk = smx_get_heads_per_disk;
- callbacks->get_tracks_per_disk = smx_get_tracks_per_disk;
- callbacks->get_indexed_sector_info = smx_get_indexed_sector_info;
-
- return FLOPPY_ERROR_SUCCESS;
-}
-
-
-
-/* ----------------------------------------------------------------------- */
-
-LEGACY_FLOPPY_OPTIONS_START( specimx )
- LEGACY_FLOPPY_OPTION( smx_dsk, "odi", "Specialist MX floppy disk image", smx_dsk_identify, smx_dsk_construct, NULL, NULL)
-LEGACY_FLOPPY_OPTIONS_END
+ { // 720K 5.25 inch
+ floppy_image::FF_525, floppy_image::DSQD,
+ 2000, 5, 80, 2, 1024, {}, 1, {}, 100, 22, 20
+ },
+ {}
+};
+
+const floppy_format_type FLOPPY_SMX_FORMAT = &floppy_image_format_creator<smx_format>;
diff --git a/src/lib/formats/smx_dsk.h b/src/lib/formats/smx_dsk.h
index 8e80d12e4ef..fdae3c3902d 100644
--- a/src/lib/formats/smx_dsk.h
+++ b/src/lib/formats/smx_dsk.h
@@ -2,17 +2,27 @@
formats/smx_dsk.h
- SVI318 disk images
+ Specialist MX disk images
*********************************************************************/
-#ifndef SMX_DSK_H
-#define SMX_DSK_H
+#ifndef SMX_DSK_H_
+#define SMX_DSK_H_
-#include "flopimg.h"
+#include "wd177x_dsk.h"
-/**************************************************************************/
+class smx_format : public wd177x_format {
+public:
+ smx_format();
-LEGACY_FLOPPY_OPTIONS_EXTERN(specimx);
+ virtual const char *name() const;
+ virtual const char *description() const;
+ virtual const char *extensions() const;
-#endif /* SVI_DSK_H */
+private:
+ static const format formats[];
+};
+
+extern const floppy_format_type FLOPPY_SMX_FORMAT;
+
+#endif
diff --git a/src/mess/drivers/special.c b/src/mess/drivers/special.c
index dff8bdeb046..0075437056f 100644
--- a/src/mess/drivers/special.c
+++ b/src/mess/drivers/special.c
@@ -379,6 +379,10 @@ static const cassette_interface special_cassette_interface =
NULL
};
+FLOPPY_FORMATS_MEMBER( special_state::specimx_floppy_formats )
+ FLOPPY_SMX_FORMAT
+FLOPPY_FORMATS_END
+
static SLOT_INTERFACE_START( specimx_floppies )
SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
SLOT_INTERFACE_END
@@ -446,8 +450,8 @@ static MACHINE_CONFIG_DERIVED( specimx, special )
/* Devices */
MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8)
- MCFG_FLOPPY_DRIVE_ADD("fd0", specimx_floppies, "525dd", 0, floppy_image_device::default_floppy_formats)
- MCFG_FLOPPY_DRIVE_ADD("fd1", specimx_floppies, "525dd", 0, floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("fd0", specimx_floppies, "525dd", 0, special_state::specimx_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("fd1", specimx_floppies, "525dd", 0, special_state::specimx_floppy_formats)
/* internal ram */
MCFG_RAM_ADD(RAM_TAG)
@@ -485,8 +489,8 @@ static MACHINE_CONFIG_START( erik, special_state )
MCFG_I8255_ADD( "ppi8255", specialist_ppi8255_interface )
MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8)
- MCFG_FLOPPY_DRIVE_ADD("fd0", specimx_floppies, "525dd", 0, floppy_image_device::default_floppy_formats)
- MCFG_FLOPPY_DRIVE_ADD("fd1", specimx_floppies, "525dd", 0, floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("fd0", specimx_floppies, "525dd", 0, special_state::specimx_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("fd1", specimx_floppies, "525dd", 0, special_state::specimx_floppy_formats)
/* internal ram */
MCFG_RAM_ADD(RAM_TAG)
diff --git a/src/mess/includes/special.h b/src/mess/includes/special.h
index ae606426764..6c964f3e6ec 100644
--- a/src/mess/includes/special.h
+++ b/src/mess/includes/special.h
@@ -15,6 +15,7 @@
#include "machine/i8255.h"
#include "machine/pit8253.h"
#include "imagedev/cassette.h"
+#include "formats/smx_dsk.h"
#include "formats/rk_cas.h"
#include "machine/wd_fdc.h"
#include "machine/ram.h"
@@ -95,6 +96,7 @@ public:
TIMER_CALLBACK_MEMBER(special_reset);
TIMER_CALLBACK_MEMBER(setup_pit8253_gates);
void fdc_drq(bool state);
+ DECLARE_FLOPPY_FORMATS( specimx_floppy_formats );
};