patterns/gb: Add 16K and 32K arrays for ROM Banks (#305)

Having arrays for dividing the GB ROM up into ROM Banks makes it much easier to jump to and inspect data at the start and end of banks.

- 16K Banks are the typical standard
- 32K banks aren't very common but are used in a couple unlicensed Games such as those using the Wisdom Tree MBC controller
This commit is contained in:
bbbbbr
2024-11-17 04:57:45 -08:00
committed by GitHub
parent af957389c2
commit 61d3e110fb

View File

@@ -7,6 +7,9 @@ import type.size;
import std.string; import std.string;
import std.mem; import std.mem;
const u16 ROMBANKSIZE_16K = 0x4000;
const u16 ROMBANKSIZE_32K = 0x8000;
bool uppercaseROMFeatures in; bool uppercaseROMFeatures in;
bool brandedROMFeatures in; bool brandedROMFeatures in;
@@ -357,5 +360,15 @@ struct JumpVectors {
u8 int5[8] [[comment("joypad")]]; u8 int5[8] [[comment("joypad")]];
}; };
struct romBank16K {
u8 Bank[ROMBANKSIZE_16K];
};
struct romBank32K {
u8 Bank[ROMBANKSIZE_32K];
};
romBank16K romBanks16K[std::mem::size() / ROMBANKSIZE_16K] @ 0x00;
romBank32K romBanks32K[std::mem::size() / ROMBANKSIZE_32K] @ 0x00;
JumpVectors jumpVectors @ 0x00 [[comment("Instructions called on interrupts or RST instructions")]]; JumpVectors jumpVectors @ 0x00 [[comment("Instructions called on interrupts or RST instructions")]];
CartridgeStart cartridgeStart @ 0x100; CartridgeStart cartridgeStart @ 0x100;