From b38e3280789153bb919ea1d3c76d847657a95b5d Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 13 Mar 2023 10:22:19 -0700 Subject: [PATCH] (hilbert.tal) Animated --- projects/examples/demos/hilbert.tal | 36 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/projects/examples/demos/hilbert.tal b/projects/examples/demos/hilbert.tal index f5a900e..40eaf90 100644 --- 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