gb-emu-lib/CPU.cpp
unsigned long CPU::RLCA(const byte& opCode)
{
    byte r = GetHighByte(m_AF);

    // Grab bit 7 and store it in the carryflag
    ISBITSET(r, 7) ? SetFlag(CarryFlag) : ClearFlag(CarryFlag);

    // Shift r left
    r = r << 1;

    // Set bit 0 of r to the old CarryFlag
    r = IsFlagSet(CarryFlag) ? SETBIT(r, 0) : CLEARBIT(r, 0);

    SetHighByte(&m_AF, r);

    // Clear sZ, clears N, clears H, affects C
    ClearFlag(ZeroFlag);
    ClearFlag(SubtractFlag);
    ClearFlag(HalfCarryFlag);

    return 4;
}
/*
    RLCA
    00000111

    The contents of the accumulator are rotated left 1-bit position. Bit 7
    is copied to the carry flag and also to bit 0.

    4 Cycles

    Flags affected(znhc): 000c
*/


The contents of the accumulator are rotated left 1-bit position. Bit 7
is copied to the carry flag and also to bit 0.

4 Cycles


The contents of the accumulator are rotated left 1 - bit position . Bit 7 is copied to the carry flag and also to bit 0 . 4 Cycles
unsigned long CPU::RLCA(const byte& opCode)
{
    byte r = GetHighByte(m_AF);
    ISBITSET(r, 7) ? SetFlag(CarryFlag) : ClearFlag(CarryFlag);
    r = r << 1;
    r = IsFlagSet(CarryFlag) ? SETBIT(r, 0) : CLEARBIT(r, 0);
    SetHighByte(&m_AF, r);
    ClearFlag(ZeroFlag);
    ClearFlag(SubtractFlag);
    ClearFlag(HalfCarryFlag);
    return 4;
}
unsigned long CPU :: RLCA ( const byte & opCode ) { byte r = GetHighByte ( m_AF ) ; ISBITSET ( r , 7 ) ? SetFlag ( CarryFlag ) : ClearFlag ( CarryFlag ) ; r = r << 1 ; r = IsFlagSet ( CarryFlag ) ? SETBIT ( r , 0 ) : CLEARBIT ( r , 0 ) ; SetHighByte ( & m_AF , r ) ; ClearFlag ( ZeroFlag ) ; ClearFlag ( SubtractFlag ) ; ClearFlag ( HalfCarryFlag ) ; return 4 ; }
RLCA
00000111
RLCA 00000111
// Grab bit 7 and store it in the carryflag // Shift r left // Set bit 0 of r to the old CarryFlag // Clear sZ, clears N, clears H, affects C