pre with removal
This commit is contained in:
parent
267a9a1b8e
commit
1259e2ef80
1 changed files with 47 additions and 4 deletions
49
pdptests.py
49
pdptests.py
|
@ -454,9 +454,10 @@ class TestMethods(unittest.TestCase):
|
||||||
# this code sequence taken from Unix startup, it's not really
|
# this code sequence taken from Unix startup, it's not really
|
||||||
# much of a test.
|
# much of a test.
|
||||||
with ASM() as a:
|
with ASM() as a:
|
||||||
a.mov(0o0122451, 'r2') # mov #122451,R2
|
a.mov(0o0122451, 'r2')
|
||||||
a.literal(0o072200, 0o0177772) # ash -6,R2
|
neg6 = -6 & 0xFFFF
|
||||||
a.bic(0o0176000, 'r2') # bic #0176000,R2
|
a.ash(neg6, 'r2')
|
||||||
|
a.bic(0o0176000, 'r2')
|
||||||
a.halt()
|
a.halt()
|
||||||
|
|
||||||
p = self.make_pdp()
|
p = self.make_pdp()
|
||||||
|
@ -1748,6 +1749,46 @@ class TestMethods(unittest.TestCase):
|
||||||
self.assertEqual(len(bp.states), default_lookbacks)
|
self.assertEqual(len(bp.states), default_lookbacks)
|
||||||
self.assertEqual(len(bp7.states), min(i+1, 7))
|
self.assertEqual(len(bp7.states), min(i+1, 7))
|
||||||
|
|
||||||
|
def test_jmp(self):
|
||||||
|
"""In many ways more of a test of ASM module labels..."""
|
||||||
|
p = self.make_pdp()
|
||||||
|
|
||||||
|
with ASM() as a:
|
||||||
|
a.clr('r0')
|
||||||
|
a.clr('r1')
|
||||||
|
a.clr('r2')
|
||||||
|
a.jmp('X2')
|
||||||
|
|
||||||
|
a.label('X0')
|
||||||
|
a.inc('r0')
|
||||||
|
a.add(2, 'r1')
|
||||||
|
a.add(3, 'r2')
|
||||||
|
a.jmp('X1')
|
||||||
|
|
||||||
|
# never executed
|
||||||
|
a.clr('r0')
|
||||||
|
a.clr('r1')
|
||||||
|
a.clr('r2')
|
||||||
|
|
||||||
|
a.label('X1')
|
||||||
|
a.inc('r1')
|
||||||
|
a.add('r1', 'r2')
|
||||||
|
a.add('r2', 'r0')
|
||||||
|
a.halt()
|
||||||
|
|
||||||
|
a.label('X2')
|
||||||
|
a.inc('r2')
|
||||||
|
a.jmp('X0')
|
||||||
|
a.halt()
|
||||||
|
|
||||||
|
print("\n")
|
||||||
|
print(list(map(oct, a)))
|
||||||
|
|
||||||
|
instloc = 0o4000
|
||||||
|
self.loadphysmem(p, a, instloc)
|
||||||
|
p.run(pc=instloc)
|
||||||
|
print("\n", p.machinestate())
|
||||||
|
|
||||||
def test_jsrco(self):
|
def test_jsrco(self):
|
||||||
"""Another special case of the JSR instruction is JSR
|
"""Another special case of the JSR instruction is JSR
|
||||||
PC, @(SP) + which exchanges the top element of
|
PC, @(SP) + which exchanges the top element of
|
||||||
|
@ -1757,6 +1798,8 @@ class TestMethods(unittest.TestCase):
|
||||||
when recalled where they left off. Such routines
|
when recalled where they left off. Such routines
|
||||||
are called 'co-routines.'
|
are called 'co-routines.'
|
||||||
"""
|
"""
|
||||||
|
p = self.make_pdp()
|
||||||
|
with ASM() as a:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def test_ubmap(self):
|
def test_ubmap(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue