Nintendo GAME BOY Programming Manual page 121

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

RST
Pushes the current value of the PC to the memory stack and loads to the PC the page 0 memory
addresses provided by operand t.
Then next instruction is fetched from the address specified by the new content of PC.
With the push, the content of the SP is decremented by 1, and the higher-order byte of the PC is loaded
in the memory address specified by the new SP value. The value of the SP is then again decremented
by 1, and the lower-order byte of the PC is loaded in the memory address specified by that value of the
SP.
The RST instruction can be used to jump to 1 of 8 addresses.
Because all of the addresses are held in page 0 memory, 0x00 is loaded in the higher-order byte of the
PC, and the value of P is loaded in the lower-order byte.
The relation between the t codes and P are as follows.
Operand
0
1
2
3
4
5
6
7
Example:
Address
8000h
8001h
(SP - 1) ← PC
t
(SP - 2) ← PC
SP ← SP - 2
← 0 PC
PC
H
t
(PC
)
H
00h
000
00h
001
00h
010
00h
011
00h
100
00h
101
00h
110
00h
111
RST
1
;
Pushes 8001h to the stack ,
and jumps to 0008h.
CY
H
--
--
H
L
← P
L
P (PC
)
L
00h
08h
10h
18h
20h
28h
30h
38h
121
Chapter 4: CPU Instruction Set
N
Z
CYCL
7 6
--
--
4
11
5 4 3
2 1 0
t
111

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents