示例#1
0
        public int LoadRegister(Registers8Bit register)
        {
            int index = ((int)register) / 2;

            if (((int)register) % 2 == 0)
            {
                return(_registers[index] >> 8);
            }
            return(_registers[index] & 0x00FF);
        }
示例#2
0
        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);
            }
        }