Răsfoiți Sursa

Set INPUT opcode to default to Immediate Mode

Commit #d1ef84a551 allowed the INPUT opcode to get its output position
in Position Mode if no Parameter Mode was specified. This is incorrect,
as INPUT should never use Position Mode. Updated to use Immediate Mode
if no mode is specified.
ApisNecros 1 an în urmă
părinte
comite
2b65bc58b6
1 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  1. 2 1
      IntComp/Computer.js

+ 2 - 1
IntComp/Computer.js

@@ -304,7 +304,8 @@ module.exports = class Computer {
      * @returns {void}
      */
     Operation_Input(rawOpcode) {
-        const outputParamMode = ComputerParameterMode.ParseParameterMode(rawOpcode, 1);
+        // Disallow Position Parameter Mode
+        const outputParamMode = ComputerParameterMode.ParseParameterMode(rawOpcode, 1) || 1;
         const outputPosition = this.stack.Next().Get(outputParamMode);
 
         /** A variable to store the input in before putting it on the stack */