mirror of
https://github.com/lloeki/python-dcpu_16.git
synced 2025-12-06 09:54:39 +01:00
run(), and HLT on infinite loop
This commit is contained in:
parent
50ab21f3e5
commit
2fff97dd64
1 changed files with 7 additions and 0 deletions
|
|
@ -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" %
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue