From 66f65daa084ded1110ede07b26636e80c12e2fb9 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 17 Apr 2020 11:27:17 -0400 Subject: [PATCH] Add word LEAVE --- blk/043 | 2 +- forth/core.fs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/blk/043 b/blk/043 index ff71f97..14cecc7 100644 --- a/blk/043 +++ b/blk/043 @@ -11,6 +11,6 @@ ABORT" x" -- *I* Compiles a ." followed by a ABORT. EXECUTE a -- Execute wordref at addr a INTERPRET -- Get a line from stdin, compile it in tmp memory, then execute the compiled contents. +LEAVE -- In a DO..LOOP, exit at the next LOOP call. QUIT -- Return to interpreter prompt immediately EXIT! -- Exit current INTERPRET loop. - diff --git a/forth/core.fs b/forth/core.fs index 5e05eb4..c8f8937 100644 --- a/forth/core.fs +++ b/forth/core.fs @@ -133,6 +133,8 @@ COMPILE R> COMPILE DROP COMPILE R> COMPILE DROP ; IMMEDIATE +: LEAVE R> R> DROP I 1- >R >R ; + ( a1 a2 u -- ) : MOVE ( u ) 0 DO