This commit is contained in:
Brooke Vibber 2022-12-11 16:37:47 -08:00
parent cf2a18e0d7
commit 0bae8670ba

View file

@ -209,6 +209,10 @@ wait_loop:
.macro run_frame frame_offset
.scope
; each scanline is 228 color clocks
; that's 114 CPU cycles
; minus 41-43 for DMA leaves 71-73 clock cycles per line
each_scanline_pair:
sty scanline ; 3 cycles
inner_scanline frame_offset, 0 ; 23-26 cycles before break, 12 cycles after
@ -219,15 +223,14 @@ wait_loop:
ldy scanline ; 3 cycles
inner_scanline frame_offset, 128 ; 23-26 cycles before break, 12 cycles after
; save for later lookup
; pair cleanup: 6 cycles
ldy VCOUNT ; 4 cycles
cpy #0 ; 2 cycles
bne each_scanline_pair ; 2 cycles
; frame cleanup: 11 cycles
lda frame_counter ; 3 cycles
eor #1 ; 2 cycles
sta frame_counter ; 3 cycles
jmp wait_start ; 3 cycles
.endscope
.endmacro