handle value type write

This commit is contained in:
Sam Hadow 2024-03-24 22:29:26 +01:00
parent e3a803469c
commit b36389841f

View File

@ -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)