summaryrefslogtreecommitdiff
path: root/src/main.js
blob: ec74ee72458de111cca186a1d9d8ef75a414be82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'use strict';

const process = require('node:process');
const fs      = require('node:fs');

const { assemble }  = require('./parser/parser.js');
const { RedcodeVm } = require('./vm/vm.js');


const files = process.argv.slice(2);
if (files.length === 0) {
	console.log("no input files provided!");
}


const warriors = files.map(fname => {
	const source = fs.readFileSync(fname, 'utf8');
	return assemble(source);
});


const vm = new RedcodeVm(8000, warriors);
console.log(vm.run(100000));