Nintendo GAME BOY Programming Manual page 101

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

POP
qq
Pops contents from the memory stack and into register pair qq.
First the contents of memory specified by the contents of SP are loaded in the lower portion of qq. Next,
the contents of SP are incremented by 1 and the contents of the memory they specify are loaded in the
upper portion of qq. The contents of SP are automatically incremented by 2.
Example: When SP = FFFCh, (FFFCh) = 5Fh, and (FFFDh) = 3Ch,
POP BC ; B ← 3Ch, C ← 5Fh, SP ← FFFEh
LDHL
SP,
The 8-bit operand e is added to SP and the result is stored in HL.
Flag
Z: Reset
H: Set if there is a carry from bit 11; otherwise reset.
N: Reset
CY: Set if there is a carry from bit 15; otherwise reset.
Example: When SP = 0xFFF8,
LDHL SP, 2 ; HL ← 0xFFFA, CY ← 0, H ← 0, N ← 0, Z ← 0
LD (nn),
SP
Stores the lower byte of SP at address nn specified by the 16-bit immediate operand nn and the upper
byte of SP at address nn + 1.
Example: When SP = FFF8h,
LD (C100h) , SP ;
qqL ← (SP)
qqH ← (SP+1)
SP ← SP+2
HL ← SP+e
e
(nn) ← SP
L
(nnH) ← SP
C100h ← F8h
C101h← FFh
CY
H
--
--
CY
H
*
*
Varies with instruction results
*
CY
H
--
--
H
101
Chapter 4: CPU Instruction Set
N
Z
CYCL
7 6
--
--
3
11
N
Z
CYCL
7 6
0
0
3
11
e = -128 to +127
N
Z
CYCL
7 6
--
--
5
00
L-ADRS
H-ADRS
5 4 3
2 1 0
qq0
001
5 4 3
2 1 0
111
000
e
5 4 3
2 1 0
001
000
n
n

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents