Move config constants to a config file
This commit is contained in:
parent
91ff26fdea
commit
b81b6c8f5a
|
|
@ -1,12 +1,11 @@
|
||||||
const printMemory = require('./print-memory.js');
|
const printMemory = require('./print-memory.js');
|
||||||
|
const { INITIAL_IP_ADDRESS, START_OF_DISPLAY_MEM } = require('./machine.config.js');
|
||||||
|
|
||||||
// 1 = verbose
|
// 1 = verbose
|
||||||
// 2 = what i'm currently focusing on
|
// 2 = what i'm currently focusing on
|
||||||
// 3 = always print
|
// 3 = always print
|
||||||
// 4 = silent
|
// 4 = silent
|
||||||
const DEBUG = 4;
|
const DEBUG = 4;
|
||||||
const INITIAL_IP_ADDRESS = 48;
|
|
||||||
const START_OF_DISPLAY_MEM = 0;
|
|
||||||
|
|
||||||
const mnemonicsWithOptionalArgs = ['end', 'cfc', 'chp'];
|
const mnemonicsWithOptionalArgs = ['end', 'cfc', 'chp'];
|
||||||
const mnemonics2opcodes = {
|
const mnemonics2opcodes = {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const START_OF_DISPLAY_MEM = 0;
|
const { START_OF_DISPLAY_MEM } = require('./machine.config');
|
||||||
|
|
||||||
exports.printDisplay = (mem) => {
|
exports.printDisplay = (mem) => {
|
||||||
const disp = START_OF_DISPLAY_MEM;
|
const disp = START_OF_DISPLAY_MEM;
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
// - instructions are two bytes long:
|
// - instructions are two bytes long:
|
||||||
// one byte for the opcode, one for the argument
|
// one byte for the opcode, one for the argument
|
||||||
|
|
||||||
const INITIAL_IP_ADDRESS = 48;
|
const { INITIAL_IP_ADDRESS, CYCLE_LIMIT } = require('./machine.config');
|
||||||
const CYCLE_LIMIT = 128; // max number of times to step the CPU, to stop endless loops
|
|
||||||
|
|
||||||
const display = require('./display.js');
|
const display = require('./display.js');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue