RST

Invoke a Reset

RST performs a reset. Specifically it calls a routine at one of 8 addresses at the base of memory. It is the equivalent of performing a CALL to that address except the RST instruction is just 1 byte compared to 3 for CALL and is slightly faster.

\((SP-1) \longleftarrow PC_h \\(SP-2) \longleftarrow PC_l \\SP \longleftarrow SP-2 \\PC_h \longleftarrow 0\\PC_l \longleftarrow b*8\)

76543210
11b111
Bits
Valueb
0000
1001
2010
3011
4100
5101
6110
7111

Issues with RST instructions

Assemblers use different conventions for the RST instruction. Some use numbers 0…7 whilst others use the address of the code invoked. They are all equivalent, as there are just 8 possible instruction codes.

Address OP Code RST Instruction Action
0000 C7 RST 0 Reset machine
0008 CF RST 1 RST 8 Operating System Specific
0010 D7 RST 2 RST $10 RST 16
0018 DF RST 3 RST $18 RST 24
0020 E7 RST 4 RST $20 RST 32
0028 EF RST 5 RST $28 RST 40
0030 F7 RST 6 RST $30 RST 48
0038 FF RST 7 RST $38 RST 56 Interrupt Handler in Mode 1
Flags Affected
None.
Opcode Matrix
Reset routine
01234567
RST
RST 0
C7111
RST 1
CF111
RST 2
D7111
RST 3
DF111
RST 4
E7111
RST 5
EF111
RST 6
F7111
RST 7
FF111
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Special