Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Rom headers (Sega and SDSC)

Reply to topic
Author Message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Rom headers (Sega and SDSC)
Post Posted: Mon Mar 05, 2001 7:33 pm
After reading that Mike G's demo had a header, I had to go and write a program to read it :o) Anyway, I have a few questions:

1. Why the gap in the SDSC header at 0x7FEA-B? Just wondered...

2. How do the version numbers work? Mike G had major = 00, minor = 01, for version 0.1. Shouldn't that be minor = 10?

3. Does anyone know how the GG product code field (0x7FFE) works? I've pretty much got SMS sussed, but the GG codes seem to be all over the place while also being somewhat ordered.

BTW, I can flesh out the end of the SDSC header proposal regarding some of the Sega header bytes, but mostly from what the nice people around here have already told me. Let me know if you want it, Eric.

People wanting a preview can look here. Oh, and it can read zipped roms!

Maxim
  View user's profile Send private message Visit poster's website
  • Joined: 18 Sep 1999
  • Posts: 498
  • Location: Portland, Oregon USA
Reply with quote
Post Posted: Mon Mar 05, 2001 8:39 pm
Quote
> After reading that Mike G's demo had a header, I had to go and write a program to read it :o) Anyway, I have a few questions:

> 1. Why the gap in the SDSC header at 0x7FEA-B? Just wondered...

The gap is there because not all of the bytes were needed, and I just liked having the pointers at the end of the (SDSC portion of the) header. For now, those bytes should be considered "Reserved for future expansion".

I keep meaning to revise the proposal to explicitly state that there are two reserved bytes at 0x7FEA and 0x7FEB. I'll do that soon.

Quote
> 2. How do the version numbers work? Mike G had major = 00, minor = 01, for version 0.1. Shouldn't that be minor = 10?

In my opinion, yes. Major=00 and Minor=01 implies version 0.01 (or 00.01) to me.

Quote
> 3. Does anyone know how the GG product code field (0x7FFE) works? I've pretty much got SMS sussed, but the GG codes seem to be all over the place while also being somewhat ordered.

Sorry, someone else will have to help out here.

Quote
> BTW, I can flesh out the end of the SDSC header proposal regarding some of the Sega header bytes, but mostly from what the nice people around here have already told me. Let me know if you want it, Eric.

Yes, post it here, and I'll update the proposal in the SDSC section.

Quote
> People wanting a preview can look here. Oh, and it can read zipped roms!

Excellent! A very nice utility. I'd either like to post the utility locally on S8-Dev, or provide a link to your site. Let me know when you've got release version (or if you'd just like me to post/link the preview version).

--
Eric Quinn
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 25 Oct 1999
  • Posts: 2029
  • Location: Monterey, California
Reply with quote
Post Posted: Mon Mar 05, 2001 9:08 pm
Quote
> > After reading that Mike G's demo had a header, I had to go and write a program to read it :o) Anyway, I have a few questions:

> > 1. Why the gap in the SDSC header at 0x7FEA-B? Just wondered...

> The gap is there because not all of the bytes were needed, and I just liked having the pointers at the end of the (SDSC portion of the) header. For now, those bytes should be considered "Reserved for future expansion".

> I keep meaning to revise the proposal to explicitly state that there are two reserved bytes at 0x7FEA and 0x7FEB. I'll do that soon.

> > 2. How do the version numbers work? Mike G had major = 00, minor = 01, for version 0.1. Shouldn't that be minor = 10?

> In my opinion, yes. Major=00 and Minor=01 implies version 0.01 (or 00.01) to me.

> > 3. Does anyone know how the GG product code field (0x7FFE) works? I've pretty much got SMS sussed, but the GG codes seem to be all over the place while also being somewhat ordered.

> Sorry, someone else will have to help out here.

> > BTW, I can flesh out the end of the SDSC header proposal regarding some of the Sega header bytes, but mostly from what the nice people around here have already told me. Let me know if you want it, Eric.

> Yes, post it here, and I'll update the proposal in the SDSC section.

> > People wanting a preview can look here. Oh, and it can read zipped roms!

> Excellent! A very nice utility. I'd either like to post the utility locally on S8-Dev, or provide a link to your site. Let me know when you've got release version (or if you'd just like me to post/link the preview version).

> --
> Eric Quinn
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Post Posted: Mon Mar 05, 2001 10:01 pm
Quote
> > BTW, I can flesh out the end of the SDSC header proposal regarding some of the Sega header bytes, but mostly from what the nice people around here have already told me. Let me know if you want it, Eric.

> Yes, post it here, and I'll update the proposal in the SDSC section.

OK, here goes:

Offsets 0x7ff0-7 have "TMR SEGA", as you already had.

0x7FF8 and 7FF9 contain an unknown value. It's often 0000, 2020 or FFFF, all of which are "nothing" values (0x20 being ASCII space). Roms with values there seem to be ones without full headers, for example Japanese SMS games. Zoop's checksummer source has a comment of "// Protocol ?" next to it, but I think it was a never-used reserved word.

0x7FFA and 7FFB contains the checksum, in big endian format. It's a 16-bit accumulator, you start at 0 and sum the bytes over the checksummed range, dropping the 17th bit whenever it appears (ie. FFFF + 1 = 0000). The range depends on the byte at 0x7FFF, see below about that.

0x7FFC and 7FFD do indeed contain the part number - the game number as on the side of the box. It's big-endian BCD. The part number can be used to find what type the cartridge was - for example, 4xxx = 1-Mega, 7xxx = 2-Mega, 9xxx = 4-Mega; a second digit of 5 indicates a Plus cartridge, ie. one with battery-backed ram. There's a more complete list in my program's readme, and as I mentioned GG games are different.

The byte at 0x7FFE is apparently a version byte (well, according to the structure in Zoop's checksummer again). I have, however, found that the high nibble is nearly always 2 when the game number begins with a 2, ie. for 3rd-party releases. The low nibble can vary, but it's nearly always 0.

The byte at 0x7FFF is split into two nibbles, where a value of 0xXY has a high nibble of 0xX and a low nibble of 0xY. The high nibble is the country code, again taken from Zoop's checksummer source:

0x3 = SMS Japan
0x4 = SMS Export
0x5 = GG Japan
0x6 = GG Export
0x7 = GG International

Export, of course, means outside Japan.

The low nibble defines the range over which to checksum the file:

0xC: 0x0000 to 0x7FEF (ie. first 32KB except header)
0xE, 0xF: As above plus 0x8000 to 0x1FFFF (ie. 128KB, 1Mbit)
0x0: As above plus 0x20000 to 0x3FFFF (ie. 256KB, 2Mbit)

The checksum range is always less than or (usually) equal to the rom size. 4-mega and larger roms are never checksummed over 256KB.

There are plenty of roms which don't conform to this - many Japanese roms have other data in the header area, since they don't need a checksum; some don't even have the TMR SEGA (Loletta No Shozou has FFs instead). A lot of games don't have the part number, some even have different values there for alternate versions. I haven't thoroughly looked at the available values, it'd take hours to look at all 700-odd SMS and GG roms.


Quote
> Excellent! A very nice utility. I'd either like to post the utility locally on S8-Dev, or provide a link to your site. Let me know when you've got release version (or if you'd just like me to post/link the preview version).

OK, I just left it until I got the official SDSC header information (I used Mike G's source to do it this afternoon), but there's not much more to add. Suggestions are of course welcome.

Maxim
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Clarifying myself
Post Posted: Mon Mar 05, 2001 10:18 pm
Quote
> > Excellent! A very nice utility. I'd either like to post the utility locally on S8-Dev, or provide a link to your site. Let me know when you've got release version (or if you'd just like me to post/link the preview version).

> OK, I just left it until I got the official SDSC header information (I used Mike G's source to do it this afternoon), but there's not much more to add. Suggestions are of course welcome.

To clarify my clarification, yes, I'll let you know when it's ready.

Maxim
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Hey, Zoop...
Post Posted: Tue Mar 06, 2001 11:09 pm
I kludged batch processing on to my program, and I've found some games whose internal game code is 1 different from the code in meka.nam. For example, F-16 Fighting Falcon has 0509 inside and C-508 in meka.nam. A lot of GG games seem to have numbers ending in 8 internally and 7 in meka.nam.

So, any idea why? The F-16 could be a transcription error, but I can't figure out the 7/8 thing in the GG games.

Maxim
  View user's profile Send private message Visit poster's website
  • Joined: 24 Jun 1999
  • Posts: 1732
  • Location: Paris, France
Reply with quote
^^^^ this is an empty message, Nicolas ^^^^
Post Posted: Wed Mar 07, 2001 6:51 am
Quote
> > > After reading that Mike G's demo had a header, I had to go and write a program to read it :o) Anyway, I have a few questions:

> > > 1. Why the gap in the SDSC header at 0x7FEA-B? Just wondered...

> > The gap is there because not all of the bytes were needed, and I just liked having the pointers at the end of the (SDSC portion of the) header. For now, those bytes should be considered "Reserved for future expansion".

> > I keep meaning to revise the proposal to explicitly state that there are two reserved bytes at 0x7FEA and 0x7FEB. I'll do that soon.

> > > 2. How do the version numbers work? Mike G had major = 00, minor = 01, for version 0.1. Shouldn't that be minor = 10?

> > In my opinion, yes. Major=00 and Minor=01 implies version 0.01 (or 00.01) to me.

> > > 3. Does anyone know how the GG product code field (0x7FFE) works? I've pretty much got SMS sussed, but the GG codes seem to be all over the place while also being somewhat ordered.

> > Sorry, someone else will have to help out here.

> > > BTW, I can flesh out the end of the SDSC header proposal regarding some of the Sega header bytes, but mostly from what the nice people around here have already told me. Let me know if you want it, Eric.

> > Yes, post it here, and I'll update the proposal in the SDSC section.

> > > People wanting a preview can look here. Oh, and it can read zipped roms!

> > Excellent! A very nice utility. I'd either like to post the utility locally on S8-Dev, or provide a link to your site. Let me know when you've got release version (or if you'd just like me to post/link the preview version).

> > --
> > Eric Quinn
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 25 Oct 1999
  • Posts: 2029
  • Location: Monterey, California
Reply with quote
----------> So's this one <----------
Post Posted: Wed Mar 07, 2001 7:15 am
Quote
> > > > After reading that Mike G's demo had a header, I had to go and write a program to read it :o) Anyway, I have a few questions:

> > > > 1. Why the gap in the SDSC header at 0x7FEA-B? Just wondered...

> > > The gap is there because not all of the bytes were needed, and I just liked having the pointers at the end of the (SDSC portion of the) header. For now, those bytes should be considered "Reserved for future expansion".

> > > I keep meaning to revise the proposal to explicitly state that there are two reserved bytes at 0x7FEA and 0x7FEB. I'll do that soon.

> > > > 2. How do the version numbers work? Mike G had major = 00, minor = 01, for version 0.1. Shouldn't that be minor = 10?

> > > In my opinion, yes. Major=00 and Minor=01 implies version 0.01 (or 00.01) to me.

> > > > 3. Does anyone know how the GG product code field (0x7FFE) works? I've pretty much got SMS sussed, but the GG codes seem to be all over the place while also being somewhat ordered.

> > > Sorry, someone else will have to help out here.

> > > > BTW, I can flesh out the end of the SDSC header proposal regarding some of the Sega header bytes, but mostly from what the nice people around here have already told me. Let me know if you want it, Eric.

> > > Yes, post it here, and I'll update the proposal in the SDSC section.

> > > > People wanting a preview can look here. Oh, and it can read zipped roms!

> > > Excellent! A very nice utility. I'd either like to post the utility locally on S8-Dev, or provide a link to your site. Let me know when you've got release version (or if you'd just like me to post/link the preview version).

> > > --
> > > Eric Quinn
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Rom header reader released
Post Posted: Wed Mar 07, 2001 7:28 pm


Get it here (232KB). And massage my ego by increasing my page counter by visiting my SMS stuff pages.

For those who didn't read the previous post, it reads the SDSC and Sega headers, checks the checksum, and decodes some of the Sega header, with zipped and unzipped roms.

Eric, I think it'd be best if you put a copy here in the Tools section or whatever.

Bug reports, suggestions and outright flame here.

Maxim
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!