gb-emu-lib/CPU.cpp
unsigned long CPU::SLAr(const byte& opCode)
{
    byte* r = GetByteRegister(opCode);

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

    // Shift r left
    (*r) = *r << 1;

    // Affects Z, clears N, clears H, affects C
    (*r == 0x00) ? SetFlag(ZeroFlag) : ClearFlag(ZeroFlag);
    ClearFlag(SubtractFlag);
    ClearFlag(HalfCarryFlag);

    return 8;
}
/*
    SLA r
    11001011 00100rrrr

    An arithmetic shift left 1-bit position is performed on the contents of the operand r. The content
    of bit 7 is copied to the carry flag.

    8 Cycles

    Flags affected(znhc): z00c
*/


An arithmetic shift left 1-bit position is performed on the contents of the operand r. The content
of bit 7 is copied to the carry flag.

8 Cycles


An arithmetic shift left 1 - bit position is performed on the contents of the operand r . The content of bit 7 is copied to the carry flag . 8 Cycles
unsigned long CPU::SLAr(const byte& opCode)
{
    byte* r = GetByteRegister(opCode);
    ISBITSET(*r, 7) ? SetFlag(CarryFlag) : ClearFlag(CarryFlag);
    (*r) = *r << 1;
    (*r == 0x00) ? SetFlag(ZeroFlag) : ClearFlag(ZeroFlag);
    ClearFlag(SubtractFlag);
    ClearFlag(HalfCarryFlag);
    return 8;
}
unsigned long CPU :: SLAr ( const byte & opCode ) { byte * r = GetByteRegister ( opCode ) ; ISBITSET ( * r , 7 ) ? SetFlag ( CarryFlag ) : ClearFlag ( CarryFlag ) ; ( * r ) = * r << 1 ; ( * r == 0x00 ) ? SetFlag ( ZeroFlag ) : ClearFlag ( ZeroFlag ) ; ClearFlag ( SubtractFlag ) ; ClearFlag ( HalfCarryFlag ) ; return 8 ; }
SLA r
11001011 00100rrrr
SLA r 11001011 00100rrrr
// Grab bit 7 and store it in the carryflag // Shift r left // Affects Z, clears N, clears H, affects C