def test_page_reference(self): self.pdp.accumulator = 7 self.pdp.memory[octal('200')] = self.instruction( 'AND 202', octal('200')) # in page 1 self.pdp.memory[octal('202')] = 4 self.pdp.run(start=octal('200'), stepping=True) self.check(accumulator=4)
def test_tad(self): self.link = 1 self.pdp.accumulator = octal('007') self.pdp.memory[0] = self.instruction('TAD 2') self.pdp.memory[2] = 1 self.pdp.run(stepping=True) self.check(accumulator=octal('010'), link=0)
def test_page_assignment(self): self.pdp.accumulator = 7 self.pdp.memory[octal('200')] = self.instruction( 'DCA 202', octal('200')) # in page 1 self.pdp.memory[octal('202')] = 4 self.pdp.run(start=octal('200'), stepping=True) self.check(memory={octal('202'): 7}, accumulator=0)
def test_indirect_and_zero_reference(self): self.pdp.accumulator = 7 self.pdp.memory[octal('200')] = self.instruction( 'AND I 2', octal('200')) # 2 in page 0 self.pdp.memory[2] = octal('203') self.pdp.memory[octal('203')] = 4 self.pdp.run(start=octal('200'), stepping=True) self.check(accumulator=4)
def effective_offset(self, parsed): offset = self.evaluate_expression(parsed) if offset < octal('200'): parsed['Z'] = 'Z' # force PAGE 0 else: offset_page = offset & octal('7600') here_page = self.planter.ic & octal('7600') if here_page != offset_page: raise Exception('%s offset refers to an inaccessible page' % parsed['line']) offset = offset & octal('177') return offset
def test_g1order(self): self.pdp.link = 0 self.pdp.accumulator = octal('1234') # order should be CLA (ac=0); CMA (ac = 7777), IAC (acc=0, link = 1), RAL (acc = 1, link =0) self.pdp.memory[0] = self.instruction('RAL IAC CLA CMA') # self.pdp.run(stepping=True) self.check(accumulator=1, link=0)
def test_iar(self): self.pdp.link = 0 self.pdp.accumulator = octal('7777') self.pdp.memory[0] = self.instruction( 'RAL IAC') # IAC should execute first! self.pdp.run(stepping=True) self.check(accumulator=1, link=0)
def test_indirect_and_zero_assignment(self): self.pdp.accumulator = 7 self.pdp.memory[octal('200')] = self.instruction( 'DCA I Z 202', octal('200')) # 2 in page 0 self.pdp.memory[2] = octal('203') self.pdp.memory[octal('203')] = 4 self.pdp.run(start=octal('200'), stepping=True) self.checker.check(memory={octal('203'): 7}, accumulator=0)
def test_search_1234(self): self.pal.assemble(StringIO(read('search-1234.pal')), list_symbols=True) self.pdp8.run(start=octal('200'), debugging=False) self.checker.check(accumulator=0)
def test_assembles_one_char(self): self.pal.assemble(StringIO(read('one_char.pal')), list_symbols=True) self.pdp8.run(start=octal('200'), debugging=True) self.checker.check(output='A')
def test_assembles_hw(self): self.pal.assemble(StringIO(read('hello.pal')), list_symbols=True) self.pdp8.run(start=octal('200'), debugging=True) self.checker.check(output='HELLO, WORLD!\r\n')
def test_assembles_mul_sub(self): self.pal.assemble(StringIO(read('mul-sub.pal')), list_symbols=True) self.pdp8.run(start=octal('200'), debugging=True) self.checker.check({136: 6})
def test_assembles_mult(self): self.pal.assemble(StringIO(read('mult.pal'))) self.pdp8.run(start=octal('200'), debugging=True) self.checker.check(accumulator=648)
def test_rtl(self): self.pdp.link = 0 self.pdp.accumulator = octal('7777') self.pdp.memory[0] = self.instruction('RTL') self.pdp.run(stepping=True) self.check(accumulator=octal('7775'), link=1)
def test_cml1(self): self.pdp.link = 1 self.pdp.accumulator = 0 self.pdp.memory[0] = self.instruction('CML') self.pdp.run(stepping=True) self.check(accumulator=octal('0'), link=0)
def test_p_zero_assignment(self): self.pdp.accumulator = 7 self.pdp.memory[octal('200')] = self.instruction('DCA Z 2') self.pdp.memory[2] = 4 self.pdp.run(start=octal('200'), stepping=True) self.check(memory={2: 7}, accumulator=0)
def test_iac1(self): self.pdp.link = 0 self.pdp.accumulator = octal('7777') self.pdp.memory[0] = self.instruction('IAC') self.pdp.run(stepping=True) self.check(accumulator=0, link=1)
def test_and(self): self.pdp.accumulator = octal('7070') self.pdp.memory[0] = self.instruction('AND 2') self.pdp.memory[2] = octal('1120') self.pdp.run(stepping=True) self.check(accumulator=octal('1020'))
def test_isz(self): self.pal.assemble(StringIO(read('isz-test.pal')), list_symbols=True) self.pdp8.run(start=octal('200'), debugging=True) self.checker.check(accumulator=0)
def test_tad_with_carry(self): self.pdp.accumulator = octal('7777') self.pdp.memory[0] = self.instruction('TAD 2') self.pdp.memory[2] = 1 self.pdp.run(stepping=True) self.check(accumulator=0, link=1)
def test_sma(self): self.pdp.accumulator = octal('7777') # -1 self.pdp.memory[0] = self.instruction('SMA') self.pdp.run(stepping=True) self.check(pc=2)
def test_ral11(self): self.pdp.link = 1 self.pdp.accumulator = octal('3777') self.pdp.memory[0] = self.instruction('RAL') self.pdp.run(stepping=True) self.check(accumulator=octal('7777'), link=0)