Hi,
does anyone know whether the horizontal timing of the LYC interrupt at Y==0 is different to other rows?
It seems the timing, (the number of cycles before the row graphics is shown) is consistent for all rows but the first. At Y==0 the interrupt seems to occur somewhat earlier.
Cheers
Timing of LYC==0
Re: Timing of LYC==0
I guess nobody truly knows,
What I've seen implemented in some emulators is that ly = 0 when the LCD is just turned on has 456 cycles and when it hits VBLANK, ly = 0 has that double timing behaviour (456 * 2).
I have it like that on my emu, but my interrupt code is a mess. Not really sure if theres a demo or game that relies on that specific quirck
What I've seen implemented in some emulators is that ly = 0 when the LCD is just turned on has 456 cycles and when it hits VBLANK, ly = 0 has that double timing behaviour (456 * 2).
I have it like that on my emu, but my interrupt code is a mess. Not really sure if theres a demo or game that relies on that specific quirck
Re: Timing of LYC==0
Thanks!
It seems LYC==0 is early by a time corresponding to about one scanline, compared to the other LYC interrupts.
This loop in the beginning of the interrupt at row zero puts it into phase:
(cgb double speed)
It seems LYC==0 is early by a time corresponding to about one scanline, compared to the other LYC interrupts.
This loop in the beginning of the interrupt at row zero puts it into phase:
Code: Select all
ld a,56
loop:
dec a
jr nz,loop
Re: Timing of LYC==0
Having it be zero during the equivalent of a "pre-render" line would make sense in a way to me.
Re: Timing of LYC==0
Wilbert Pol's fork of mooneye-gb has some tests for LY=0. If these are correct, the behavior is that LY=153 lasts for just 4 cycles, then becomes LY=0, even though the mode is still VBLANK. So LY=0 actually lasts for 452 + 456 cycles. But it looks like the LY=LYC interrupt for LY=0 doesn't fire exactly when LY becomes 0, but after a 4-cycle delay. Another interesting case that is likely related: it seems that if you write 153 to LYC on the cycle when LY becomes 0, the STAT interrupt will fire.