commit aeea54c0d6da88d395c376d5eb5c0cfafcb45eb6
parent e44049306dd5fdcde811b912eafab0cdfc907e79
Author: Henry Wilson <m3henry@googlemail.com>
Date: Wed, 21 Jun 2017 05:39:59 +0100
ignoring 0 length tokens
Diffstat:
M | main.s | | | 26 | ++++++++++++++++++++++++-- |
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/main.s b/main.s
@@ -29,7 +29,12 @@ verb forth QUIT
verb forth INTERPRET
set numin 0
3: do WORD
- do FIND
+ do DUP
+ do fetch
+ if 0f
+ do DROP
+ goto 2f
+ 0: do FIND
if 1f
const 0
do SWAP
@@ -53,7 +58,14 @@ verb forth INTERPRET
get numtib
do less
if 3b
- saycr "\x1B[92m ⏎"
+ do DEPTH
+ test equal 0 4f
+ say "\x1B[92m ⏎ "
+ do dot
+ do CR
+ endword
+4: do DROP
+ saycr "\x1B[92m 🗸"
endword
verb forth CONVERT
@@ -503,6 +515,16 @@ dountil: codeword
# Memory management
+verb code DEPTH
+ mov SP, ACC
+ sub $stack, ACC
+ shr ACC
+ shr ACC
+ shr ACC
+ _dup
+ mov ACC, TOS
+ jmp next
+
verb code fetch "@>"
minstk 1
mov (TOS), TOS