Fixed the creation and exporting of thick track 86F images.

This commit is contained in:
OBattler
2018-03-05 23:35:01 +01:00
parent 651bdf3931
commit 381dd2376c
2 changed files with 20 additions and 10 deletions

View File

@@ -10,7 +10,7 @@
* data in the form of FM/MFM-encoded transitions) which also
* forms the core of the emulator's floppy disk emulation.
*
* Version: @(#)fdd_86f.c 1.0.14 2018/01/18
* Version: @(#)fdd_86f.c 1.0.15 2018/03/05
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Copyright 2016-2018 Miran Grca.
@@ -3390,6 +3390,8 @@ int d86f_export(int drive, wchar_t *fn)
int tracks = 86;
int i;
int inc = 1;
uint32_t magic = 0x46423638;
uint16_t version = 0x020B;
@@ -3411,13 +3413,17 @@ int d86f_export(int drive, wchar_t *fn)
fwrite(tt, 1, ((d86f_get_sides(drive) == 2) ? 2048 : 1024), f);
/* Do this do teremine how many tracks to actually output. */
fdd_do_seek(drive, 2);
if (d86f[drive].cur_track == 1)
tracks >>= 1;
/* In the case of a thick track drive, always increment track
by two, since two tracks are going to get output at once. */
if (!fdd_doublestep_40(drive))
inc = 2;
for (i = 0; i < tracks; i++) {
fdd_do_seek(drive, i);
for (i = 0; i < tracks; i += inc) {
if (inc == 2)
fdd_do_seek(drive, i >> 1);
else
fdd_do_seek(drive, i);
d86f[drive].cur_track = i;
d86f_write_tracks(drive, &f, tt);
}

View File

@@ -8,7 +8,7 @@
*
* Handle the New Floppy Image dialog.
*
* Version: @(#)win_new_floppy.c 1.0.2 2018/02/25
* Version: @(#)win_new_floppy.c 1.0.3 2018/03/05
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
@@ -82,6 +82,7 @@ create_86f(WCHAR *file_name, disk_size_t disk_size, uint8_t rpm_mode)
uint32_t array_size, array_size2;
uint32_t track_base, track_size;
int i;
uint32_t shift = 0;
dflags = 0; /* Has surface data? - Assume no for now. */
dflags |= (disk_size.hole << 1); /* Hole */
@@ -153,12 +154,15 @@ create_86f(WCHAR *file_name, disk_size_t disk_size, uint8_t rpm_mode)
track_base = 8 + ((disk_size.sides == 2) ? 2048 : 1024);
for (i = 0; i < disk_size.tracks * disk_size.sides; i++)
if (disk_size.tracks <= 43)
shift = 1;
for (i = 0; i < (disk_size.tracks * disk_size.sides) << shift; i++)
tarray[i] = track_base + (i * track_size);
fwrite(tarray, 1, (disk_size.sides == 2) ? 2048 : 1024, f);
for (i = 0; i < disk_size.tracks * disk_size.sides; i++) {
for (i = 0; i < (disk_size.tracks * disk_size.sides) << shift; i++) {
fwrite(&tflags, 2, 1, f);
fwrite(&index_hole_pos, 4, 1, f);
fwrite(empty, 1, array_size, f);