rotozoom: minor optimization

This commit is contained in:
Vince Weaver 2021-01-07 13:55:01 -05:00
parent 18892d4804
commit 74ea0a13b9
2 changed files with 14 additions and 7 deletions

View File

@ -1,10 +1,16 @@
c00_scrn_offsets_l: common_offsets_l:
.byte <$c00,<$c80,<$d00,<$d80,<$e00,<$e80,<$f00,<$f80 .byte <$c00,<$c80,<$d00,<$d80,<$e00,<$e80,<$f00,<$f80
.byte <$c28,<$ca8,<$d28,<$da8,<$e28,<$ea8,<$f28,<$fa8 .byte <$c28,<$ca8,<$d28,<$da8,<$e28,<$ea8,<$f28,<$fa8
.byte <$c50,<$cd0,<$d50,<$dd0,<$e50,<$ed0,<$f50,<$fd0 .byte <$c50,<$cd0,<$d50,<$dd0,<$e50,<$ed0,<$f50,<$fd0
c00_scrn_offsets_h: scrn_c00_offsets_h:
.byte >$c00,>$c80,>$d00,>$d80,>$e00,>$e80,>$f00,>$f80 .byte >$c00,>$c80,>$d00,>$d80,>$e00,>$e80,>$f00,>$f80
.byte >$c28,>$ca8,>$d28,>$da8,>$e28,>$ea8,>$f28,>$fa8 .byte >$c28,>$ca8,>$d28,>$da8,>$e28,>$ea8,>$f28,>$fa8
.byte >$c50,>$cd0,>$d50,>$dd0,>$e50,>$ed0,>$f50,>$fd0 .byte >$c50,>$cd0,>$d50,>$dd0,>$e50,>$ed0,>$f50,>$fd0
gr_400_offsets_h:
.byte >$400,>$480,>$500,>$580,>$600,>$680,>$700,>$780
.byte >$428,>$4a8,>$528,>$5a8,>$628,>$6a8,>$728,>$7a8
.byte >$450,>$4d0,>$550,>$5d0,>$650,>$6d0,>$750,>$7d0

View File

@ -12,6 +12,8 @@
; $39e3e=237,118=4.22fps add scrn address lookup table ; $39e3e=237,118=4.22fps add scrn address lookup table
; $39fdf=237,535 add two scale multiplies ; $39fdf=237,535 add two scale multiplies
; $39e17=237,079=4.22fps change the init to also use multiply ; $39e17=237,079=4.22fps change the init to also use multiply
; $39dc9=237,001= change to use common lookup table (outside inner loop)
CAL = $B0 CAL = $B0
CAH = $B1 CAH = $B1
@ -177,16 +179,15 @@ smc_even:
ldy #$4c ; jmp ; 2 ldy #$4c ; jmp ; 2
smc_write: smc_write:
sty rplot3_smc ; 4 sty rplot3_smc ; 4
asl ; now even ; 2
tay ; 2 tay ; 2
lda gr_offsets,Y ; lookup low-res memory address ; 4 lda common_offsets_l,Y ; lookup low-res memory address ; 4
sta rplot1_smc+1 ; 4 sta rplot1_smc+1 ; 4
sta rplot2_smc+1 ; 4 sta rplot2_smc+1 ; 4
clc ; 2 clc ; 2
lda gr_offsets+1,Y ; 4 lda gr_400_offsets_h,Y ; 4
adc DRAW_PAGE ; add in draw page offset ; 3 adc DRAW_PAGE ; add in draw page offset ; 3
sta rplot1_smc+2 ; 4 sta rplot1_smc+2 ; 4
sta rplot2_smc+2 ; 4 sta rplot2_smc+2 ; 4
@ -235,9 +236,9 @@ rotozoom_xloop:
; TODO: put these in zero page? ; TODO: put these in zero page?
; also we can share low bytes with other lookup ; also we can share low bytes with other lookup
lda c00_scrn_offsets_l,Y ; lookup low-res memory address ; 4 lda common_offsets_l,Y ; lookup low-res memory address ; 4
sta BASL ; 3 sta BASL ; 3
lda c00_scrn_offsets_h,Y ; 4 lda scrn_c00_offsets_h,Y ; 4
sta BASH ; 3 sta BASH ; 3
; carry was set a bit before to low bit of YPH ; carry was set a bit before to low bit of YPH