I am trying to load code from a harddrive using ata-pio. As an emulator i use qemu x86.
The code is 16bit.
But it does not display the 'R' as I would have expected...
Code: Select all
[BITS 16]
;________________________________ load_ata:
load_ata:
MOV DX, 0x1F6
MOV AL, 0x0A0 ;Drive 0, head 0
OUT DX, AL
MOV DX, 0x1F2
MOV AL, 0x1 ;read 1 sector
OUT DX, AL
MOV DX, 0x1F3 ;sector 1
MOV AL, 0x2
OUT DX, AL
MOV DX, 0x1F4
MOV AL, 0x0 ;cylinder 0
OUT DX, AL
MOV DX, 0x1F5
MOV AL, 0x0 ;rest of cylinder 0
OUT DX, AL
MOV DX, 0x1F7
MOV AL, 0x20 ;command read with retry
OUT DX, AL
.load:
IN AL, DX
TEST AL, 0x8 ;wait for it being ready
JZ load_ata.load
MOV CX, 512/2 ;data comes as 16bit
MOV DI, 0x1000 ;buffer
MOV DX, 0x1F0
REP INSW
;__________________________________ end_ata.
JMP 0x1000
CLI
HLT
times 510-($-$$) db 0x0
dw 0xaa55
codelabel:
MOV AH, 0x0e
MOV AL, 'R'
INT 0x10
CLI
HLT
times 2048 db 0