From b36389841fcfa3e111c8e40afc475f4bbc82241e Mon Sep 17 00:00:00 2001 From: Sam Hadow Date: Sun, 24 Mar 2024 22:29:26 +0100 Subject: [PATCH] handle value type write --- src/ram.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ram.py b/src/ram.py index 6f2ede0..97c51ba 100644 --- a/src/ram.py +++ b/src/ram.py @@ -42,8 +42,9 @@ class Ram(object): if len(self.output_registers) <= index: self.output_registers.extend([None] * (index + 1 - len(self.output_registers))) # extend with uninitialized values self.output_registers[index] = value + elif type == "value": + raise TypeError("cannot write on value") elif type == "reference": target_index = self.read_register(ref_origin, index) self.write_register(ref_target, target_index, value) - # def op(self, type_r1, index_r1, type_r2, index_r2, type_r3, index_r3)