diff options
| author | kitty <nepeta@canaglie.net> | 2026-02-20 00:21:54 +1100 |
|---|---|---|
| committer | kitty <nepeta@canaglie.net> | 2026-02-20 00:21:54 +1100 |
| commit | fe72c676dacc2174e780c59558fc593a2272cb88 (patch) | |
| tree | 17b2b4e29110b5ad3cdc151624832914785bf88f | |
| parent | 2359bd9add794fecb9d4bc08484978dc3112a674 (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,,,, :<
| -rw-r--r-- | jefs.fs | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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 |
