I saw someone program IDE hard disk I/O directly, I don't know how he can do that
since I just know using BIOS rutinues or system APIs

How can i get some information on this aspect ?
Posted on 2003-09-30 06:56:43 by littlebob1
Im seeking it too. Tell me if you have.

Dion: kalo ada tolong terjemahin yah.:grin:
Posted on 2003-09-30 20:48:20 by realvampire
Or read Solar OS source code, there is a sample application inside (made by Hawk) that does just that: reads HDD via IN/OUT from ports, using LBA extensions
Posted on 2003-09-30 21:06:58 by BogdanOntanu
I hope it was not because Im stupid, I cannot understand. Here is my code

HDReadSector32 proc ; lpBuff,H&d,cyl,sect num,sect count

pop d.[ebp+#16]

pop d.[ebp+#12] ; Sector Count
pop d.[ebp+#8] ; Sector Number
pop d.[ebp+#4] ; Cylinder
pop d.[ebp] ; Head and drive
pop edi ; Buffer address

push d.[ebp+#16]

mov edx,1f2 ; 1f2
mov al,1 ;
out ; Sector Count send.

inc dx ; 1f3
mov eax,[ebp+#8] ; Sector number.

inc dx ; Cylinder
mov eax,[ebp+#4]
inc dx
mov al,ah

inc dx ; 1f6
mov eax,[ebp]

inc dx ; 1f7
mov al,#20

hdrs32 data ; label for jump
test al,8
jz hdrs32

mov ecx,512
mov edx,1f0
rep insb

HDReadSector32 endp

It failed, it only give me a value -1 al. Any advice?
Posted on 2003-10-01 08:52:59 by realvampire

I attach complete port listing. Included some details. I don't sure but i think firstly you must set data or status register port for R/W operation.

Posted on 2003-10-01 10:03:27 by CYDONIA
littlebob1: i hope you are working on an interesting h/w project (s/w one isnt so fun).

CYDONIA, could u tell me where do you got those numbers from?

btw, i googling a while with keyword = programming hard disk controller, and found:


(check the "Programming the PC's hard disk controller").
as a note, harddisk controller sometimes mentioned in abbreviationed fashion, it is HDC, while FDC for floppy, which is i have some experience programming it directly :)

but, i dont find what the diff in h/w between IDE-SCSI? and where is ATA play its role? (just to make you more curious, littlebob1. dont be rush, take a course on yourself the technique to search the inet, because its not easy to find one :)

realvampire: i dont see any wierd result there, or i am wrong too :P

oh, to mod, i think this thread is better put on OS section.
Posted on 2003-10-02 06:05:02 by dion
I've got some information from follow url:


someone must be interested in it
Posted on 2003-10-02 07:41:39 by littlebob1
Do you mean it working? how can it be working ?:confused:
Posted on 2003-10-03 04:17:50 by realvampire
Hi all friends,

Below link asm example about r/w hdd with hardware ports and comments.


or complete tutor :


Posted on 2003-10-03 16:01:54 by CYDONIA