set

Set bit

Sets one bit of a register or memory byte to one, leaving the other bits unchanged.

SZHP/VNC ––––––
  • Changes no flag

Forms

  • Sets bit b of r.

  • Sets bit b of (HL).

  • Sets bit b of the memory location pointed to by IX plus dd.

Undocumented 1 row

Left out of Zilog's manual, but the Z80 runs them, and so does this emulator.

  • Sets bit b of the memory location pointed to by IX plus dd. The result is then stored in r.

Operands

b
A bit number from 0 to 7, where bit 0 is the least significant bit.
r
An 8-bit register: a, b, c, d, e, h or l.
(hl)
The byte in memory at the address stored in hl. More
(ix+dd)
The byte in memory at ix + dd, where dd is a signed displacement from -128 to 127, for example (ix+5) or (ix-3). (iy+dd) works the same way. More
        .org 0x8000
        ld b, 3
        set 0, b
        halt