MCPcopy Create free account
hub / github.com/Stewmath/GameYob / initGameboyMode

Function initGameboyMode

arm9/source/gameboy.cpp:386–413  ·  view source on GitHub ↗

Called either from startup, or when the BIOS writes to FF50.

Source from the content-addressed store, hash-verified

384
385// Called either from startup, or when the BIOS writes to FF50.
386void initGameboyMode() {
387 gbRegs.af.b.l = 0xB0;
388 gbRegs.bc.w = 0x0013;
389 gbRegs.de.w = 0x00D8;
390 gbRegs.hl.w = 0x014D;
391 switch(resultantGBMode) {
392 case 0: // GB
393 gbRegs.af.b.h = 0x01;
394 gbMode = GB;
395 if (romSlot0[0x143] == 0x80 || romSlot1[0x143] == 0xC0)
396 // Init the palette in case the bios overwrote it, since it
397 // assumed it was starting in GBC mode.
398 initGFXPalette();
399 break;
400 case 1: // GBC
401 gbRegs.af.b.h = 0x11;
402 if (gbaModeOption)
403 gbRegs.bc.b.h |= 1;
404 gbMode = CGB;
405 break;
406 case 2: // SGB
407 sgbMode = true;
408 gbRegs.af.b.h = 0x01;
409 gbMode = GB;
410 initSGB();
411 break;
412 }
413}
414
415void checkLYC() {
416 if (ioRam[0x44] == ioRam[0x45])

Callers 2

initCPUFunction · 0.85
writeIOFunction · 0.85

Calls 2

initGFXPaletteFunction · 0.85
initSGBFunction · 0.85

Tested by

no test coverage detected