Called either from startup, or when the BIOS writes to FF50.
| 384 | |
| 385 | // Called either from startup, or when the BIOS writes to FF50. |
| 386 | void 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 | |
| 415 | void checkLYC() { |
| 416 | if (ioRam[0x44] == ioRam[0x45]) |
no test coverage detected