From 0cc647dd09fd4a942c1133755e096868d1bd84ff Mon Sep 17 00:00:00 2001 From: Jonas Hvid Date: Sun, 8 Mar 2020 14:57:05 +0100 Subject: [PATCH] Refactor INTERPRET so we also have INTERPRET-WORD --- bootstrap.asm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bootstrap.asm b/bootstrap.asm index 1fc941a..dd72ed9 100644 --- a/bootstrap.asm +++ b/bootstrap.asm @@ -47,11 +47,10 @@ forth OUTOF_IMMEDIATE, ']' dq LIT, 1, STATE, PUT_BYTE dq EXIT -;; The INTERPRET word reads and interprets user input. It's behavior depends on -;; the current STATE. It provides special handling for integers. -forth INTERPRET, 'INTERPRET' - ;; Read word - dq READ_WORD +;; INTERPRET-WORD expects a word as a (buffer, length) pair on the stack. It +;; interprets and executes the word. It's behavior depends on the current STATE. +;; It provides special handling for integers. +forth INTERPRET_WORD, 'INTERPRET-WORD' dq PAIRDUP ;; Stack is (word length word length). dq FIND ; Try to find word @@ -95,3 +94,9 @@ forth INTERPRET, 'INTERPRET' ;; (Number, immediate mode) dq EXIT + +;; The INTERPRET word reads and interprets a single word from the user. +forth INTERPRET, 'INTERPRET' + dq READ_WORD + dq INTERPRET_WORD + dq EXIT -- 2.39.2