public void Push(ushort value) { var spAddress = GetRegister(Registers.SP); MemoryMapper.SetUInt16(spAddress, value); SetRegister(Registers.SP, (ushort)(spAddress - 2)); StackFrameSize += 2; }
public ushort Pop() { var nextSpAddress = GetRegister(Registers.SP) + 2; SetRegister(Registers.SP, (ushort)nextSpAddress); StackFrameSize -= 2; return(MemoryMapper.GetUInt16((ushort)nextSpAddress)); }
public void SetRegister(Registers reg, ushort value) { MemoryMapper.SetUInt16((ushort)RegisterMap[reg], value); }
public ushort GetRegister(Registers reg) { return(MemoryMapper.GetUInt16((ushort)RegisterMap[reg])); }