summaryrefslogtreecommitdiff
path: root/jefs.fs
diff options
context:
space:
mode:
Diffstat (limited to 'jefs.fs')
-rw-r--r--jefs.fs12
1 files changed, 8 insertions, 4 deletions
diff --git a/jefs.fs b/jefs.fs
index 0f4a282..f53f219 100644
--- a/jefs.fs
+++ b/jefs.fs
@@ -24,9 +24,6 @@ decimal
: 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 "
@@ -45,12 +42,18 @@ decimal
: if 0branch >mark ; immediate ( I: -- a )
: else branch >mark swap >resolve ; immediate
: then >resolve ; immediate
+: while 0branch >mark ; immediate
+: repeat branch swap <resolve >resolve ; immediate
: / /mod swap drop ;
: mod /mod drop ;
: negate 0 swap - ;
: abs dup 0< if negate then ;
+32 constant bl
+: space bl emit ;
+: spaces begin dup 0> while space 1- repeat drop ;
+
\ PNO
\ mostly from pforth
255 allot variable pad
@@ -64,10 +67,11 @@ variable hld
: (u.) <# #s #> ;
: u. (u.) say space ;
+: u.r >r (u.) r> over - spaces say ;
: (.) dup abs <# #s swap sign #> ;
: . (.) say space ;
-
\ TODO something is leaking its stack (a word address i think)
+15 10 u.r
t
bye