From c7be67e860da6ba4a903cc7048e5714c9a7a0c90 Mon Sep 17 00:00:00 2001 From: Nihilazo Date: Wed, 24 Nov 2021 08:23:56 +0000 Subject: [PATCH] sawtooth motion. I want this to become a triangle or sine motion. --- scroller.tal | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scroller.tal b/scroller.tal index a535b0c..c771d14 100644 --- a/scroller.tal +++ b/scroller.tal @@ -9,6 +9,7 @@ %DEBUG2 { SWP ;print-hex JSR2 ;print-hex JSR2 #0a .Console/write DEO } %MOD { DIVk MUL SUB } +%MOD2 { DIV2k MUL2 SUB2 } %RTN { JMP2r } @@ -47,13 +48,21 @@ BRK @redraw ( -> ) &charpos $2 &run + ;font .Screen/addr DEO2 + #00 .Screen/sprite DEO ( clear up remnants of last one ) #0000 ,&charpos STR2 #0000 STH2 &loop - STH2rk ;text ++ LDA #00 EQU ,&end JCN + STH2rk ;text ADD2 LDA #00 EQU ,&end JCN + ( draw new ) ;font #0008 ;text STH2rk ADD2 LDA #20 SUB #00 SWP MUL2 ADD2 .Screen/addr DEO2 ,&charpos LDR2 .scrollpos LDZ2 ADD2 .Screen/x DEO2 - STH2rk .Screen/y DEO2 + STH2rk + .scrollpos LDZ2 + #0008 DIV2 ADD2 + #0010 MOD2 + .Screen/height DEI2 #0002 DIV2 ADD2 + .Screen/y DEO2 ( do wave motion ) STH2rk SWP POP ( get low byte of counter ) #03 MOD #01 ADD .Screen/sprite DEO STH2r #0001 ADD2 STH2 ( increment counter ) @@ -61,7 +70,7 @@ BRK ,&loop JMP &end .scrollpos LDZ2 #0000 STH2r #0008 MUL2 SUB2 EQU2 ,&resetscroll JCN - .scrollpos LDZ2 #0002 SUB2 .scrollpos STZ2 + .scrollpos LDZ2 #0002 SUB2 .scrollpos STZ2 ( scroll forward ) BRK &resetscroll .Screen/width DEI2 .scrollpos STZ2