1
0
mirror of synced 2026-03-01 01:39:46 +00:00

Improve timeout management logic.

This commit is contained in:
Matthieu Bucchianeri
2025-02-10 18:44:42 -08:00
parent 6fd29c313d
commit a1a46d803e
7 changed files with 138 additions and 134 deletions

View File

@@ -129,7 +129,7 @@ _header DD -1 ; link to the next device
DW DGROUP:STRATEGY ; address of the strategy routine
DW DGROUP:INTERRUPT; " " " interrupt "
DB 1 ; number of drives
DB 'SDCDv12' ; DOS doesn't really use these bytes
DB 'SDCDv13' ; DOS doesn't really use these bytes
; The geometry (sectors/track, tracks/cylinder) defined in the BPB is rather
; arbitrary in the case of the TU58, but there are things to watch out for.

View File

@@ -254,14 +254,13 @@ int wait_ready (void) /* 1:OK, 0:Timeout */
BYTE d;
UINT tmr;
for (tmr = 5000; tmr; tmr--) { /* Wait for ready in timeout of 500ms */
outp(DATAPORT+15, 50);
do { /* Wait for ready in timeout of 500ms */
d = inp(DATAPORT);
if (d == 0xFF) break;
dly_us(100);
}
} while(!inp(DATAPORT+15));
return tmr ? 1 : 0;
return d == 0xFF;
}
@@ -310,11 +309,11 @@ int rcvr_datablock ( /* 1:OK, 0:Failed */
UINT tmr;
for (tmr = 1000; tmr; tmr--) { /* Wait for data packet in timeout of 100ms */
outp(DATAPORT+15, 10);
do { /* Wait for data packet in timeout of 100ms */
d = inp(DATAPORT);
if (d != 0xFF) break;
dly_us(100);
}
} while(!inp(DATAPORT+15));
if (d != 0xFE) {
return 0; /* If not valid data token, return with error */
}