02 Lab Manual - Program Using Macro
02 Lab Manual - Program Using Macro
EXPERIMENT NO: 03
TITLE: Program using Macro
AIM: Write 8086 Assembly Language Program to display personal information, using Macro.
Hardware /Software Requirement:PC, Windows XP/7, 8086 Assembler, Editor.
Objectives:
1. To study concept of Macro.
2. To apply concept of macro in program
Background:
Macros:
Usually, a macro, like a procedure, is defined for performing a specific function. When the repeated
group of instructions is too short or not appropriate to be written as a procedure, then macro is
preferably used. A macro is a group of instructions the user brackets and gives a name to it. Each
time a macro is called in the program, the assembler will insert the defined group of instructions in
place of the call. Replacing the macro with the instructions it represents is commonly called
expanding the macro. Using a macro avoids the overhead time involved in calling and returning
from a procedure.
Syntax:
Name MACRO [parameters]
<Instructions>
ENDM
Pre-Lab Task:
Required interrupt functions:-
Interrupt No.
INT 21H
Function
Description
AH= 09H
AH= 4CH
Instruction
Description
LEA
Program Template:
DISPLAY MACRO MSG
; Write down set of instructions to display a message
ENDM
DATA SEGMENT
; Declare various messages to display personal information
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS: DATA
MOV AX, DATA
MOV DS, AX
; Initialization of DS register
; Call macro some number of times, to display all required personal information
MOV AH, 4CH
INT 21H
CODE ENDS
END
; To terminate a program
In-Lab Task:
Students will execute a complete program as per following algorithm and will write down
the Result/Output.
Algorithm
1. Define a macro to display the message.
2. Declare various messages containing personal information.
3. Call Macro to display the messages.
4. Terminate the program and return back to OS.
Result/Output: - ____________________________________________________
__________________________________________________________________
__________________________________________________________________
Post-Lab Task:
Outcomes:
Students should understand1. The concept of Macro
2. Passing parameter to a Macro
3. Comparison with Procedure
Reference Books:1. John E. Uffenbeck , The 8086/ 8088 Family: Design, Programming and Interfacing, Pearson.
2. Douglas V. Hall Microprocessor and Interfacing Programming and Hardware Pearson.
3. Peter Abel, IBM PC Assembly Language and Programming Pearson.
NameofTeacher
Sign