From d1cf88229d7a30561e6f75d3543a719f8c798b91 Mon Sep 17 00:00:00 2001
From: Clyne Sullivan <clyne@bitgloo.com>
Date: Sun, 19 Feb 2023 18:44:10 -0500
Subject: do loops, executor fixes

---
 state.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'state.cpp')

diff --git a/state.cpp b/state.cpp
index 6d056ba..2f1990b 100644
--- a/state.cpp
+++ b/state.cpp
@@ -49,7 +49,12 @@ void State::execute(Addr addr)
 
         do {
             ip += sizeof(Cell);
-            CoreWords::run(dict.read(ip), *this);
+
+            const auto ins = dict.read(ip);
+            if (!CoreWords::run(ins, *this)) {
+                pushr(ip);
+                ip = ins - sizeof(Cell);
+            }
         } while (ip);
     }
 }
-- 
cgit v1.2.3