diff --git a/src/Makefile.mingw b/src/Makefile.mingw index 4f618f45d..ee51703b3 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -8,7 +8,7 @@ # # Modified Makefile for Win32 (MinGW32) environment. # -# Version: @(#)Makefile.mingw 1.0.43 2017/09/03 +# Version: @(#)Makefile.mingw 1.0.45 2017/09/12 # # Authors: Miran Grca, # Fred N. van Kempen, @@ -104,6 +104,9 @@ OPTS = -DWIN32 -I$(PLAT) $(EXTRAS) $(STUFF) ifdef EXFLAGS OPTS += $(EXFLAGS) endif +ifdef EXINC +OPTS += -I$(EXINC) +endif ifeq ($(X64), y) ifeq ($(OPTIM), y) @@ -239,8 +242,8 @@ DEVOBJ = bugger.o lpt.o $(SERIAL) \ mouse.o mouse_serial.o mouse_ps2.o mouse_bus.o FDDOBJ = fdd.o fdc.o fdi2raw.o \ - floppy.o \ - floppy_86f.o floppy_fdi.o floppy_imd.o floppy_img.o floppy_td0.o + floppy.o floppy_common.o floppy_86f.o \ + floppy_fdi.o floppy_imd.o floppy_img.o floppy_json.o floppy_td0.o CDROMOBJ= cdrom.o \ cdrom_dosbox.o cdrom_image.o cdrom_ioctl.o cdrom_null.o @@ -485,6 +488,8 @@ dma.o: ibm.h cpu/x86.h mem.h io.h dma.h floppy.o: ibm.h config.h floppy.h floppy_fdi.h fdc.h fdd.h timer.h \ floppy_img.h floppy_86f.h floppy_td0.h floppy_imd.h +floppy_common.o: ibm.h floppy.h floppy_common.h fdc.h fdd.h + floppy_86f.o: lzf/lzf.h config.h dma.h random.h floppy.h floppy_86f.h \ fdc.h fdd.h ibm.h @@ -493,6 +498,8 @@ floppy_fdi.o: ibm.h floppy.h floppy_img.h floppy_fdi.h fdc.h fdd.h fdi2raw.h \ floppy_td0.o: ibm.h floppy.h floppy_td0.h fdc.h fdd.h +floppy_json.o: ibm.h floppy.h floppy_common.h floppy_json.h fdc.h fdd.h + fdc.o: ibm.h io.h dma.h pic.h timer.h floppy.h fdc.h fdd.h fdd.o: ibm.h floppy.h fdc.h fdd.h diff --git a/src/floppy/floppy.c b/src/floppy/floppy.c index 39ebdb182..da40cf9fb 100644 --- a/src/floppy/floppy.c +++ b/src/floppy/floppy.c @@ -9,7 +9,7 @@ * Generic floppy disk interface that communicates with the * other handlers. * - * Version: @(#)floppy.c 1.0.2 2017/09/03 + * Version: @(#)floppy.c 1.0.3 2017/09/12 * * Authors: Sarah Walker, * Miran Grca, @@ -22,11 +22,12 @@ #include "../config.h" #include "../timer.h" #include "floppy.h" -#include "floppy_fdi.h" -#include "floppy_img.h" #include "floppy_86f.h" -#include "floppy_td0.h" +#include "floppy_fdi.h" #include "floppy_imd.h" +#include "floppy_img.h" +#include "floppy_json.h" +#include "floppy_td0.h" #include "fdc.h" #include "fdd.h" @@ -102,7 +103,7 @@ static struct {L"720", img_load, img_close, -1}, {L"86F", d86f_load, d86f_close, -1}, {L"BIN", img_load, img_close, -1}, - {L"CQ", img_load, img_close, -1}, + {L"CQ", img_load, img_close, -1}, {L"CQM", img_load, img_close, -1}, {L"DSK", img_load, img_close, -1}, {L"FDI", fdi_load, fdi_close, -1}, @@ -112,6 +113,7 @@ static struct {L"IMA", img_load, img_close, -1}, {L"IMD", imd_load, imd_close, -1}, {L"IMG", img_load, img_close, -1}, + {L"JSON", json_load, json_close, -1}, {L"TD0", td0_load, td0_close, -1}, {L"VFD", img_load, img_close, -1}, {L"XDF", img_load, img_close, -1}, @@ -138,9 +140,9 @@ void floppy_load(int drive, wchar_t *fn) if (!_wcsicmp(p, loaders[c].ext) && (size == loaders[c].size || loaders[c].size == -1)) { driveloaders[drive] = c; - loaders[c].load(drive, fn); - drive_empty[drive] = 0; memcpy(floppyfns[drive], fn, (wcslen(fn) << 1) + 2); + loaders[c].load(drive, floppyfns[drive]); + drive_empty[drive] = 0; fdd_forced_seek(real_drive(drive), 0); floppy_changed[drive] = 1; return; diff --git a/src/floppy/floppy_common.c b/src/floppy/floppy_common.c new file mode 100644 index 000000000..b5f181bf5 --- /dev/null +++ b/src/floppy/floppy_common.c @@ -0,0 +1,436 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Shared code for all the floppy modules. + * + * Version: @(#)floppy_common.c 1.0.1 2017/09/10 + * + * Author: Fred N. van Kempen, + * Copyright 2017 Fred N. van Kempen. + */ +#include +#include "../ibm.h" +#include "../floppy/floppy.h" +#include "floppy_common.h" + + +uint8_t floppy_holes[6] = { 0, 0, 0, 1, 1, 2 }; + +uint8_t floppy_rates[6] = { 2, 2, 1, 4, 0, 3 }; + +double floppy_bit_rates_300[6] = { + (250.0 * 300.0) / 360.0, + 250.0, + 300.0, + (500.0 * 300.0) / 360.0, + 500.0, + 1000.0 +}; + +/* + * First dimension is possible sector sizes (0 = 128, 7 = 16384), + * second is possible bit rates (250/360, 250, 300, 500/360, 500, 1000). + * + * Disks formatted at 250 kbps @ 360 RPM can be read with a 360 RPM + * single-RPM 5.25" drive by setting the rate to 250 kbps. + * + * Disks formatted at 300 kbps @ 300 RPM can be read with any 300 RPM + * single-RPM drive by setting the rate to 300 kbps. + */ +uint8_t floppy_max_sectors[8][6] = { + { 26, 31, 38, 53, 64, 118 }, /* 128 */ + { 15, 19, 23, 32, 38, 73 }, /* 256 */ + { 7, 10, 12, 17, 22, 41 }, /* 512 */ + { 3, 5, 6, 9, 11, 22 }, /* 1024 */ + { 2, 2, 3, 4, 5, 11 }, /* 2048 */ + { 1, 1, 1, 2, 2, 5 }, /* 4096 */ + { 0, 0, 0, 1, 1, 3 }, /* 8192 */ + { 0, 0, 0, 0, 0, 1 } /* 16384 */ +}; + +uint8_t floppy_dmf_r[21] = { + 12,2,13,3,14,4,15,5,16,6,17,7,18,8,19,9,20,10,21,11,1 +}; + + +static uint8_t floppy_gap3_sizes[5][8][48] = { + { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [0][0] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [0][1] */ + 0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [0][2] */ + 0x00,0x00,0x6C,0x48,0x2A,0x08,0x02,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x83,0x26,0x00,0x00,0x00,0x00, /* [0][3] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [0][4] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [0][5] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [0][6] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [0][7] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } + }, + { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [1][0] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [1][1] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x54,0x1C,0x0E,0x00,0x00, /* [1][2] */ + 0x00,0x00,0x6C,0x48,0x2A,0x08,0x02,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x79,0x06, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [1][3] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [1][4] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [1][5] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [1][6] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [1][7] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } + }, + { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [2][0] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x32,0x0C,0x00,0x00,0x00,0x36, /* [2][1] */ + 0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x58,0x50,0x2E,0x00,0x00,0x00,0x00,0x00, /* [2][2] */ + 0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0xF0,0x74,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [2][3] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [2][4] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [2][5] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [2][6] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [2][7] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } + }, + { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [3][0] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [3][1] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [3][2] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x53,0x4E,0x3D,0x2C, + 0x1C,0x0D,0x02,0x00,0x00,0x00,0x01,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [3][3] */ + 0x00,0x00,0xF7,0xAF,0x6F,0x55,0x1F,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [3][4] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [3][5] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [3][6] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [3][7] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } + }, + { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [4][0] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [4][1] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x92,0x54, /* [4][2] */ + 0x38,0x23,0x00,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x74,0x24,0x00,0x00,0x00,0x00,0x00,0x00, /* [4][3] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [4][4] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [4][5] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [4][6] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [4][7] */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } + } +}; + + + +int +floppy_get_gap3_size(int rate, int size, int sector) +{ + return(floppy_gap3_sizes[rate][size][sector]); +} + + +uint8_t +floppy_sector_size_code(int size) +{ + int ret = 2; + + switch(size) { + case 128: + ret = 0; + break; + + case 256: + ret = 1; + break; + + case 512: + ret = 2; + break; + + case 1024: + ret = 3; + break; + + case 2048: + ret = 4; + break; + + case 4096: + ret = 5; + break; + + case 8192: + ret = 6; + break; + + case 16384: + ret = 7; + break; + + default: + break; + } + + return(ret); +} + + +int +floppy_sector_code_size(uint8_t code) +{ + return(128 << code); +} + + +int +floppy_bps_valid(uint16_t bps) +{ + int i; + + for (i=0; i<=8; i++) { + if (bps == (128 << i)) { + return 1; + } + } + + return(0); +} + + +int +floppy_interleave(int sector, int skew, int spt) +{ + uint32_t add = (spt & 1); + uint32_t adjust = (spt >> 1); + uint32_t adjusted_r; + uint32_t skewed_i; + + skewed_i = (sector + skew) % spt; + adjusted_r = (skewed_i >> 1) + 1; + if (skewed_i & 1) { + adjusted_r += (adjust + add); + } + + return(adjusted_r); +} diff --git a/src/floppy/floppy_common.h b/src/floppy/floppy_common.h new file mode 100644 index 000000000..f8972d6e3 --- /dev/null +++ b/src/floppy/floppy_common.h @@ -0,0 +1,34 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Shared code for all the floppy modules. + * + * Version: @(#)floppy_common.h 1.0.1 2017/09/10 + * + * Author: Fred N. van Kempen, + * Copyright 2017 Fred N. van Kempen. + */ +#ifndef FLOPPY_COMMON_H +# define FLOPPY_COMMON_H + + +extern uint8_t floppy_holes[6]; +extern uint8_t floppy_rates[6]; +extern double floppy_bit_rates_300[6]; +extern uint8_t floppy_max_sectors[8][6]; +extern uint8_t floppy_dmf_r[21]; + + +extern int floppy_get_gap3_size(int rate, int size, int sector); +extern uint8_t floppy_sector_size_code(int size); +extern int floppy_sector_code_size(uint8_t code); +extern int floppy_bps_valid(uint16_t bps); +extern int floppy_interleave(int sector, int skew, int spt); + + +#endif /*FLOPPY_COMMON_H*/ diff --git a/src/floppy/floppy_json.c b/src/floppy/floppy_json.c new file mode 100644 index 000000000..c36c9810b --- /dev/null +++ b/src/floppy/floppy_json.c @@ -0,0 +1,645 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of the PCjs JSON floppy image format. + * + * Version: @(#)floppy_json.c 1.0.1 2017/09/12 + * + * Author: Fred N. van Kempen, + * Copyright 2017 Fred N. van Kempen. + */ +#include +#include +#include "../ibm.h" +#include "floppy.h" +#include "fdc.h" +#include "fdd.h" +#include "floppy_common.h" +#include "floppy_json.h" + + +#define NTRACKS 256 +#define NSIDES 2 +#define NSECTORS 128 + + +typedef struct { + uint8_t track, /* ID: track number */ + side, /* side number */ + sector; /* sector number 1.. */ + uint16_t size; /* encoded size of sector */ + uint8_t *data; /* allocated data for it */ +} sector_t; + +typedef struct { + FILE *f; + + /* Geometry. */ + uint8_t tracks, /* number of tracks */ + sides, /* number of sides */ + sectors, /* number of sectors per track */ + spt[NTRACKS][NSIDES]; /* number of sectors per track */ + + uint8_t track, /* current track */ + side, /* current side */ + sector[NSIDES]; /* current sector */ + + uint8_t dmf; /* disk is DMF format */ + uint8_t interleave; +#if 0 + uint8_t skew; +#endif + uint8_t gap2_len; + uint8_t gap3_len; + int track_width; + + uint16_t disk_flags, /* flags for the entire disk */ + track_flags; /* flags for the current track */ + + uint8_t interleave_ordered[NTRACKS][NSIDES]; + + sector_t sects[NTRACKS][NSIDES][NSECTORS]; +} json_t; + + +static json_t images[FDD_NUM]; + + +static void +handle(json_t *img, char *name, char *str) +{ + sector_t *sec = NULL; + uint32_t l, pat; + uint8_t *p; + char *sp; + int i, s; + + /* Point to the currently selected sector. */ + sec = &img->sects[img->track][img->side][img->dmf-1]; + + /* If no name given, assume sector is done. */ + if (name == NULL) { + /* If no buffer, assume one with 00's. */ + if (sec->data == NULL) { + sec->data = (uint8_t *)malloc(sec->size); + memset(sec->data, 0x00, sec->size); + } + + /* Encode the sector size. */ + sec->size = floppy_sector_size_code(sec->size); + + /* Set up the rest of the Sector ID. */ + sec->track = img->track; + sec->side = img->side; + + return; + } + + if (! strcmp(name, "sector")) { + sec->sector = atoi(str); + sec->size = 512; + } else if (! strcmp(name, "length")) { + sec->size = atoi(str); + } else if (! strcmp(name, "pattern")) { + pat = atol(str); + + if (sec->data == NULL) + sec->data = (uint8_t *)malloc(sec->size); + p = sec->data; + s = (sec->size / sizeof(uint32_t)); + for (i=0; i>= 8; + *p++ = (l & 0x000000ff); + l >>= 8; + *p++ = (l & 0x000000ff); + l >>= 8; + *p++ = (l & 0x000000ff); + } +#if 1 + pclog("JSON: added sector (%d,%d,%d/%d) size=%d pat=%08lx\n", + sec->track,sec->side,sec->sector,img->dmf,sec->size,pat); +#endif + } else if (! strcmp(name, "data")) { + if (sec->data == NULL) + sec->data = (uint8_t *)malloc(sec->size); + p = sec->data; + while (str && *str) { + sp = strchr(str, ','); + if (sp != NULL) *sp++ = '\0'; + l = atol(str); + +#if 1 + if (p==sec->data) + pclog("JSON: added sector (%d,%d,%d/%d) size=%d data=%08lx\n", + sec->track,sec->side,sec->sector,img->dmf,sec->size,l); +#endif + *p++ = (l & 0x000000ff); + l >>= 8; + *p++ = (l & 0x000000ff); + l >>= 8; + *p++ = (l & 0x000000ff); + l >>= 8; + *p++ = (l & 0x000000ff); + + str = sp; + } + } +} + + +static int +unexpect(int c, int state, int level) +{ + pclog("JSON: Unexpected '%c' in state %d/%d.\n", c, state, level); + + return(-1); +} + + +static int +load_image(json_t *img) +{ + char buff[4096], name[32]; + int c, i, j, state, level; + char *ptr; + + if (img->f == NULL) { + pclog("JSON: no file loaded!\n"); + return(0); + } + + /* Initialize. */ + for (i=0; isects[i][j], 0x00, sizeof(sector_t)); + } + img->track = img->side = img->dmf = 0; /* "dmf" is "sector#" */ + + /* Now run the state machine. */ + ptr = NULL; + level = state = 0; + while (state >= 0) { + /* Get a character from the input. */ + c = fgetc(img->f); + if ((c == EOF) || ferror(img->f)) { + state = -1; + break; + } + + /* Process it. */ + switch(state) { + case 0: /* read level header */ + img->dmf = 1; + if (c != '[') { + state = unexpect(c, state, level); + } else { + if (++level == 3) + state++; + } + break; + + case 1: /* read sector header */ + if (c != '{') + state = unexpect(c, state, level); + else + state++; + break; + + case 2: /* begin sector data name */ + if (c != '\"') { + state = unexpect(c, state, level); + } else { + ptr = name; + state++; + } + break; + + case 3: /* read sector data name */ + if (c == '\"') { + *ptr = '\0'; + state++; + } else { + *ptr++ = c; + } + break; + + case 4: /* end of sector data name */ + if (c != ':') { + state = unexpect(c, state, level); + } else { + ptr = buff; + state++; + } + break; + + case 5: /* read sector value data */ + switch(c) { + case ',': + case '}': + *ptr = '\0'; + handle(img, name, buff); + + if (c == '}') + state = 7; /* done */ + else + state = 2; /* word */ + break; + + case '[': + state++; + break; + + default: + *ptr++ = c; + } + break; + + case 6: /* read sector data complex */ + if (c != ']') + *ptr++ = c; + else + state = 5; + break; + + case 7: /* sector done */ + handle(img, NULL, NULL); + switch(c) { + case ',': /* next sector */ + img->dmf++; + state = 1; + break; + + case ']': /* all sectors done */ + if (--level == 0) + state = -1; + else state++; + break; + + default: + state = unexpect(c, state, level); + } + break; + + case 8: /* side done */ + switch(c) { + case ',': /* next side */ + state = 0; + break; + + case ']': /* all sides done */ + if (--level == 0) + state = -1; + else state++; + break; + + default: + state = unexpect(c, state, level); + } + img->spt[img->track][img->side] = img->dmf; + img->side++; + break; + + case 9: /* track done */ + switch(c) { + case ',': /* next track */ + img->side = 0; + state = 0; + break; + + case ']': /* all tracks done */ + if (--level == 0) + state = -1; + else state++; + break; + + default: + state = unexpect(c, state, level); + } + img->track++; + break; + } + + } + + /* Save derived values. */ + img->tracks = img->track; + img->sides = img->side; + + return(1); +} + + +/* Seek the heads to a track, and prepare to read data from that track. */ +static void +json_seek(int drive, int track) +{ + uint8_t id[4] = { 0,0,0,0 }; + json_t *img = &images[drive]; + int side, sector; + int rate, gap2, gap3, pos; + int ssize, rsec, asec; + int interleave_type; + + if (img->f == NULL) { + pclog("JSON: seek: no file loaded!\n"); + return; + } + + /* Allow for doublestepping tracks. */ + if (! img->track_width && fdd_doublestep_40(drive)) track /= 2; + + /* Set the new track. */ + img->track = track; + + /* Reset the 86F state machine. */ + d86f_reset_index_hole_pos(drive, 0); + d86f_reset_index_hole_pos(drive, 1); + d86f_zero_bit_field(drive, 0); + d86f_zero_bit_field(drive, 1); + + interleave_type = 0; + for (side=0; sidesides; side++) { + /* Get transfer rate for this side. */ + rate = img->track_flags & 0x07; + if (!rate && (img->track_flags & 0x20)) rate = 4; + + /* Get correct GAP3 value for this side. */ + gap3 = floppy_get_gap3_size(rate, + img->sects[track][side][0].size, + img->spt[track][side]); + + /* Get correct GAP2 value for this side. */ + gap2 = ((img->track_flags & 0x07) >= 3) ? 41 : 22; + + pos = d86f_prepare_pretrack(drive, side, 0); + + for (sector=0; sectorspt[track][side]; sector++) { + if (interleave_type == 0) { + rsec = img->sects[track][side][sector].sector; + asec = sector; + } else { + rsec = floppy_dmf_r[sector]; + asec = img->interleave_ordered[rsec][side]; + } + id[0] = track; + id[1] = side; + id[2] = rsec; + id[3] = img->sects[track][side][asec].size; + ssize = floppy_sector_code_size(img->sects[track][side][asec].size); + + pos = d86f_prepare_sector( + drive, side, pos, id, + img->sects[track][side][asec].data, + ssize, gap2, gap3, + 0, /*deleted flag*/ + 0 /*bad_crc flag*/ + ); + + if (sector == 0) + d86f_initialize_last_sector_id(drive,id[0],id[1],id[2],id[3]); + } + } +} + + +static uint16_t +disk_flags(int drive) +{ + return(images[drive].disk_flags); +} + + +static uint16_t +track_flags(int drive) +{ + return(images[drive].track_flags); +} + + +static void +set_sector(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8_t n) +{ + json_t *img = &images[drive]; + int i; + + img->sector[side] = 0; + + /* Make sure we are on the desired track. */ + if (c != img->track) return; + + /* Set the desired side. */ + img->side = side; + + /* Now loop over all sector ID's on this side to find our sector. */ + for (i=0; ispt[c][side]; i++) { + if ((img->sects[img->track][side][i].track == c) && + (img->sects[img->track][side][i].side == h) && + (img->sects[img->track][side][i].sector == r) && + (img->sects[img->track][side][i].size == n)) { + img->sector[side] = i; + } + } +} + + +static uint8_t +poll_read_data(int drive, int side, uint16_t pos) +{ + json_t *img = &images[drive]; + uint8_t sec = img->sector[side]; + + return(img->sects[img->track][side][sec].data[pos]); +} + + +void +json_init(void) +{ + memset(images, 0x00, sizeof(images)); +} + + +void +json_load(int drive, wchar_t *fn) +{ + json_t *img = &images[drive]; + sector_t *sec; + double bit_rate; + int temp_rate; + int i; + + /* Just in case- remove ourselves from 86F. */ + d86f_unregister(drive); + + /* Zap any old data. */ + memset(img, 0x00, sizeof(json_t)); + + /* Open the image file. */ + img->f = _wfopen(fn, L"rb"); + if (img->f == NULL) { + memset(fn, 0x00, sizeof(wchar_t)); + return; + } + + /* Our images are always RO. */ + writeprot[drive] = 1; + + /* Load all sectors from the image file. */ + if (! load_image(img)) { + pclog("JSON: failed to initialize\n"); + (void)fclose(img->f); + img->f = NULL; + memset(fn, 0x00, sizeof(wchar_t)); + return; + } + + pclog("JSON(%d): %S (%i tracks, %i sides, %i sectors)\n", + drive, fn, img->tracks, img->sides, img->spt[0][0]); + + /* + * If the image has more than 43 tracks, then + * the tracks are thin (96 tpi). + */ + img->track_width = (img->tracks > 43) ? 1 : 0; + + /* If the image has 2 sides, mark it as such. */ + img->disk_flags = 0x00; + if (img->sides == 2) + img->disk_flags |= 0x08; + + /* JSON files are always assumed to be MFM-encoded. */ + img->track_flags = 0x08; + + img->interleave = 0; +#if 0 + img->skew = 0; +#endif + + temp_rate = 0xff; + sec = &img->sects[0][0][0]; + for (i=0; i<6; i++) { + if (img->spt[0][0] > floppy_max_sectors[sec->size][i]) continue; + + bit_rate = floppy_bit_rates_300[i]; + temp_rate = floppy_rates[i]; + img->disk_flags |= (floppy_holes[i] << 1); + + if ((bit_rate == 500.0) && (img->spt[0][0] == 21) && + (sec->size == 2) && (img->tracks >= 80) && + (img->tracks <= 82) && (img->sides == 2)) { + /* + * This is a DMF floppy, set the flag so + * we know to interleave the sectors. + */ + img->dmf = 1; + } else { + if ((bit_rate == 500.0) && (img->spt[0][0] == 22) && + (sec->size == 2) && (img->tracks >= 80) && + (img->tracks <= 82) && (img->sides == 2)) { + /* + * This is marked specially because of the + * track flag (a RPM slow down is needed). + */ + img->interleave = 2; + } + + img->dmf = 0; + } + + break; + } + + if (temp_rate == 0xff) { + pclog("JSON: invalid image (temp_rate=0xff)\n"); + (void)fclose(img->f); + img->f = NULL; + memset(fn, 0x00, sizeof(wchar_t)); + return; + } + + if (img->interleave == 2) { + img->interleave = 1; + img->disk_flags |= 0x60; + } + + img->gap2_len = (temp_rate == 3) ? 41 : 22; + if (img->dmf) { + img->gap3_len = 8; + } else { + img->gap3_len = floppy_get_gap3_size(temp_rate,sec->size,img->spt[0][0]); + } + + if (! img->gap3_len) { + pclog("JSON: image of unknown format was inserted into drive %c:!\n", + 'C'+drive); + (void)fclose(img->f); + img->f = NULL; + memset(fn, 0x00, sizeof(wchar_t)); + return; + } + + img->track_flags |= (temp_rate & 0x03); /* data rate */ + if (temp_rate & 0x04) + img->track_flags |= 0x20; /* RPM */ + + pclog(" disk_flags: 0x%02x, track_flags: 0x%02x, GAP3 length: %i\n", + img->disk_flags, img->track_flags, img->gap3_len); + pclog(" bit rate 300: %.2f, temporary rate: %i, hole: %i, DMF: %i\n", + bit_rate, temp_rate, (img->disk_flags >> 1), img->dmf); + + /* Set up handlers for 86F layer. */ + d86f_handler[drive].disk_flags = disk_flags; + d86f_handler[drive].side_flags = track_flags; + d86f_handler[drive].writeback = null_writeback; + d86f_handler[drive].set_sector = set_sector; + d86f_handler[drive].read_data = poll_read_data; + d86f_handler[drive].write_data = null_write_data; + d86f_handler[drive].format_conditions = null_format_conditions; + d86f_handler[drive].extra_bit_cells = null_extra_bit_cells; + d86f_handler[drive].encoded_data = common_encoded_data; + d86f_handler[drive].read_revolution = common_read_revolution; + d86f_handler[drive].index_hole_pos = null_index_hole_pos; + d86f_handler[drive].get_raw_size = common_get_raw_size; + d86f_handler[drive].check_crc = 1; + d86f_set_version(drive, 0x0063); + + d86f_common_handlers(drive); + + drives[drive].seek = json_seek; +} + + +/* Close the image. */ +void +json_close(int drive) +{ + json_t *img = &images[drive]; + int t, h, s; + + /* Unlink image from the system. */ + d86f_unregister(drive); + + /* Release all the sector buffers. */ + for (t=0; t<256; t++) { + for (h=0; h<2; h++) { + memset(img->sects[t][h], 0x00, sizeof(sector_t)); + for (s=0; s<256; s++) { + if (img->sects[t][h][s].data != NULL) + free(img->sects[t][h][s].data); + img->sects[t][h][s].data = NULL; + } + } + } + + if (img->f != NULL) { + (void)fclose(img->f); + img->f = NULL; + } +} diff --git a/src/floppy/floppy_json.h b/src/floppy/floppy_json.h new file mode 100644 index 000000000..82e2a6820 --- /dev/null +++ b/src/floppy/floppy_json.h @@ -0,0 +1,26 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of the PCjs JSON floppy image format. + * + * Version: @(#)floppy_json.h 1.0.1 2017/09/06 + * + * Author: Fred N. van Kempen, + * Copyright 2017 Fred N. van Kempen. + */ +#ifndef EMU_FLOPPY_JSON_H +# define EMU_FLOPPY_JSON_H + + +//extern void json_init(void); +extern void json_load(int drive, wchar_t *fn); +extern void json_close(int drive); +//extern void json_seek(int drive, int track); + + +#endif /*EMU_FLOPPY_JSON_H*/ diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 103f29c78..74b7c6c61 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -8,7 +8,7 @@ * * Windows resource script. * - * Version: @(#)86Box.rc 1.0.8 2017/09/02 + * Version: @(#)86Box.rc 1.0.9 2017/09/07 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -833,7 +833,7 @@ BEGIN IDS_2156 "%" PRIu64 IDS_2157 "%" PRIu64 " MB (CHS: %" PRIu64 ", %" PRIu64 ", %" PRIu64 ")" IDS_2158 "Floppy %i (%s): %ws" - IDS_2159"All floppy images (*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.TD0;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.TD0;*.VFD;*.XDF\0Advanced sector-based images (*.IMD;*.TD0)\0*.IMD;*.TD0\0Basic sector-based images (*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.VFD;*.XDF\0Flux images (*.FDI)\0*.FDI\0Surface-based images (*.86F)\0*.86F\0All files (*.*)\0*.*\0" + IDS_2159"All floppy images (*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.JSON;*.TD0;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.JSON;*.TD0;*.VFD;*.XDF\0Advanced sector-based images (*.IMD;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector-based images (*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.JSON;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.JSON;*.VFD;*.XDF\0Flux images (*.FDI)\0*.FDI\0Surface-based 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..." diff --git a/src/win/win_serial.c b/src/win/win_serial.c index 332ff1970..a5ab56f66 100644 --- a/src/win/win_serial.c +++ b/src/win/win_serial.c @@ -12,12 +12,13 @@ * Windows and UNIX systems, with support for FTDI and Prolific * USB ports. Support for these has been removed. * - * Version: @(#)win_serial.c 1.0.3 2017/06/04 + * Version: @(#)win_serial.c 1.0.4 2017/09/12 * * Author: Fred N. van Kempen, * Copyright 2017 Fred N. van Kempen. */ #include +#include #include #include #include "plat_thread.h"