From fe72c676dacc2174e780c59558fc593a2272cb88 Mon Sep 17 00:00:00 2001 From: kitty Date: Fri, 20 Feb 2026 00:21:54 +1100 Subject: 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,,,, :< --- jefs.fs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'jefs.fs') 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 -- cgit v1.2.3