GB Memory: Initialize HRAM when skipping BIOS in GBC mode (fixes #3420)

This commit is contained in:
Vicki Pfau 2025-05-13 20:52:19 -07:00
parent f3663c86ad
commit 03ad202c4d
2 changed files with 21 additions and 0 deletions

View File

@ -17,6 +17,7 @@ Features:
- "Headless" frontend for running tests, automation, etc.
Emulation fixes:
- ARM: Add framework for coprocessor support
- GB Memory: Initialize HRAM when skipping BIOS in GBC mode (fixes mgba.io/i/3420)
- GB Serialize: Add missing Pocket Cam state to savestates
- GB Video: Implement DMG-style sprite ordering
- GBA: Unhandled bkpt should be treated as an undefined exception

View File

@ -28,6 +28,25 @@ static const uint8_t _knownHeader[4] = {0xCE, 0xED, 0x66, 0x66};
static const uint8_t _knownHeaderSachen[4] = {0x7C, 0xE7, 0xC0, 0x00};
static const uint8_t _registeredTrademark[] = {0x3C, 0x42, 0xB9, 0xA5, 0xB9, 0xA5, 0x42, 0x3C};
static const uint8_t _cgbBiosHram[GB_SIZE_HRAM] = {
0xCE, 0xED, 0x66, 0x66, 0xCC, 0x0D, 0x00, 0x0B,
0x03, 0x73, 0x00, 0x83, 0x00, 0x0C, 0x00, 0x0D,
0x00, 0x08, 0x11, 0x1F, 0x88, 0x89, 0x00, 0x0E,
0xDC, 0xCC, 0x6E, 0xE6, 0xDD, 0xDD, 0xD9, 0x99,
0xBB, 0xBB, 0x67, 0x63, 0x6E, 0x0E, 0xEC, 0xCC,
0xDD, 0xDC, 0x99, 0x9F, 0xBB, 0xB9, 0x33, 0x3E,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x71, 0x02, 0x4D, 0x01, 0xC1, 0xFF,
0x0D, 0x00, 0xD3, 0x05, 0xF9, 0x00, 0x00,
};
#define DMG0_BIOS_CHECKSUM 0xC2F5CC97
#define DMG_BIOS_CHECKSUM 0x59C8598E
#define MGB_BIOS_CHECKSUM 0xE6920754
@ -746,6 +765,7 @@ void GBSkipBIOS(struct GB* gb) {
gb->memory.io[GB_REG_SVBK] = 0xFF;
GBVideoDisableCGB(&gb->video);
}
memcpy(gb->memory.hram, _cgbBiosHram, sizeof(gb->memory.hram));
nextDiv = 0xC;
break;
}