Browse Source

Finished all opcodes in assembler

master
Bryan Miller 5 years ago
parent
commit
f005dda779
1 changed files with 154 additions and 21 deletions
  1. +154
    -21
      test/unit.src.chip.MOS6502.assembler.spec.js

+ 154
- 21
test/unit.src.chip.MOS6502.assembler.spec.js View File

@@ -1059,22 +1059,118 @@ describe("Testing MOS6502 Assembler...", function(){
});

// -------------------------------------------------------------
it("SBC Immediate");
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");
it("SBC Immediate", function(){
let res = asm.reset().compile("SBC #$44").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0xE9);
expect(res[1]).to.equal(0x44);
});

it("SBC Zero Page", function(){
let res = asm.reset().compile("SBC $44").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0xE5);
expect(res[1]).to.equal(0x44);
});

it("SBC Zero Page, X", function(){
let res = asm.reset().compile("SBC $44,X").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0xF5);
expect(res[1]).to.equal(0x44);
});

it("SBC Absolute", function(){
let res = asm.reset().compile("SBC $4400").result();
expect(res.length).to.equal(3);
expect(res[0]).to.equal(0xED);
expect(res[1]).to.equal(0x00);
expect(res[2]).to.equal(0x44);
});

it("SBC Absolute, X", function(){
let res = asm.reset().compile("SBC $4400,X").result();
expect(res.length).to.equal(3);
expect(res[0]).to.equal(0xFD);
expect(res[1]).to.equal(0x00);
expect(res[2]).to.equal(0x44);
});

it("SBC Absolute, Y", function(){
let res = asm.reset().compile("SBC $4400,Y").result();
expect(res.length).to.equal(3);
expect(res[0]).to.equal(0xF9);
expect(res[1]).to.equal(0x00);
expect(res[2]).to.equal(0x44);
});

it("SBC Indirect, X", function(){
let res = asm.reset().compile("SBC ($44,X)").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0xE1);
expect(res[1]).to.equal(0x44);
});

it("SBC Indirect, Y", function(){
let res = asm.reset().compile("SBC ($44),Y").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0xF1);
expect(res[1]).to.equal(0x44);
});

// -------------------------------------------------------------
it("STA Zero Page");
it("STA Zero Page, X");
it("STA Absolute");
it("STA Absolute, X");
it("STA Absolute, Y");
it("STA Indirect, X");
it("STA Indirect, Y");
it("STA Zero Page", function(){
let res = asm.reset().compile("STA $44").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0x85);
expect(res[1]).to.equal(0x44);
});

it("STA Zero Page, X", function(){
let res = asm.reset().compile("STA $44,X").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0x95);
expect(res[1]).to.equal(0x44);
});

it("STA Absolute", function(){
let res = asm.reset().compile("STA $4400").result();
expect(res.length).to.equal(3);
expect(res[0]).to.equal(0x8D);
expect(res[1]).to.equal(0x00);
expect(res[2]).to.equal(0x44);
});

it("STA Absolute, X", function(){
let res = asm.reset().compile("STA $4400,X").result();
expect(res.length).to.equal(3);
expect(res[0]).to.equal(0x9D);
expect(res[1]).to.equal(0x00);
expect(res[2]).to.equal(0x44);
});

it("STA Absolute, Y", function(){
let res = asm.reset().compile("STA $4400,Y").result();
expect(res.length).to.equal(3);
expect(res[0]).to.equal(0x99);
expect(res[1]).to.equal(0x00);
expect(res[2]).to.equal(0x44);
});

it("STA Indirect, X", function(){
let res = asm.reset().compile("STA ($44,X)").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0x81);
expect(res[1]).to.equal(0x44);
});

it("STA Indirect, Y", function(){
let res = asm.reset().compile("STA ($44),Y").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0x91);
expect(res[1]).to.equal(0x44);
});

// -------------------------------------------------------------
it("PHA", function(){
asm.reset();
@@ -1119,13 +1215,50 @@ describe("Testing MOS6502 Assembler...", function(){
});

// -------------------------------------------------------------
it("STX Zero Page");
it("STX Zero Page, Y");
it("STX Absolute");
it("STX Zero Page", function(){
let res = asm.reset().compile("STX $44").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0x86);
expect(res[1]).to.equal(0x44);
});

it("STX Zero Page, Y", function(){
let res = asm.reset().compile("STX $44, Y").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0x96);
expect(res[1]).to.equal(0x44);
});

it("STX Absolute", function(){
let res = asm.reset().compile("STX $4400").result();
expect(res.length).to.equal(3);
expect(res[0]).to.equal(0x8E);
expect(res[1]).to.equal(0x00);
expect(res[2]).to.equal(0x44);
});

// -------------------------------------------------------------
it("STY Zero Page");
it("STY Zero Page, X");
it("STY Absolute");
it("STY Zero Page", function(){
let res = asm.reset().compile("STY $44").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0x84);
expect(res[1]).to.equal(0x44);
});

it("STY Zero Page, X", function(){
let res = asm.reset().compile("sty $44,x").result();
expect(res.length).to.equal(2);
expect(res[0]).to.equal(0x94);
expect(res[1]).to.equal(0x44);
});

it("STY Absolute", function(){
let res = asm.reset().compile("STY $4400").result();
expect(res.length).to.equal(3);
expect(res[0]).to.equal(0x8C);
expect(res[1]).to.equal(0x00);
expect(res[2]).to.equal(0x44);
});

// -------------------------------------------------------------
});

Loading…
Cancel
Save