i have an issue with bochs reading my floppy drive. After reading a few sectors (1 - 10) bochs exits with the following error: [BIOS ] int13_diskette: ctrl not ready.
The error occurs while executing interrupt 13h, but the parameters given to the interrupt seem to be fine:
AX: 0x0201
BX: 0x0900
CX: 0x0004
DX: 0x0100
ES: 0x0000
Here is the floppy disk reading part:
Code: Select all
; input:
; dl -> device
; es:bx -> Buffer to read to
; ax -> Start sector
; cx -> Number of sectors
;
; output:
; carry -> On error
fat_read_device:
mov di, FAT_READ_RETRIES ; retries for error -> 5
.try_load:
push ax
push bx
push cx
push bx
mov bl, dl ; remember device
mov dx, ax
int 0xe2 ; Convert lba to chs -> Writing to cl, ch and dh
mov dl, bl
pop bx
mov ah, 0x02 ; Read device es:bx
mov al, 0x01 ; Number of sectors to read
;xchg bx, bx
int 0x13
jnc .done ; test if succeeded
xor ax, ax ; Reset disk
int 0x13
dec di ; decrement error counter
pop cx
pop bx
pop ax
jnz .try_load ; attempt to read again
stc
ret
.done:
int 0xcf ; Feedback disk operation -> Print a '.'
pop cx
pop bx
pop ax
add bx, word [bpbBytesPerSector] ; next sector
inc ax ; read next sector
loop fat_read_device ; repeat until cx sectors are read
ret
Has anyone had the same issue or does anyone have an idea what i am doing wrong?