CALL
The call instruction saves the current Program Counter (PC) value on the stack and then jumps to the address of the subroutine. The return (RET) instruction is used at the end of the subroutine, which pops the saved PC value from the stack and jumps back to that location.
Note that JP provides a similar operation in that it changes the flow of execution, except jp does not use a return address while CALL will include this on the stack.
| Instruction | Description | Opcode |
|---|---|---|
| CALL {address} | No condition | CD {????} |
| CALL Z, {address} | Zero flag (Z) is set | CC {????} |
| CALL NZ, {address} | Zero flag (Z) is not set | C4 {????} |
| CALL C, {address} | Carry flag (C) is set | DC {????} |
| CALL NC, {address} | Carry flag (C) is not set | D4 {????} |
| CALL M, {address} | Minus flag (S) is set (minus sign) | EC {????} |
| CALL P, {address} | Plus flag (S) is not set (plus sign) | E4 {????} |
| CALL PO, {address} | Parity odd or has overflow flag (P) is set | FC {????} |
| CALL PE, {address} | Parity even or had no overflow flag (P) is not set | F4 {????} |