SegaCD main routine

Ask anything your want about Mega/SegaCD programming.

Moderator: Mask of Destiny

Post Reply
ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

SegaCD main routine

Post by ob1 » Mon Jul 09, 2007 9:21 pm

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.

Mask of Destiny
Very interested
Posts: 616
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Mon Jul 09, 2007 10:31 pm

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.

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Tue Jul 10, 2007 5:00 am

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'.

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

Post by TascoDLX » Tue Jul 10, 2007 10:58 am

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.

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Tue Jul 10, 2007 11:37 am

You avoid me a pain in the butt. Thank you.

cdoty
Very interested
Posts: 117
Joined: Wed Nov 29, 2006 2:54 pm
Location: Houston, TX
Contact:

Post by cdoty » Wed Nov 07, 2007 4:22 am

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!

TulioAdriano
Very interested
Posts: 81
Joined: Tue Jul 10, 2007 7:45 pm
Location: Brazil / USA
Contact:

Post by TulioAdriano » Wed Nov 07, 2007 3:27 pm

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.
Image

cdoty
Very interested
Posts: 117
Joined: Wed Nov 29, 2006 2:54 pm
Location: Houston, TX
Contact:

Post by cdoty » Mon Nov 12, 2007 4:21 pm

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.

TulioAdriano
Very interested
Posts: 81
Joined: Tue Jul 10, 2007 7:45 pm
Location: Brazil / USA
Contact:

Post by TulioAdriano » Mon Nov 12, 2007 4:26 pm

My bad. So sorry...

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

Post Reply