From 9c7b188263c76fbe9032cd92780f5e7bbc1cf84a Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 24 Jan 2023 21:16:14 -0500 Subject: [PATCH] parallax: update par_tiny --- graphics/gr/parallax/par_tiny.s | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/graphics/gr/parallax/par_tiny.s b/graphics/gr/parallax/par_tiny.s index fa091b6a..560080f5 100644 --- a/graphics/gr/parallax/par_tiny.s +++ b/graphics/gr/parallax/par_tiny.s @@ -11,6 +11,7 @@ ; 102 bytes -- make page value self-modifying code ; 101 bytes -- overlap some constants ; 99 bytes -- merge frame +; 115 bytes -- code to change direction ; Zero Page GBASL = $26 @@ -39,17 +40,24 @@ SETGR = $FB40 .globalzp masks .globalzp offsets .globalzp page_smc +.globalzp horiz_smc +.globalzp dir_horiz_lookup parallax: ;=================== ; init screen - jsr HGR2 ; set hires, full-screen +; jsr HGR2 ; set hires, full-screen ; A/Y are 0 ; note! Only can do this if $E6 is free - bit LORES ; set lores +; bit LORES ; set lores + + ; have to do it this way as above messes with $E7 + + jsr SETGR + bit FULLGR parallax_forever: @@ -60,7 +68,15 @@ parallax_forever: sta frames+1 ; frame/2 lsr sta frames+2 ; frame/4 - + lsr + lsr + lsr + and #$3 + tax + lda dir_horiz_lookup,X + sta horiz_smc +; lda dir_vert_lookup,X +; sta vert_smc ;========================== ; flip page @@ -112,16 +128,18 @@ xloop: color_loop: ;=========================== - ; SMALL + ; vertical scroll sec ; subtract frame from Y tya +horiz_smc: sbc frames,X sta X2 ; store interim result lda YY ; get YY and adjust offset to look nicer clc adc offsets,X + adc frames,X eor X2 and masks,X ; do the mask @@ -134,6 +152,8 @@ skip_color: dex bpl color_loop + + ;======================== ; actually draw color @@ -154,4 +174,8 @@ masks: .byte $8,$4 ;,$2 ; overlap offsets:.byte $2,$1,$0 colors: .byte $1b,$26,$4c +; ADC,X BIT,X SBC,X BIT,X +dir_horiz_lookup: .byte $75,$24,$F5,$24 + + frames: