From: Jonas Hvid Date: Sun, 8 Mar 2020 13:57:05 +0000 (+0100) Subject: Refactor INTERPRET so we also have INTERPRET-WORD X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=0cc647dd09fd4a942c1133755e096868d1bd84ff;p=rrq%2Fjonasforth.git Refactor INTERPRET so we also have INTERPRET-WORD --- 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