summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2012-08-24 22:22:41 +0000
committer Olivier Galibert <galibert@pobox.com>2012-08-24 22:22:41 +0000
commit6752a99aeaa4cf3dc431be786e70ed898526e6d3 (patch)
tree470265f7c4fabb0172acd73f2ff74f8b17094df3 /src/lib
parent41a817b9dc39bb50704a3879e6ece61f445a733c (diff)
floppy: Harmless intermediate commit that could help Micko (nw)
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/formats/d88_dsk.c217
-rw-r--r--src/lib/formats/d88_dsk.h32
-rw-r--r--src/lib/formats/flopimg.h8
-rw-r--r--src/lib/formats/upd765_dsk.c194
-rw-r--r--src/lib/formats/upd765_dsk.h48
-rw-r--r--src/lib/formats/xdf_dsk.c77
-rw-r--r--src/lib/formats/xdf_dsk.h28
-rw-r--r--src/lib/lib.mak2
8 files changed, 604 insertions, 2 deletions
diff --git a/src/lib/formats/d88_dsk.c b/src/lib/formats/d88_dsk.c
index 6c58c5bb7e1..950e04495b4 100644
--- a/src/lib/formats/d88_dsk.c
+++ b/src/lib/formats/d88_dsk.c
@@ -376,3 +376,220 @@ FLOPPY_CONSTRUCT(d88_dsk_construct)
return FLOPPY_ERROR_SUCCESS;
}
+
+
+
+/***************************************************************************
+
+ 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/d88_dsk.h
+
+ D88 disk images
+
+*********************************************************************/
+
+#include "emu.h"
+#include "d88_dsk.h"
+
+d88_format::d88_format()
+{
+}
+
+const char *d88_format::name() const
+{
+ return "d88";
+}
+
+const char *d88_format::description() const
+{
+ return "D88 disk image";
+}
+
+const char *d88_format::extensions() const
+{
+ return "d77,d88,1dd";
+}
+
+int d88_format::identify(io_generic *io, UINT32 form_factor)
+{
+ int size = io_generic_size(io);
+ UINT8 h[32];
+
+ io_generic_read(io, h, 0, 32);
+ if((LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c)) == size) &&
+ (h[0x1b] == 0x00 || h[0x1b] == 0x10 || h[0x1b] == 0x20 || h[0x1b] == 0x30 || h[0x1b] == 0x40))
+ return 100;
+
+ return 0;
+}
+
+bool d88_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+{
+ UINT8 h[32];
+
+ io_generic_read(io, h, 0, 32);
+
+ int cell_count = 0;
+ int track_count = 0;
+ int head_count = 0;
+ switch(h[0x1b]) {
+ case 0x00:
+ cell_count = 100000;
+ track_count = 42;
+ head_count = 2;
+ image->set_variant(floppy_image::DSDD);
+ break;
+
+ case 0x10:
+ cell_count = 100000;
+ track_count = 82;
+ head_count = 2;
+ image->set_variant(floppy_image::DSQD);
+ break;
+
+ case 0x20:
+ cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
+ track_count = 82;
+ head_count = 2;
+ image->set_variant(floppy_image::DSHD);
+ break;
+
+ case 0x30:
+ cell_count = 100000;
+ track_count = 42;
+ head_count = 1;
+ image->set_variant(floppy_image::SSDD);
+ break;
+
+ case 0x40:
+ cell_count = 100000;
+ track_count = 82;
+ head_count = 1;
+ image->set_variant(floppy_image::SSQD);
+ break;
+ }
+
+ if(!head_count)
+ return false;
+
+ UINT32 track_pos[164];
+ io_generic_read(io, track_pos, 32, 164*4);
+
+ for(int track=0; track < track_count; track++)
+ for(int head=0; head < head_count; head++) {
+ int pos = LITTLE_ENDIANIZE_INT32(track_pos[track * head_count + head]);
+ if(!pos)
+ continue;
+
+ UINT32 track_data[210000];
+ UINT8 sect_data[65536];
+ int tpos = 0;
+
+ // gap 4a , IAM and gap 1
+ for(int i=0; i<80; i++) mfm_w(track_data, tpos, 8, 0x4e);
+ for(int i=0; i<12; i++) mfm_w(track_data, tpos, 8, 0x00);
+ for(int i=0; i< 3; i++) raw_w(track_data, tpos, 16, 0x5224);
+ mfm_w(track_data, tpos, 8, 0xfc);
+ for(int i=0; i<50; i++) mfm_w(track_data, tpos, 8, 0x4e);
+
+ // Updated after reading the first header
+ int sector_count = 1;
+ int gap3 = 84;
+ for(int i=0; i<sector_count; i++) {
+ UINT8 hs[16];
+ io_generic_read(io, hs, pos, 16);
+ UINT16 size = LITTLE_ENDIANIZE_INT16(*(UINT16 *)(hs+14));
+ io_generic_read(io, sect_data, pos+16, size);
+ pos += 16+size;
+
+ if(i == 0) {
+ sector_count = LITTLE_ENDIANIZE_INT16(*(UINT16 *)(hs+4));
+ if(size < 512)
+ gap3 = form_factor == floppy_image::FF_35 ? 54 : 50;
+ else
+ gap3 = form_factor == floppy_image::FF_35 ? 84 : 80;
+ }
+
+ int cpos;
+ UINT16 crc;
+ // sync and IDAM and gap 2
+ for(int j=0; j<12; j++) mfm_w(track_data, tpos, 8, 0x00);
+ cpos = tpos;
+ for(int j=0; j< 3; j++) raw_w(track_data, tpos, 16, 0x4489);
+ mfm_w(track_data, tpos, 8, 0xfe);
+ mfm_w(track_data, tpos, 8, hs[0]);
+ mfm_w(track_data, tpos, 8, hs[1]);
+ mfm_w(track_data, tpos, 8, hs[2]);
+ mfm_w(track_data, tpos, 8, hs[3]);
+ crc = calc_crc_ccitt(track_data, cpos, tpos);
+ mfm_w(track_data, tpos, 16, crc);
+ for(int j=0; j<22; j++) mfm_w(track_data, tpos, 8, 0x4e);
+
+ // sync, DAM, data and gap 3
+ for(int j=0; j<12; j++) mfm_w(track_data, tpos, 8, 0x00);
+ cpos = tpos;
+ for(int j=0; j< 3; j++) raw_w(track_data, tpos, 16, 0x4489);
+ mfm_w(track_data, tpos, 8, 0xfb);
+ for(int j=0; j<size; j++) mfm_w(track_data, tpos, 8, sect_data[j]);
+ crc = calc_crc_ccitt(track_data, cpos, tpos);
+ mfm_w(track_data, tpos, 16, crc);
+ for(int j=0; j<gap3; j++) mfm_w(track_data, tpos, 8, 0x4e);
+ }
+
+ // Gap 4b
+
+ if(tpos > cell_count)
+ throw emu_fatalerror("d88_format: Incorrect layout on track %d head %d, expected_size=%d, current_size=%d", track, head, cell_count, tpos);
+ while(tpos < cell_count-15) mfm_w(track_data, tpos, 8, 0x4e);
+ raw_w(track_data, tpos, cell_count-tpos, 0x9254 >> (16+tpos-cell_count));
+
+ generate_track_from_levels(track, head, track_data, cell_count, 0, image);
+ }
+
+ return true;
+}
+
+
+bool d88_format::save(io_generic *io, floppy_image *image)
+{
+ return true;
+}
+
+bool d88_format::supports_save() const
+{
+ return true;
+}
+
+const floppy_format_type FLOPPY_D88_FORMAT = &floppy_image_format_creator<d88_format>;
diff --git a/src/lib/formats/d88_dsk.h b/src/lib/formats/d88_dsk.h
index e69de29bb2d..f4bf58fe0f3 100644
--- a/src/lib/formats/d88_dsk.h
+++ b/src/lib/formats/d88_dsk.h
@@ -0,0 +1,32 @@
+/*********************************************************************
+
+ formats/d88_dsk.h
+
+ D88 disk images
+
+*********************************************************************/
+
+#ifndef D88_DSK_H
+#define D88_DSK_H
+
+#include "flopimg.h"
+
+
+class d88_format : public floppy_image_format_t
+{
+public:
+ d88_format();
+
+ 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 const char *name() const;
+ virtual const char *description() const;
+ virtual const char *extensions() const;
+ virtual bool supports_save() const;
+};
+
+extern const floppy_format_type FLOPPY_D88_FORMAT;
+
+#endif /* D88_DSK_H */
diff --git a/src/lib/formats/flopimg.h b/src/lib/formats/flopimg.h
index 3539d52cd89..8eb6334544a 100644
--- a/src/lib/formats/flopimg.h
+++ b/src/lib/formats/flopimg.h
@@ -608,15 +608,19 @@ public:
//! Form factors
enum {
FF_UNKNOWN = 0x00000000, //!< Unknown, useful when converting
+ FF_3 = 0x20202033, //!< "3 " 3 inch disk
FF_35 = 0x20203533, //!< "35 " 3.5 inch disk
FF_525 = 0x20353235, //!< "525 " 5.25 inch disk
+ FF_8 = 0x20202038, //!< "8 " 8 inch disk
};
//! Variants
enum {
SSSD = 0x44535353, //!< "SSSD", Single-sided single-density
- SSDD = 0x44445353, //!< "DSSD", Double-sided single-density
- DSDD = 0x44445344, //!< "DSDD", Double-sided double-density (720K)
+ SSDD = 0x44445353, //!< "SSDD", Single-sided double-density
+ SSQD = 0x44515353, //!< "SSQD", Single-sided quad-density
+ DSDD = 0x44445344, //!< "DSDD", Double-sided double-density (720K in 3.5, 360K in 5.25)
+ DSQD = 0x44515344, //!< "DSQD", Double-sided quad-density (720K in 5.25, means DD+80 tracks)
DSHD = 0x44485344, //!< "DSHD", Double-sided high-density (1440K)
DSED = 0x44455344, //!< "DSED", Double-sided extra-density (2880K)
};
diff --git a/src/lib/formats/upd765_dsk.c b/src/lib/formats/upd765_dsk.c
index e69de29bb2d..236904c7910 100644
--- a/src/lib/formats/upd765_dsk.c
+++ b/src/lib/formats/upd765_dsk.c
@@ -0,0 +1,194 @@
+/***************************************************************************
+
+ 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/upd765_dsk.h
+
+ helper for simple upd765-formatted disk images
+
+*********************************************************************/
+
+#include "emu.h"
+#include "formats/upd765_dsk.h"
+
+upd765_format::upd765_format(const format *_formats)
+{
+ formats = _formats;
+}
+
+int upd765_format::find_size(io_generic *io, UINT32 form_factor)
+{
+ int size = io_generic_size(io);
+ for(int i=0; formats[i].form_factor; i++) {
+ if(form_factor != floppy_image::FF_UNKNOWN && form_factor != formats[i].form_factor)
+ continue;
+
+ int format_size;
+ if(formats[i].sector_base_size)
+ format_size = formats[i].sector_base_size * formats[i].sector_count;
+ else {
+ format_size = 0;
+ for(int j=0; j != formats[i].sector_count; j++)
+ format_size += formats[i].per_sector_size[j];
+ }
+
+ format_size *= formats[i].track_count * formats[i].head_count;
+
+ if(size == format_size)
+ return i;
+ }
+ return -1;
+}
+
+int upd765_format::identify(io_generic *io, UINT32 form_factor)
+{
+ int type = find_size(io, form_factor);
+
+ if(type != -1)
+ return 50;
+ return 0;
+}
+
+bool upd765_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+{
+ int type = find_size(io, form_factor);
+ if(type == -1)
+ return false;
+
+ const format &f = formats[type];
+
+ floppy_image_format_t::desc_e desc[] = {
+ /* 00 */ { MFM, 0x4e, f.gap_4a },
+ /* 01 */ { MFM, 0x00, 12 },
+ /* 02 */ { RAW, 0x5224, 3 },
+ /* 03 */ { MFM, 0xfc, 1 },
+ /* 04 */ { MFM, 0x4e, f.gap_1 },
+ /* 05 */ { SECTOR_LOOP_START, 0, f.sector_count-1 },
+ /* 06 */ { MFM, 0x00, 12 },
+ /* 07 */ { CRC_CCITT_START, 1 },
+ /* 08 */ { RAW, 0x4489, 3 },
+ /* 09 */ { MFM, 0xfe, 1 },
+ /* 10 */ { TRACK_ID },
+ /* 11 */ { HEAD_ID },
+ /* 12 */ { SECTOR_ID },
+ /* 13 */ { SIZE_ID },
+ /* 14 */ { CRC_END, 1 },
+ /* 15 */ { CRC, 1 },
+ /* 16 */ { MFM, 0x4e, f.gap_2 },
+ /* 17 */ { MFM, 0x00, 12 },
+ /* 18 */ { CRC_CCITT_START, 2 },
+ /* 19 */ { RAW, 0x4489, 3 },
+ /* 20 */ { MFM, 0xfb, 1 },
+ /* 21 */ { SECTOR_DATA, -1 },
+ /* 22 */ { CRC_END, 2 },
+ /* 23 */ { CRC, 2 },
+ /* 24 */ { MFM, 0x4e, f.gap_3 },
+ /* 25 */ { SECTOR_LOOP_END },
+ /* 26 */ { MFM, 0x4e, 0 },
+ /* 27 */ { RAWBITS, 0x9254, 0 },
+ /* 28 */ { END }
+ };
+
+ int current_size = (f.gap_4a+12+3+1+f.gap_1)*16;
+ if(f.sector_base_size)
+ current_size += f.sector_base_size * f.sector_count * 16;
+ else {
+ for(int j=0; j != f.sector_count; j++)
+ current_size += f.per_sector_size[j] * 16;
+ }
+ current_size += (12+3+1+4+2+f.gap_2+12+3+1+2+f.gap_3) * f.sector_count * 16;
+
+ int total_size = 200000000/f.cell_size;
+ int remaining_size = total_size - current_size;
+ if(remaining_size < 0)
+ throw emu_fatalerror("upd765_format: Incorrect track layout, max_size=%d, current_size=%d", total_size, current_size);
+
+ // Fixup the end gap
+ desc[26].p2 = remaining_size / 16;
+ desc[27].p2 = remaining_size & 15;
+ desc[27].p1 >>= 16-(remaining_size & 15);
+
+ int track_size;
+ if(f.sector_base_size)
+ track_size = f.sector_base_size * f.sector_count;
+ else {
+ track_size = 0;
+ for(int i=0; i != f.sector_count; i++)
+ track_size += f.per_sector_size[i];
+ }
+
+ UINT8 sectdata[40*512];
+ desc_s sectors[40];
+ if(f.sector_base_id == -1) {
+ for(int i=0; i<f.sector_count; i++) {
+ int cur_offset = 0;
+ for(int j=0; j<f.sector_count; j++)
+ if(f.per_sector_id[j] < f.per_sector_id[i])
+ cur_offset += f.sector_base_size ? f.sector_base_size : f.per_sector_size[j];
+ sectors[i].data = sectdata + cur_offset;
+ sectors[i].size = f.sector_base_size ? f.sector_base_size : f.per_sector_size[i];
+ sectors[i].sector_id = f.per_sector_id[i];
+ }
+ } else {
+ int cur_offset = 0;
+ for(int i=0; i<f.sector_count; i++) {
+ sectors[i].data = sectdata + cur_offset;
+ sectors[i].size = f.sector_base_size ? f.sector_base_size : f.per_sector_size[i];
+ cur_offset += sectors[i].size;
+ sectors[i].sector_id = i + f.sector_base_id;
+ }
+ }
+
+ for(int track=0; track < f.track_count; track++)
+ for(int head=0; head < f.head_count; head++) {
+ io_generic_read(io, sectdata, (track*f.head_count + head)*track_size, track_size);
+ generate_track(desc, track, head, sectors, f.sector_count, total_size, image);
+ }
+
+ image->set_variant(f.variant);
+
+ return true;
+}
+
+
+bool upd765_format::save(io_generic *io, floppy_image *image)
+{
+ return true;
+}
+
+bool upd765_format::supports_save() const
+{
+ return true;
+}
+
diff --git a/src/lib/formats/upd765_dsk.h b/src/lib/formats/upd765_dsk.h
index e69de29bb2d..e4f11d86ef0 100644
--- a/src/lib/formats/upd765_dsk.h
+++ b/src/lib/formats/upd765_dsk.h
@@ -0,0 +1,48 @@
+/*********************************************************************
+
+ formats/upd765_dsk.h
+
+ helper for simple upd765-formatted disk images
+
+*********************************************************************/
+
+#ifndef UPD765_DSK_H
+#define UPD765_DSK_H
+
+#include "flopimg.h"
+
+class upd765_format : public floppy_image_format_t
+{
+public:
+ struct format {
+ UINT32 form_factor; // See floppy_image for possible values
+ UINT32 variant; // See floppy_image for possible values
+
+ int cell_size; // See floppy_image_format_t for details
+ int sector_count;
+ int track_count;
+ int head_count;
+ int sector_base_size;
+ int per_sector_size[40]; // if sector_base_size is 0
+ int sector_base_id; // 0 or 1 usually, -1 if there's interleave
+ int per_sector_id[40]; // if sector_base_id is -1. If both per are used, then sector per_sector_id[i] has size per_sector_size[i]
+ int gap_4a; // Usually 80 - number of 4e between index and IAM sync
+ int gap_1; // Usually 50 - number of 4e between IAM and first IDAM sync
+ int gap_2; // 22 for <=1.44Mb, 41 for 2.88Mb - number of 4e between sector header and data sync
+ int gap_3; // Usually 84 - number of 4e between sector crc and next IDAM
+ };
+
+ // End the array with {}
+ upd765_format(const format *formats);
+
+ 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:
+ const format *formats;
+ int find_size(io_generic *io, UINT32 form_factor);
+};
+
+#endif /* UPD765_DSK_H */
diff --git a/src/lib/formats/xdf_dsk.c b/src/lib/formats/xdf_dsk.c
index e69de29bb2d..fce84bd9736 100644
--- a/src/lib/formats/xdf_dsk.c
+++ b/src/lib/formats/xdf_dsk.c
@@ -0,0 +1,77 @@
+/***************************************************************************
+
+ 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/xdf_dsk.c
+
+ x68k bare-bones formats
+
+*********************************************************************/
+
+#include "emu.h"
+#include "formats/xdf_dsk.h"
+
+xdf_format::xdf_format() : upd765_format(formats)
+{
+}
+
+const char *xdf_format::name() const
+{
+ return "xdf";
+}
+
+const char *xdf_format::description() const
+{
+ return "XDF disk image";
+}
+
+const char *xdf_format::extensions() const
+{
+ return "xdf,hdm,2hd";
+}
+
+// Unverified gap sizes
+const xdf_format::format xdf_format::formats[] = {
+ {
+ floppy_image::FF_525, floppy_image::DSHD,
+ 1200, // 1us, 360rpm
+ 8, 77, 2,
+ 1024, {},
+ 1, {},
+ 80, 50, 22, 84
+ },
+ {}
+};
+
+const floppy_format_type FLOPPY_XDF_FORMAT = &floppy_image_format_creator<xdf_format>;
diff --git a/src/lib/formats/xdf_dsk.h b/src/lib/formats/xdf_dsk.h
index e69de29bb2d..3b01cdd6d2d 100644
--- a/src/lib/formats/xdf_dsk.h
+++ b/src/lib/formats/xdf_dsk.h
@@ -0,0 +1,28 @@
+/*********************************************************************
+
+ formats/xdf_dsk.h
+
+ x68k bare-bones formats
+
+*********************************************************************/
+
+#ifndef XDF_DSK_H_
+#define XDF_DSK_H_
+
+#include "upd765_dsk.h"
+
+class xdf_format : public upd765_format {
+public:
+ xdf_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_XDF_FORMAT;
+
+#endif
diff --git a/src/lib/lib.mak b/src/lib/lib.mak
index 7e4218f4a66..eccf11556eb 100644
--- a/src/lib/lib.mak
+++ b/src/lib/lib.mak
@@ -161,6 +161,7 @@ FORMATSOBJS = \
$(LIBOBJ)/formats/tvc_cas.o \
$(LIBOBJ)/formats/tzx_cas.o \
$(LIBOBJ)/formats/uef_cas.o \
+ $(LIBOBJ)/formats/upd765_dsk.o \
$(LIBOBJ)/formats/vg5k_cas.o \
$(LIBOBJ)/formats/vt_cas.o \
$(LIBOBJ)/formats/vt_dsk.o \
@@ -168,6 +169,7 @@ FORMATSOBJS = \
$(LIBOBJ)/formats/wavfile.o \
$(LIBOBJ)/formats/x07_cas.o \
$(LIBOBJ)/formats/x1_tap.o \
+ $(LIBOBJ)/formats/xdf_dsk.o \
$(LIBOBJ)/formats/z80ne_dsk.o \
$(LIBOBJ)/formats/zx81_p.o \
$(LIBOBJ)/formats/hxcmfm_dsk.o \