summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jefs.fs21
-rw-r--r--readme.md12
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 `<BUILDS`: https://amforth.sourceforge.net/TG/recipes/Builds.html
+- page describing pictured numeric output: http://www.jimbrooks.org/web/forth/forthPicturedNumericOutput.php
## silly little plans
@@ -59,8 +61,16 @@ sure how exactly to implement this?
https://news.ycombinator.com/item?id=44231594 top comment here discusses
the forth `<BUILDS` which i've never heard of elsewhere. in fact if i look up
`forth "<BUILDS"` on duckduckgo that link is the only result.
-i debased myself and looked it up on google too, and found a few more results
+i debased myself and looked it up on google too, and found a few more results.
maybe i can do something with that because i like `DOES>` and i wanna use it
maybe this sucks shit but my idea is that i compile in a relative jmp with
`<BUILDS` and fill it in with `DOES>`
+
+### 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 `#>`.