Procedures LAb
Procedures LAb
language
USING EMU8086
Objectives
language.
procedures.
Introduction to Procedures
procedure_name proc
1. Procedure definition
; procedure body 2. Procedure call
ret 3. Procedure return
procedure_name endp
How CALL and RET Work
; jump to IP
Stack Operations for CALL and RET
•CALL:
print_message proc
lea dx, msg
mov ah, 09h
int 21h
ret
print_message endp
Passing Parameters to Procedures
instructions).
Example: Passing Parameters via Stack
•main pushes two numbers onto the stack and calls add_numbers.
•add_numbers accesses parameters via the stack frame and adds them.