summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkitty <nepeta@canaglie.net>2026-03-08 19:56:32 +1100
committerkitty <nepeta@canaglie.net>2026-03-08 19:56:32 +1100
commit2bf0d651a66c94139b320487398010277d1a510a (patch)
tree0874649f14ae187a6b8f22c8c874867b515f9642
parentc4745240f68839843909b6a4d8624f15f58fa7c1 (diff)
jonesforth depth
-rw-r--r--jefs.fs3
1 files changed, 3 insertions, 0 deletions
diff --git a/jefs.fs b/jefs.fs
index 8dd4a8e..b36d9e3 100644
--- a/jefs.fs
+++ b/jefs.fs
@@ -1,6 +1,7 @@
\ i think something is going on with the stack. i dunno
: cell+ 8 + ;
+: cell- 8 - ;
: say ( c-addr u -- ) swap 1 1 syscall3 drop ;
: emit ( chr -- ) sp cell+ 1 swap 1 1 syscall3 2drop ;
: cr 10 emit ;
@@ -266,6 +267,8 @@ make error-msgs #error-msgs cells allot
: (words) ( lfa -- ) dup hidden? not if >nfa dup w@ swap 2 + swap say 2 spaces else drop then ;
: words latest @ begin ?dup 0<> while dup (words) @ repeat cr ;
+: depth ( -- n ) s0 @ sp @ - 16 - ;
+
\ I/O {{{
0 constant stdin
1 constant stdout