[Resolved]Read sectors from CD-ROM

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
User avatar
leyley
Member
Member
Posts: 35
Joined: Thu Jun 28, 2012 1:54 am

[Resolved]Read sectors from CD-ROM

Post by leyley »

I've found this: http://wiki.osdev.org/ATAPI from wiki, but I have no idea which ports I operated when I'm loading data form a CD-ROM, can somebody give me some explanations about ATAPI(or some example cods which are used for reading sectors from CD-ROM)?
Thanks!
Thanks for your replies, I can read data from CD-ROM now.
Last edited by leyley on Thu Nov 29, 2012 8:02 am, edited 1 time in total.

Code: Select all

#rm -rf /
ateno3
Member
Member
Posts: 25
Joined: Sun Oct 02, 2011 3:36 am
Location: Spain

Re: Read sectors from CD-ROM

Post by ateno3 »

You should read the IDE Wiki Page because there a lot of codes about how you can do it. Moreover, codes for ATA driver
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: Read sectors from CD-ROM

Post by Griwes »

Pedantic note: "code" is always singular, never plural.
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
ateno3
Member
Member
Posts: 25
Joined: Sun Oct 02, 2011 3:36 am
Location: Spain

Re: Read sectors from CD-ROM

Post by ateno3 »

Griwes wrote:Pedantic note: "code" is always singular, never plural.
I am sorry, English is not my native language.
User avatar
leyley
Member
Member
Posts: 35
Joined: Thu Jun 28, 2012 1:54 am

Re: Read sectors from CD-ROM

Post by leyley »

I've found some codes for reading sectors from HDs, but it seems that the codes doesn't fit for CDROM operations.
Does CDROM use same I/O ports as HDs do(1Fx,17x)?
Maybe I need something about IO ports...

Code: Select all

#rm -rf /
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Read sectors from CD-ROM

Post by Combuster »

leyley wrote:http://wiki.osdev.org/ATAPI
(...)
Does CDROM use same I/O ports as HDs do(1Fx,17x)?
Learn to read. Please. [-X
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Read sectors from CD-ROM

Post by egos »

In other words read about ATAPI subset.
If you have seen bad English in my words, tell me what's wrong, please.
User avatar
leyley
Member
Member
Posts: 35
Joined: Thu Jun 28, 2012 1:54 am

Re: Read sectors from CD-ROM

Post by leyley »

Combuster wrote:
leyley wrote:http://wiki.osdev.org/ATAPI
(...)
Does CDROM use same I/O ports as HDs do(1Fx,17x)?
Learn to read. Please. [-X
...................................................................
Now I know that they use same ports because they are seat on IDE.
Read HDs using ATA while CD-ROMs need ATAPI.
Is there any extra info about ATAPI PACKET?

Code: Select all

#rm -rf /
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Read sectors from CD-ROM

Post by egos »

See PACKET command description. Here is packet to read sector(s):

Code: Select all

  db 0BEh
  db FORMAT ; 0 - any
  dd STARTSEC
  db 0
  dw SECCOUNT
  db FLAGS ; 10h - only data
  db 0
  db 0
If you have seen bad English in my words, tell me what's wrong, please.
User avatar
leyley
Member
Member
Posts: 35
Joined: Thu Jun 28, 2012 1:54 am

Re: Read sectors from CD-ROM

Post by leyley »

egos wrote:See PACKET command description. Here is packet to read sector(s):

Code: Select all

  db 0BEh
  db FORMAT ; 0 - any
  dd STARTSEC
  db 0
  dw SECCOUNT
  db FLAGS ; 10h - only data
  db 0
  db 0
The "PACKET command" segment of ATAPI makes me confused because there's no further description of such command(maybe the wiki page needs to be updated?).
Thank you very much! I really appreciate that you can give me the detail of a PACKET and its description.

Code: Select all

#rm -rf /
Post Reply