call
Pushes the return address onto the stack and jumps to a 16-bit address, either always or only when a flag condition is met.
17/10 cycles: 17 when it calls, 10 when it does not
Used in
- call, ret and passing valuesZ80 assembly
- Ports: in and outZ80 assembly
- Interrupts: im, ei, di and haltZ80 assembly
- A subroutine with its arguments in registersZ80 assembly
- Stack arguments and a stack frameZ80 assembly
- Recursion: factorial and FibonacciZ80 assembly
- Print a stringZ80 assembly
- Read two numbers and print their sumZ80 assembly
- Print a number in any base without helpZ80 assembly
- The snake gameZ80 assembly
SZHP/VNC ––––––
- Changes no flag
Forms
call3 bytes · 17 cyclesThe current PC value plus three is pushed onto the stack, then is loaded with
nnnn.-
If the condition
ccis true, the current PC value plus three is pushed onto the stack, then is loaded withnnnn.
Pseudo-instructions
Other spellings the assembler accepts; each form shows the instruction it becomes.
-
If the condition
ccis true, the current PC value plus three is pushed onto the stack, then is loaded withnnnn.
Operands
nnnn- A 16-bit value or address,
0to65535, written as a number or label.(nnnn)accesses memory at that address. More cc- A flag condition:
nz(zero flag clear,Z = 0),z(zero flag set,Z = 1),nc(carry flag clear,C = 0),c(carry flag set,C = 1),po(parity/overflow flag clear,P/V = 0),pe(parity/overflow flag set,P/V = 1),p(sign flag clear,S = 0),m(sign flag set,S = 1),nv(alias forpo,P/V = 0) orv(alias forpe,P/V = 1). Herectests the carry flag; it does not name thecregister. More
.org 0x8000
call nz, target
halt
target: ret