20 lines
469 B
Python
20 lines
469 B
Python
#!/usr/bin/python
|
|
|
|
class Caretaker:
|
|
|
|
def __init__(self):
|
|
self.objects=dict() # Create empty objects pool
|
|
# Add registers to pool
|
|
for reg in ["MAR","MDR", "PC", "MBR", "SP","LV","CPP","TOS","OPC","H"]:
|
|
self.objects[reg]=0
|
|
self.objects["RAM"]=None
|
|
|
|
def __getitem__(self,key):
|
|
return(self.objects[key])
|
|
|
|
def __setitem__(self,key,value):# TODO: Do special treatment for MBR
|
|
self.objects[key]=value
|
|
|
|
def items(self):
|
|
return(self.objects.items())
|
|
|