public int LoadRegister(Registers8Bit register) { int index = ((int)register) / 2; if (((int)register) % 2 == 0) { return(_registers[index] >> 8); } return(_registers[index] & 0x00FF); }
public void SetRegister(Registers8Bit register, int value) { int index = ((int)register) / 2; if (register == Registers8Bit.F) { value &= 0xF0; } if (((int)register) % 2 == 0) { value <<= 8; _registers[index] = (_registers[index] & 0x00FF) | (value & 0xFF00); } else { _registers[index] = (_registers[index] & 0xFF00) | (value & 0x00FF); } }