summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruvok2026-01-11 12:15:33 +0100
committeruvok2026-01-11 12:15:33 +0100
commit3696780079e50a4f2de4647de970f56e732d5ac3 (patch)
treef793f9ee8d19a1a1bf8c63f59234e5ed8f495a35
parent7cfefff02ac4f7bdfddeac490e9eb12b6ec82d04 (diff)
Use control flow for halting
-rw-r--r--nandgame/cpp/Vcomputer__main.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/nandgame/cpp/Vcomputer__main.cpp b/nandgame/cpp/Vcomputer__main.cpp
index 6908377..77e291f 100644
--- a/nandgame/cpp/Vcomputer__main.cpp
+++ b/nandgame/cpp/Vcomputer__main.cpp
@@ -53,7 +53,8 @@ int main(int argc, char **argv, char **) {
simpc_ui_init();
- while (VL_LIKELY(!contextp->gotFinish()) && contextp->time() < 500) {
+ while (VL_LIKELY(!contextp->gotFinish()) && contextp->time() < 500 &&
+ !topp->halt) {
auto i = contextp->time();
if (i != 0 && (i % TICKS_PER_INS) == 0) {
@@ -65,10 +66,6 @@ int main(int argc, char **argv, char **) {
// Evaluate model
topp->eval();
- // both bits 14 and 15 need to be set
- if (topp->halt)
- break;
-
simpc_ui_write(topp, i, StepPosition_t::AFTER_EVAL);
// Advance time