From 9242ffc4e6a19e2c4aa9679d7cb9a93b23072b35 Mon Sep 17 00:00:00 2001 From: Brooke Vibber Date: Sat, 7 Sep 2024 12:12:11 -0700 Subject: [PATCH] clanup --- dither4.s | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/dither4.s b/dither4.s index 864748e..02dbb45 100644 --- a/dither4.s +++ b/dither4.s @@ -159,25 +159,24 @@ wait_loop: sta AUDC1 ; 4 cyc .endmacro - .macro audio_prep + .macro audio_prep ; 8-9 cycles ; Y is VCOUNT at entry lda (sample_ptr),y ; 5/6 cyc sta audiotemp ; 3 cyc .endmacro - ; call with A pre-loaded to audiotemp - .macro audio_play_lo - ;lda audiotemp ; 3 cyc - and #$0f ; 2 cyc - ora #$10 ; 2 cyc - sta AUDC1 ; 4 cyc + .macro audio_play_lo ; 8 cycles + ; A is loaded with packed audio byte at entry + and #$0f ; 2 cyc + ora #$10 ; 2 cyc + sta AUDC1 ; 4 cyc .endmacro ; clobbers Y .macro audio_play_hi ; 12 cycles - ldy audiotemp ; 3 cyc + ldy audiotemp ; 3 cyc lda audio_high_byte,y ; 5 cyc - sta AUDC1 ; 4 cyc + sta AUDC1 ; 4 cyc .endmacro .macro audio_inc @@ -216,26 +215,25 @@ wait_loop: sty scanline ; 3 cycles inner_scanline frame_offset, 0 ; 23-26 cycles before break, 12 cycles after - ldy scanline ; 3 cycles - audio_prep - audio_play_lo + ldy scanline ; 3 cycles + audio_prep ; 8-9 cycles + audio_play_lo ; 8 cycles ldy scanline ; 3 cycles inner_scanline frame_offset, 128 ; 23-26 cycles before break, 12 cycles after - audio_play_hi + audio_play_hi ; 12 cycles - ; pair cleanup: 6 cycles ldy VCOUNT ; 4 cycles bne each_scanline_pair ; 2 cycles + ; Do bookkeeping during vblank! audio_inc ; 22-32 cycles ; frame cleanup: 11 cycles lda frame_counter ; 3 cycles eor #1 ; 2 cycles sta frame_counter ; 3 cycles - ;jmp wait_start ; 3 cycles jmp each_frame ; 3 cycles .endscope .endmacro