summaryrefslogtreecommitdiff
path: root/jefs.fs
diff options
context:
space:
mode:
authorkitty <nepeta@canaglie.net>2026-02-20 00:21:54 +1100
committerkitty <nepeta@canaglie.net>2026-02-20 00:21:54 +1100
commitfe72c676dacc2174e780c59558fc593a2272cb88 (patch)
tree17b2b4e29110b5ad3cdc151624832914785bf88f /jefs.fs
parent2359bd9add794fecb9d4bc08484978dc3112a674 (diff)
negate, abs, tuck from pforth, .
holby Sheet!! numeric i/o is real!!! need to test different bases. if hex works and also if number padding works (i have not tested that yet) i can start writing better debugging tools and i can stop having to pipe my output through xxd!! this also will mean the end of DONEDONEYIPPEEEE,,,, :<
Diffstat (limited to 'jefs.fs')
-rw-r--r--jefs.fs9
1 files changed, 7 insertions, 2 deletions
diff --git a/jefs.fs b/jefs.fs
index 719e07d..bbe6160 100644
--- a/jefs.fs
+++ b/jefs.fs
@@ -7,6 +7,8 @@
: decimal 10 base ! ;
: hex 16 base ! ;
+: tuck swap over ;
+
hex
: ret, c3 c, ;
decimal
@@ -37,6 +39,8 @@ decimal
: / /mod swap drop ;
: mod /mod drop ;
+: negate 0 swap - ;
+: abs dup 0< if negate then ;
\ PNO
\ mostly from pforth
@@ -45,10 +49,11 @@ variable hld
: <# pad hld ! ;
: hold 1 hld -! ( chr ) hld @ c! ;
: sign 0< if [ char - ] literal hold then ;
-: # base @ /mod swap 9 over > if 7 + then [ char 0 ] literal + hold ; \ issue is in here i think?
+: # base @ /mod swap 9 over > if 7 + then [ char 0 ] literal + hold ;
: #s begin # dup 0= until ;
: #> drop hld @ pad over - ;
-: ud. <# #s #> say space ;
+: u. <# #s #> say space ;
+: . dup abs <# #s swap sign #> say space ;
bye