Exercise-7(Searching)
Exercise-7(Searching)
School of Engineering
IV Semester 2018-19
Exercise-
7
Write an ALP to search a key element in a list of
numbers
Exercise Descrip-
tionof instructions to which a name is given. Each time
A macro is a group
a macro is called in a program, the assembler will replace the macro
name with the group of instructions.
Advantages:
1.Macro reduces the amount of repetitive coding
2.Program becomes more readable and simple
3.Execution time is less as compared to calling procedures
4.Reduces errors caused by repetitive coding
Defining macros:
Before using macros, we have to define them. Macros are defined be-
fore the definition of segments. Assembler provides two directives for
defining a macro: MACRO and ENDM.MACRO directive informs the
assembler the beginning of a macro. The general form is:
Macro_name MACRO argument1, argument2, …
Arguments are optional. ENDM informs the assembler the end of the
macro. Its general form is : ENDM
Exercise Description---Con-
tinued
Macros are just like procedures, but not really. Macros look like procedures,
but they exist only until your code is compiled, after compilation all macros
are replaced with real instructions. If you declared a macro and never used
it in your code, compiler will simply ignore it.