Просмотр исходного кода

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 год назад
Родитель
Сommit
2b65bc58b6
1 измененных файлов с 2 добавлено и 1 удалено
  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 */