; Tests sprite overflow flag timing to PPU clock accuracy .include "sprite_overflow.inc" .include "sync_vbl.s" clear_time = 6819 overflow_time = 7290 ; Reads $2002 at n PPU clocks into frame, where 0 is the point at which ; VBL flag first reads back as set. .macro test_timing n .local n_ n_ = (n) + 3 jsr test_timing_ delay 29781 delay_ppu_even (n_ .MOD 3) + 9 lda #$18 sta $2001 delay n_/3 - 3 + 29781 - 33 - 1 lda $2002 tax and #$20 .endmacro test_timing_: jsr wait_vbl lda #>sprites jsr sync_vbl_even_dma lda $2002 rts main: jsr init_sprite_overflow ; First 9 sprites Y = 128 lda #128 ldx #