There are three memory opcodes that are important for us. One for loading from memory and two for storing into memory.

MLOAD lets us load one word (32 bytes) from memory specified by an offset. It puts that word on top of the stack.

def mload(evm): 
    offset = evm.stack.pop()
    value = evm.memory.load(offset)
    evm.pc += 1

MSTORE allows us to save one word to memory and MSTORE8 allows us to save one byte to memory.

def mstore(evm): 
    # TODO: should be right aligned
    offset, value = evm.stack.pop(), cpu.stack.pop(), value)
    evm.pc += 1
def mstore8(evm): 
    offset, value = evm.stack.pop(), evm.stack.pop(), value)
    evm.pc += 1