updated doc and brought back spec demo

This commit is contained in:
Loic Nageleisen 2012-04-08 20:01:41 +02:00
parent ec4711d2af
commit 54e56b82db
2 changed files with 10 additions and 3 deletions

View file

@ -12,9 +12,9 @@ It's meant to be used interactively via the Python REPL as well as programmatica
An example of a Python REPL session:
>>> from dcpu_16 import CPU
>>> from dcpu_16 import CPU, spec_demo
>>> c = CPU(debug=True)
>>> c.load_m() # loads demo program
>>> c.load_m(spec_demo) # loads demo program
>>> c.step() # step by one instruction
<< SET
<< c.r[0x0]

View file

@ -364,7 +364,8 @@ class CPU(object):
def j(c, val):
c.r[7] = val
def _op(c, word):
"""dispatch to op"""
def _pointer(c, code):
"""get pointer to valcode"""
@ -430,3 +431,9 @@ class CPU(object):
pass
spec_demo = [
0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
0x9037, 0x61c1, 0x7dc1, 0x001a, 0x0000, 0x0000, 0x0000, 0x0000,
]