Page 1 of 1

Documenting using the CD drive without the BIOS

Posted: Wed Jun 12, 2019 7:15 pm
by Sik
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.

Re: Documenting using the CD drive without the BIOS

Posted: Sat Jun 15, 2019 2:11 am
by Sik
…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)

Re: Documenting using the CD drive without the BIOS

Posted: Mon Jun 17, 2019 12:59 pm
by Near
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.

Re: Documenting using the CD drive without the BIOS

Posted: Mon Jun 17, 2019 5:12 pm
by TascoDLX
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.

Re: Documenting using the CD drive without the BIOS

Posted: Mon Jun 17, 2019 5:14 pm
by Sik
…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 (・~・)

Re: Documenting using the CD drive without the BIOS

Posted: Tue Jun 18, 2019 1:17 pm
by King Of Chaos
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.