I've written a simple routine to read a sector from a floppy disc (in protected mode). On some real PCs it's working on some not. And Bochs gives me also an error saying "<< PANIC >> write 0x03f5: receiving new command 0x46, old one (0x0f) pending."
Here is the code:
Code: Select all
;turn motor a on, disable IRQ and DMA, select drive 00h (A:)
mov dx, 0x3f2
mov al, 00010100b
out dx, al
;Seek Track command
mov dx, 0x3f5
mov al, 00001111b
out dx, al
mov al, 00000100b ; Select Head 1 on drive 00
out dx, al
mov al, 0x00 ;Cylinder 0
out dx, al
mov dx,3F4h
in al,dx
mov cl, 0x01
mov bl, 0x00
;Read sector command
mov dx, 0x3f5
mov al, 01000110b
out dx, al
mov al, 00000100b ; Select Head 1 on drive 00
out dx, al
mov al, bl ; Cylinder 0
out dx, al
mov al, 0x01 ; Head 1
out dx, al
mov al, cl ; Sector 1
out dx, al
mov al, 0x02 ; 512 Bytes per sector
out dx, al
mov al, 0x12 ; 18 sectors per track
out dx, al
mov al, 0x1B ; length of GAP (27 normal so 0x1B)
out dx, al
mov al, 0xff ; must be 0xff
out dx, al
mov edi, [vbe_lfb]
mov dx, 0x3F5
mov ecx, 512
mov di, [es:edi]
rep insb