3.2 How to include binary data-banks to your ROM image


If you want to include binary code into your program you can use the following procedure.

- Compile a standard 32KB ROM Image
- Set BYTE 0x147 to 1 (ROM+MBC1)
- Set BYTE 0x148 to your used romsize
- Add your 16KB Binaryfile to that image
(i.e. on MS-DOS systems simply use COPY /b main.gb + bank01.gb final.gb)


0 - 256Kbit = 32KByte = 2 banks
1 - 512Kbit = 64KByte = 4 banks
2 - 1Mbit = 128KByte = 8 banks
3 - 2Mbit = 256KByte = 16 banks
4 - 4Mbit = 512KByte = 32 banks
5 - 8Mbit = 1MByte = 64 banks
6 - 16Mbit = 2MByte = 128 banks

52 - 9Mbit = 1.1MByte = 72 banks
53 - 10Mbit = 1.2MByte = 80 banks
54 - 12Mbit = 1.5MByte = 96 banks


- Finally use RGBFIX95 to pad your file and fix all the other stuff.

For accessing this (extern) data from C you can use this method:

UBYTE *data,externdata;
data=(UBYTE*)0x4000;

SWITCH_ROM_MBC1(2) // Switch to ROM Bank 2
externdata=*data; // Here you already access BANK 2
SWITCH_ROM_MBC1(1) // Switch back to ROM Bank 1