Always do disk reads one sector at a time

PCem emulating IBM PC 5150 seems to have a bug where int 0x13/2 will report
it read zero sectors regardless of how many sectors it actually read.
This commit is contained in:
Juhani Krekelä 2021-07-04 18:52:11 +03:00
parent 591fe91f93
commit 8d67cdf201
1 changed files with 11 additions and 25 deletions

View File

@ -282,35 +282,21 @@ loadsectors:
and al, 0xC0 and al, 0xC0
or cl, al or cl, al
; Copy number of sectors to still read to ax and cap at 127 mov ah, 2
pop ax mov al, 1
push ax mov dl, [drivenumber]
cmp al, 127 int 0x13
jbe .read ; TODO: Handle reset & retry
mov al, 127 jnc .noerror
.noerror:
.read:
mov ah, 2
mov dl, [drivenumber]
int 0x13
; Decrement cx by the number of sectors read
pop cx pop cx
xor ah, ah pop ax
sub cx, ax
; Increment bx by the number of sectors read times 512 inc ax
xor dx, dx add bx, 512
mov dh, al
shl dx, 1
add bx, dx
; Increment ax by the number of sectors read loop .loop
pop dx
add ax, dx
test cx, cx
jnz .loop
pop dx pop dx
pop cx pop cx