Page 1 of 1

ATAPI Driver

Posted: Tue Oct 04, 2005 5:15 am
by Guest
Hello,

i have just written an ATA driver for reading and writing to HD.
Now i want to write an ATAPI driver to read from CD.
In my book is a list of ATAPI packets.
The packet 0x28 is for read.
I know how to send the packet but the packet is 12 bytes.
How does the packet look with the read command ?
And after i sent the packet how does the next step look to read a sector ?
Please help, because i dont want read the whole ATAPI documentation.

Re:ATAPI Driver

Posted: Tue Oct 04, 2005 6:40 am
by bubach

Re:ATAPI Driver

Posted: Tue Oct 04, 2005 7:09 am
by Guest
Hey, i used google and found some docs but some of you guys are really good and know very much. So why not ask,
because i just want to know how a packet looks with the command and what do after send...

Re:ATAPI Driver

Posted: Tue Oct 04, 2005 8:09 am
by Dex4u
It looks like this :

Code: Select all

;====================================================;
; Read disk                                          ;
;====================================================;

Read_disk:
        call  Small_Delay1
        call  Wait_unit_ready
        call  Small_Delay1
        call  Wait_unit_ready
        jc    Unit_not_ready_Read_disk
        call  Read_disk_packet
        call  Send_Atapi_Packet
        call  Read_atapi_bufferx
        ret

Unit_not_ready_Read_disk:
        stc
        ret   

;====================================================;
; Read disk packet                                    ;
;====================================================;

Read_disk_packet:
        call Clear_atapi_packet
        mov   byte[packet+0],0x28
        mov   ebx,dword[SectorAdress]
        call Mirror_ebx
        mov   dword[packet+2],ebx
        mov   ax,001
        mov   byte[packet+8],al
        mov   byte[packet+7],ah
        mov   byte[LoByte],48
        mov   byte[HiByte],20
        ret
Whats your hdd driver written in, may be we could do a swap ;D.

Re:ATAPI Driver

Posted: Tue Oct 04, 2005 9:04 am
by Guest
Hello, thanks for your help but i have got it to read a sector from cd alone. My HD driver is written in C.
But its not really good because i just wanted to get it to work ;D