22 lines
512 B
JavaScript
Raw Normal View History

2021-12-08 13:17:38 +01:00
const fs = require('fs');
2022-01-13 13:04:55 +01:00
const parseOptions = require("./parseOptions");
2021-12-08 13:17:38 +01:00
2022-01-13 13:04:55 +01:00
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);
2021-12-08 13:17:38 +01:00
prg = prg.slice(2);
2022-01-13 13:04:55 +01:00
fs.writeFileSync(options.output,prg);
console.log(`${options.output} written`);
2021-12-08 13:17:38 +01:00