diff --git a/simulator.js b/simulator.js index 819a378..a690702 100644 --- a/simulator.js +++ b/simulator.js @@ -288,7 +288,11 @@ exports.runProgram = async (code, debug = false) => { let step = 0; while (true) { step = step + 1; - if (CYCLE_LIMIT && (step > CYCLE_LIMIT)) { break; } // Temporary limit as a lazy way to halt infinite loops: + // Temporary limit as a lazy way to halt infinite loops: + if (CYCLE_LIMIT && (step > CYCLE_LIMIT)) { + console.log('SIMULATION HALTING - reached cycle limit'); + break; + } if (!CPU.running) break; if (CPU.IP >= CPU.memory.length) break; stepCPU();