diff --git a/CHANGES b/CHANGES index 09f0f22cb..c8cba4bb6 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/src/gb/gb.c b/src/gb/gb.c index 102e4cfa2..790d37c23 100644 --- a/src/gb/gb.c +++ b/src/gb/gb.c @@ -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; }