assembler - Rename 'debugInfo' to 'sourceInfo' and return it second in output - {machinecode, sourceinfo}
This commit is contained in:
parent
14a32b9c27
commit
41d7b7ba54
|
|
@ -165,7 +165,7 @@ function handleConstantDefinitions(op, arg, IP, constants) {
|
||||||
* it will be assembled to the default intial value of the IP,
|
* it will be assembled to the default intial value of the IP,
|
||||||
* as specified in `machine.config.js`.
|
* as specified in `machine.config.js`.
|
||||||
* @param {string} source - Assembly source to decode
|
* @param {string} source - Assembly source to decode
|
||||||
* @return {{ debugInfo: Object, machineCode: Uint8Array }};
|
* @return {{ sourceInfo: Object, machineCode: Array }};
|
||||||
**/
|
**/
|
||||||
function decodeInstructions(source) {
|
function decodeInstructions(source) {
|
||||||
dbg.nit('Pre-parsing...');
|
dbg.nit('Pre-parsing...');
|
||||||
|
|
@ -194,7 +194,7 @@ function decodeInstructions(source) {
|
||||||
/** @type {Array<number>} - Assembled source code, as an array of bytes **/
|
/** @type {Array<number>} - Assembled source code, as an array of bytes **/
|
||||||
let machineCode = new Array(IP).fill(0);
|
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
|
// Initialize memory-mapped IO -- TODO this should probably be in the CPU, not here
|
||||||
machineCode[CFG.pointerToDisplay] = CFG.displayAddr;
|
machineCode[CFG.pointerToDisplay] = CFG.displayAddr;
|
||||||
|
|
@ -335,7 +335,7 @@ function decodeInstructions(source) {
|
||||||
machineCode[IP] = decodedOp;
|
machineCode[IP] = decodedOp;
|
||||||
machineCode[IP + 1] = decodedArg;
|
machineCode[IP + 1] = decodedArg;
|
||||||
|
|
||||||
debugInfo[IP] = {
|
sourceInfo[IP] = {
|
||||||
lineNumber: line.number,
|
lineNumber: line.number,
|
||||||
source: line.source,
|
source: line.source,
|
||||||
address: IP,
|
address: IP,
|
||||||
|
|
@ -374,7 +374,7 @@ function decodeInstructions(source) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { 'debugInfo': debugInfo, 'machineCode': new Uint8Array(machineCode) };
|
return { 'machineCode': machineCode, 'sourceInfo': sourceInfo };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue