run(), and HLT on infinite loop

This commit is contained in:
Loic Nageleisen 2012-04-09 11:47:14 +02:00
parent 50ab21f3e5
commit 2fff97dd64

View file

@ -409,6 +409,13 @@ class CPU(object):
op(c, *args) op(c, *args)
if c.debug: log(c.dump_r()) if c.debug: log(c.dump_r())
def run(c):
last_pc = 0xFFFF
while c.pc != last_pc:
last_pc = c.pc
c.step()
log("Infinite loop")
def dump_r(c): def dump_r(c):
"""human-readable register status""" """human-readable register status"""
return " ".join( "%s=%04X" % return " ".join( "%s=%04X" %