cpu - Add feature: Quit after cycle limit reached
This commit is contained in:
parent
2802623c4c
commit
897749b108
2
cpu.js
2
cpu.js
|
|
@ -334,6 +334,7 @@ async function stepCPU(debugInfo, debug = false) {
|
|||
if (CPU.IP >= CPU.memory.length) {
|
||||
console.error('HALTING - IP greater than memory size');
|
||||
CPU.running = false;
|
||||
process.exit();
|
||||
} else {
|
||||
CPU.currentInstruction.opcode = CPU.memory[CPU.IP];
|
||||
CPU.currentInstruction.operand = CPU.memory[CPU.IP+1];
|
||||
|
|
@ -344,7 +345,6 @@ async function stepCPU(debugInfo, debug = false) {
|
|||
console.error(`Error: Invalid opcode`);
|
||||
console.error(` Executing $${num2hex(info.machine[0])} $${num2hex(info.machine[1])}`);
|
||||
console.error(` from line ${info.lineNumber}: ${info.source}`);
|
||||
console.error();
|
||||
process.exit();
|
||||
}
|
||||
executeInstruction(CPU.currentInstruction.operand);
|
||||
|
|
|
|||
Loading…
Reference in New Issue