From dab770163829302cb6c68c1a173ec72d7cc1a31b Mon Sep 17 00:00:00 2001 From: kitty Date: Thu, 19 Feb 2026 12:26:42 +1100 Subject: recurse, bl, slightly broken PNO --- jefs.fs | 21 ++++++++++++++++++++- readme.md | 12 +++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/jefs.fs b/jefs.fs index b726db0..9b073f7 100644 --- a/jefs.fs +++ b/jefs.fs @@ -16,10 +16,14 @@ decimal : [compile] parse find drop >cfa compile, ; immediate : ' parse find drop >cfa [compile] lit ; immediate \ note: no error handling (yet) +: recurse latest @ >cfa compile, ; immediate : literal [compile] lit ; immediate : constant create [compile] lit ret, ; : variable 1 cells allot create [compile] lit ret, ; +32 constant bl +: space bl emit ; + \ TODO interpret mode strings? : s" [ char " ] literal 1 >in +! ( skip spc ) [compile] litstring ; immediate : ." [compile] s" ' say compile, ; immediate \ lol this word breaks the highlighting, here have another " @@ -34,8 +38,23 @@ decimal : / /mod swap drop ; : mod /mod drop ; +\ PNO +\ mostly from pforth +\ currently broken if unsigned number has more than 18 digits +\ unfortunately this also seems to include any negative number +variable hld +: <# dap 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 ; +: #s begin # dup 0= until ; +: #> drop hld @ dap over - ; + +: ud. <# #s #> say space ; + : t ." testtest" cr ; : testing 0 if TESTSTR else TESTSTR2 then say cr ; -t +1000000000000000000 999999999999999999 .s +drop ud. testing bye diff --git a/readme.md b/readme.md index caca7ae..7f34a62 100644 --- a/readme.md +++ b/readme.md @@ -41,8 +41,10 @@ so a wonky but hopefully not too slow solution is to compile - jonesforth, public domain forth tutorial implementation which was significantly cribbed from and studied: http://git.annexia.org/?p=jonesforth.git;a=tree - jonesforth nasm port: http://ratfactor.com/repos/nasmjf/ +- pforth, also public domain, alsos useful for Yoinking and Sploinking stuff: https://github.com/philburk/pforth - starting forth part 1: http://www.bradrodriguez.com/papers/moving1.htm - page describing `` and i wanna use it maybe this sucks shit but my idea is that i compile in a relative jmp with `` + +### PNO +'pictured numeric output'. its forth's numeric output functionality. +this is me trying to describe it so i can figure it out and implement it. +note that this forth doesn't have double numbers +(i don't think it's necessary, since cells are 64 bit) +so PNO works on single cell values. +PNO is started by `<#` and ended by `#>`. -- cgit v1.2.3