Pokemon Blue - May be related to STAT interrupts. I would imagine that one type of interrupt (likely H-Blank) is being triggered so the game can safely modify SCX for the scanline for the wave-like effects. Seems like all the GB Pokemon games (Red through Crystal) don't make the very first scanline move when attacks make those wave-like effects (LY=LYC test maybe? Perhaps the effect just couldn't be done when testing for LY=0). If it loops forever rather than crashing, it's usually a sign that you're not feeding it input it expects (an interrupt, a certain value in the MMIO registers, stuff like that). The best thing to do is look at the GB assembly in a debugger and compare it in an emulator. Time consuming, but effective, since eventually your emulator will diverge from a correct, working emulator and you can then pinpoint where exactly.
That was one of the reasons I wrote the profiler, just didn't have the time and motivation to dig through the output.
I also noticed that it does not move the second scanline, which looks weird and should probably not happen.
Edit: The issue was easy to find, he checks for LY==143, but LY resets after reaching 142.
A closer look at my code revealed that I triggered the Vblank interrupt at the end of scanline 143 instead of 144.
This fixed the loop but now the topmost 3 scanlines don't move...
This apparently fixed Pokemon Crystal too.
As for double-speed, I kinda struggled to implement it correctly too, in fact, I only knew my implementation was broken because the Oracle games were messed up. I solved it by simply halving the CPU cycles the LCD acknowledged after each instruction (my emulated APU is not cycle-based, not yet), but by sending the original amount of CPU cycles to the timers. The CPU runs at 2x its normal operating speed (meaning all timers run twice as fast too) but LCD operations, DMA transfers run at the same speed. The setup I just described follows that, but it took me a while to figure it out.
Three new lines and it seems to work fine :satisfied .
Edit: Some palette issues and the map corruption in Zelda DX is now fixed,
but remains in the DMG Zelda.
Other stuff - Sprite palettes in DMG games are off. You may know how to fix it already, but just make sure you're correctly reading OBP0 and OBP1. Also, seems like you still have BG/Sprite priority issues (Suicune in the intro of Crystal should be behind the grass). For reference, there are only 4 cases where a sprite's pixel will prevail over the BG's pixel (GBC only):
The color issues probably happened when I swapped color channels around to fix GBC games, but the palette lookups seem fine.
I check the OBJ-to-BG priority but not (yet) the BG-to-OBJ, so that could explain it.
Last edited: