(SP-1) <- PCh, (SP-2) <- PCl, PCh <- $00, PCl <- p)
RST
p
b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
---|---|---|---|---|---|---|---|
1 | 1 | t | 1 | 1 | 1 |
The current Program Counter (PC) contents are pushed onto the external memory stack, and the Page 0 memory location assigned by operand p is loaded to the PC. Program execution then begins with the op code in the address now pointed to by PC. The push is performed by first decrementing the contents of the Stack Pointer (SP), loading the high-order byte of PC to the memory address now pointed to by SP, decrementing SP again, and loading the low-order byte of PC to the address now pointed to by SP. The Restart instruction allows for a jump to one of eight addresses indicated in the following table. The operand p is assembled to the object code using the corresponding t state.
Because all addresses are stored in Page 0 of memory, the high-order byte of PC is loaded with $00. The number selected from the p column of the table is loaded to the low-order byte of PC.
p | t | Hex |
---|---|---|
$00 | 000 | $C7 |
$08 | 001 | $CF |
$10 | 010 | $D7 |
$18 | 011 | $DF |
$20 | 100 | $E7 |
$28 | 101 | $EF |
$30 | 110 | $F7 |
$38 | 111 | $FF |
If the Program Counter contains $15B3h , then upon the execution of
RST $18
(object code 1101111 ) instruction, the PC contains $0018 as the address of the next fetched op code.