Professional Documents
Culture Documents
Assembler Directives
Instruction Set
Assembler
statements:
1. Executable statements- These are the
statements to be executed by the
processor. It consists of the entire
instruction set of 8086.
2. Assembler directives- These are the
statements that direct the assembler to do
something. As the name says, it directs the
Directives
assembler to do a task.
• The specialty of these statements
is that they are effective only
during the assembly of a program
but they do not generate any code
that is machine executable.
1. Model Small:
Simplified segment directives. Initialize a memory model, using the .MODEL directive, before declaring
any segment.
Directives
• PROC: The PROC directive is used to identify the start of a procedure. The
term near or far is used to specify the type of the procedure.
• ENDP – End of Procedure
• END - End Program
• ENDS - End Segment
• Macro: To identify macro definition
• MEND- End of Macro definition
1. MOV AH,09 ;TO DISPLAY MSG ON SCREEN
LEAD DX, MSG
INT 21H
Important 2. MOV AH,01 ;ENTER CHAR FROM USER
Interrupt and INT 21H
Functions RETURN: AL: ASCII VALUE OF ENTERED KEY
3. MOV AH,02 ;DISPLAY CHAR
MOV DL,AL
INT 21H
Differentiate between Near and Far Procedure
Near Call Far Call
A near call refers a procedure which is in the same A Far call refers a procedure which is in different code
code segment. segment
It is also called Intra-segment call. It is also called Inter-segment call
A Near Call replaces the old IP with new IP A FAR replaces CS & IP with new CS & IP.
It uses keyword near for calling procedure. It uses keyword far for calling procedure.
Less stack locations are required More stack locations are required.
Macros Procedure
Every time macro call, it is replaced by definition Written once and call many times
Program takes up more memory space. Program takes up comparatively less memory space.
Difference No overhead of using stack for transferring control Overhead of using stack for transferring control
Between Macros
and Procedure
Execution is fast Execution is comparatively slow.
Macros are used when repeated group of Procedure is used when repeated group of
instruction is too short. instructions is quite large.
Questions?
• Define Assembler Directives. List and explain various assembler
directives.
• Differentiate between Macros and Procedure. Also write when to use
Macros and When to use procedure in the program.
• Write ALP to convert ASCII to BCD or BCD to ASCII.
• Apply macros and procedure in the program to design calculator using
ALP.
Any Query?
• Thank you.