-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPart 1
58 lines (43 loc) · 960 Bytes
/
Part 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Description
1. Macros are defined with STARTMACRO and ended with ENDMACRO.
2. The argument in macro definition is preceded by '%' symbol.
3. There is no such indentation rule in defining macros.
4. Comments in macros can be defined by using '//'.
5. Macro can be called anywhere in the .asm program with parameters or without parameters and after expansion of whole definition get substituted.
General Syntax of Macro Definition
STARTMACRO macroname
instruction1
//comment1
instruction2
STARTMACRO macroname1
..
..
ENDMACRO
ENDMACRO
Without Parameters
STARTMACRO Sum
mov eax,1
mov ebx,2
add eax,ebx
push eax
call printf
ENDMACRO
Call:- Sum
Positional Parameters
STARTMACRO Sum %a,%b
mov eax,a
mov ebx,b
add eax,ebx
push eax
call printf
ENDMACRO
Call:- Sum 1,2
Keyword Parameters
STARTMACRO Sum %a,%b
mov eax,[a]
mov ebx,[b]
add eax,ebx
push eax
call printf
ENDMACRO
Call:- Sum %b=1,%a=2