1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-10-31 23:09:49 +00:00
8bitworkshop/src/tools/jsasm.js

22 lines
606 B
JavaScript
Raw Permalink Normal View History

var fs = require('fs');
var asm = require('../../gen/worker/assembler.js');
var stdinBuffer = fs.readFileSync(0);
var code = stdinBuffer.toString();
var asm = new asm.Assembler();
asm.loadJSON = function(filename) {
return JSON.parse(fs.readFileSync(filename, 'utf8'));
};
asm.loadInclude = function(filename) {
filename = filename.substr(1, filename.length-2); // remove quotes
//return fs.readFileSync(filename, 'utf8');
};
asm.loadModule = function(top_module) {
//TODO
};
var out = asm.assembleFile(code);
//console.log(out);
out.output.forEach(function(x) {
console.log(x.toString(16));
});