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