用汇编直接对硬盘操作的问题
我想写个操作系统,我需要对硬盘进行直接操作,INT13我用过,现在的问题是我不想调用中断,而想直接用I/O指令,或MOV指令,写I/O端口来操作硬盘,有谁写过这种程序么,也就是INT13的内部程序。 我猜这要看硬盘或者硬盘控制器本身的手册了。估计英文的比较好找。 commmandbad dw 01f0hres:
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
页:
[1]