@Leo - I think graphical effects like that have to do with the WX register (0xFF4B). The GB CPU Manual has small bit about that here:
The scanline interrupt is selectable via the LCDC register (0xFF40), so you'll need to make your emulated LCD capable of using the WX/WY registers and your emulated Z80/GB will need to handle LCDC status interrupts. I assume the game's code has an algorithm that produces the necessary offsets for WX so everything moves back and forth smoothly.
I'm not that far along yet, however. My emulated LCD ignores WX/WY; most of the time they're set to 0 and in the early stages of development I have other things I need to refine. Eventually though, I need to get that squared away. The only interrupts I've enabled are VBlanks; interrupt handling itself is setup (albeit commented out) I just need to generate the interrupts appropriately.
Oh, and I figured out where my troubles were. My MMU was the trouble; it kept writing to values in the first two ROM banks, essentially re-writing the game's code. How could I forget what Read-Only-Memory means? XD Additionally, my emulated LCD didn't initially handle sprites with a Priority of 1 (below the background) but that's done, so now I can fully play Tetris, with the minor caveat that all of the blocks are "T" blocks. This is expected, since I haven't yet gotten to implementing timers, which are necessary for getting more "random" blocks. Also, the score's value is displayed in hexadecimal, since I haven't yet tackled the DAA (Decimal Adjust Accumulator) instruction. Having gotten so far, I feel pretty good
Now you've gotten me curious about NES emulation... I know a bit about the system, but not much. Maybe someday later I'll have a good look-see
Quote:WX may be changed during a scan line interrupt (to either cause a graphic distortion effect or to disable the window (WX>166) ) but changes to WY are not dynamic and won't be noticed until the next screen redraw.
The scanline interrupt is selectable via the LCDC register (0xFF40), so you'll need to make your emulated LCD capable of using the WX/WY registers and your emulated Z80/GB will need to handle LCDC status interrupts. I assume the game's code has an algorithm that produces the necessary offsets for WX so everything moves back and forth smoothly.
I'm not that far along yet, however. My emulated LCD ignores WX/WY; most of the time they're set to 0 and in the early stages of development I have other things I need to refine. Eventually though, I need to get that squared away. The only interrupts I've enabled are VBlanks; interrupt handling itself is setup (albeit commented out) I just need to generate the interrupts appropriately.
Oh, and I figured out where my troubles were. My MMU was the trouble; it kept writing to values in the first two ROM banks, essentially re-writing the game's code. How could I forget what Read-Only-Memory means? XD Additionally, my emulated LCD didn't initially handle sprites with a Priority of 1 (below the background) but that's done, so now I can fully play Tetris, with the minor caveat that all of the blocks are "T" blocks. This is expected, since I haven't yet gotten to implementing timers, which are necessary for getting more "random" blocks. Also, the score's value is displayed in hexadecimal, since I haven't yet tackled the DAA (Decimal Adjust Accumulator) instruction. Having gotten so far, I feel pretty good

Now you've gotten me curious about NES emulation... I know a bit about the system, but not much. Maybe someday later I'll have a good look-see
