Skip to content

Commit

Permalink
first test for Disassembler
Browse files Browse the repository at this point in the history
  • Loading branch information
christo committed Dec 20, 2024
1 parent c7ff7ce commit bcc3908
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions client/test/machine/asm/Disassembler.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {expect} from 'chai';
import {Disassembler} from "../../../src/machine/asm/Disassembler";
import {Mos6502} from "../../../src/machine/mos6502";
import {FileBlob} from "../../../src/machine/FileBlob";
import {ArrayMemory, LE} from "../../../src/machine/core";
import {DisassemblyMetaImpl} from "../../../src/machine/asm/DisassemblyMetaImpl";
import {niladicOpcodes} from "../util";

describe("disassembler", () => {
it("disassemble1 niladic", () => {
const NOP_BYTES = niladicOpcodes(["NOP"]);
const code: number[] = [0, 0, ...NOP_BYTES];
const mem = new ArrayMemory(code, LE, true, true);
const fb = new FileBlob("testblob", mem);
const dm = new DisassemblyMetaImpl(0, 0, 2);
const d: Disassembler = new Disassembler(Mos6502.ISA, fb, dm);
const disassembled = d.disassemble1(mem, 2);
console.log(disassembled);
expect(disassembled.instruction.op.mnemonic).to.equal("NOP");
})
})

0 comments on commit bcc3908

Please sign in to comment.