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:
parent
591fe91f93
commit
8d67cdf201
36
bootsect.asm
36
bootsect.asm
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue