CPU/ASM/Memory.py
2024-04-29 22:03:14 +08:00

20 lines
421 B
Python

# pylint:disable=W0622
import program
from error import *
CMDs = ["ldr", "str"]
def ldr(self, operand:program.Operand):
if operand[0].isRegister() and operand[1].isMemory():
operand[0].set(operand[1].get())
else:
raise BadOperand()
def str(self, operand):
if operand[0].isRegister() and operand[1].isMemory():
operand[1].set(operand[0].get())
else:
raise BadOperand()