Browse Source

Fixes a bug where the HALT instruction decrements PC instead of setting it to -1

Shuning Bian 2 months ago
parent
commit
7f209d681e
1 changed files with 1 additions and 1 deletions
  1. 1 1
      vm.py

+ 1 - 1
vm.py

@@ -98,7 +98,7 @@ def main():
 
 
         if inst.op == Instruction.OP_HALT:
         if inst.op == Instruction.OP_HALT:
             halted = True
             halted = True
-            pc -= 1
+            pc = -1
 
 
         if inst.op == Instruction.OP_STATE:
         if inst.op == Instruction.OP_STATE:
             pc += 1
             pc += 1