ATAPI Driver

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Guest

ATAPI Driver

Post 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.
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:ATAPI Driver

Post by bubach »

"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
Guest

Re:ATAPI Driver

Post 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...
Dex4u

Re:ATAPI Driver

Post 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.
Guest

Re:ATAPI Driver

Post 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
Post Reply