Responsibilities of a called function, Igure, Rame – Zilog Z80380 User Manual
Page 66: Layout
Advertising

Function Calls
Run Time Environment
4–2
UM004001-COR1103
F
IGURE
4-1. F
RAME
LAYOUT
R
ESPONSIBILITIES
OF
A
C
ALLED
F
UNCTION
A called function must perform the following tasks.
1. Push the frame pointer (IX) onto the stack.
2. Allocate the local frame.
3. Execute the code for the function.
4. If the function returns a scalar value it is placed in the accumulator (
HL
register for scalars
greater than eight bits and the
A
register for eight-bit scalars).
5. Deallocate the local frame.
6. Restore the caller’s frame pointer.
7. Return.
ParameterN
.
.
.
Parameter 1
Parameter 0
Return address
Caller’s frame pointer (IX)
Locals
Temporaries
Low Address
Stack Pointer
Frame Pointer
Run Time Stack
High Address
Advertising