From f46c813bf5f150fd739c018f33092e73bf1f63be Mon Sep 17 00:00:00 2001 From: d6 Date: Thu, 17 Mar 2022 23:04:40 -0400 Subject: [PATCH] update mksite --- fix16.tal | 47 ++++++++++++++++++++++++++++++++++++++++------- mksite.sh | 2 +- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/fix16.tal b/fix16.tal index d6a0106..b895599 100644 --- a/fix16.tal +++ b/fix16.tal @@ -47,7 +47,7 @@ ( then we can just shift that argument right by 8 and use ) ( MUL2. ) -|1000 +%xyz { ;x16-emit JSR2 #0a #18 DEO } ( useful constants ) ( ) @@ -80,6 +80,39 @@ %x16-is-non-neg { x16-minimum LTH2 } %x16-is-neg { x16-maximum GTH2 } +%x16-emit-dec { #30 ADD #18 DEO } + +( |0100 + x16-zero xyz + x16-one xyz + x16-two xyz + x16-ten xyz + x16-hundred xyz + x16-pi/2 xyz + x16-pi xyz + x16-pi*2 xyz + x16-e xyz + x16-phi xyz + x16-sqrt-2 xyz + x16-sqrt-3 xyz + x16-epsilon xyz + #1234 xyz + BRK ) + +@x16-emit ( x* -> ) + SWP DUP #64 LTH ,&<100 JCN + #64 DIVk DUP x16-emit-dec MUL SUB ,&>=10 JMP + &<100 DUP #0a LTH ,&<10 JCN + &>=10 #0a DIVk DUP x16-emit-dec MUL SUB + &<10 x16-emit-dec + LIT '. #18 DEO + ( emit fractional part ) + #00 SWP ( lo* ) + #000a MUL2 #0100 DIV2k DUP2 NIP x16-emit-dec MUL2 SUB2 + #000a MUL2 #0100 DIV2k DUP2 NIP x16-emit-dec MUL2 SUB2 + #000a MUL2 #0100 DIV2k STH2k MUL2 SUB2 #0080 LTH2 ,&no-round JCN INC2r + &no-round STH2r NIP x16-emit-dec JMP2r + ( comparison between x and y. ) ( - ff: x < y ) ( - 00: x = y ) @@ -101,12 +134,12 @@ LTH2k ,< JCN GTH2 JMP2r < POP2 POP2 #ff JMP2r -@x16-eq ( x* y* -> x=y ) EQU2 JMP2r -@x16-ne ( x* y* -> x!=0 ) NEQ2 JMP2r -@x16-lt ( x* y* -> x x x x x=y^ ) EQU2 JMP2r +@x16-ne ( x* y* -> x!=0^ ) NEQ2 JMP2r +@x16-lt ( x* y* -> x x x x bool^ ) NIP #00 EQU JMP2r diff --git a/mksite.sh b/mksite.sh index c1a644e..edd0228 100755 --- a/mksite.sh +++ b/mksite.sh @@ -1,6 +1,6 @@ #!/bin/sh -for NAME in about.txt math32.tal test-math32.tal tester.py primes32.tal regex.tal repl-regex.tal test-regex.tal grep.tal femto.tal femto.txt femto rainbow.tal drums.tal drums2.tal bfloat16.tal fix16.tal fixed.tal tal-mode1.png tal.nanorc; do +for NAME in about.txt math32.tal test-math32.tal test-math32.py primes32.tal regex.tal repl-regex.tal test-regex.tal grep.tal femto.tal femto.txt femto rainbow.tal drums.tal drums2.tal bfloat16.tal fix16.tal fixed.tal tal-mode1.png tal.nanorc; do echo "-> $NAME" cp $NAME /var/www/plastic-idolatry.com/html/erik/nxu done