Sonic and Sega Retro Message Board: SEGA CD Mode 1 Player - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Loading News Feed...
 

SEGA CD Mode 1 Player

#1 User is offline Chilly Willy 

Posted 16 December 2011 - 09:26 PM

  • Posts: 730
  • Joined: 10-April 09
  • Gender:Male
  • Project:Wolf3D MCD
There's been a lot of talk since the release of Sonic 1 with Redbook Audio, mainly people asking for code. I can see why they might not want to post their code since it's probably hacked into Sonic 1 pretty bad. However, there still exists a need to show how to use Mode 1. To that end, I did a small demo - this is a tiny CD player done using Mode 1 of the SEGA CD, and includes full source. From this, you should get a good idea of how Mode 1 works. If not, ask questions in the thread here and I'll answer them. THIS is the place for Mode 1 questions, not the Sonic1Mode1 thread.

The project was compiled with my gcc toolchain, but it wouldn't take much work to convert the code to whatever you normally use. The player goes beyond what you would use in a game, but it's an example.

Controls:
A - play from current track to end of disc
B - play current track once
C - stop playing
X - show current track info
Y - play current track repeatedly
Z - pause/resume
START - check disc

Notes: The TOC is invalid until you check the disc. The CDBIOS doesn't initialize its TOC until you call DRVINIT (which is what my check disc routine does). So when you first start the player, the status may show wildly wrong disc info (first and last tracks being over 99, e.g.). If the tray/lid is open, it will show that. Insert a disc and press START - you should get proper disc info after the status is done showing "Reading TOC" and goes to "PAUSED". The current track may not be the same as the playing track - you can start a track playing and then change the "current" track to something else. Pressing X to see the track info shows the info for the current track displayed on the screen, not the track playing. The track info consists of the track time and track type; the track type is pretty straightforward - it's either a DATA track (track 1 of mixed mode discs), or a CDDA track for audio tracks. The track time shows the BCD minutes/seconds/frames/track number as MMSSFFTN. It shows where the track starts, while the track number is the same as the track number you asked for info on, or 00 is an error occured.

While this example is a CD audio player, I could have easily also read data discs, showing sector data. I did the audio player since that's mainly what people wanted - to see how to play CDDA from a game in rom. The Sub-CPU program is really simple - wait for commands from the Main-CPU, then do them. The commands all pertain to handling the CD audio, but they could as easily use the ASIC, use the PCM chip, read data from sectors, etc. When I start doing some ASIC tests, this will be the test bed to start from as it's easier for me to write the test file to SD card and run in Mode 1 than to keep burning CDRs.

I've tested this on a Model 2 Genesis + Model 2 CD and on a CDX. Let me know if you have any trouble on other models, but it SHOULD work on anything.

mode1player.zip

Update - 20111219: Should work WonderMega and X'Eye and might work on LaserActive; also inits drive on startup if a disc is in place from the start.
mode1player2.zip

Update - 20111228: It's been tried on the LaserActive and doesn't work. Still looking into the issue there, but it's currently the only system known not to work.

Update - 20120105: Now works with LaserActive.

Mode1Example-20120104.zip
This post has been edited by Chilly Willy: 05 January 2012 - 01:07 PM

#2 User is offline Aerosol 

Posted 16 December 2011 - 10:18 PM

  • FML
  • Posts: 5368
  • Joined: 27-April 08
  • Gender:Male
  • Location:New York
  • Project:Sonic (?): Coming summer of 2055...?
I don't know anything about sega cd emulation. How do I get this running with Kega Fusion 3.63?

#3 User is offline Chilly Willy 

Posted 16 December 2011 - 11:19 PM

  • Posts: 730
  • Joined: 10-April 09
  • Gender:Male
  • Project:Wolf3D MCD
You don't. This is so new, nobody supports it. Maybe with an example out, emulation authors might add it to their next update.

#4 User is offline theocas 

Posted 16 December 2011 - 11:30 PM

  • Battery not included. Each set sold separately. Assembly required.
  • Posts: 343
  • Joined: 10-February 10
  • Gender:Male
  • Location:Austin, TX
  • Project:Mega CD PCM Sound Driver
  • Wiki edits:50

View PostAerosolSP, on 16 December 2011 - 10:18 PM, said:

I don't know anything about sega cd emulation. How do I get this running with Kega Fusion 3.63?


...of course it works on emulators.

View PostChilly Willy, on 16 December 2011 - 11:19 PM, said:

You don't. This is so new, nobody supports it. Maybe with an example out, emulation authors might add it to their next update.


It works on Kega Fusion. It just involves some secret code. Only works on Fusion though, since all other emulator authors that support Sega CD are too lazy to implement this.

Hint hint.

Posted Image :V
This post has been edited by theocas: 16 December 2011 - 11:33 PM

#5 User is offline Aerosol 

Posted 16 December 2011 - 11:37 PM

  • FML
  • Posts: 5368
  • Joined: 27-April 08
  • Gender:Male
  • Location:New York
  • Project:Sonic (?): Coming summer of 2055...?
Thanks theocas.

This is pretty neat. When I'm back on my own computer I'll take a closer look at it. Not that I'll figure it out on my own :P

#6 User is offline Chilly Willy 

Posted 16 December 2011 - 11:41 PM

  • Posts: 730
  • Joined: 10-April 09
  • Gender:Male
  • Project:Wolf3D MCD
Thanks for the info on Kega - good to see at least ONE emulator supports it. Of COURSE it would be Snake's. :)

EDIT: Just set up 3.63x for linux - my demo works great! Well, now I have an emu I can test stuff like this on besides real hardware. I normally use Gens_GS, but it doesn't seem to support Mode 1.
This post has been edited by Chilly Willy: 16 December 2011 - 11:55 PM

#7 User is offline Andlabs 

Posted 17 December 2011 - 12:00 AM

  • 「いっきまーす」
  • Posts: 2081
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
MCD emulator authors aren't lazy; the Mega CD isn't something that has been well-explored, though we do have some niche discussions (like that Mega LD discussion going on now on SpritesMind). Though given how much you two know about the Mega CD, why don't you two step up to the plate? :) I'm not a hardware engineer so I really can't help that much; the only thing I can do is analyze the Mega CD BIOS given what we know and I have too much on my plate as it is so sorry :/

(though IDK but I think getting the VDP decapped and analyzed so might be something more important first)
This post has been edited by Andlabs: 17 December 2011 - 12:03 AM

#8 User is offline Flygon 

Posted 17 December 2011 - 12:18 AM

  • Totally me irl
  • Posts: 2142
  • Joined: 10-February 06
  • Gender:Not Telling
  • Location:Victoria, Australia
  • Project:Cleavage
  • Wiki edits:10
Doesn't work on my Sega CD drive. Given the Sonic 1 Mode 1 demonstration works perfectly, something's gone on your end.

#9 User is offline Aerosol 

Posted 17 December 2011 - 12:21 AM

  • FML
  • Posts: 5368
  • Joined: 27-April 08
  • Gender:Male
  • Location:New York
  • Project:Sonic (?): Coming summer of 2055...?

View PostFlygon, on 17 December 2011 - 12:18 AM, said:

Doesn't work on my Sega CD drive. Given the Sonic 1 Mode 1 demonstration works perfectly, something's gone on your end.


Sonic 1 mode 1 doesn't work for me though, so you can't be so sure. Or maybe you can I dunno :v:

#10 User is offline Flygon 

Posted 17 December 2011 - 12:32 AM

  • Totally me irl
  • Posts: 2142
  • Joined: 10-February 06
  • Gender:Not Telling
  • Location:Victoria, Australia
  • Project:Cleavage
  • Wiki edits:10
And this, ladies and gentlemen, is why homebrewers generally don't bother with the Sega CD's bitchiness. :v:

#11 User is offline Chilly Willy 

Posted 17 December 2011 - 03:21 AM

  • Posts: 730
  • Joined: 10-April 09
  • Gender:Male
  • Project:Wolf3D MCD

View PostFlygon, on 17 December 2011 - 12:18 AM, said:

Doesn't work on my Sega CD drive. Given the Sonic 1 Mode 1 demonstration works perfectly, something's gone on your end.


What model/region is it? Need a little more info to go on. :)

Does it give an error message? How is it not working?
This post has been edited by Chilly Willy: 17 December 2011 - 03:22 AM

#12 User is offline Flygon 

Posted 17 December 2011 - 03:32 AM

  • Totally me irl
  • Posts: 2142
  • Joined: 10-February 06
  • Gender:Not Telling
  • Location:Victoria, Australia
  • Project:Cleavage
  • Wiki edits:10
No error messgae. European Sega Mega CD II, revision 2.0.0. European Sega Mega Drive II, modified but set to default settings. And I doubt CCAM is breaking the mod. :v:

If you were testing with a Model I CD drive, this'd explain so much.

Basically, it sure as heck detects the tracks, even tells me how the CD drive goes. Only failure? No audio plays. I'll check if the drive actually revs and spins for audio playback when I'm not about to be a personal taxi driver.

#13 User is offline Chilly Willy 

Posted 17 December 2011 - 03:54 AM

  • Posts: 730
  • Joined: 10-April 09
  • Gender:Male
  • Project:Wolf3D MCD

View PostFlygon, on 17 December 2011 - 03:32 AM, said:

No error messgae. European Sega Mega CD II, revision 2.0.0. European Sega Mega Drive II, modified but set to default settings. And I doubt CCAM is breaking the mod. :v:

If you were testing with a Model I CD drive, this'd explain so much.

Basically, it sure as heck detects the tracks, even tells me how the CD drive goes. Only failure? No audio plays. I'll check if the drive actually revs and spins for audio playback when I'm not about to be a personal taxi driver.


I've tested with a US Model 2 and a CDX. If it does everything but play audio, it's finding everything it needs and initializing okay. You did push START before trying to play tracks, right? As I mentioned in the OP, when the CD first starts up, it usually has a bad TOC, and checking the disc reads the TOC so it can actually play the tracks. Also, don't try playing data tracks (track 1 on mixed mode discs) - I'm not sure what it would do.

EDIT: When you try to play a track, it should briefly (sometimes too brief to see) say "NOT READY", then it should say "SEEKING" and then finally say "PLAYING".
This post has been edited by Chilly Willy: 17 December 2011 - 03:56 AM

#14 User is offline sasuke 

Posted 17 December 2011 - 04:36 PM

  • Posts: 66
  • Joined: 05-June 09
  • Gender:Male
  • Wiki edits:1
Good. I was actually going to try to make one of these myself, but I had no time because of finals. Good to see a working demo, though.

#15 User is offline Flygon 

Posted 18 December 2011 - 08:04 PM

  • Totally me irl
  • Posts: 2142
  • Joined: 10-February 06
  • Gender:Not Telling
  • Location:Victoria, Australia
  • Project:Cleavage
  • Wiki edits:10
Sorry about the delay, managed to get it working with rereading the TOC. I cannot believe I missed such an obvious step. Sorry.

  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users