sawtooth motion. I want this to become a triangle or sine motion.

This commit is contained in:
Nico 2021-11-24 08:23:56 +00:00
parent 6dc1668fcc
commit c7be67e860
1 changed files with 12 additions and 3 deletions

View File

@ -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