lib/cpu/opcodes.js
function add_sp_n (cpu, mmu) {
    const n = mmu.readByte(cpu.pc + 1).signed();
    const r = cpu.sp + n;

    const op = cpu.sp ^ n ^ r;

    cpu.f = 0;
    if ((op & 0x10) != 0) cpu.f |= FLAG_H;
    if ((op & 0x100) != 0) cpu.f |= FLAG_C;

    return r;
}
function add_sp_n (cpu, mmu) {
    const n = mmu.readByte(cpu.pc + 1).signed();
    const r = cpu.sp + n;

    const op = cpu.sp ^ n ^ r;

    cpu.f = 0;
    if ((op & 0x10) != 0) cpu.f |= FLAG_H;
    if ((op & 0x100) != 0) cpu.f |= FLAG_C;

    return r;
}
function add_sp_n ( cpu , mmu ) { const n = mmu . readByte ( cpu . pc + 1 ) . signed ( ) ; const r = cpu . sp + n ; const op = cpu . sp ^ n ^ r ; cpu . f = 0 ; if ( ( op & 0x10 ) != 0 ) cpu . f |= FLAG_H ; if ( ( op & 0x100 ) != 0 ) cpu . f |= FLAG_C ; return r ; }
LD HL,SP+n
LDHL SP,n

Description
Put SP + n effective address into HL.

Use with:
n = one byte signed immediate value.

Flags affected:
Z - Reset.
N - Reset.
H - Set or reset according to operation.
C - Set or reset according to operation.

Opcodes:
Instruction    Parameters    Opcode    Cycles
LDHL           SP,n          F8        12
LD HL SP + n LDHL SP n