diff --git a/src/gb/GB.cpp b/src/gb/GB.cpp index f95dc730..67cb1615 100644 --- a/src/gb/GB.cpp +++ b/src/gb/GB.cpp @@ -1651,7 +1651,7 @@ u8 gbReadOpcode(register u16 address) return register_SCX; case 0x44: if (((gbHardware & 7) && ((gbLcdMode == 1) && (gbLcdTicks == 0x71))) || - (!(register_LCDC && 0x80))) + (!(register_LCDC & 0x80))) return 0; else return register_LY; @@ -1931,7 +1931,7 @@ u8 gbReadMemory(register u16 address) return register_SCX; case 0x44: if (((gbHardware & 7) && ((gbLcdMode == 1) && (gbLcdTicks == 0x71))) || - (!(register_LCDC && 0x80))) + (!(register_LCDC & 0x80))) return (0); else return register_LY; @@ -2208,11 +2208,6 @@ void gbReset() gbDmaTicks = 0; clockTicks = 0; - if(gbSpeed) { - gbSpeedSwitch(); - gbMemory[0xff4d] = 0; - } - // clean Wram // This kinda emulates the startup state of Wram on GB/C (not very accurate, // but way closer to the reality than filling it with 00es or FFes). @@ -2236,6 +2231,11 @@ void gbReset() gbMemory[temp] = 0xff; } + if(gbSpeed) { + gbSpeedSwitch(); + gbMemory[0xff4d] = 0; + } + // GB bios set this memory area to 0 // Fixes Pitman (J) title screen if (gbHardware & 0x1) { @@ -2244,10 +2244,10 @@ void gbReset() // clean LineBuffer if (gbLineBuffer != NULL) - memset(gbLineBuffer, 0, sizeof(gbLineBuffer)); + memset(gbLineBuffer, 0, sizeof(*gbLineBuffer)); // clean Pix if (pix != NULL) - memset(pix, 0, sizeof(pix)); + memset(pix, 0, sizeof(*pix)); // clean Vram if (gbVram != NULL) memset(gbVram, 0, 0x4000);