Added (read-only) support for DDI floppy images.

This commit is contained in:
OBattler
2018-04-28 15:37:26 +02:00
parent c2add9e3fe
commit d17380913e
3 changed files with 27 additions and 13 deletions

View File

@@ -8,7 +8,7 @@
*
* Implementation of the floppy drive emulation.
*
* Version: @(#)fdd.c 1.0.6 2018/04/10
* Version: @(#)fdd.c 1.0.7 2018/04/28
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -114,6 +114,7 @@ static const struct
{L"BIN", img_load, img_close, -1},
{L"CQ", img_load, img_close, -1},
{L"CQM", img_load, img_close, -1},
{L"DDI", img_load, img_close, -1},
{L"DSK", img_load, img_close, -1},
{L"FDI", fdi_load, fdi_close, -1},
{L"FDF", img_load, img_close, -1},

View File

@@ -13,7 +13,7 @@
* re-merged with the other files. Much of it is generic to
* all formats.
*
* Version: @(#)fdd_img.c 1.0.5 2018/03/17
* Version: @(#)fdd_img.c 1.0.6 2018/04/28
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -605,7 +605,7 @@ img_load(int drive, wchar_t *fn)
uint8_t bpb_mid; /* Media type ID. */
uint8_t bpb_sectors;
uint8_t bpb_sides;
uint8_t fdi, cqm, fdf;
uint8_t fdi, cqm, fdf, ddi;
uint16_t comment_len = 0;
int16_t block_len = 0;
uint32_t cur_pos = 0;
@@ -646,10 +646,16 @@ img_load(int drive, wchar_t *fn)
writeprot[drive] = 1;
fwriteprot[drive] = writeprot[drive];
fdi = cqm = 0;
fdi = cqm = ddi = 0;
dev->interleave = dev->skew = 0;
if (! wcscasecmp(ext, L"DDI")) {
ddi = 1;
dev->base = 0x2400;
} else
dev->base = 0;
if (! wcscasecmp(ext, L"FDI")) {
/* This is a Japanese FDI image, so let's read the header */
pclog("img_load(): File is a Japanese FDI image...\n");
@@ -903,16 +909,20 @@ img_load(int drive, wchar_t *fn)
} else {
dev->disk_at_once = 0;
/* Read the BPB */
pclog("img_load(): File is a raw image...\n");
fseek(dev->f, 0x0B, SEEK_SET);
if (ddi) {
pclog("img_load(): File is a DDI image...\n");
fwriteprot[drive] = writeprot[drive] = 1;
} else
pclog("img_load(): File is a raw image...\n");
fseek(dev->f, dev->base + 0x0B, SEEK_SET);
fread(&bpb_bps, 1, 2, dev->f);
fseek(dev->f, 0x13, SEEK_SET);
fseek(dev->f, dev->base + 0x13, SEEK_SET);
fread(&bpb_total, 1, 2, dev->f);
fseek(dev->f, 0x15, SEEK_SET);
fseek(dev->f, dev->base + 0x15, SEEK_SET);
bpb_mid = fgetc(dev->f);
fseek(dev->f, 0x18, SEEK_SET);
fseek(dev->f, dev->base + 0x18, SEEK_SET);
bpb_sectors = fgetc(dev->f);
fseek(dev->f, 0x1A, SEEK_SET);
fseek(dev->f, dev->base + 0x1A, SEEK_SET);
bpb_sides = fgetc(dev->f);
cqm = 0;
@@ -920,9 +930,12 @@ img_load(int drive, wchar_t *fn)
fseek(dev->f, -1, SEEK_END);
size = ftell(dev->f) + 1;
if (ddi)
size -= 0x2400;
jump_if_fdf:
dev->base = 0;
if (!ddi)
dev->base = 0;
fdi = 0;
}

View File

@@ -8,7 +8,7 @@
*
* Application resource script for Windows.
*
* Version: @(#)86Box.rc 1.0.34 2018/04/26
* Version: @(#)86Box.rc 1.0.35 2018/04/28
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -934,7 +934,7 @@ BEGIN
IDS_2156 "%u"
IDS_2157 "%u MB (CHS: %i, %i, %i)"
IDS_2158 "Floppy %i (%s): %ls"
IDS_2159 "All images (*.0??;*.1??;*.360;*.720;*.86F;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF)\0*.0??;*.1??;*.360;*.720;*.86F;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.360;*.720;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.360;*.720;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"
IDS_2159 "All images (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"
IDS_2160 "Configuration files (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0"
IDS_2161 "&New image..."
IDS_2162 "&Existing image..."