commit b38e3280789153bb919ea1d3c76d847657a95b5d
parent 39fa5851eb50a1aab00f7ea2c721182245abb180
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Mon, 13 Mar 2023 10:22:19 -0700
(hilbert.tal) Animated
Diffstat:
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/projects/examples/demos/hilbert.tal b/projects/examples/demos/hilbert.tal
@@ -11,14 +11,18 @@
#7f0a .System/g DEO2
#8e0a .System/b DEO2
( screen size )
- #0140 .Screen/width DEO2
- #0140 .Screen/height DEO2
- ( draw )
- #03ff #0000
- &l
- STH2k INC2k d2xy STH2r d2xy #01 draw-line
- INC2 GTH2k ?&l
- POP2 POP2
+ #00c0
+ DUP2 .Screen/width DEO2
+ .Screen/height DEO2
+ ( vector )
+ ;on-frame .Screen/vector DEO2
+
+BRK
+
+@on-frame ( -> )
+
+ [ LIT2 &f $2 ] INC2k ,&f STR2
+ INC2k d2xy ROT2 d2xy #01 draw-line
BRK
@@ -28,27 +32,27 @@ BRK
#0000
DUP2 ,&x STR2
,&y STR2
- #0020 #0001
+ #2001
&l
- STH2k
+ #00 OVR STH2
[ LIT2 &t $2 ]
DUP2 DUP2 #01 SFT2 #0001 AND2 DUP2 ,&rx STR2
EOR2 #0001 AND2 ,&ry STR2
#02 SFT2 ,&t STR2
[ LIT2 &x $2 ] [ LIT2 &y $2 ] [ LIT2 &rx $2 ] [ LIT2 &ry $2 ]
- STH2kr rot
+ STH2kr rot
STH2kr ,&ry LDR2 MUL2 ADD2 ,&y STR2
STH2r ,&rx LDR2 MUL2 ADD2 ,&x STR2
- DUP2 ADD2 GTH2k ?&l
- POP2 POP2
- ,&x LDR2 #30 SFT2 #0020 ADD2
- ,&y LDR2 #30 SFT2 #0020 ADD2
+ DUP ADD GTHk ?&l
+ POP2
+ ,&x LDR2 #20 SFT2 #0020 ADD2
+ ,&y LDR2 #20 SFT2 #0020 ADD2
JMP2r
@rot ( x* y* rx* ry* n* -- x* y* )
- ( n-1 ) #0001 SUB2 STH2
+ #0001 SUB2 STH2
SWP2 ,&rx STR2
ORA ?&skipy
[ LIT2 &rx $2 ] #0001 NEQ2 ?&skipx