aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gb.h')
-rw-r--r--src/gb.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gb.h b/src/gb.h
index 5192e85..7162b4d 100644
--- a/src/gb.h
+++ b/src/gb.h
@@ -118,10 +118,20 @@ struct GB {
int serial_out_fd; // if >=0, transmitted serial bytes written here (stdout)
int serial_in_fd; // if >=0, received serial bytes read here (stdin), else 0xFF
bool poweroff; // set by the $ED opcode: request a clean emulator exit
+
+ // Boot ROM (BIOS). When boot_rom is non-NULL, gb_reset starts execution
+ // inside it (PC=0) with power-on register state; the ROM maps over low
+ // memory until the game writes 0xFF50 to hand control to the cartridge.
+ u8 *boot_rom;
+ int boot_rom_len; // 0x100 = DMG boot rom, 0x900 = CGB boot rom
+ bool boot_rom_active; // true while the boot ROM is still mapped in
};
void gb_init(GB *gb);
void gb_reset(GB *gb);
+// Load a boot ROM (BIOS) image so the next gb_reset boots through it. Returns
+// 0 on success. 256-byte images boot as DMG; 2304-byte images as CGB.
+int gb_load_bootrom(GB *gb, const char *path);
// Run one full CPU instruction (advancing all subsystems). Returns T-cycles.
int gb_step(GB *gb);
void gb_run_frame(GB *gb);