Browse Source

Update INPUT opcode to Relative param mode

ApisNecros 1 year ago
parent
commit
d1ef84a551
1 changed files with 5 additions and 3 deletions
  1. 5 3
      IntComp/Computer.js

+ 5 - 3
IntComp/Computer.js

@@ -186,7 +186,7 @@ module.exports = class Computer {
                     status = false;
                     break;
                 }
-                this.Operation_Input();
+                this.Operation_Input(rawOpcode);
                 break;
             }
             case this.OPCODES.OUTPUT: {
@@ -300,10 +300,12 @@ module.exports = class Computer {
      * user for input.
      *
      * @private
+     * @param {number} rawOpcode The opcode in memory used to make this call
      * @returns {void}
      */
-    Operation_Input() {
-        const outputPosition = this.stack.Next().Get(ComputerParameterMode.IMMEDIATE_MODE);
+    Operation_Input(rawOpcode) {
+        const outputParamMode = ComputerParameterMode.ParseParameterMode(rawOpcode, 1);
+        const outputPosition = this.stack.Next().Get(outputParamMode);
 
         /** A variable to store the input in before putting it on the stack */
         let userInput;