Both .86F and .IMG handlers now handle 40-track media correctly on 80-track drives with double stepping.
This commit is contained in:
@@ -2,7 +2,7 @@ VPATH = . dosbox resid-fp slirp
|
|||||||
CPP = g++.exe
|
CPP = g++.exe
|
||||||
CC = gcc.exe
|
CC = gcc.exe
|
||||||
WINDRES = windres.exe
|
WINDRES = windres.exe
|
||||||
CFLAGS = -O3 -march=native -mtune=native -fbranch-probabilities -fvpt -funroll-loops -fpeel-loops -ftracer -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse -mstackrealign
|
CFLAGS = -O3 -march=native -mtune=native -fbranch-probabilities -fvpt -funroll-loops -fpeel-loops -ftracer -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse -mstackrealign -g
|
||||||
OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o acerm3a.o ali1429.o amstrad.o cdrom-ioctl.o cdrom-iso.o \
|
OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o acerm3a.o ali1429.o amstrad.o cdrom-ioctl.o cdrom-iso.o \
|
||||||
cdrom-null.o codegen.o codegen_ops.o codegen_timing_486.o codegen_timing_686.o codegen_timing_pentium.o codegen_timing_winchip.o codegen_x86.o compaq.o config.o cpu.o dac.o \
|
cdrom-null.o codegen.o codegen_ops.o codegen_timing_486.o codegen_timing_686.o codegen_timing_pentium.o codegen_timing_winchip.o codegen_x86.o compaq.o config.o cpu.o dac.o \
|
||||||
device.o disc.o disc_86f.o disc_fdi.o disc_img.o disc_sector_86box.o dma.o fdc.o fdc37c665.o fdc37c932fr.o fdd.o fdi2raw.o gameport.o headland.o i430hx.o i430lx.o i430fx.o \
|
device.o disc.o disc_86f.o disc_fdi.o disc_img.o disc_sector_86box.o dma.o fdc.o fdc37c665.o fdc37c932fr.o fdd.o fdi2raw.o gameport.o headland.o i430hx.o i430lx.o i430fx.o \
|
||||||
@@ -30,7 +30,8 @@ LIBS = -mwindows -lwinmm -lopenal.dll -lopenal -lddraw -ldinput8 -ldxguid -ld3d9
|
|||||||
|
|
||||||
86Box.exe: $(OBJ) $(DBOBJ) $(SIDOBJ) $(SLIRPOBJ)
|
86Box.exe: $(OBJ) $(DBOBJ) $(SIDOBJ) $(SLIRPOBJ)
|
||||||
$(CC) $(OBJ) $(DBOBJ) $(SIDOBJ) $(SLIRPOBJ) -o "86Box.exe" $(LIBS)
|
$(CC) $(OBJ) $(DBOBJ) $(SIDOBJ) $(SLIRPOBJ) -o "86Box.exe" $(LIBS)
|
||||||
strip "86Box.exe"
|
|
||||||
|
a.exe: strip "86Box.exe"
|
||||||
|
|
||||||
all : 86Box.exe
|
all : 86Box.exe
|
||||||
|
|
||||||
|
@@ -86,19 +86,23 @@ static struct
|
|||||||
uint8_t track_index;
|
uint8_t track_index;
|
||||||
uint8_t old_track_byte;
|
uint8_t old_track_byte;
|
||||||
uint8_t old_track_index;
|
uint8_t old_track_index;
|
||||||
|
uint8_t cur_track;
|
||||||
} d86f[2];
|
} d86f[2];
|
||||||
|
|
||||||
/* Needed for formatting! */
|
/* Needed for formatting! */
|
||||||
|
int d86f_is_40_track(int drive)
|
||||||
|
{
|
||||||
|
return (d86f[drive].disk_flags & 1) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
int d86f_realtrack(int drive, int track)
|
int d86f_realtrack(int drive, int track)
|
||||||
{
|
{
|
||||||
if (!(d86f[drive].track_flags & 0x40) && fdd_doublestep_40(drive))
|
if (d86f_is_40_track(drive) && fdd_doublestep_40(drive))
|
||||||
track /= 2;
|
track /= 2;
|
||||||
|
|
||||||
return track;
|
return track;
|
||||||
}
|
}
|
||||||
|
|
||||||
void d86f_writeback(int drive, int track);
|
|
||||||
|
|
||||||
static void d86f_setupcrc(uint16_t poly, uint16_t rvalue)
|
static void d86f_setupcrc(uint16_t poly, uint16_t rvalue)
|
||||||
{
|
{
|
||||||
int c = 256, bc;
|
int c = 256, bc;
|
||||||
@@ -296,11 +300,6 @@ int d86f_get_sides(int drive)
|
|||||||
return (d86f[drive].disk_flags & 8) ? 2 : 1;
|
return (d86f[drive].disk_flags & 8) ? 2 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int d86f_is_40_track(int drive)
|
|
||||||
{
|
|
||||||
return !(d86f[drive].disk_flags & 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int d86f_is_mfm(int drive)
|
int d86f_is_mfm(int drive)
|
||||||
{
|
{
|
||||||
return (d86f[drive].track_flags & 8) ? 1 : 0;
|
return (d86f[drive].track_flags & 8) ? 1 : 0;
|
||||||
@@ -350,6 +349,8 @@ void d86f_seek(int drive, int track)
|
|||||||
memset(d86f[drive].track_data[side], 0xFF, 25000);
|
memset(d86f[drive].track_data[side], 0xFF, 25000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d86f[drive].cur_track = track;
|
||||||
|
|
||||||
if (!(d86f[drive].track_offset[track]))
|
if (!(d86f[drive].track_offset[track]))
|
||||||
{
|
{
|
||||||
/* Track does not exist in the image, initialize it as unformatted. */
|
/* Track does not exist in the image, initialize it as unformatted. */
|
||||||
@@ -373,8 +374,9 @@ void d86f_seek(int drive, int track)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void d86f_writeback(int drive, int track)
|
void d86f_writeback(int drive)
|
||||||
{
|
{
|
||||||
|
int track = d86f[drive].cur_track;
|
||||||
int side;
|
int side;
|
||||||
|
|
||||||
if (!d86f[drive].f)
|
if (!d86f[drive].f)
|
||||||
@@ -576,7 +578,7 @@ void d86f_prepare_track_layout(int drive, int side)
|
|||||||
|
|
||||||
void d86f_format(int drive, int track, int side, int rate, uint8_t fill)
|
void d86f_format(int drive, int track, int side, int rate, uint8_t fill)
|
||||||
{
|
{
|
||||||
d86f[drive].req_sector.id.c = track;
|
d86f[drive].req_sector.id.c = d86f[drive].cur_track;
|
||||||
d86f[drive].req_sector.id.h = side;
|
d86f[drive].req_sector.id.h = side;
|
||||||
|
|
||||||
if (side && (d86f_get_sides(drive) == 1))
|
if (side && (d86f_get_sides(drive) == 1))
|
||||||
@@ -587,7 +589,7 @@ void d86f_format(int drive, int track, int side, int rate, uint8_t fill)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((track < 0) || (track > 256))
|
if ((d86f[drive].cur_track < 0) || (d86f[drive].cur_track > 256))
|
||||||
{
|
{
|
||||||
fdc_writeprotect();
|
fdc_writeprotect();
|
||||||
d86f[drive].state = STATE_IDLE;
|
d86f[drive].state = STATE_IDLE;
|
||||||
@@ -609,7 +611,7 @@ void d86f_format(int drive, int track, int side, int rate, uint8_t fill)
|
|||||||
if (!d86f[drive].track_in_file)
|
if (!d86f[drive].track_in_file)
|
||||||
{
|
{
|
||||||
/* Track is absent from the file, let's add it. */
|
/* Track is absent from the file, let's add it. */
|
||||||
d86f[drive].track_offset[track] = d86f[drive].file_size;
|
d86f[drive].track_offset[d86f[drive].cur_track] = d86f[drive].file_size;
|
||||||
d86f[drive].file_size += 50002;
|
d86f[drive].file_size += 50002;
|
||||||
if (d86f_get_sides(drive) == 2)
|
if (d86f_get_sides(drive) == 2)
|
||||||
{
|
{
|
||||||
@@ -881,7 +883,7 @@ void d86f_poll_readwrite(int drive, int side)
|
|||||||
max_len = fdc_get_gap();
|
max_len = fdc_get_gap();
|
||||||
if (d86f[drive].datac == (fdc_get_gap() - 1))
|
if (d86f[drive].datac == (fdc_get_gap() - 1))
|
||||||
{
|
{
|
||||||
if (!disable_write) d86f_writeback(drive, d86f[drive].req_sector.id.c);
|
if (!disable_write) d86f_writeback(drive);
|
||||||
d86f_poll_finish(drive, side);
|
d86f_poll_finish(drive, side);
|
||||||
fdc_sector_finishread(drive);
|
fdc_sector_finishread(drive);
|
||||||
return;
|
return;
|
||||||
@@ -1047,7 +1049,7 @@ void d86f_poll_format(int drive, int side)
|
|||||||
{
|
{
|
||||||
// pclog("Index hole hit again, format finished\n");
|
// pclog("Index hole hit again, format finished\n");
|
||||||
d86f[drive].state = STATE_IDLE;
|
d86f[drive].state = STATE_IDLE;
|
||||||
if (!disable_write) d86f_writeback(drive, d86f[drive].req_sector.id.c);
|
if (!disable_write) d86f_writeback(drive);
|
||||||
fdc_sector_finishread(drive);
|
fdc_sector_finishread(drive);
|
||||||
d86f[drive].index_count = 0;
|
d86f[drive].index_count = 0;
|
||||||
d86f_poll_advancebyte(drive, side);
|
d86f_poll_advancebyte(drive, side);
|
||||||
|
@@ -108,7 +108,7 @@ int img_realtrack(int drive, int track)
|
|||||||
return track;
|
return track;
|
||||||
}
|
}
|
||||||
|
|
||||||
void img_writeback(int drive, int track);
|
void img_writeback(int drive);
|
||||||
|
|
||||||
static int sector_size_code(int sector_size)
|
static int sector_size_code(int sector_size)
|
||||||
{
|
{
|
||||||
@@ -648,7 +648,7 @@ void img_seek(int drive, int track)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void img_writeback(int drive, int track)
|
void img_writeback(int drive)
|
||||||
{
|
{
|
||||||
if (!img[drive].f)
|
if (!img[drive].f)
|
||||||
return;
|
return;
|
||||||
@@ -658,13 +658,13 @@ void img_writeback(int drive, int track)
|
|||||||
|
|
||||||
if (img[drive].sides == 2)
|
if (img[drive].sides == 2)
|
||||||
{
|
{
|
||||||
fseek(img[drive].f, img[drive].base + (track * img[drive].sectors * img[drive].sector_size * 2), SEEK_SET);
|
fseek(img[drive].f, img[drive].base + (disc_track[drive] * img[drive].sectors * img[drive].sector_size * 2), SEEK_SET);
|
||||||
fwrite(img[drive].track_data[0], img[drive].sectors * img[drive].sector_size, 1, img[drive].f);
|
fwrite(img[drive].track_data[0], img[drive].sectors * img[drive].sector_size, 1, img[drive].f);
|
||||||
fwrite(img[drive].track_data[1], img[drive].sectors * img[drive].sector_size, 1, img[drive].f);
|
fwrite(img[drive].track_data[1], img[drive].sectors * img[drive].sector_size, 1, img[drive].f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fseek(img[drive].f, img[drive].base + (track * img[drive].sectors * img[drive].sector_size), SEEK_SET);
|
fseek(img[drive].f, img[drive].base + (disc_track[drive] * img[drive].sectors * img[drive].sector_size), SEEK_SET);
|
||||||
fwrite(img[drive].track_data[0], img[drive].sectors * img[drive].sector_size, 1, img[drive].f);
|
fwrite(img[drive].track_data[0], img[drive].sectors * img[drive].sector_size, 1, img[drive].f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ typedef struct
|
|||||||
|
|
||||||
static sector_t disc_sector_data[2][2][MAX_SECTORS];
|
static sector_t disc_sector_data[2][2][MAX_SECTORS];
|
||||||
static int disc_sector_count[2][2];
|
static int disc_sector_count[2][2];
|
||||||
void (*disc_sector_writeback[2])(int drive, int track);
|
void (*disc_sector_writeback[2])(int drive);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -393,7 +393,7 @@ void disc_sector_poll()
|
|||||||
if (!cur_byte[drive] && disc_gap_has_ended(drive))
|
if (!cur_byte[drive] && disc_gap_has_ended(drive))
|
||||||
{
|
{
|
||||||
disc_sector_state[drive] = STATE_IDLE;
|
disc_sector_state[drive] = STATE_IDLE;
|
||||||
if (!disable_write) disc_sector_writeback[drive](drive, disc_sector_track[drive]);
|
if (!disable_write) disc_sector_writeback[drive](drive);
|
||||||
fdc_finishread(drive);
|
fdc_finishread(drive);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -454,7 +454,7 @@ void disc_sector_poll()
|
|||||||
advance_byte();
|
advance_byte();
|
||||||
if (index_count[drive] == 2)
|
if (index_count[drive] == 2)
|
||||||
{
|
{
|
||||||
if (!disable_write) disc_sector_writeback[drive](drive, disc_sector_track[drive]);
|
if (!disable_write) disc_sector_writeback[drive](drive);
|
||||||
fdc_finishread(drive);
|
fdc_finishread(drive);
|
||||||
disc_sector_state[drive] = STATE_IDLE;
|
disc_sector_state[drive] = STATE_IDLE;
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,7 @@ void disc_sector_stop();
|
|||||||
void disc_sector_poll();
|
void disc_sector_poll();
|
||||||
void disc_sector_stop();
|
void disc_sector_stop();
|
||||||
|
|
||||||
extern void (*disc_sector_writeback[2])(int drive, int track);
|
extern void (*disc_sector_writeback[2])(int drive);
|
||||||
void disc_sector_prepare_track_layout(int drive, int side, int track);
|
void disc_sector_prepare_track_layout(int drive, int side, int track);
|
||||||
|
|
||||||
#define length_gap0 80
|
#define length_gap0 80
|
||||||
|
@@ -20,7 +20,7 @@ typedef struct
|
|||||||
|
|
||||||
static sector_t disc_sector_data[2][2][MAX_SECTORS];
|
static sector_t disc_sector_data[2][2][MAX_SECTORS];
|
||||||
static int disc_sector_count[2][2];
|
static int disc_sector_count[2][2];
|
||||||
void (*disc_sector_writeback[2])(int drive, int track);
|
void (*disc_sector_writeback[2])(int drive);
|
||||||
|
|
||||||
int cur_track_pos[2] = {0, 0};
|
int cur_track_pos[2] = {0, 0};
|
||||||
int id_counter[2] = {0, 0};
|
int id_counter[2] = {0, 0};
|
||||||
@@ -436,7 +436,7 @@ void disc_sector_poll()
|
|||||||
{
|
{
|
||||||
// pclog("Index hole hit again, format finished\n");
|
// pclog("Index hole hit again, format finished\n");
|
||||||
disc_sector_state[drive] = STATE_IDLE;
|
disc_sector_state[drive] = STATE_IDLE;
|
||||||
if (!disable_write) disc_sector_writeback[drive](drive, disc_sector_track[drive]);
|
if (!disable_write) disc_sector_writeback[drive](drive);
|
||||||
fdc_sector_finishread(drive);
|
fdc_sector_finishread(drive);
|
||||||
}
|
}
|
||||||
if ((disc_sector_state[drive] == STATE_FORMAT_FIND) && disc_sector_can_read_address(drive))
|
if ((disc_sector_state[drive] == STATE_FORMAT_FIND) && disc_sector_can_read_address(drive))
|
||||||
@@ -527,7 +527,7 @@ void disc_sector_poll()
|
|||||||
if ((disc_sector_state[drive] == STATE_WRITE_SECTOR) && (last_sector[drive] != NULL))
|
if ((disc_sector_state[drive] == STATE_WRITE_SECTOR) && (last_sector[drive] != NULL))
|
||||||
{
|
{
|
||||||
disc_sector_state[drive] = STATE_IDLE;
|
disc_sector_state[drive] = STATE_IDLE;
|
||||||
if (!disable_write) disc_sector_writeback[drive](drive, disc_sector_track[drive]);
|
if (!disable_write) disc_sector_writeback[drive](drive);
|
||||||
fdc_sector_finishread(drive);
|
fdc_sector_finishread(drive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user