SET
Bit Manipulation Group
Expansion:
SET
Usage:
set {0-7},{r}
Sets a bit in a specific position of the byte.
The bit order is %76543210 (first zero indexed byte begins at least significant).
| Instruction | Description | Opcode |
|---|---|---|
| SET 0, A | Set bit at position 0 of the byte held in registry A | CBC7 |
| SET 0, B | Set bit at position 0 of the byte held in registry B | CBC0 |
| SET 0, C | Set bit at position 0 of the byte held in registry C | CBC1 |
| SET 0, D | Set bit at position 0 of the byte held in registry D | CBC2 |
| SET 0, E | Set bit at position 0 of the byte held in registry E | CBC3 |
| SET 0, H | Set bit at position 0 of the byte held in registry H | CBC4 |
| SET 0, L | Set bit at position 0 of the byte held in registry L | CBC5 |
| SET 0, (HL) | Set bit at position 0 of the byte held in address HL | CBC6 |
| SET 0, (IX+dis) | Set bit at position 0 of the byte held in address IX+displacement | DDCB {??} C6 |
| SET 0, (IY+dis) | Set bit at position 0 of the byte held in address IY+displacement | FDCB {??} C6 |
| Instruction | Description | Opcode |
|---|---|---|
| SET 1, A | Set bit at position 1 of the byte held in registry A | CBCF |
| SET 1, B | Set bit at position 1 of the byte held in registry B | CBC8 |
| SET 1, C | Set bit at position 1 of the byte held in registry C | CBC9 |
| SET 1, D | Set bit at position 1 of the byte held in registry D | CBCA |
| SET 1, E | Set bit at position 1 of the byte held in registry E | CBCB |
| SET 1, H | Set bit at position 1 of the byte held in registry H | CBCC |
| SET 1, L | Set bit at position 1 of the byte held in registry L | CBCD |
| SET 1, (HL) | Set bit at position 1 of the byte held in address HL | CBCE |
| SET 1, (IX+dis) | Set bit at position 1 of the byte held in address IX+displacement | DDCB {??} CE |
| SET 1, (IY+dis) | Set bit at position 1 of the byte held in address IY+displacement | FDCB {??} CE |
| Instruction | Description | Opcode |
|---|---|---|
| SET 2, A | Set bit at position 2 of the byte held in registry A | CBD7 |
| SET 2, B | Set bit at position 2 of the byte held in registry B | CBD0 |
| SET 2, C | Set bit at position 2 of the byte held in registry C | CBD1 |
| SET 2, D | Set bit at position 2 of the byte held in registry D | CBD2 |
| SET 2, E | Set bit at position 2 of the byte held in registry E | CBD3 |
| SET 2, H | Set bit at position 2 of the byte held in registry H | CBD4 |
| SET 2, L | Set bit at position 2 of the byte held in registry L | CBD5 |
| SET 2, (HL) | Set bit at position 2 of the byte held in address HL | CBD6 |
| SET 2, (IX+dis) | Set bit at position 2 of the byte held in address IX+displacement | DDCB {??} D6 |
| SET 2, (IY+dis) | Set bit at position 2 of the byte held in address IY+displacement | FDCB {??} D6 |
| Instruction | Description | Opcode |
|---|---|---|
| SET 3, A | Set bit at position 3 of the byte held in registry A | CBDF |
| SET 3, B | Set bit at position 3 of the byte held in registry B | CBD8 |
| SET 3, C | Set bit at position 3 of the byte held in registry C | CBD9 |
| SET 3, D | Set bit at position 3 of the byte held in registry D | CBDA |
| SET 3, E | Set bit at position 3 of the byte held in registry E | CBDB |
| SET 3, H | Set bit at position 3 of the byte held in registry H | CBDC |
| SET 3, L | Set bit at position 3 of the byte held in registry L | CBDD |
| SET 3, (HL) | Set bit at position 3 of the byte held in address HL | CBDE |
| SET 3, (IX+dis) | Set bit at position 3 of the byte held in address IX+displacement | DDCB {??} DE |
| SET 3, (IY+dis) | Set bit at position 3 of the byte held in address IY+displacement | FDCB {??} DE |
| Instruction | Description | Opcode |
|---|---|---|
| SET 4, A | Set bit at position 4 of the byte held in registry A | CBE7 |
| SET 4, B | Set bit at position 4 of the byte held in registry B | CBE0 |
| SET 4, C | Set bit at position 4 of the byte held in registry C | CBE1 |
| SET 4, D | Set bit at position 4 of the byte held in registry D | CBE2 |
| SET 4, E | Set bit at position 4 of the byte held in registry E | CBE3 |
| SET 4, H | Set bit at position 4 of the byte held in registry H | CBE4 |
| SET 4, L | Set bit at position 4 of the byte held in registry L | CBE5 |
| SET 4, (HL) | Set bit at position 4 of the byte held in address HL | CBE6 |
| SET 4, (IX+dis) | Set bit at position 4 of the byte held in address IX+displacement | DDCB {??} E6 |
| SET 4, (IY+dis) | Set bit at position 4 of the byte held in address IY+displacement | FDCB {??} E6 |
| Instruction | Description | Opcode |
|---|---|---|
| SET 5, A | Set bit at position 5 of the byte held in registry A | CBEF |
| SET 5, B | Set bit at position 5 of the byte held in registry B | CBE8 |
| SET 5, C | Set bit at position 5 of the byte held in registry C | CBE9 |
| SET 5, D | Set bit at position 5 of the byte held in registry D | CBEA |
| SET 5, E | Set bit at position 5 of the byte held in registry E | CBEB |
| SET 5, H | Set bit at position 5 of the byte held in registry H | CBEC |
| SET 5, L | Set bit at position 5 of the byte held in registry L | CBED |
| SET 5, (HL) | Set bit at position 5 of the byte held in address HL | CBEE |
| SET 5, (IX+dis) | Set bit at position 5 of the byte held in address IX+displacement | DDCB {??} EE |
| SET 5, (IY+dis) | Set bit at position 5 of the byte held in address IY+displacement | FDCB {??} EE |
| Instruction | Description | Opcode |
|---|---|---|
| SET 6, A | Set bit at position 6 of the byte held in registry A | CBF7 |
| SET 6, B | Set bit at position 6 of the byte held in registry B | CBF0 |
| SET 6, C | Set bit at position 6 of the byte held in registry C | CBF1 |
| SET 6, D | Set bit at position 6 of the byte held in registry D | CBF2 |
| SET 6, E | Set bit at position 6 of the byte held in registry E | CBF3 |
| SET 6, H | Set bit at position 6 of the byte held in registry H | CBF4 |
| SET 6, L | Set bit at position 6 of the byte held in registry L | CBF5 |
| SET 6, (HL) | Set bit at position 6 of the byte held in address HL | CBF6 |
| SET 6, (IX+dis) | Set bit at position 6 of the byte held in address IX+displacement | DDCB {??} F6 |
| SET 6, (IY+dis) | Set bit at position 6 of the byte held in address IY+displacement | FDCB {??} F6 |
| Instruction | Description | Opcode |
|---|---|---|
| SET 7, A | Set bit at position 7 of the byte held in registry A | CBFF |
| SET 7, B | Set bit at position 7 of the byte held in registry B | CBF8 |
| SET 7, C | Set bit at position 7 of the byte held in registry C | CBF9 |
| SET 7, D | Set bit at position 7 of the byte held in registry D | CBFA |
| SET 7, E | Set bit at position 7 of the byte held in registry E | CBFB |
| SET 7, H | Set bit at position 7 of the byte held in registry H | CBFC |
| SET 7, L | Set bit at position 7 of the byte held in registry L | CBFD |
| SET 7, (HL) | Set bit at position 7 of the byte held in address HL | CBFE |
| SET 7, (IX+dis) | Set bit at position 7 of the byte held in address IX+displacement | DDCB {??} FE |
| SET 7, (IY+dis) | Set bit at position 7 of the byte held in address IY+displacement | FDCB {??} FE |
Example
ld a, %10101010 ; load the binary value into reg A
set 2, a ; set bit 3 of register a
; value will now be %10101110