/opcodes/rst

Control Flow // RST (ReSTart)

Description

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 00h. The number selected from the p column of the table is loaded to the low-order byte of PC. pt 00h 000 08h 001 10h 010 18h 011 20h 100 28h 101 30h 110 38h 111

Example

If the Program Counter contains 15B3h, then upon the execution of an RST 18h (object code 1101111) instruction, the PC contains 0018h as the address of the next fetched op code. Input and Output Group The following input and output group instructions are each described in this section. Simply click to jump to an instruction’s description to learn more. IN A, (n) – see page 295 IN r (C) – see page 296 INI – see page 298 INIR – see page 300 IND – see page 302 INDR – see page 304 OUT (n), A – see page 306 OUT (C), r – see page 307 OUTI – see page 309 OTIR – see page 311 OUTD – see page 313 OTDR – see page 315

Opcodes