From a714a9d71a6a472908df8eb6f0434f53b378195a Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Sat, 14 Apr 2012 15:41:20 +0200 Subject: [PATCH] guard against SET PC, [SP++], and SET PC, [--SP] --- dcpu_16.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dcpu_16.py b/dcpu_16.py index 131d6f3..b0e60c1 100644 --- a/dcpu_16.py +++ b/dcpu_16.py @@ -415,8 +415,10 @@ class CPU(object): def run(c): """step until PC is constant""" last_pc = 0xFFFF - while c.pc != last_pc: + last_sp = 0xFFFF + while c.pc != last_pc or c.sp != last_sp: last_pc = c.pc + last_sp = c.sp c.step() log("Infinite loop")