I thought I'd post something here based on my experience. During the scanline emulation process, you should execute the CPU core for 84/85 cycles. This amount corresponds to the number of CPU cycles it takes the PPU to render 256 pixels. Once this is done, you should update the vertical/horizontal scrolling counters (Loopy_V and Loopy_T). After that, the core should execute 29 other cycles (corresponding to the HBlank period) and then update Loopy_V with Loopy_T (Loopy_V = Loopy _T). This scheme has worked quite well for me: games like Battletoads, Radracer, and Bigfoot run without glitches.