Feature (simulator): Add 'simulation halting - reached cycle limit' notice

This commit is contained in:
n loewen 2023-08-15 16:05:31 +01:00
parent 245da348ea
commit 79ad1678f4
1 changed files with 5 additions and 1 deletions

View File

@ -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();