Beruflich Dokumente
Kultur Dokumente
GRADE
SIGNAIM:
PROCEDURE:
1] org 100h
call m1 //it calls the procedure m1
mov ax,2
ret
m1 proc
mov bx,3 //initialize bx = 3
ret //returns to mov
m1 ENDP
ret
2] org 100h
mov al,1
mov bl,2
call m2
Write
call m2
call m2
call m2
ret
m2 proc
mul bl
ret
m2 endp
ret
MACRO:
Ret
PROCEDURE
MACRO
Due to
machine
required.
repeated generation
code more memory
of
is
When you want to use a procedure you When you want to use a macro, you can just type
should use CALL instruction, for its name. For example:
example:
MyMacro
CALL MyProc
You should use stack or any general
purpose registers to pass parameters To pass parameters to macro, you can
just type them after the macro name.
to procedure.
For example:
MyMacro 1, 2, 3
To mark the end of the macro ENDM To mark the end of the procedure, you
directive is enough.
should type the name of the procedure
before the ENDP directive.
Procedure is used for big codes.
Macro is used for small chunks of code.
Parameters can be passed in register
memory location or stack.
Procedure is located at some specific
address in memory, and if you use the
same procedure 100 times, the CPU
will transfer control to this part of the
memory.