Gb-studio: Cartidge Header for ROM

Created on 29 Apr 2019  路  7Comments  路  Source: chrismaltby/gb-studio

Some of us on discord are already disucssing what kind of cartidges we can flash our games on to.

Many of the cheap chinese clone cartidges are using MBC5 memory controllers, which makes me wonder what header bits are being set when we compile a rom?

Please have a look at: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header#0147_-_Cartridge_Type

This is an example of a header that needs to be set, dependent on the hardware that we're programming. Is there any chance of a simple GUI/Menu to select these?

Many thanks

Rochey

Most helpful comment

Done :-) 51d2d2a9b56fb4d733038dace9a9056ad38294f7 adds Cartridge Type to the "Game" menu, defaulting to MBC5+RAM+BATTERY

Screenshot 2019-04-29 at 23 09 06

The was no inbuilt method I could find for setting the cartridge title so I did it by manually editing the ROM data.

https://github.com/chrismaltby/gb-studio/blob/51d2d2a9b56fb4d733038dace9a9056ad38294f7/src/lib/compiler/makeBuild.js#L14-L21

Bit messy but it works :-)

Verified the ROM in hex editor, 0x134 - 0x143 contain the game title and the 1B just after the game title hex is 0x147 containing MBC5+RAM+BATTERY

Screenshot 2019-04-29 at 23 09 58

All 7 comments

Dev builds are currently using cartridge type 3 for MBC1+RAM+BATTERY since the save/load feature has been added.
A few people have mentioned using MBC5 controllers now though so I could change to 1B for MBC5+RAM+BATTERY if that's better?

Thanks Chris,

Just wondering if this should be an option, depending on which hardware you're writing to. MBC5 seems the most popular, but locking folks in seems a little strict.

Yeah I think you're right.

I think the only valid options for the ROMs it creates are MBC5+RAM+BATTERY, MBC1+RAM+BATTERY, MBC5+RAM and MBC1+RAM so I'll add an option to choose one of these. And then if you don't include BATTERY I'll have to warn about if you try to use the Save/Load events

I tried to figure out how the cartridge header is generated. But couldn't find anything obvious in the makefile. Where are things like the cartridge title defined?

Hi Thomas, I鈥檒l sort this one, mostly got the UI done, just need to hook it to the makefile part. For your reference though it鈥檚 the flag -Wl-yt# in the makefile, currently hard coded as 3 in the develop branch http://gbdk.sourceforge.net/guidelines.html

Great :) While you are at it, could you also add the ability to change the cartridge title (0x134 - 0x143)?

Done :-) 51d2d2a9b56fb4d733038dace9a9056ad38294f7 adds Cartridge Type to the "Game" menu, defaulting to MBC5+RAM+BATTERY

Screenshot 2019-04-29 at 23 09 06

The was no inbuilt method I could find for setting the cartridge title so I did it by manually editing the ROM data.

https://github.com/chrismaltby/gb-studio/blob/51d2d2a9b56fb4d733038dace9a9056ad38294f7/src/lib/compiler/makeBuild.js#L14-L21

Bit messy but it works :-)

Verified the ROM in hex editor, 0x134 - 0x143 contain the game title and the 1B just after the game title hex is 0x147 containing MBC5+RAM+BATTERY

Screenshot 2019-04-29 at 23 09 58

Was this page helpful?
0 / 5 - 0 ratings