Page 1 of 1

SegaCD main routine

Posted: Mon Jul 09, 2007 9:21 pm
by ob1
Hi you all.
Finally, I've decided to ask this one big question ? How does the SegaCD actually runs ?
I mean, from a cartridge point of view, it's damn so simple. Offset $4 is the PC initial value, the 68k reads from it and goes on. After each instruction, you just increment PC, there you are.
What about the CD ?
I mean, I can't make something like :
BSR loop2
if loop2 isn't alreday in memory.
So, how ?
I've thought about a lot of things, the most possible one would be : the subCPU loads (but how ?!?) data from CD, put it into its huge RAM, and passes it to the mainCPU thanks to the Comm Port.
But then, how does the subCPU where to load data from ? Do I have to tell it "go to sector 54126" ? Or do I have to ask it "copy data from $78EF 4520 to Comm Port" ?
It's even so intersting since I guess the same routine must bu used for Saturn, and everything else.
Please, teach me.

Posted: Mon Jul 09, 2007 10:31 pm
by Mask of Destiny
Heh, I have just the document with you. See this page: http://www.retrodev.com/segacd.html

Start reading where it says "General"

You can use the program BuildSCD from the same page to take care of putting together all the headers for you, or you can write some macros for your assembler. In either case, you need an appropriate org statement at the beginning of your code so the assembler knows how to resolve absolute addresses.

Posted: Tue Jul 10, 2007 5:00 am
by ob1
Amazing ressource.
Shame on me I didn't look your site before. Actually I did when I was working with the 32X.
What clearly appears to me is that the Initial Program (base.img) is a masterpiece I'm going to look at.

It isn't yet clear how to read further after, but from the star, here I am !!!

Thank you Mask'.

Posted: Tue Jul 10, 2007 10:58 am
by TascoDLX
ob1 wrote:What clearly appears to me is that the Initial Program (base.img) is a masterpiece I'm going to look at.
Nothing special here. It just calls the BIOS routine to display the Sonic SEGA logo. Much of this is compressed graphics; sound data is there as well.

Posted: Tue Jul 10, 2007 11:37 am
by ob1
You avoid me a pain in the butt. Thank you.

Posted: Wed Nov 07, 2007 4:22 am
by cdoty
Also check out Devsters BasiE... (whatever the hell it is) source code:
http://devster.monkeeh.com/sega/basiegaxorz/src.html

It's BasiEgaXorz... Ewww it taste worse coming back up!

Posted: Wed Nov 07, 2007 3:27 pm
by TulioAdriano
cdoty wrote:It's BasiEgaXorz... Ewww it taste worse coming back up!
I have to thank Devster anyway, even though programming in BEX I don't get the fastest code of the full functionality of MD/MCD, it is thanks to it that I could understand how to program to the system.

Comming from PC architecture to MD architecture can be quite challenging if you don't have a language you're familiar with. BEX brought that to all VB programmers around the world.

Posted: Mon Nov 12, 2007 4:21 pm
by cdoty
TulioAdriano wrote:I have to thank Devster anyway, even though programming in BEX I don't get the fastest code of the full functionality of MD/MCD, it is thanks to it that I could understand how to program to the system.
I was making a joke about the name, not the product.

Devster's code is pretty well written.

Posted: Mon Nov 12, 2007 4:26 pm
by TulioAdriano
My bad. So sorry...

That's why I call it BEX, ;) :P 8)