From 61d3e110fb252902769e89ae0322aaf1bf46ca5f Mon Sep 17 00:00:00 2001 From: bbbbbr Date: Sun, 17 Nov 2024 04:57:45 -0800 Subject: [PATCH] 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 --- patterns/gb.hexpat | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/patterns/gb.hexpat b/patterns/gb.hexpat index 947ac98..79d0d33 100644 --- a/patterns/gb.hexpat +++ b/patterns/gb.hexpat @@ -7,6 +7,9 @@ import type.size; import std.string; import std.mem; +const u16 ROMBANKSIZE_16K = 0x4000; +const u16 ROMBANKSIZE_32K = 0x8000; + bool uppercaseROMFeatures in; bool brandedROMFeatures in; @@ -357,5 +360,15 @@ struct JumpVectors { 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")]]; CartridgeStart cartridgeStart @ 0x100;