diff --git a/assembler.js b/assembler.js index 63f9cc4..941ba99 100644 --- a/assembler.js +++ b/assembler.js @@ -153,7 +153,7 @@ function handleConstantDefinitions(op, arg, IP, constants) { * @param {SourceLineInfo} line * @returns {Object} **/ -function assembleMnemonicsWithOptionalArgs(line, assemblerState) { +function assembleMnemonicsWithOptionalArgs(line) { if (mnemonicsWithOptionalArgs.indexOf(line.operation) < 0) { console.error(`Missing opcode for line ${line.number}: ${line.source}`); throw new Error("Missing opcode"); @@ -206,7 +206,8 @@ function decodeInstructions(source) { // Decode line by line... for (let i = 0; i < lines.length; i++) { - let line = lines[0]; + let line = lines[i]; + console.log(line); if (line.type === 'code') { const op = line.operation; const arg = null; @@ -246,6 +247,9 @@ function decodeInstructions(source) { /** @typedef {'direct'|'indirect'} AddressingMode **/ let addressingMode = 'direct'; + // Now that it can't be a label or a constant, normalize the opcode + line.operation = line.operation.toLowerCase(); + // Operands - Handle references to labels if (arg !== null && arg.startsWith(ASM_LABEL_PREFIX)) {