hard disk I/O
Posted: Tue Aug 11, 2009 1:22 am
Hello,
I was reading lot of posts here and I think this forum is great. I'm preparing myself to create semi-os for data recovery. I was looking answer in specifications of ATA and PCI and ISA arch.
Problem is that this piece of code on some machines works and at some doesn't. When it doesn't work it writes to buffer 00600060 or 01560000. I've tested it on 5 different machines (2x lenovo laptops - works, 2x dell laptops - doesn't work, HP PC desktop - works).
Any one have a clue what i've done wrong?
Cheers,
WA
I was reading lot of posts here and I think this forum is great. I'm preparing myself to create semi-os for data recovery. I was looking answer in specifications of ATA and PCI and ISA arch.
Code: Select all
mov dx,1f6h ;Drive and head port
mov al,0a0h ;Drive 0, head 0
out dx,al
mov dx,1f2h ;Sector count port
mov al,1 ;Read one sector
out dx,al
mov dx,1f3h ;Sector number port
mov al,1 ;Read sector one
out dx,al
mov dx,1f4h ;Cylinder low port
mov al,0 ;Cylinder 0
out dx,al
mov dx,1f5h ;Cylinder high port
mov al,0 ;The rest of the cylinder 0
out dx,al
mov dx,1f7h ;Command port
mov al,20h ;Read with retry.
out dx,al
still_going:
in al,dx
test al,8 ;This means the sector buffer requires
;servicing.
jz still_going ;Don't continue until the sector buffer
;is ready.
mov ecx,512 ;One sector /2
;mov edi,offset buffer
mov dx,1f0h ;Data port - data comes in and out of here.
rep insd
Any one have a clue what i've done wrong?
Cheers,
WA