summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2013-02-09 10:35:45 +0000
committer Olivier Galibert <galibert@pobox.com>2013-02-09 10:35:45 +0000
commit1ac400963a346cee9bf4b1b20de361fe1148aef3 (patch)
tree7ae21fd018bc5b1a0a07ce970e850eb98e8f1c7b
parentc4fbee1e1640fae9c269eb9d2cdad6770e759ecf (diff)
flopimg: When generating a pc layout, don't write the gap3 after the last sector [O. Galibert]
-rw-r--r--src/lib/formats/flopimg.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/formats/flopimg.c b/src/lib/formats/flopimg.c
index 6881484bb84..779a4b6b7c0 100644
--- a/src/lib/formats/flopimg.c
+++ b/src/lib/formats/flopimg.c
@@ -2611,7 +2611,7 @@ void floppy_image_format_t::build_pc_track_fm(int track, int head, floppy_image
total_size += sects[i].actual_size;
int etpos = tpos;
- etpos += (sector_count*(6+5+2+11+6+1+2) + total_size)*16;
+ etpos += (sector_count*(6+5+2+gap_2+6+1+2) + total_size)*16;
if(etpos > cell_count)
throw emu_fatalerror("Incorrect layout on track %d head %d, expected_size=%d, current_size=%d", track, head, cell_count, etpos);
@@ -2636,7 +2636,7 @@ void floppy_image_format_t::build_pc_track_fm(int track, int head, floppy_image
for(int j=0; j<gap_2; j++) fm_w(track_data, tpos, 8, 0xff);
if(!sects[i].data)
- for(int j=0; j<6+1+sects[i].actual_size+2+gap_3; j++) fm_w(track_data, tpos, 8, 0xff);
+ for(int j=0; j<6+1+sects[i].actual_size+2+(i != sector_count-1 ? gap_3 : 0); j++) fm_w(track_data, tpos, 8, 0xff);
else {
// sync, DAM, data and gap 3
@@ -2648,7 +2648,8 @@ void floppy_image_format_t::build_pc_track_fm(int track, int head, floppy_image
if(sects[i].bad_crc)
crc = 0xffff^crc;
fm_w(track_data, tpos, 16, crc);
- for(int j=0; j<gap_3; j++) fm_w(track_data, tpos, 8, 0xff);
+ if(i != sector_count-1)
+ for(int j=0; j<gap_3; j++) fm_w(track_data, tpos, 8, 0xff);
}
}
@@ -2706,7 +2707,7 @@ void floppy_image_format_t::build_pc_track_mfm(int track, int head, floppy_image
for(int j=0; j<gap_2; j++) mfm_w(track_data, tpos, 8, 0x4e);
if(!sects[i].data)
- for(int j=0; j<12+4+sects[i].actual_size+2+gap_3; j++) mfm_w(track_data, tpos, 8, 0x4e);
+ for(int j=0; j<12+4+sects[i].actual_size+2+(i != sector_count-1 ? gap_3 : 0); j++) mfm_w(track_data, tpos, 8, 0x4e);
else {
// sync, DAM, data and gap 3
@@ -2719,7 +2720,8 @@ void floppy_image_format_t::build_pc_track_mfm(int track, int head, floppy_image
if(sects[i].bad_crc)
crc = 0xffff^crc;
mfm_w(track_data, tpos, 16, crc);
- for(int j=0; j<gap_3; j++) mfm_w(track_data, tpos, 8, 0x4e);
+ if(i != sector_count-1)
+ for(int j=0; j<gap_3; j++) mfm_w(track_data, tpos, 8, 0x4e);
}
}