From 4896dfcfb4b8eb4e859d25d7fade2cc654292100 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 15 Sep 2016 03:59:49 +0200 Subject: [PATCH] 86F write handler now correctly only writes 1 GAP3 byte and just pulses through the rest. --- src/disc_86f.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/disc_86f.c b/src/disc_86f.c index b0bfa6249..9a6ba30ea 100644 --- a/src/disc_86f.c +++ b/src/disc_86f.c @@ -1000,6 +1000,7 @@ void d86f_poll_reset(int drive, int side) { d86f[drive].state = STATE_IDLE; d86f[drive].index_count = 0; + d86f[drive].datac = 0; d86f_poll_advancebyte(drive, side); } @@ -1025,7 +1026,6 @@ int d86f_poll_check_notfound(int drive) void d86f_poll_finish(int drive, int side) { d86f_poll_reset(drive, side); - d86f_poll_advancebyte(drive, side); d86f[drive].last_sector.dword = 0xFFFFFFFF; } @@ -1114,24 +1114,20 @@ void d86f_poll_readwrite(int drive, int side) else if (d86f[drive].state == STATE_WRITE_SECTOR_GAP3) { max_len = fdc_get_gap(); - if (d86f[drive].datac == (fdc_get_gap() - 1)) + if (!disable_write && !d86f[drive].datac) { + d86f_poll_write(drive, side, fdc_is_mfm() ? 0x4E : 0xFF, BYTE_GAP3); + } + if (d86f[drive].datac == (max_len - 1)) + { + d86f_poll_finish(drive, side); if (!disable_write) { - d86f_poll_write(drive, side, fdc_is_mfm() ? 0x4E : 0xFF, BYTE_GAP3); d86f_writeback(drive); } - d86f_poll_finish(drive, side); fdc_sector_finishread(drive); return; } - else - { - if (!disable_write) - { - d86f_poll_write(drive, side, fdc_is_mfm() ? 0x4E : 0xFF, BYTE_GAP3); - } - } } d86f[drive].datac++; @@ -1182,9 +1178,8 @@ void d86f_poll_find_nf(int drive, int side) case BYTE_ID: d86f[drive].id_pos = d86f[drive].track_pos - d86f[drive].section_pos; - data = d86f[drive].track_data_byte; - d86f[drive].rw_sector_id.byte_array[d86f[drive].id_pos] = data; - d86f_calccrc(drive, data); + d86f[drive].rw_sector_id.byte_array[d86f[drive].id_pos] = d86f[drive].track_data_byte; + d86f_calccrc(drive, d86f[drive].track_data_byte); break; case BYTE_ID_CRC: d86f[drive].id_pos = d86f[drive].track_pos - d86f[drive].section_pos;