gb-emu-lib/CPU.cpp
unsigned long CPU::RRCA(const byte& opCode)
{
    byte A = GetHighByte(m_AF);
    bool carry = ISBITSET(A, 0);

    A = A >> 1;

    if (carry)
    {
        SetFlag(CarryFlag);
        A = SETBIT(A, 7);
    }
    else
    {
        ClearFlag(CarryFlag);
        A = CLEARBIT(A, 7);
    }

    SetHighByte(&m_AF, A);

    ClearFlag(ZeroFlag);
    ClearFlag(SubtractFlag);
    ClearFlag(HalfCarryFlag);

    return 4;
}
/*
    RRCA - 0x0F

    The contents off the accumulator are roated right 1-bit. Bit 0 is copied to the carry
    flag and also to bit 7.

    4 Cycles

    Flags affected(znhc): 000c
*/
0x0F
The contents off the accumulator are roated right 1-bit. Bit 0 is copied to the carry
flag and also to bit 7.

4 Cycles


0x0F The contents off the accumulator are roated right 1 - bit . Bit 0 is copied to the carry flag and also to bit 7 . 4 Cycles
unsigned long CPU::RRCA(const byte& opCode)
{
    byte A = GetHighByte(m_AF);
    bool carry = ISBITSET(A, 0);
    A = A >> 1;
    if (carry)
    {
        SetFlag(CarryFlag);
        A = SETBIT(A, 7);
    }
    else
    {
        ClearFlag(CarryFlag);
        A = CLEARBIT(A, 7);
    }
    SetHighByte(&m_AF, A);
    ClearFlag(ZeroFlag);
    ClearFlag(SubtractFlag);
    ClearFlag(HalfCarryFlag);
    return 4;
}
unsigned long CPU :: RRCA ( const byte & opCode ) { byte A = GetHighByte ( m_AF ) ; bool carry = ISBITSET ( A , 0 ) ; A = A >> 1 ; if ( carry ) { SetFlag ( CarryFlag ) ; A = SETBIT ( A , 7 ) ; } else { ClearFlag ( CarryFlag ) ; A = CLEARBIT ( A , 7 ) ; } SetHighByte ( & m_AF , A ) ; ClearFlag ( ZeroFlag ) ; ClearFlag ( SubtractFlag ) ; ClearFlag ( HalfCarryFlag ) ; return 4 ; }
RRCA - 0x0F
The contents off the accumulator are roated right 1-bit.
RRCA - 0x0F The contents off the accumulator are roated right 1 - bit .