plasma: optimize for speed at expense of size

This commit is contained in:
Vince Weaver 2021-01-09 13:09:19 -05:00
parent 0801d09f32
commit 43c7819e9e

View File

@ -6,6 +6,7 @@
; 130 -- optimize indexing of lookup ; 130 -- optimize indexing of lookup
; 126 -- run loops backaward ; 126 -- run loops backaward
; 124 -- notice X already 0 before plot ; 124 -- notice X already 0 before plot
; 131 -- use GBASCALC. much faster, but 7 bytes larger
.include "zp.inc" .include "zp.inc"
.include "hardware.inc" .include "hardware.inc"
@ -71,39 +72,60 @@ plot_frame:
; plot frame ; plot frame
;ldx #0 ; YY=0 ; ldx #40 ; YY=0
plot_yloop: plot_yloop:
ldy #0 ; XX = 0 ldy #0 ; XX = 0
txa
lsr
php
jsr GBASCALC ; point GBASL/H to address in A
; after, A trashed, C is clear
plp
lda #$0f ; setup mask
bcc plot_mask
adc #$e0
plot_mask:
sta MASK
plot_xloop: plot_xloop:
stx SAVEX ; SAVE YY stx SAVEX ; SAVE YY
sty SAVEY ; SAVE XX
tya tya ; get x&0xf
and #$f and #$f
sta CTEMP sta CTEMP
txa txa ; get y<<4
and #$f
asl asl
asl asl
asl asl
asl asl
ora CTEMP
ora CTEMP ; get (y*15)+x
tax tax
lda lookup,X
plot_lookup:
; sta plot_lookup_smc+1
plot_lookup_smc:
lda lookup,X ; load lookup, (y*16)+x
; lda lookup ; load lookup, (y*16)+x
and #$f and #$f
lsr lsr
tax tax
lda colorlookup,X lda colorlookup,X
jsr SETCOL jsr SETCOL
lda SAVEX jsr PLOT1 ; plot at GBASL,Y (x co-ord in Y)
jsr PLOT ; plot at Y,A
ldy SAVEY ; restore XX
ldx SAVEX ; restore YY ldx SAVEX ; restore YY
iny iny