def test_meta_cleared(self):
        """
        === Defect ===
        Incorrect disassembly display when assembling demo segment after 
        asm.fib was loaded. 
        
        === Steps to reproduce ===
        l('asm.fib')
        a.position = 0x2000 
        a(ldx_imm, 0x00) 
        a(ldy_imm, 0x30) 
        a(jsr, 'STROUT') 
        a(rts)
        d(0x2000, 0x2007) 

        === Incorrect output === 
        PROGRAM_START:
            $2000: a2 00     ldx #$00
            $2002: a0 30     ldy #fib.acc
            $2004: 20 15 07  jsr STROUT
            $2007: 60        rts
            
        === Correct output === 
            $2002: a0 30     ldy #$30
            
        === Reason ===
        Assembler does not set _new_position to True when PC advanced during
        a normal assembly operation. 
        """

        from asm import fib
        a = self.a
        fib.assemble(a) 
        
        a.position = 0x2000 
        a(ldx_imm, 0x00) 
        a(ldy_imm, 0x30) 
        a(jsr, 'STROUT') 
        a(rts)
        
        result = self.d.dump(0x2000, 0x2007)
        lines = result.splitlines()
        self.assertEquals('$2002: a0 30     ldy #$30', lines[2].lstrip())
Example #2
0
    def test_output(self):
        suite.banner(self.test_output)
        a = self.a
        
        _;      a(jsr,      'fib')
        _;      a(brk)
        _;      a(nop)
        
        fib.assemble(self.a) 
        self.run_test() 
        
        self.assertEquals("""\
1
1
2
3
5
8
13
21
34
55
89
""".strip(), self.output.getvalue().strip())