CPU/error.py
2024-05-07 16:47:19 +08:00

30 lines
502 B
Python

class MemoryError(Exception):
pass
class AddressError(MemoryError):
def __init__(self, index=None):
super().__init__(self)
if not index:
self.errorinfo = "None"
else:
self.errorinfo = str(hex(index))
def __str__(self):
return self.errorinfo
class OutOfMemory(MemoryError):
pass
class InstructionError(Exception):
pass
class InvalidInstruction(InstructionError):
pass
class BadOperand(InstructionError):
pass