apple1-videocard-lib/tools/prg2bin.js
2022-01-13 13:04:55 +01:00

22 lines
512 B
JavaScript

const fs = require('fs');
const parseOptions = require("./parseOptions");
const options = parseOptions([
{ name: 'input', alias: 'i', type: String },
{ name: 'output', alias: 'o', type: String }
]);
if(options.input === undefined || options.output === undefined) {
console.log("usage: prg2bin -i inputfile.prg -o outputfile.bin");
process.exit(-1);
}
let prg = fs.readFileSync(options.input);
prg = prg.slice(2);
fs.writeFileSync(options.output,prg);
console.log(`${options.output} written`);