CPU bug fixes and Simulator enhancements.

Bug Fixes:

- Fixed several bugs in the CPU that caused processor status flags to
  be set incorrectly.  Instructions affected were: STA, STX, STY, CMP,
  CPX, CPY, BIT.

- Made some internal-use-only methods on the CPU class private.

- Fixed incorrect disassembly of (Indirect,X) and (Indirect),Y
  instructions. Although this didn't affect behavior, it certainly
  caused me some confusion in debugging.

- Added missing "BCS" instruction to instruction table.

Enhancements:

- Now includes a full version of Lee Davison's Enhanced 6502 BASIC
  bundled as source code and a ROM image. Get that REAL COMPUTER
  EXPERIENCE!(tm)

- If a file named "rom.bin" exists in the same directory where the
  simulator is executed, it will be loaded at addresses $d000-$ffff.

- Gave the CPU an idle loop to make simulated timing a little more
  realistic (but this is still an area needing major improvement)

- Changed the CPU's toString() method to give better debugging output.

- Added a small typeahead buffer to the Console.

- Better exception messaging.

Misc:

- Bumped version to 0.5, updated README.
This commit is contained in:
Seth Morabito committed 2012-10-21 20:05:05 -07:00
1 parent c1caf8c6b4
commit 795ccfde5d
25 files changed
+13622 -4508

No files matched your search

@@ -709,7 +709,8 @@ public class CpuZeroPageXModeTest extends TestCase {
bus.loadProgram(0x94, 0x10); // STY $10,X
cpu.step();
assertEquals(0x00, bus.read(0x40));
assertTrue(cpu.getZeroFlag());
// Should have no effect on flags.
assertFalse(cpu.getZeroFlag());
assertFalse(cpu.getNegativeFlag());
cpu.reset();
@@ -730,7 +731,7 @@ public class CpuZeroPageXModeTest extends TestCase {
cpu.step();
assertEquals(0x80, bus.read(0x40));
assertFalse(cpu.getZeroFlag());
assertTrue(cpu.getNegativeFlag());
assertFalse(cpu.getNegativeFlag());
}
/* STA - Store Accumulator - $95 */
@@ -742,7 +743,8 @@ public class CpuZeroPageXModeTest extends TestCase {
bus.loadProgram(0x95, 0x10); // STA $10,X
cpu.step();
assertEquals(0x00, bus.read(0x40));
assertTrue(cpu.getZeroFlag());
// Should have no effect on flags.
assertFalse(cpu.getZeroFlag());
assertFalse(cpu.getNegativeFlag());
cpu.reset();
@@ -763,7 +765,7 @@ public class CpuZeroPageXModeTest extends TestCase {
cpu.step();
assertEquals(0x80, bus.read(0x40));
assertFalse(cpu.getZeroFlag());
assertTrue(cpu.getNegativeFlag());
assertFalse(cpu.getNegativeFlag());
}
/* LDY - Load Y Register - $b4 */
@@ -852,7 +854,7 @@ public class CpuZeroPageXModeTest extends TestCase {
cpu.step();
assertFalse(cpu.getCarryFlag()); // m < y
assertFalse(cpu.getZeroFlag());
assertFalse(cpu.getNegativeFlag()); // m - y > 0
assertTrue(cpu.getNegativeFlag()); // m - y < 0
}
/* DEC - Decrement Memory Location - $d6 */