예제 #1
0
    def test_do_assemble_passes_addr_for_relative_branch_calc(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble('4000 bvs $4005')

        out = stdout.getvalue()
        self.assertEqual("$4000  70 03     BVS $4005\n", out)
예제 #2
0
    def test_do_assemble_shows_overflow_error(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble('c000 lda #$fff')

        out = stdout.getvalue()
        self.assertEqual("Overflow error: c000 lda #$fff\n", out)
예제 #3
0
    def test_do_assemble_shows_bad_syntax_error(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble('c000 foo')

        out = stdout.getvalue()
        self.assertEqual("Syntax error: foo\n", out)
예제 #4
0
    def test_do_assemble_shows_bad_label_error(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble('nonexistant rts')

        out = stdout.getvalue()
        self.assertEqual("Bad label: nonexistant rts\n", out)
예제 #5
0
    def test_do_assemble_constrains_address_to_valid_range(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble("-1 lda #$ab")

        out = stdout.getvalue()
        self.assertEqual("Overflow error: -1 lda #$ab\n", out)
예제 #6
0
파일: test_monitor.py 프로젝트: BigEd/py65
 def test_do_assemble_shows_bad_statement_error(self):
     stdout = StringIO()
     mon = Monitor(stdout=stdout)
     mon.do_assemble('c000 foo')
     
     out = stdout.getvalue()
     self.assertEqual("Assemble failed: foo\n", out)
예제 #7
0
    def test_do_assemble_constrains_address_to_valid_range(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble("-1 lda #$ab")

        out = stdout.getvalue()
        self.assertEqual("Overflow error: -1 lda #$ab\n", out)
예제 #8
0
    def test_do_assemble_passes_addr_for_relative_branch_calc(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble('4000 bvs $4005')

        out = stdout.getvalue()
        self.assertEqual("$4000  70 03     BVS $4005\n", out)
예제 #9
0
 def test_do_assemble_shows_bad_statement_error(self):
     stdout = StringIO()
     mon = Monitor(stdout=stdout)
     mon.do_assemble('c000 foo')
     
     out = stdout.getvalue()
     self.assertEqual("Assemble failed: foo\n", out)
예제 #10
0
    def test_do_assemble_shows_bad_syntax_error(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble('c000 foo')

        out = stdout.getvalue()
        self.assertEqual("Syntax error: foo\n", out)
예제 #11
0
    def test_do_assemble_shows_overflow_error(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble('c000 lda #$fff')

        out = stdout.getvalue()
        self.assertEqual("Overflow error: c000 lda #$fff\n", out)
예제 #12
0
    def test_do_assemble_outputs_disassembly(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble('c000 lda #$ab')

        out = stdout.getvalue()
        self.assertEqual("$c000  a9 ab     LDA #$ab\n", out)
예제 #13
0
    def test_do_assemble_shows_bad_label_error(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble('nonexistant rts')

        out = stdout.getvalue()
        self.assertEqual("Bad label: nonexistant rts\n", out)
예제 #14
0
    def test_do_assemble_outputs_disassembly(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble('c000 lda #$ab')

        out = stdout.getvalue()
        self.assertEqual("$c000  a9 ab     LDA #$ab\n", out)
예제 #15
0
    def test_do_assemble_parses_start_address_label(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_add_label('c000 base')
        mon.do_assemble('c000 rts')

        mpu = mon._mpu
        self.assertEqual(0x60, mpu.memory[0xC000])
예제 #16
0
    def test_do_assemble_assembles_valid_statement(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble('c000 lda #$ab')

        mpu = mon._mpu
        self.assertEqual(0xA9, mpu.memory[0xC000])
        self.assertEqual(0xAB, mpu.memory[0xC001])
예제 #17
0
    def test_do_assemble_parses_start_address_label(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_add_label('c000 base')
        mon.do_assemble('c000 rts')

        mpu = mon._mpu
        self.assertEqual(0x60, mpu.memory[0xC000])
예제 #18
0
    def test_do_assemble_assembles_valid_statement(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)
        mon.do_assemble('c000 lda #$ab')

        mpu = mon._mpu
        self.assertEqual(0xA9, mpu.memory[0xC000])
        self.assertEqual(0xAB, mpu.memory[0xC001])