This commit is contained in:
Reece Wilson 2024-07-07 12:41:36 +01:00
parent 9ea0994e07
commit 23854f6f0b
3 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,5 @@
let consts = require("./constants.js");
function Constants(ctx, method) {
this.ctx = ctx;
this.method = method;

View File

@ -1,5 +1,6 @@
const consts = require("./../constants.js");
const insts = require("./../instructions/instructions.js");
const decoder = require("./../instructions/instructionDecoder.js");
const fmt = require("util").format;
function append(_, level, str) {
@ -35,11 +36,11 @@ function alignInstruction(instruction) {
}
function dmpInstruction(_, level, parsedCode) {
if (parsedCode.instruction.type == insts.instructionTypes.iABC)
if (parsedCode.instruction.type == decoder.instructionTypes.iABC)
append(_, level, fmt("iABC\t%s(%i, %i, %i)", alignInstruction(parsedCode.instruction.name), parsedCode.a, parsedCode.b, parsedCode.c));
else if (parsedCode.instruction.type == insts.instructionTypes.iABx)
else if (parsedCode.instruction.type == decoder.instructionTypes.iABx)
append(_, level, fmt("iABx\t%s(%i, %i)", alignInstruction(parsedCode.instruction.name), parsedCode.a, parsedCode.b));
else if (parsedCode.instruction.type == insts.instructionTypes.iAsBx)
else if (parsedCode.instruction.type == decoder.instructionTypes.iAsBx)
append(_, level, fmt("iAsBx\t%s(%i, %i)", alignInstruction(parsedCode.instruction.name), parsedCode.a, parsedCode.b));
}

9
compile.js Normal file
View File

@ -0,0 +1,9 @@
var hks = require("./index.js");
var context = new hks.T6Context();
var pathIn = process.argv[2];
var pathOut = process.argv[3];
context.assembleFile(pathIn);
context.save(pathOut);