|
|
@@ -673,32 +673,178 @@ describe("Testing MOS6502 Assembler...", function(){ |
|
|
|
expect(res[2]).to.equal(0x51); |
|
|
|
}); |
|
|
|
// ------------------------------------------------------------- |
|
|
|
it("LDA Immediate"); |
|
|
|
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"); |
|
|
|
it("LDA Immediate", function(){ |
|
|
|
let res = asm.reset().compile("LDA #$44").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0xA9); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDA Zero Page", function(){ |
|
|
|
let res = asm.reset().compile("LDA $44").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0xA5); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDA Zero Page, X", function(){ |
|
|
|
let res = asm.reset().compile("LDA $44,X").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0xB5); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDA Absolute", function(){ |
|
|
|
let res = asm.reset().compile("LDA $4400").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0xAD); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDA Absolute, X", function(){ |
|
|
|
let res = asm.reset().compile("LDA $4400,X").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0xBD); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDA Absolute, Y", function(){ |
|
|
|
let res = asm.reset().compile("LDA $4400, Y").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0xB9); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDA Indirect, X", function(){ |
|
|
|
let res = asm.reset().compile("LDA ($44,X)").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0xA1); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDA Indirect, Y", function(){ |
|
|
|
let res = asm.reset().compile("LDA ($44),Y").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0xB1); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
// ------------------------------------------------------------- |
|
|
|
it("LDX Immediate"); |
|
|
|
it("LDX Zero Page"); |
|
|
|
it("LDX Zero Page, Y"); |
|
|
|
it("LDX Absolute"); |
|
|
|
it("LDX Absolute, Y"); |
|
|
|
it("LDX Immediate", function(){ |
|
|
|
let res = asm.reset().compile("LDX #$44").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0xA2); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDX Zero Page", function(){ |
|
|
|
let res = asm.reset().compile("LDX $44").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0xA6); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDX Zero Page, Y", function(){ |
|
|
|
let res = asm.reset().compile("LDX $44,Y").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0xB6); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDX Absolute", function(){ |
|
|
|
let res = asm.reset().compile("LDX $4400").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0xAE); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDX Absolute, Y", function(){ |
|
|
|
let res = asm.reset().compile("LDX $4400,Y").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0xBE); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
// ------------------------------------------------------------- |
|
|
|
it("LDY Immediate"); |
|
|
|
it("LDY Zero Page"); |
|
|
|
it("LDY Zero Page, X"); |
|
|
|
it("LDY Absolute"); |
|
|
|
it("LDY Absolute, X"); |
|
|
|
it("LDY Immediate", function(){ |
|
|
|
let res = asm.reset().compile("LDY #$44").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0xA0); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDY Zero Page", function(){ |
|
|
|
let res = asm.reset().compile("LDY $44").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0xA4); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDY Zero Page, X", function(){ |
|
|
|
let res = asm.reset().compile("LDY $44,X").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0xB4); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDY Absolute", function(){ |
|
|
|
let res = asm.reset().compile("LDY $4400").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0xAC); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LDY Absolute, X", function(){ |
|
|
|
let res = asm.reset().compile("LDY $4400,X").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0xBC); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
// ------------------------------------------------------------- |
|
|
|
it("LSR Accumulator"); |
|
|
|
it("LSR Zero Page"); |
|
|
|
it("LSR Zero Page, X"); |
|
|
|
it("LSR Absolute"); |
|
|
|
it("LSR Absolute, X"); |
|
|
|
it("LSR Accumulator", function(){ |
|
|
|
let res = asm.reset().compile("LSR A").result(); |
|
|
|
expect(res.length).to.equal(1); |
|
|
|
expect(res[0]).to.equal(0x4A); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LSR Zero Page", function(){ |
|
|
|
let res = asm.reset().compile("LSR $44").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0x46); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LSR Zero Page, X", function(){ |
|
|
|
let res = asm.reset().compile("LSR $44,X").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0x56); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LSR Absolute", function(){ |
|
|
|
let res = asm.reset().compile("LSR $4400").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0x4E); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("LSR Absolute, X", function(){ |
|
|
|
let res = asm.reset().compile("LSR $4400, X").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0x5E); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
// ------------------------------------------------------------- |
|
|
|
it("NOP", function(){ |
|
|
|
asm.reset(); |
|
|
@@ -708,14 +854,65 @@ describe("Testing MOS6502 Assembler...", function(){ |
|
|
|
}); |
|
|
|
|
|
|
|
// ------------------------------------------------------------- |
|
|
|
it("ORA Immediate"); |
|
|
|
it("ORA Zero Page"); |
|
|
|
it("ORA Zero Page, X"); |
|
|
|
it("ORA Absolute"); |
|
|
|
it("ORA Absolute, X"); |
|
|
|
it("ORA Absolute, Y"); |
|
|
|
it("ORA Indirect, X"); |
|
|
|
it("ORA Indirect, Y"); |
|
|
|
it("ORA Immediate", function(){ |
|
|
|
let res = asm.reset().compile("ORA #$44").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0x09); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ORA Zero Page", function(){ |
|
|
|
let res = asm.reset().compile("ORA $44").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0x05); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ORA Zero Page, X", function(){ |
|
|
|
let res = asm.reset().compile("ORA $44,X").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0x15); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ORA Absolute", function(){ |
|
|
|
let res = asm.reset().compile("ORA $4400").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0x0D); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ORA Absolute, X", function(){ |
|
|
|
let res = asm.reset().compile("ORA $4400,X").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0x1D); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ORA Absolute, Y", function(){ |
|
|
|
let res = asm.reset().compile("ORA $4400,Y").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0x19); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ORA Indirect, X", function(){ |
|
|
|
let res = asm.reset().compile("ORA ($44,X)").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0x01); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ORA Indirect, Y", function(){ |
|
|
|
let res = asm.reset().compile("ORA ($44), Y").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0x11); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
// ------------------------------------------------------------- |
|
|
|
it("DEX", function(){ |
|
|
|
asm.reset(); |
|
|
@@ -774,17 +971,79 @@ describe("Testing MOS6502 Assembler...", function(){ |
|
|
|
}); |
|
|
|
|
|
|
|
// ------------------------------------------------------------- |
|
|
|
it("ROL Accumulator"); |
|
|
|
it("ROL Zero Page"); |
|
|
|
it("ROL Zero Page, X"); |
|
|
|
it("ROL Absolute"); |
|
|
|
it("ROL Absolute, X"); |
|
|
|
it("ROL Accumulator", function(){ |
|
|
|
let res = asm.reset().compile("ROL A").result(); |
|
|
|
expect(res.length).to.equal(1); |
|
|
|
expect(res[0]).to.equal(0x2A); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ROL Zero Page", function(){ |
|
|
|
let res = asm.reset().compile("ROL $44").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0x26); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ROL Zero Page, X", function(){ |
|
|
|
let res = asm.reset().compile("ROL $44,X").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0x36); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ROL Absolute", function(){ |
|
|
|
let res = asm.reset().compile("ROL $4400").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0x2E); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ROL Absolute, X", function(){ |
|
|
|
let res = asm.reset().compile("ROL $4400,X").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0x3E); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
// ------------------------------------------------------------- |
|
|
|
it("ROR Accumulator"); |
|
|
|
it("ROR Zero Page"); |
|
|
|
it("ROR Zero Page, X"); |
|
|
|
it("ROR Absolute"); |
|
|
|
it("ROR Absolute, X"); |
|
|
|
it("ROR Accumulator", function(){ |
|
|
|
let res = asm.reset().compile("ROR A").result(); |
|
|
|
expect(res.length).to.equal(1); |
|
|
|
expect(res[0]).to.equal(0x6A); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ROR Zero Page", function(){ |
|
|
|
let res = asm.reset().compile("ROR $44").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0x66); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ROR Zero Page, X", function(){ |
|
|
|
let res = asm.reset().compile("ROR $44,X").result(); |
|
|
|
expect(res.length).to.equal(2); |
|
|
|
expect(res[0]).to.equal(0x76); |
|
|
|
expect(res[1]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ROR Absolute", function(){ |
|
|
|
let res = asm.reset().compile("ROR $4400").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0x6E); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
it("ROR Absolute, X", function(){ |
|
|
|
let res = asm.reset().compile("ROR $4400,X").result(); |
|
|
|
expect(res.length).to.equal(3); |
|
|
|
expect(res[0]).to.equal(0x7E); |
|
|
|
expect(res[1]).to.equal(0x00); |
|
|
|
expect(res[2]).to.equal(0x44); |
|
|
|
}); |
|
|
|
|
|
|
|
// ------------------------------------------------------------- |
|
|
|
it("RTI", function(){ |
|
|
|
asm.reset(); |