call/ret
The call instructions push the program counter value of the next instruction onto the stack and set the program counter to the given address. The return instruction pops the program counter value and sets the program counter to it.
Prefixing these instructions with prefix_a16
results in undefined behavior.
(The program counter value would be written to or read from IO devices.)
Instruction | Encoding | Semantics | Cycles |
---|---|---|---|
call imm16 | 00 001 001 imm16 | see below | 7 |
call pi | 00 010 001 | see below | 5 |
ret | 00 011 001 | see below | 4 |
Semantics of call imm16
Let denote the address of the first byte after this instruction and denote the 16 bit program counter register. is the 16 bit stack pointer register.
The microcode of this instruction uses the 16 bit shadow register internally.
Semantics of call pi
Let denote the address of the first byte after this instruction and denote the 16 bit program counter register. is the 16 bit stack pointer register and is the 16 bit page-index register.
Semantics of ret
denotes the 16 bit program counter register and the 16 bit stack pointer register.