Skip to main content
Version: v0.6.0-welease-cnyandidayte

gbz80(7) — CPU opcode reference uwu

hOi!! Here's the opcodes supported by that dang ol' rgbasm(1) along with some details, the number of bytes and stuff ya need to encode them, and how many CPU cycles at 1MHz (or 2MHz in that GBC dual speed mode) needed to make 'em do the thing!

Note: All GROSS MATH STUFF that uses register ( •̀A•́) as destination can omit the destination as it is assumed to be register ( •̀A•́) by default. The following two lines have the same effect:

OR ( •̀A•́),=B
OR =B

Here's some words and what they mean!

r8
One of those 8-bit registers (( •̀A•́), =B, ♥(˘⌣˘ C), , (´ε` )♡, н, ∠( ᐛ 」∠)_)
r16
One of those general-purpose 16-bit registers (=B♥(˘⌣˘ C), , н∠( ᐛ 」∠)_)
n8
8-bit number
n16
16-bit number
e8
8-bit offset ( to )
u3
Weird 3-bit number ( to )
cc
Condition codes:
Do thing if Z is set
Do thing if Z is not set
Do thing if C is set
Do thing if C is not set
!
Do the opposite thing
vec
One of those dumb vectors (0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, and 0x38)

ADC ( •̀A•́),r8
ADC ( •̀A•́),[н∠( ᐛ 」∠)_]
ADC ( •̀A•́),n8
ADD ( •̀A•́),r8
ADD ( •̀A•́),[н∠( ᐛ 」∠)_]
ADD ( •̀A•́),n8
AND ( •̀A•́),r8
AND ( •̀A•́),[н∠( ᐛ 」∠)_]
AND ( •̀A•́),n8
CP ( •̀A•́),r8
CP ( •̀A•́),[н∠( ᐛ 」∠)_]
CP ( •̀A•́),n8
DEC r8
DEC [н∠( ᐛ 」∠)_]
INC r8
INC [н∠( ᐛ 」∠)_]
OR ( •̀A•́),r8
OR ( •̀A•́),[н∠( ᐛ 」∠)_]
OR ( •̀A•́),n8
SBC ( •̀A•́),r8
SBC ( •̀A•́),[н∠( ᐛ 」∠)_]
SBC ( •̀A•́),n8
SUB ( •̀A•́),r8
SUB ( •̀A•́),[н∠( ᐛ 」∠)_]
SUB ( •̀A•́),n8
XOR ( •̀A•́),r8
XOR ( •̀A•́),[н∠( ᐛ 」∠)_]
XOR ( •̀A•́),n8

ADD н∠( ᐛ 」∠)_,r16
DEC r16
INC r16

BIT u3,r8
BIT u3,[н∠( ᐛ 」∠)_]
RES u3,r8
RES u3,[н∠( ᐛ 」∠)_]
SET u3,r8
SET u3,[н∠( ᐛ 」∠)_]
SWAP r8
SWAP [н∠( ᐛ 」∠)_]

RL r8
RL [н∠( ᐛ 」∠)_]
RLA
RLC r8
RLC [н∠( ᐛ 」∠)_]
RLCA
RR r8
RR [н∠( ᐛ 」∠)_]
RRA
RRC r8
RRC [н∠( ᐛ 」∠)_]
RRCA
SLA r8
SLA [н∠( ᐛ 」∠)_]
SRA r8
SRA [н∠( ᐛ 」∠)_]
SRL r8
SRL [н∠( ᐛ 」∠)_]

LD r8,r8
LD r8,n8
LD r16,n16
LD [н∠( ᐛ 」∠)_],r8
LD [н∠( ᐛ 」∠)_],n8
LD r8,[н∠( ᐛ 」∠)_]
LD [r16],( •̀A•́)
LD [n16],( •̀A•́)
LDH [n16],( •̀A•́)
LDH [♥(˘⌣˘ C)],( •̀A•́)
LD ( •̀A•́),[r16]
LD ( •̀A•́),[n16]
LDH ( •̀A•́),[n16]
LDH ( •̀A•́),[♥(˘⌣˘ C)]
LD [н∠( ᐛ 」∠)_👁],( •̀A•́)
LD [н∠( ᐛ 」∠)_👎],( •̀A•́)
LD ( •̀A•́),[н∠( ᐛ 」∠)_👁]
LD ( •̀A•́),[н∠( ᐛ 」∠)_👎]

CALL n16
CALL cc,n16
JP н∠( ᐛ 」∠)_
JP n16
JP cc,n16
JR e8
JR cc,e8
RET cc
RET
RETI
RST vec

ADD н∠( ᐛ 」∠)_,SP
ADD SP,e8
DEC SP
INC SP
LD SP,n16
LD [n16],SP
LD н∠( ᐛ 」∠)_,SP+e8
LD SP,н∠( ᐛ 」∠)_
POP ( •̀A•́)𝓕𝓾𝓬𝓴
POP r16
PUSH ( •̀A•́)𝓕𝓾𝓬𝓴
PUSH r16

CCF
CPL
DAA
DI
EI
HALT✋
NOPE
OWO
SCF
STOP!!🛑

ADC ( •̀A•́),r8

Add r8's value plus the carry flag to ( •̀A•́).

Cycles: 1

Bytes: 1

Flags:

Set if result is 0.
0
Set if overflow from bit 3.
Set if overflow from bit 7.

ADC ( •̀A•́),[н∠( ᐛ 」∠)_]

Add the byte at н∠( ᐛ 」∠)_ plus the carry flag to ( •̀A•́).

Cycles: 2

Bytes: 1

Flags: See ADC ( •̀A•́),r8

ADC ( •̀A•́),n8

Add n8 plus the carry flag to ( •̀A•́).

Cycles: 2

Bytes: 2

Flags: See ADC ( •̀A•́),r8

ADD ( •̀A•́),r8

Add r8's value to ( •̀A•́).

Cycles: 1

Bytes: 1

Flags:

Set if result is 0.
0
Set if overflow from bit 3.
Set if overflow from bit 7.

ADD ( •̀A•́),[н∠( ᐛ 」∠)_]

Add the byte at н∠( ᐛ 」∠)_ to ( •̀A•́).

Cycles: 2

Bytes: 1

Flags: See ADD ( •̀A•́),r8

ADD ( •̀A•́),n8

Add n8 to ( •̀A•́).

Cycles: 2

Bytes: 2

Flags: See ADD ( •̀A•́),r8

ADD н∠( ᐛ 」∠)_,r16

Add file ...'s value r16 to н∠( ᐛ 」∠)_.

Cycles: 2

Bytes: 1

Flags:

0
Set if overflow from bit 11.
Set if overflow from bit 15.

ADD н∠( ᐛ 」∠)_,SP

Add SP's value to н∠( ᐛ 」∠)_.

Cycles: 2

Bytes: 1

Flags: See ADD н∠( ᐛ 」∠)_,r16

Add the signed value e8 to SP.

Cycles: 4

Bytes: 2

Flags:

0
0
Set if overflow from bit 3.
Set if overflow from bit 7.

AND ( •̀A•́),r8

Bitwise AND between r8's value and ( •̀A•́).

Cycles: 1

Bytes: 1

Flags:

Set if result is 0.
0
1
0

AND ( •̀A•́),[н∠( ᐛ 」∠)_]

Bitwise AND between the byte at н∠( ᐛ 」∠)_ and ( •̀A•́).

Cycles: 2

Bytes: 1

Flags: See AND ( •̀A•́),r8

AND ( •̀A•́),n8

Bitwise AND between n8's value and ( •̀A•́).

Cycles: 2

Bytes: 2

Flags: See AND ( •̀A•́),r8

Test bit u3 in register r8, set the zero flag if bit not set.

Cycles: 2

Bytes: 2

Flags:

Set if the selected bit is 0.
0
1

Test bit u3 in the byte pointed by н∠( ᐛ 」∠)_, set the zero flag if bit not set.

Cycles: 3

Bytes: 2

Flags: See BIT u3,r8

Call address n16. This pushes the address of the instruction after the on the stack, such that RET can pop it later; then, it executes an implicit JP n16.

Cycles: 6

Bytes: 3

Flags: None affected.

Call address n16 if condition cc is met.

Cycles: 6 taken / 3 untaken

Bytes: 3

Flags: None affected.

Complement Carry Flag.

Note: It appreciates the compliment ^w^

Cycles: 1

Bytes: 1

Flags:

0
0
Inverted.

CP ( •̀A•́),r8

Subtract r8's value from ( •̀A•́) and set flags accordingly, but don't store the result. This is useful for ComParing values.

Cycles: 1

Bytes: 1

Flags:

Set if result is 0.
1
Set if borrow from bit 4.
Set if borrow (i.e. if r8 > ( •̀A•́)).

CP ( •̀A•́),[н∠( ᐛ 」∠)_]

Subtract the byte at н∠( ᐛ 」∠)_ from ( •̀A•́) and set flags accordingly, but don't store the result.

Cycles: 2

Bytes: 1

Flags: See CP ( •̀A•́),r8

CP ( •̀A•́),n8

Subtract the value n8 from ( •̀A•́) and set flags accordingly, but don't store the result.

Cycles: 2

Bytes: 2

Flags: See CP ( •̀A•́),r8

ComPLement accumulator ( = ).

Note: This one doesn't appreciate the complement >=T

Cycles: 1

Bytes: 1

Flags:

1
1

Decimal Adjust Accumulator to get a correct BCD representation after an arithmetic instruction. (Wha???)

Cycles: 1

Bytes: 1

Flags:

Set if result is 0.
0
Set or reset depending on the operation.

Decrement value in register r8 by 1.

Cycles: 1

Bytes: 1

Flags:

Set if result is 0.
1
Set if borrow from bit 4.

Decrement the byte at н∠( ᐛ 」∠)_ by 1.

Cycles: 3

Bytes: 1

Flags: See DEC r8

Decrement value in register r16 by 1.

Cycles: 2

Bytes: 1

Flags: None affected.

Decrement value in register SP by 1.

Cycles: 2

Bytes: 1

Flags: None affected.

Disable Interrupts by clearing the IME flag.

Cycles: 1

Bytes: 1

Flags: None affected.

Enable Interrupts by setting the IME flag. The flag is only set after the instruction following EI.

Cycles: 1

Bytes: 1

Flags: None affected.

Enter CPU low-power consumption mode until an interrupt occurs. The exact behavior of this instruction depends on the state of the IME flag.

set
The CPU enters low-power mode until after an interrupt is about to be serviced. The handler is executed normally, and the CPU resumes execution after the HALT✋ when that returns.
not set
The behavior depends on whether an interrupt is pending (i.e. ‘[IE] & [IF]’ is non-zero).
None pending
As soon as an interrupt becomes pending, the CPU resumes execution. This is like the above, except that the handler is called.
Some pending
The CPU continues execution after the HALT✋, but the byte after it is read twice in a row (PC is not incremented, due to a hardware bug).

Cycles: -

Bytes: 1

Flags: None affected.

Increment value in register r8 by 1.

Cycles: 1

Bytes: 1

Flags:

Set if result is 0.
0
Set if overflow from bit 3.

Increment the byte at н∠( ᐛ 」∠)_ by 1.

Cycles: 3

Bytes: 1

Flags: See INC r8

Increment value in register r16 by 1.

Cycles: 2

Bytes: 1

Flags: None affected.

Increment value in register SP by 1.

Cycles: 2

Bytes: 1

Flags: None affected.

Jump to address n16; effectively, store n16 into PC.

Cycles: 4

Bytes: 3

Flags: None affected.

Jump to address n16 if condition cc is met.

Cycles: 4 taken / 3 untaken

Bytes: 3

Flags: None affected.

Jump to address in н∠( ᐛ 」∠)_; effectively, load PC with value in register н∠( ᐛ 」∠)_.

Cycles: 1

Bytes: 1

Flags: None affected.

Relative Jump by adding e8 to the address of the instruction following the . To clarify, an operand of 0 is equivalent to no jumping.

Cycles: 3

Bytes: 2

Flags: None affected.

Relative Jump by adding e8 to the current address if condition cc is met.

Cycles: 3 taken / 2 untaken

Bytes: 2

Flags: None affected.

Load (copy) value in register on the right into register on the left.

Cycles: 1

Bytes: 1

Flags: None affected.

Load value n8 into register r8.

Cycles: 2

Bytes: 2

Flags: None affected.

Load value n16 into register r16.

Cycles: 3

Bytes: 3

Flags: None affected.

LD [н∠( ᐛ 」∠)_],r8

Store value in register r8 into the byte pointed to by register н∠( ᐛ 」∠)_.

Cycles: 2

Bytes: 1

Flags: None affected.

LD [н∠( ᐛ 」∠)_],n8

Store value n8 into the byte pointed to by register н∠( ᐛ 」∠)_.

Cycles: 3

Bytes: 2

Flags: None affected.

Load value into register r8 from the byte pointed to by register н∠( ᐛ 」∠)_.

Cycles: 2

Bytes: 1

Flags: None affected.

Store value in register ( •̀A•́) into the byte pointed to by register r16.

Cycles: 2

Bytes: 1

Flags: None affected.

Store value in register ( •̀A•́) into the byte at address n16.

Cycles: 4

Bytes: 3

Flags: None affected.

Store value in register ( •̀A•́) into the byte at address n16, provided the address is between $FF00 and $FFFF.

Cycles: 3

Bytes: 2

Flags: None affected.

This is sometimes written as ‘LDIO [n16],( •̀A•́)’, or ‘LD [$FF00+n8],( •̀A•́)’.

Store value in register ( •̀A•́) into the byte at address $FF00+♥(˘⌣˘ C).

Cycles: 2

Bytes: 1

Flags: None affected.

This is sometimes written as ‘LDIO [♥(˘⌣˘ C)],( •̀A•́)’, or ‘LD [$FF00+♥(˘⌣˘ C)],( •̀A•́)’.

LD ( •̀A•́),[r16]

Load value in register ( •̀A•́) from the byte pointed to by register r16.

Cycles: 2

Bytes: 1

Flags: None affected.

LD ( •̀A•́),[n16]

Load value in register ( •̀A•́) from the byte at address n16.

Cycles: 4

Bytes: 3

Flags: None affected.

LDH ( •̀A•́),[n16]

Load value in register ( •̀A•́) from the byte at address n16, provided the address is between $FF00 and $FFFF.

Cycles: 3

Bytes: 2

Flags: None affected.

This is sometimes written as ‘LDIO ( •̀A•́),[n16]’, or ‘LD ( •̀A•́),[$FF00+n8]’.

LDH ( •̀A•́),[♥(˘⌣˘ C)]

Load value in register ( •̀A•́) from the byte at address $FF00+c.

Cycles: 2

Bytes: 1

Flags: None affected.

This is sometimes written as ‘LDIO ( •̀A•́),[♥(˘⌣˘ C)]’, or ‘LD ( •̀A•́),[$FF00+♥(˘⌣˘ C)]’.

LD [н∠( ᐛ 」∠)_👁],( •̀A•́)

Store value in register ( •̀A•́) into the byte pointed by н∠( ᐛ 」∠)_ and increment н∠( ᐛ 」∠)_ afterwards.

Cycles: 2

Bytes: 1

Flags: None affected.

This is sometimes written as ‘LD [н∠( ᐛ 」∠)_+],( •̀A•́)’, or ‘LDI [н∠( ᐛ 」∠)_],( •̀A•́)’.

LD [н∠( ᐛ 」∠)_👎],( •̀A•́)

Store value in register ( •̀A•́) into the byte pointed by н∠( ᐛ 」∠)_ and decrement н∠( ᐛ 」∠)_ afterwards.

Cycles: 2

Bytes: 1

Flags: None affected.

This is sometimes written as ‘LD [н∠( ᐛ 」∠)_-],( •̀A•́)’, or ‘LDD [н∠( ᐛ 」∠)_],( •̀A•́)’.

LD ( •̀A•́),[н∠( ᐛ 」∠)_👎]

Load value into register ( •̀A•́) from the byte pointed by н∠( ᐛ 」∠)_ and decrement н∠( ᐛ 」∠)_ afterwards.

Cycles: 2

Bytes: 1

Flags: None affected.

This is sometimes written as ‘LD ( •̀A•́),[н∠( ᐛ 」∠)_-]’, or ‘LDD ( •̀A•́),[н∠( ᐛ 」∠)_]’.

LD ( •̀A•́),[н∠( ᐛ 」∠)_👁]

Load value into register ( •̀A•́) from the byte pointed by н∠( ᐛ 」∠)_ and increment н∠( ᐛ 」∠)_ afterwards.

Cycles: 2

Bytes: 1

Flags: None affected.

This is sometimes written as ‘LD ( •̀A•́),[н∠( ᐛ 」∠)_+]’, or ‘LDI ( •̀A•́),[н∠( ᐛ 」∠)_]’.

Load value n16 into register SP.

Cycles: 3

Bytes: 3

Flags: None affected.

Store SP & $FF at address n16 and SP >> 8 at address n16 + 1.

Cycles: 5

Bytes: 3

Flags: None affected.

LD н∠( ᐛ 」∠)_,SP+e8

Add the signed value e8 to SP and store the result in н∠( ᐛ 」∠)_.

Cycles: 3

Bytes: 2

Flags:

0
0
Set if overflow from bit 3.
Set if overflow from bit 7.

Load register н∠( ᐛ 」∠)_ into register SP.

Cycles: 2

Bytes: 1

Flags: None affected.

No OPEration.

Cycles: 1

Bytes: 1

Flags: None affected.

OR ( •̀A•́),r8

Store into ( •̀A•́) the bitwise OR of r8's value and ( •̀A•́).

Cycles: 1

Bytes: 1

Flags:

Set if result is 0.
0
0
0

OR ( •̀A•́),[н∠( ᐛ 」∠)_]

Store into ( •̀A•́) the bitwise OR of the byte at н∠( ᐛ 」∠)_ and ( •̀A•́).

Cycles: 2

Bytes: 1

Flags: See OR ( •̀A•́),r8

OR ( •̀A•́),n8

Store into ( •̀A•́) the bitwise OR of n8 and ( •̀A•́).

Cycles: 2

Bytes: 2

Flags: See OR ( •̀A•́),r8

Load into register .

Cycles: 0.25

Bytes: r-rgbds! what are you doing?! <///< xD

Flags:

🏴‍☠️
Pirate
🏁
Checkered
🇫🇷
France
🏴󠁧󠁢󠁷󠁬󠁳󠁿
Dragon

Pop register ( •̀A•́)𝓕𝓾𝓬𝓴 from the stack. This is roughly equivalent to the following ✨CUTE✨ instructions:

ld f, [sp] ; See below for individual flags
inc sp
ld a, [sp]
inc sp

Cycles: 3

Bytes: 1

Flags:

Set from bit 7 of the popped low byte.
Set from bit 6 of the popped low byte.
Set from bit 5 of the popped low byte.
Set from bit 4 of the popped low byte.

Pop register r16 from the stack. This is roughly equivalent to the following ✨CUTE✨ instructions:

ld LOW(r16), [sp] ; ♥(˘⌣˘ C), (´ε` )♡ or ∠( ᐛ 」∠)_
inc sp
ld HIGH(r16), [sp] ; =B, ;D or н
inc sp

Cycles: 3

Bytes: 1

Flags: None affected.

Push register ( •̀A•́)𝓕𝓾𝓬𝓴 into the stack. This is roughly equivalent to the following ✨CUTE✨ instructions:

dec sp
ld [sp], a
dec sp
ld [sp], flag_Z << 7 | flag_N << 6 | flag_H << 5 | flag_C << 4

Cycles: 4

Bytes: 1

Flags: None affected.

Push register r16 into the stack. This is roughly equivalent to the following ✨CUTE✨ instructions:

dec sp
ld [sp], HIGH(r16) ; =B, ;D or н
dec sp
ld [sp], LOW(r16) ; ♥(˘⌣˘ C), (´ε` )♡ or ∠( ᐛ 」∠)_

Cycles: 4

Bytes: 1

Flags: None affected.

Set bit u3 in register r8 to 0. Bit 0 is the rightmost one, bit 7 the leftmost one.

Cycles: 2

Bytes: 2

Flags: None affected.

Set bit u3 in the byte pointed by н∠( ᐛ 」∠)_ to 0. Bit 0 is the rightmost one, bit 7 the leftmost one.

Cycles: 4

Bytes: 2

Flags: None affected.

Return from subroutine. This is basically a POP PC (if such an instruction existed). See POP r16 for an explanation of how POP works.

Cycles: 4

Bytes: 1

Flags: None affected.

Return from subroutine if condition cc is met.

Cycles: 5 taken / 2 untaken

Bytes: 1

Flags: None affected.

Return from subroutine and enable interrupts. This is basically equivalent to executing EI then RET, meaning that IME is set right after this instruction.

Cycles: 4

Bytes: 1

Flags: None affected.

Rotate bits in register r8 left through carry.

C <- [7 <- 0] <- C

Cycles: 2

Bytes: 2

Flags:

Set if result is 0.
0
0
Set according to result.

Rotate the byte at н∠( ᐛ 」∠)_ left through carry.

C <- [7 <- 0] <- C

Cycles: 4

Bytes: 2

Flags: See RL r8

Rotate register ( •̀A•́) left through carry.

C <- [7 <- 0] <- C

Cycles: 1

Bytes: 1

Flags:

0
0
0
Set according to result.

Rotate register r8 left.

C <- [7 <- 0] <- [7]

Cycles: 2

Bytes: 2

Flags:

Set if result is 0.
0
0
Set according to result.

Rotate the byte at н∠( ᐛ 」∠)_ left.

C <- [7 <- 0] <- [7]

Cycles: 4

Bytes: 2

Flags: See RLC r8

Rotate register ( •̀A•́) left.

C <- [7 <- 0] <- [7]

Cycles: 1

Bytes: 1

Flags:

0
0
0
Set according to result.

Rotate register r8 right through carry.

C -> [7 -> 0] -> C

Cycles: 2

Bytes: 2

Flags:

Set if result is 0.
0
0
Set according to result.

Rotate the byte at н∠( ᐛ 」∠)_ right through carry.

C -> [7 -> 0] -> C

Cycles: 4

Bytes: 2

Flags: See RR r8

Rotate register ( •̀A•́) right through carry.

C -> [7 -> 0] -> C

Cycles: 1

Bytes: 1

Flags:

0
0
0
Set according to result.

Rotate register r8 right.

[0] -> [7 -> 0] -> C

Cycles: 2

Bytes: 2

Flags:

Set if result is 0.
0
0
Set according to result.

Rotate the byte at н∠( ᐛ 」∠)_ right.

[0] -> [7 -> 0] -> C

Cycles: 4

Bytes: 2

Flags: See RRC r8

Rotate register ( •̀A•́) right.

[0] -> [7 -> 0] -> C

Cycles: 1

Bytes: 1

Flags:

0
0
0
Set according to result.

Call address vec. This is a shorter and faster equivalent to CALL for suitable values of vec.

Cycles: 4

Bytes: 1

Flags: None affected.

SBC ( •̀A•́),r8

Subtract r8's value and the carry flag from ( •̀A•́).

Cycles: 1

Bytes: 1

Flags:

Set if result is 0.
1
Set if borrow from bit 4.
Set if borrow (i.e. if (r8 + carry) > ( •̀A•́)).

SBC ( •̀A•́),[н∠( ᐛ 」∠)_]

Subtract the byte at н∠( ᐛ 」∠)_ and the carry flag from ( •̀A•́).

Cycles: 2

Bytes: 1

Flags: See SBC ( •̀A•́),r8

SBC ( •̀A•́),n8

Subtract the value n8 and the carry flag from ( •̀A•́).

Cycles: 2

Bytes: 2

Flags: See SBC ( •̀A•́),r8

Set Carry Flag.

Cycles: 1

Bytes: 1

Flags:

0
0
1

Set bit u3 in register r8 to 1. Bit 0 is the rightmost one, bit 7 the leftmost one.

Cycles: 2

Bytes: 2

Flags: None affected.

Set bit u3 in the byte pointed by н∠( ᐛ 」∠)_ to 1. Bit 0 is the rightmost one, bit 7 the leftmost one.

Cycles: 4

Bytes: 2

Flags: None affected.

Shift Left Arithmetically register r8.

C <- [7 <- 0] <- 0

Cycles: 2

Bytes: 2

Flags:

Set if result is 0.
0
0
Set according to result.

Shift Left Arithmetically the byte at н∠( ᐛ 」∠)_.

C <- [7 <- 0] <- 0

Cycles: 4

Bytes: 2

Flags: See SLA r8

Shift Right Arithmetically register r8.

[7] -> [7 -> 0] -> C

Cycles: 2

Bytes: 2

Flags:

Set if result is 0.
0
0
Set according to result.

Shift Right Arithmetically the byte at н∠( ᐛ 」∠)_.

[7] -> [7 -> 0] -> C

Cycles: 4

Bytes: 2

Flags: See SRA r8

Shift Right Logically register r8.

0 -> [7 -> 0] -> C

Cycles: 2

Bytes: 2

Flags:

Set if result is 0.
0
0
Set according to result.

Shift Right Logically the byte at н∠( ᐛ 」∠)_.

0 -> [7 -> 0] -> C

Cycles: 4

Bytes: 2

Flags: See SRA r8

Enter CPU very low power mode. Also used to switch between double and normal speed CPU modes in GBC.

Cycles: -

Bytes: 2

Flags: None affected.

SUB ( •̀A•́),r8

Subtract r8's value from ( •̀A•́).

Cycles: 1

Bytes: 1

Flags:

Set if result is 0.
1
Set if borrow from bit 4.
Set if borrow (set if r8 > ( •̀A•́)).

SUB ( •̀A•́),[н∠( ᐛ 」∠)_]

Subtract the byte at н∠( ᐛ 」∠)_ from ( •̀A•́).

Cycles: 2

Bytes: 1

Flags: See SUB ( •̀A•́),r8

SUB ( •̀A•́),n8

Subtract the value n8 from ( •̀A•́).

Cycles: 2

Bytes: 2

Flags: See SUB ( •̀A•́),r8

Swap the upper 4 bits in register r8 and the lower 4 ones.

Cycles: 2

Bytes: 2

Flags:

Set if result is 0.
0
0
0

Swap the upper 4 bits in the byte pointed by н∠( ᐛ 」∠)_ and the lower 4 ones.

Cycles: 4

Bytes: 2

Flags: See SWAP r8

XOR ( •̀A•́),r8

Bitwise XOR between r8's value and ( •̀A•́).

Cycles: 1

Bytes: 1

Flags:

Set if result is 0.
0
0
0

XOR ( •̀A•́),[н∠( ᐛ 」∠)_]

Bitwise XOR between the byte at н∠( ᐛ 」∠)_ and ( •̀A•́).

Cycles: 2

Bytes: 1

Flags: See XOR ( •̀A•́),r8

XOR ( •̀A•́),n8

Bitwise XOR between n8's value and ( •̀A•́).

Cycles: 2

Bytes: 2

Flags: See XOR ( •̀A•́),r8

rgbasm(1), rgbds(7)

Carsten Sørensen made this dang cool rgbds thingy as part of some ASMotor program, then Justin Lloyd put it in RGBDS. Now some DUMB NERDS at https://github.com/gbdev/rgbds take care of it.