CPU/ASM/Memory.py
2024-05-02 08:54:42 +08:00

21 lines
431 B
Python

# pylint:disable=W0622
import program
from error import *
CMDs = ["ldr", "str", 'ldrb']
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()