commmandbad dw 01f0h
res:
mov dx,commandbad
add dx,07h
in al,dx
test al,80h
jnz res ;check if or not busy
mov dx,commandbad
add dx,02h
mov al,00h
out dx,al
mov al,1h
out dx,al ;set sector count
mov dx,commandbad
add dx,03h
mov al,00h
out dx,al
mov al,00h
out dx,al ;set LBA low
mov dx,commandbad
add dx,04h
mov al,00h
out dx,al
out dx,al ;set LBA mid
mov dx,commandbad
add dx,05h
mov al,00h
out dx,al
out dx,al ;set LBA high
mov dx,commandbad
add dx,06h
mov al,40h
out dx,al ;set LBA enable
mov dx,commandbad
add dx,07h
mov al,24h
out dx,al ;set 24h command
@@:
in al,dx
test al,80h
jnz @b ;check if or not busy
test al,01h
jnz res ;check if or not error
test al,40h
jz res ;check DRAY is or not ready
mov di,0h
@@:
mov dx,commandbad
insw ;read data to result
mov dx,commandbad
add dx,07h
IN AL,DX
test AL, 08h
jnz @b
阅读(1240) | 评论(0) | 转发(0) |