diff --git a/projects/examples/demos/hilbert.tal b/projects/examples/demos/hilbert.tal index b0f137c..a0ecbf9 100644 --- a/projects/examples/demos/hilbert.tal +++ b/projects/examples/demos/hilbert.tal @@ -55,8 +55,15 @@ [ LIT2 &t $2 ] DUP2 #02 SFT2 ,&t STR2 ( ) DUP2 #01 SFT2 #0001 AND2 DUP2 ,&rx STR2 ( ) EOR2 #0001 AND2 ,&ry STR2 - [ LIT2 &x $2 ] [ LIT2 &y $2 ] [ LIT2 &rx $2 ] [ LIT2 &ry $2 ] - ( ) STH2kr rot + [ LIT2 &x $2 ] [ LIT2 &y $2 ] [ LIT2 &ry $2 ] + ( ) DUP2r [ LIT2r 0001 ] SUB2r + ( | rot ) + ORA ?{ + [ LIT2 &rx $2 ] #0001 NEQ2 ?{ + ( rx-n-1 ) SWP2 STH2kr SWP2 SUB2 + ( ry-n-1 ) SWP2 STH2kr SWP2 SUB2 } + ( swap ) SWP2 } + POP2r ( ) STH2kr ,&ry LDR2 MUL2 ADD2 ,&y STR2 ( ) STH2r ,&rx LDR2 MUL2 ADD2 ,&x STR2 DUP ADD GTHk ?&l @@ -64,13 +71,3 @@ ( ) ,&x LDR2 #20 SFT2 #0020 ADD2 ( ) ,&y LDR2 #20 SFT2 #0020 ADD2 JMP2r -@rot ( x* y* rx* ry* n* -- x* y* ) - #0001 SUB2 STH2 - SWP2 ,&rx STR2 - ORA ?{ - [ LIT2 &rx $2 ] #0001 NEQ2 ?{ - ( rx-n-1 ) SWP2 STH2kr SWP2 SUB2 - ( ry-n-1 ) SWP2 STH2kr SWP2 SUB2 } - ( swap ) SWP2 } - POP2r JMP2r -