From 2d38e289572b0a1a2982ef49a55c57567f9ae68e Mon Sep 17 00:00:00 2001 From: n loewen Date: Tue, 15 Aug 2023 10:55:01 +0100 Subject: [PATCH] Bugfix (assembler): Put the pointer to display memory in the right place Refactor: Put the value of the pointer to display memory in machine.config.js --- assembler.js | 4 ++-- machine.config.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/assembler.js b/assembler.js index b004241..4d6fe53 100644 --- a/assembler.js +++ b/assembler.js @@ -1,5 +1,5 @@ const { logMemory, num2hex } = require('./logging.js'); -const { INITIAL_IP_ADDRESS, POINTER_TO_START_OF_DISPLAY_MEM } = require('./machine.config.js'); +const { INITIAL_IP_ADDRESS, START_OF_DISPLAY_MEM, POINTER_TO_START_OF_DISPLAY_MEM } = require('./machine.config.js'); // 1 = verbose // 2 = what i'm currently focusing on @@ -34,7 +34,7 @@ function decodeInstructions(line) { let lines = line.split(/\n/); // returns an array of lines let machineCode = new Array(INITIAL_IP_ADDRESS).fill(0); - machineCode[0] = POINTER_TO_START_OF_DISPLAY_MEM; + machineCode[POINTER_TO_START_OF_DISPLAY_MEM] = START_OF_DISPLAY_MEM; let labels = {}; let constants = {}; diff --git a/machine.config.js b/machine.config.js index 4e8395d..b526793 100644 --- a/machine.config.js +++ b/machine.config.js @@ -1,4 +1,5 @@ module.exports = { + "START_OF_DISPLAY_MEM": 0, "POINTER_TO_START_OF_DISPLAY_MEM": 32, "POINTER_TO_START_OF_KEYPAD_MEM": 33, "INITIAL_IP_ADDRESS": 48,