gb-emu-lib/CPU.cpp
unsigned long CPU::ANDn(const byte& opCode)
{
    byte n = ReadBytePC();

    byte result = GetHighByte(m_AF) & n;
    SetHighByte(&m_AF, result);

    (result == 0x00) ? SetFlag(ZeroFlag) : ClearFlag(ZeroFlag);
    ClearFlag(SubtractFlag);
    SetFlag(HalfCarryFlag);
    ClearFlag(CarryFlag);

    return 8;
}
/*
    AND n
    11100110 (0xE6)

    The logical AND operation is performed between the byte specified in n and the byte contained
    in the accumulator. The resutl is stored in the accumulator.

    8 Cycles

    Flags affected(znhc): z010
*/


The logical AND operation is performed between the byte specified in n and the byte contained
in the accumulator. The resutl is stored in the accumulator.

8 Cycles


The logical AND operation is performed between the byte specified in n and the byte contained in the accumulator . The resutl is stored in the accumulator . 8 Cycles
unsigned long CPU::ANDn(const byte& opCode)
{
    byte n = ReadBytePC();
    byte result = GetHighByte(m_AF) & n;
    SetHighByte(&m_AF, result);
    (result == 0x00) ? SetFlag(ZeroFlag) : ClearFlag(ZeroFlag);
    ClearFlag(SubtractFlag);
    SetFlag(HalfCarryFlag);
    ClearFlag(CarryFlag);
    return 8;
}
unsigned long CPU :: ANDn ( const byte & opCode ) { byte n = ReadBytePC ( ) ; byte result = GetHighByte ( m_AF ) & n ; SetHighByte ( & m_AF , result ) ; ( result == 0x00 ) ? SetFlag ( ZeroFlag ) : ClearFlag ( ZeroFlag ) ; ClearFlag ( SubtractFlag ) ; SetFlag ( HalfCarryFlag ) ; ClearFlag ( CarryFlag ) ; return 8 ; }
AND n
11100110 (0xE6)
AND n 11100110 ( 0xE6 )