Browse Source

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 năm trước cách đây
mục cha
commit
2b65bc58b6
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  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 */