commit 6db5e43b1d2ed679998cb3490f202a44c35af590
parent 67a1982023d18706891a71de771f2b6ea7be19fb
Author: Henry Wilson <m3henry@googlemail.com>
Date: Thu, 3 Aug 2017 16:05:50 +0100
R@ and ." added. WORD now can use other delimiters
Diffstat:
4 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/compiler.s b/compiler.s
@@ -70,6 +70,7 @@ verb forth compnew "\x3A" #":"
do modeC
get LAST
do markstore
+ const ' '
do WORD
do fetch
const 8
@@ -239,3 +240,16 @@ verb forth ELSE "ELSE" immediate
verb forth THEN "THEN" immediate
do forwardresolve
endword
+
+# Strings
+
+verb forth echo ".\"" immediate
+ compile dostr
+ const '"'
+ do WORD
+ do fetch
+ const 8
+ do plus
+ do ALLOT
+ compile PRINT
+ endword
diff --git a/input.s b/input.s
@@ -23,6 +23,7 @@ verb code ACCEPT
jmp _drop
verb forth WORD
+ do pushret
do HERE
const 0
do OVER
@@ -41,7 +42,11 @@ verb forth WORD
do incaddr
do DUP
const ' '
- do lequal
+ do less
+ do OVER
+ do peekret
+ do equal
+ do OR
if 2f
do HERE
do incaddr
@@ -50,6 +55,7 @@ verb forth WORD
do inc
goto 1b
2: do DROP
-3: do DROP
+3: do popret
+ do drop2
do HERE
endword
diff --git a/interpreter.s b/interpreter.s
@@ -6,7 +6,8 @@ verb forth MODE
verb forth INTERPRET
set numin 0
- 3: do WORD
+ 3: const ' '
+ do WORD
do DUP
do fetch
if 0f
diff --git a/stack.s b/stack.s
@@ -74,3 +74,8 @@ verb code popret "R>"
_dup
pop TOS
jmp next
+
+verb code peekret "R@"
+ _dup
+ mov (%rsp), TOS
+ jmp next