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