Skip to content

Commit

Permalink
GB: Send LCD interrupt only if there is no INT 48h signal
Browse files Browse the repository at this point in the history
- Fixes Speedy Gonzales status bar in GB emulated hardware type.
  • Loading branch information
retro-wertz committed Jul 18, 2019
1 parent b147e91 commit 85bd86c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/gb/GB.cpp
Expand Up @@ -1270,6 +1270,7 @@ void gbWriteMemory(uint16_t address, uint8_t value)
//register_STAT = (register_STAT & 0x87) |
// (value & 0x7c);
gbMemory[0xff41] = register_STAT = (value & 0xf8) | (register_STAT & 0x07); // fix ?
// TODO:
// GB bug from Devrs FAQ
// http://www.devrs.com/gb/files/faqs.html#GBBugs
// 2018-7-26 Backported STAT register bug behavior
Expand All @@ -1280,12 +1281,15 @@ void gbWriteMemory(uint16_t address, uint8_t value)
// Games below relies on this bug, , and are incompatible with the GBC.
// - Road Rash: crash after player screen
// - Zerg no Densetsu: crash right after showing a small portion of intro
// - 2019-07-18 - Speedy Gonzalez status bar relies on this as well.

if ((gbHardware & 5)
&& (((!gbInt48Signal) && (gbLcdMode < 2) && (register_LCDC & 0x80))
|| (register_LY == register_LYC))) {

gbMemory[0xff0f] = register_IF |=2;
// send LCD interrupt only if no interrupt 48h signal...
if (!gbInt48Signal)
gbMemory[0xff0f] = register_IF |= 2;
}

gbInt48Signal &= ((register_STAT >> 3) & 0xF);
Expand All @@ -1307,7 +1311,7 @@ void gbWriteMemory(uint16_t address, uint8_t value)
if (!gbInt48Signal) {
gbMemory[0xff0f] = register_IF |= 2;
}
gbInt48Signal |= 4;
//gbInt48Signal |= 4;
}
gbCompareLYToLYC();

Expand Down

0 comments on commit 85bd86c

Please sign in to comment.