Custom BIOS from cart

Ask anything your want about Mega/SegaCD programming.

Moderator: Mask of Destiny

Post Reply
KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Custom BIOS from cart

Post by KanedaFr » Tue Nov 18, 2014 12:02 pm

Hi there,

For debug/dev purpose, I'd like to make a custom bios.
This bios could be used on emulator (standard bios), on hardware (standard bios to burn), on cart (to avoid hardware update)

I read some posts like
viewtopic.php?p=14320#14320
viewtopic.php?p=21772#21772
viewtopic.php?t=1746



, some points should be taken in account to handle the 2 ways
- standard bios is loaded form 0x0 while cart bios is loaded from 0x400000 (base adress)
- header is different (not sure exactly how...)
- info of sub cpu must be defined at 0x1A8+
- region security code must be added at 0x200 and should be the same that the one on standard bios of the MCD used
- custom main bios should be added afer region security code
- subbios is zipped using Kosinski

So basically, I can't take any bios I want and burnt it on a cart
but i could take the subcpu, pcm driver and security code from a bios, and add them on a custom bios

So
- what the bios did before giving the hand to the cart bios ? nothing , only looking for cart bios first ?
- is there a way to bypass this tmss pair which ask for a custon bios for each bios existing ?
- what is the "best" bios available to start with ?
- is there some bios which doesn't work with some MCD model ?for ex if I take a region free Jap MCD1 Bios, will it work on a European MCD2 ? I assume XEyes, JVC, CDX are not valid ...?
- is there some bios which doesn't handle cart bios ? (first jap model?)
- a cart bios is only a standard card with /CART not grounded (VCC or NC ?), nothing more like address mapping , right ?

anything more to know ?

l_oliveira
Very interested
Posts: 53
Joined: Mon Mar 07, 2011 12:58 am

Post by l_oliveira » Sat Dec 27, 2014 3:03 pm

For debugging purposes I'd like to suggest:

This boot method:
viewtopic.php?p=14320#14320

Coupled with some RAM on cart and some hardware for uploading cross development builds being tested.

The cart could be something like this:

0x400000-0x40FFFF SEGA security code + bootloader
0x400000-4FFFFFF SRAM (after poking a register to hide the bootloader away)

Of course the bootloader could contain the comms driver and you could have the option of keep it on so you don't need to build comms driver on the code being tested.

Or it could simply contain a driver using the already stabilished joyport bitbanging protocol as implemented here: http://www.retrodev.com/transfer.html if you're feeling cheap.

It's actually simpler than it looks like. No need to replace the main BIOS if you do this stuff... Even a original console can be used for development this way without you need to bother with burning discs.

As a bonus, when you boot the system with this method, you will already find the SUB CPU alive and ready to read discs.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sat Dec 27, 2014 5:39 pm

To make a custom bios, it takes a full understanding of the existing bios. We barely understand how the bios starts, much less how it works. What you want is currently not possible. Someone would need to do the most detailed RE possible on multiple existing bioses before you even began, and I don't see that happening.

There was enough research done to allow Mode 1 booting, and region-free booting, and that's the extent of the knowledge about the cd bios.

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

Post by Mask of Destiny » Sat Dec 27, 2014 10:37 pm

Once upon a time I had a commented disassembly of a good chunk of both the main and sub-CPU BIOS from a US Model 2 Sega CD (don't remember the revision). Unfortunately, I think I lost all of that apart from what I had already posted publicly in a hard drive failure years ago. I hadn't gotten very far with any of the code that directly interacts with the CD hardware anyway (from what I remember, the BIOS CD functions mostly just poke data into RAM that gets picked up by an interrupt routine which made the code harder to follow and the inner workings of the CD hardware wasn't my primary focus at the time).

Working on an open source BIOS replacement is actually on my TODO list. I'd have to start over on the RE front, but it should be easier this time since I actually have a better idea what I'm doing now. I wasn't planning on starting until I started on Sega CD support in BlastEm (which is a ways off) since having a BIOS I can legally distribute is my main motivation. That said, if someone wants to collaborate on the project I could potentially start sooner.

l_oliveira
Very interested
Posts: 53
Joined: Mon Mar 07, 2011 12:58 am

Post by l_oliveira » Sat Dec 27, 2014 11:12 pm

I don't think anyone will have any trouble with SEGA from reusing/copying their BIOS.

Also, documenting everything at a centralized place is a great idea.


Really, at this point in time I can't see them complain about anything but the copying of the games. And even that is highly unlikely to happen.

Post Reply