gb-emu-lib/CPU.cpp
unsigned long CPU::ORr(const byte& opCode)
{
    byte* r = GetByteRegister(opCode);
    SetHighByte(&m_AF, *r | GetHighByte(m_AF));

    // Affects Z and clears NHC
    if (GetHighByte(m_AF) == 0x00)
    {
        SetFlag(ZeroFlag);
    }
    else
    {
        ClearFlag(ZeroFlag);
    }

    ClearFlag(SubtractFlag);
    ClearFlag(HalfCarryFlag);
    ClearFlag(CarryFlag);

    return 4;
}
/*
    OR r
    10110rrr

    The logical OR operation is performed between the register specified in the r
    operand and the byte contained in the accumulator. The result is stored in the accumulator.
    Register r can be A, B, C, D, E, H, or L.

    4 Cycles

    Flags affected(znhc): z000
*/


The logical OR operation is performed between the register specified in the r
operand and the byte contained in the accumulator. The result is stored in the accumulator.
Register r can be A, B, C, D, E, H, or L.

4 Cycles


The logical OR operation is performed between the register specified in the r operand and the byte contained in the accumulator . The result is stored in the accumulator . Register r can be A B C D E H or L . 4 Cycles
unsigned long CPU::ORr(const byte& opCode)
{
    byte* r = GetByteRegister(opCode);
    SetHighByte(&m_AF, *r | GetHighByte(m_AF));
    if (GetHighByte(m_AF) == 0x00)
    {
        SetFlag(ZeroFlag);
    }
    else
    {
        ClearFlag(ZeroFlag);
    }
    ClearFlag(SubtractFlag);
    ClearFlag(HalfCarryFlag);
    ClearFlag(CarryFlag);
    return 4;
}
unsigned long CPU :: ORr ( const byte & opCode ) { byte * r = GetByteRegister ( opCode ) ; SetHighByte ( & m_AF , * r | GetHighByte ( m_AF ) ) ; if ( GetHighByte ( m_AF ) == 0x00 ) { SetFlag ( ZeroFlag ) ; } else { ClearFlag ( ZeroFlag ) ; } ClearFlag ( SubtractFlag ) ; ClearFlag ( HalfCarryFlag ) ; ClearFlag ( CarryFlag ) ; return 4 ; }
OR r
10110rrr
OR r 10110rrr
// Affects Z and clears NHC