Bug Fixes and Copyright Date Change

The simulator now passes Klaus Dormann's 6502 Functional Test suite for
the first time.

Bug Fixes:

- PHP was not correctly setting the Break bit on the stack copy of the
  processor status, so subsequent PLA's would not set the Break status
  flag.

- The CPU had swapped NMI and IRQ reset vectors, so RTI was failing.

- BRK was pushing PC + 2 onto the stack, instead of PC + 1

- (Zero Page,X) addressing mode did not correctly wrap on zero page
  boundaries.

- The instruction table used for disassembly had addressing modes
  of LDA $B9 and $BD reversed. This did not affect behavior, only
  disassembly of these instructions.

Other:

- Updated copyright date for 2013.

- Started migrating old JUnit 3 style tests to JUnit 4 annotations.
This commit is contained in:
Seth Morabito committed 2013-01-01 17:03:16 -08:00
1 parent 92b61e4839
commit da8250778e
25 files changed
+323 -130

No files matched your search

@@ -48,6 +48,32 @@ public class CpuIndexedIndirectModeTest {
assertEquals(0x45, cpu.getAccumulator());
}
@Test
public void testZeroPageWrap() throws Exception {
bus.write(0x0020, 0x01);
bus.write(0x0021, 0x07); // ($0701)
bus.write(0x0701, 0xaa);
bus.write(0x000f, 0x02);
bus.write(0x0010, 0x08); // ($0802)
bus.write(0x0802, 0xbb);
bus.write(0x010f, 0x03);
bus.write(0x0110, 0x09); // ($0903)
bus.write(0x0903, 0xcc);
cpu.setXRegister(0x10);
// No wrap needed
bus.loadProgram(0xa1, 0x10, // LDA ($10,X) = ($10 + $10) & $ff = $20
0xa1, 0xff); // LDA ($ff,X) = ($ff + $10) & $ff = $0f, NOT $10f!
cpu.step(1);
assertEquals(0xaa, cpu.getAccumulator());
cpu.step(1);
assertEquals(0xbb, cpu.getAccumulator());
}
@Test
public void test_ORA() throws Exception {
bus.write(0x0012, 0x1f);