So after trying a reset and issuing the read command again you still get the same error code from the interrupt? Or is it a different error? Or does the code fail somewhere else?
The code as it currently stands:
Code: Select all
start:
mov ax, 0x07C0
mov ds, ax
mov es, ax
mov ah,08H ;Drive verification
mov dl,00h
int 13h
cmp ah,00h
jne vererr ;chance to throw code
mov ah,90h
add ah,bl
cmp bl,04h
jl vererr ;throw code if less than 1.44MB
mov si,fat ;Janky Fat check
mov al,[si]
cmp al,'F'
jne nofat
inc si
mov al,[si]
cmp al,'A'
jne nofat
inc si
mov al,[si]
cmp al,'T'
jne nofat
mov si,0
read:
mov ah,00h ;drive reset
mov dl,00h
int 13h
cmp ah,00h
jne reserr ;chance to throw code
mov cl,[spfat] ;Read Attempt
add cl,[spfat]
add cl,[reserved]
mov ah,02h
mov al,01h
mov ch,00h
mov dh,00h
mov dl,00h
mov bx,200h
int 13h
cmp ah,00h
jne thrice ;if code check thrice
mov si,read1
call int_print
mov si,0x7E00
call int_print
jmp final
thrice: ;throw three errors before reporting
inc si
cmp si,2
jle read
jmp readerr
int_print:
mov ah,0Eh
mov bh,01h
mov al,[si]
int 10h
inc si
cmp byte [si],0
jne int_print
ret
readerr: ;procedural error stuff
inc [er]
reserr:
inc [er]
nofat:
inc [er]
vererr:
inc [er]
printerr:
push ax
mov si,em
call int_print
pop cx
mov ah,0Eh
mov bh,01h
mov cl,ch
mov ch,0
ror cx,4
mov al,cl
add al,48
int 10h
mov cl,0
rol cx,4
mov al,cl
add al,48
int 10h
mov al,'-'
int 10h
mov al,[er]
add al,48
int 10h
jmp final
read1 db 'Read1',0Dh,0Ah,0 ;variables
em db 'Err ',0
er db 0
final:
Every command dealing with the floppy has a chance to throw an error. None of the command return an error except for Drive Read Attempt and it constantly returns error code 20
Your method of checking if the floppy is a FAT formatted floppy is completely broken, btw. You should NOT rely on the filesystem type field of the BPB to be anything at all. You really must do the proper checks as specified in the FAT documentation.
Yea its a placeholder method. It can be relied on with windows formatted floppies. *shrugs*
Ah, so you have the issues of running in an emulator and the issues of using real hardware. I'd suggest getting your code to work on the emulator with a disk image first, and then try getting it to work on real hardware as well.
Suggestion noted, thanks.