|
|
@@ -55,6 +55,29 @@ describe("Testing MOS6502 CPU...", function(){ |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
describe("Testing LDA...", function(){ |
|
|
|
it("LDA Immediate", function(){ |
|
|
|
cpu.memory.clearPage(0); |
|
|
|
cpu.memory.load(0, [0xA9, 0x01, 0xA9, 0xBB]); |
|
|
|
cpu.reset(); |
|
|
|
tick(); |
|
|
|
tick(); |
|
|
|
expect(cpu.A).to.equal(0x01); |
|
|
|
tick(); |
|
|
|
expect(cpu.A).to.equal(0x01); |
|
|
|
tick(); |
|
|
|
expect(cpu.A).to.equal(0xBB); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDA Zero Page"); |
|
|
|
it("LDA Zero Page, X"); |
|
|
|
it("LDA Absolute"); |
|
|
|
it("LDA Absolute, X"); |
|
|
|
it("LDA Absolute, Y"); |
|
|
|
it("LDA Indirect, X"); |
|
|
|
it("LDA Indirect, Y"); |
|
|
|
}); |
|
|
|
|
|
|
|
describe("Testing ADC...", function(){ |
|
|
|
it("ADC Immediate", function(){ |
|
|
|
cpu.memory.clearPage(0); |
|
|
@@ -62,12 +85,15 @@ describe("Testing MOS6502 CPU...", function(){ |
|
|
|
// CLV |
|
|
|
// CLD |
|
|
|
// CLI |
|
|
|
// LDA $00 |
|
|
|
// ADC $01 |
|
|
|
// ADC $01 |
|
|
|
cpu.memory.load(0, [0x18, 0xB8, 0xD8, 0x58, 0x69, 0x01, 0x69, 0x01]); |
|
|
|
cpu.memory.load(0, [0x18, 0xB8, 0xD8, 0x58, 0xA9, 0x00, 0x69, 0x01, 0x69, 0x01]); |
|
|
|
cpu.reset(); |
|
|
|
// Getting through the 4 clear flag calls. Each should take 2 ticks. |
|
|
|
tick(); tick(); tick(); tick(); tick(); tick(); tick(); tick(); |
|
|
|
// Next two ticks for the LDA call |
|
|
|
tick(); tick(); |
|
|
|
// Now processing the adds. |
|
|
|
expect(cpu.A).to.equal(0); |
|
|
|
tick(); |
|
|
@@ -88,7 +114,7 @@ describe("Testing MOS6502 CPU...", function(){ |
|
|
|
it("ADC Indirect, X"); |
|
|
|
it("ADC Indirect, Y"); |
|
|
|
|
|
|
|
it ("ADC Test Zero flag", /*function(){ |
|
|
|
it ("ADC Test Zero flag"/*, function(){ |
|
|
|
cpu.memory.clearPage(0); |
|
|
|
cpu.memory.load(0, [0x18, 0xB8, 0xD8, 0x58, 0x69, 0xFF, 0x69, 0x01]); |
|
|
|
// Getting through the 4 clear flag calls. Each should take 2 ticks. |
|
|
@@ -105,9 +131,43 @@ describe("Testing MOS6502 CPU...", function(){ |
|
|
|
expect(cpu.A).to.equal(2); |
|
|
|
}*/); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe("Testing SBC...", function(){ |
|
|
|
it("SBC Immediate", function(){ |
|
|
|
cpu.memory.clearPage(0); |
|
|
|
// SEC |
|
|
|
// CLV |
|
|
|
// CLD |
|
|
|
// CLI |
|
|
|
// LDA $00 |
|
|
|
// SBC $01 |
|
|
|
// SBC $01 |
|
|
|
cpu.memory.load(0, [0x38, 0xB8, 0xD8, 0x58, 0xA9, 0x00, 0xE9, 0x01, 0xE9, 0x01]); |
|
|
|
cpu.reset(); |
|
|
|
// Getting through the 1 set and 3 clear flag calls. Each should take 2 ticks. |
|
|
|
tick(); tick(); tick(); tick(); tick(); tick(); tick(); tick(); |
|
|
|
// Next two ticks for the LDA call |
|
|
|
tick(); tick(); |
|
|
|
// Now processing the subtractions. |
|
|
|
expect(cpu.A).to.equal(0); |
|
|
|
tick(); |
|
|
|
expect(cpu.A).to.equal(0); |
|
|
|
tick(); |
|
|
|
expect(cpu.A).to.equal(0xFF); |
|
|
|
tick(); |
|
|
|
expect(cpu.A).to.equal(0xFF); |
|
|
|
tick(); |
|
|
|
expect(cpu.A).to.equal(0xFE); |
|
|
|
}); |
|
|
|
|
|
|
|
it("SBC Zero Page"); |
|
|
|
it("SBC Zero Page, X"); |
|
|
|
it("SBC Absolute"); |
|
|
|
it("SBC Absolute, X"); |
|
|
|
it("SBC Absolute, Y"); |
|
|
|
it("SBC Indirect, X"); |
|
|
|
it("SBC Indirect, Y"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|