diff --git a/vm/nga-python/Memory.py b/vm/nga-python/Memory.py index 9150a35..357fb81 100644 --- a/vm/nga-python/Memory.py +++ b/vm/nga-python/Memory.py @@ -11,9 +11,13 @@ class Memory(): self.memory[i] = cell i = i + 1 f.close() + self.length = size def store(self, value, address): self.memory[address] = value def fetch(self, address): return self.memory[address] + + def size(self): + return self.length diff --git a/vm/nga-python/retro.py b/vm/nga-python/retro.py index 2e32f78..7946f0b 100644 --- a/vm/nga-python/retro.py +++ b/vm/nga-python/retro.py @@ -258,7 +258,7 @@ def i_fe(): elif target == -2: stack.push(len(address)) elif target == -3: - stack.push(len(memory)) + stack.push(memory.size()) elif target == -4: stack.push(2147483648) elif target == -5: @@ -647,4 +647,3 @@ if __name__ == "__main__": else: for source in sources: run_file(source) -