assembler - Rename 'debugInfo' to 'sourceInfo' and return it second in output - {machinecode, sourceinfo}

This commit is contained in:
n loewen 2023-08-29 12:52:48 -04:00
parent 14a32b9c27
commit 41d7b7ba54
1 changed files with 4 additions and 4 deletions

View File

@ -165,7 +165,7 @@ function handleConstantDefinitions(op, arg, IP, constants) {
* it will be assembled to the default intial value of the IP,
* as specified in `machine.config.js`.
* @param {string} source - Assembly source to decode
* @return {{ debugInfo: Object, machineCode: Uint8Array }};
* @return {{ sourceInfo: Object, machineCode: Array }};
**/
function decodeInstructions(source) {
dbg.nit('Pre-parsing...');
@ -194,7 +194,7 @@ function decodeInstructions(source) {
/** @type {Array<number>} - Assembled source code, as an array of bytes **/
let machineCode = new Array(IP).fill(0);
let debugInfo = {};
let sourceInfo = {};
// Initialize memory-mapped IO -- TODO this should probably be in the CPU, not here
machineCode[CFG.pointerToDisplay] = CFG.displayAddr;
@ -335,7 +335,7 @@ function decodeInstructions(source) {
machineCode[IP] = decodedOp;
machineCode[IP + 1] = decodedArg;
debugInfo[IP] = {
sourceInfo[IP] = {
lineNumber: line.number,
source: line.source,
address: IP,
@ -374,7 +374,7 @@ function decodeInstructions(source) {
}
}
return { 'debugInfo': debugInfo, 'machineCode': new Uint8Array(machineCode) };
return { 'machineCode': machineCode, 'sourceInfo': sourceInfo };
}