From 0801d09f32395bca4064c6e89ee0fe679c5a250c Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 9 Jan 2021 12:26:57 -0500 Subject: [PATCH] plasma: more optimization --- graphics/gr/plasma/plasma.s | 45 ++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/graphics/gr/plasma/plasma.s b/graphics/gr/plasma/plasma.s index c37ca273..b9773f84 100644 --- a/graphics/gr/plasma/plasma.s +++ b/graphics/gr/plasma/plasma.s @@ -2,6 +2,10 @@ ; 151 -- original ; 137 -- optimize generation +; 136 -- align lookup table so we can index it easier +; 130 -- optimize indexing of lookup +; 126 -- run loops backaward +; 124 -- notice X already 0 before plot .include "zp.inc" .include "hardware.inc" @@ -26,39 +30,34 @@ SAVEY = $FF ; + 8.0 + (sintable[yy&0xf]) ; ) / 2; +create_lookup: - - ldy #0 - sty SAVEOFF + ldy #15 create_yloop: - ldx #0 + ldx #15 create_xloop: -; lda SAVEOFF -; and #$f -; tax - clc lda #15 adc sinetable,X adc sinetable,Y lsr lookup_smc: - stx SAVEX - ldx SAVEOFF - sta lookup,X - ldx SAVEX + sta lookup ; always starts at $d00 - inc SAVEOFF - inx - cpx #16 - bne create_xloop + inc lookup_smc+1 - iny - cpy #16 - bne create_yloop + dex + bpl create_xloop + + dey + bpl create_yloop + + +create_lookup_done: forever_loop: +cycle_colors: ; cycle colors ldx #0 @@ -68,9 +67,11 @@ cycle_loop: bne cycle_loop - ; plot +plot_frame: - ldx #0 ; YY=0 + ; plot frame + + ;ldx #0 ; YY=0 plot_yloop: ldy #0 ; XX = 0 plot_xloop: @@ -124,4 +125,6 @@ colorlookup: ;.byte $07,$07,$06,$06,$02,$02,$05,$05 .byte $00,$05,$07,$0f,$07,$06,$02,$05 +.org $d00 +;.align $100 lookup: