Documenting using the CD drive without the BIOS

Ask anything your want about Mega/SegaCD programming.

Moderator: Mask of Destiny

Post Reply
Sik
Very interested
Posts: 895
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Documenting using the CD drive without the BIOS

Post by Sik » Wed Jun 12, 2019 7:15 pm

Since there has been discussion about the CDD last month I was wondering if we could start documenting how to use the CD drive without the BIOS (i.e. documenting how the BIOS does its stuff in the first place). Not sure whether it'd be easier or harder than decompressing the actual BIOS but it would be nice to know at least (albeit there could be other benefits like possibly allowing using more compact code and claim back some PRG-RAM space). Also could probably help making emulation easier to implement.

I suppose it'd be easiest to start documenting how to detect if the CD is there and how to play (and stop) CD tracks. I may look at the CDD stuff later to see if I can figure out how it works but if somebody else want to start here go ahead.
Sik is pronounced as "seek", not as "sick".

Sik
Very interested
Posts: 895
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Documenting using the CD drive without the BIOS

Post by Sik » Sat Jun 15, 2019 2:11 am

…OK no matter how much I try reading the CDD stuff I have no clue how the heck you'd play audio tracks (or how you'd tell when a track ends). And on top of that the docs I have seem to conflict with each other regarding some values (e.g. is status 0x00 no disc or stopped disc?). Any clues?

From what little I'm seeing, the best I can figure out is that to play a track you need to seek to its beginning then send the command to play, and then keep monitoring the current time until it hits the end of the track and send a stop command? (unless you want the disc to keep playing into the following tracks, that is)
Sik is pronounced as "seek", not as "sick".

byuu
Very interested
Posts: 94
Joined: Thu Feb 28, 2008 4:45 pm

Re: Documenting using the CD drive without the BIOS

Post by byuu » Mon Jun 17, 2019 12:59 pm

0x0 is stopped. 0xb is no disc. The older information was more guesswork, whereas the newer information comes from a combination of the official PDF manuals and some source code to an emulation of the CDD (which is, at least for me, not comprehensible outside of the constants.)

The CDD will pause once the end of an audio track is reached. I presume it's the same for a (the) data track.

TascoDLX
Very interested
Posts: 256
Joined: Tue Feb 06, 2007 8:18 pm

Re: Documenting using the CD drive without the BIOS

Post by TascoDLX » Mon Jun 17, 2019 5:12 pm

The BIOS constantly polls the CDD for status (within the level 4 interrupt handler). As soon as it sees the track number change, it will initiate a pause. It uses a similar process when reading data sectors. Obviously the BIOS is also constantly checking CDD for error code, open tray, or any other unexpected status change that may inhibit its current action.

Sik
Very interested
Posts: 895
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Documenting using the CD drive without the BIOS

Post by Sik » Mon Jun 17, 2019 5:14 pm

…so my guess was correct then.

We need a new document (and by that I mean text, not source code) describing how to use the CDD. Even if just from a 68000 programmer viewpoint (rather than emulation viewpoint, which is a lot trickier and probably deserves its own separate documentation). So far the little that there's documented outside of code feels impossible to decipher (・~・)
Sik is pronounced as "seek", not as "sick".

King Of Chaos
Very interested
Posts: 273
Joined: Fri Feb 29, 2008 8:12 pm
Location: United States

Re: Documenting using the CD drive without the BIOS

Post by King Of Chaos » Tue Jun 18, 2019 1:17 pm

You guys might want to try asking the Terraonion guys about it, their developer said on Discord they're willing to share their information and findings they documented during the Mega SD development.

Post Reply