lib/cpu/opcodes.js
function add (cpu, n) {
    const r = cpu.a + n;

    cpu.f = 0;
    if ((r & 0xff) == 0) cpu.f |= FLAG_Z;
    if (((cpu.a ^ n ^ r) & 0x10) != 0) cpu.f |= FLAG_H;
    if ((r & 0x100) != 0) cpu.f |= FLAG_C;

    return r;
}
function add (cpu, n) {
    const r = cpu.a + n;

    cpu.f = 0;
    if ((r & 0xff) == 0) cpu.f |= FLAG_Z;
    if (((cpu.a ^ n ^ r) & 0x10) != 0) cpu.f |= FLAG_H;
    if ((r & 0x100) != 0) cpu.f |= FLAG_C;

    return r;
}
function add ( cpu , n ) { const r = cpu . a + n ; cpu . f = 0 ; if ( ( r & 0xff ) == 0 ) cpu . f |= FLAG_Z ; if ( ( ( cpu . a ^ n ^ r ) & 0x10 ) != 0 ) cpu . f |= FLAG_H ; if ( ( r & 0x100 ) != 0 ) cpu . f |= FLAG_C ; return r ; }
8-Bit ALU 
ADD A,n

Description:
Add n to A.

Use with:
n = A, B, C, D, E, H, L, (HL), #

Flags affected:
Z - Set if result is zero.
N - Reset.
H - Set if carry from bit 3.
C - Set if carry from bit 7.

Opcodes:
Instruction    Parameters    Opcode    Cycles
ADD            A,A           87        4
ADD            A,B           80        4
ADD            A,C           81        4
ADD            A,D           82        4
ADD            A,E           83        4
ADD            A,H           84        4
ADD            A,L           85        4
ADD            A,(HL)        86        8
ADD            A,#           C6        8
8 - Bit ALU ADD A n