Professional Documents
Culture Documents
3
Instructor: Muhammad Wasim
Semester: BS – IV
Objective:
1. Understanding of Assembler
2. Steps of Assembly Programs
3. Learning of Assembler Programs
4. Learning of Linker Program
5. Learning of Running a program
6. Learning of Directives
Signature: _____________________________
1
Lab No 3
Introduction:
Assembler & Debug
Assembler Debug
- Very versatile - Not so versatile
- Good on long program - Good on short program
- More program overload - Low program overloaded
- Not easy to run - Easy to run
- Isolated from the machine - Close to the machine
To Run a Program:
C:\Assembler>myprog
2
Lab No 3
The Turbo Debug mode is use for debug a program, this mode trace (F7) and run (F9) a program
after debugging.
Directives:
Directives are information for assembler or compiler that will not be executed.
Examples of Directives:
END (Not executed, message to assembler about end of program not to compiler).
ENDS (End of segment).
PROC (Start of procedure (subroutine))
ENDP (End of procedure (subroutine), same as in C {----------------})
Types of Procedures:
1. Far A program can store at any memory location. It store in other segments. It means the
procedure with exit other than the calling program.
2. Near The program will store in the same segment. It means the procedure with exit
only the calling program.
Main abc
Proc Far Proc Near
------------ -------------
------------ -------------
------------ -------------
call abc Return
It occupies more memory space It occupies less memory space (Large Program)
(Small Program)
NOTE: Data segment and extra segment are initialized at the beginning of program, but
code segment and stack segment registers are initialized by OS.
Instruction:
Instructions are information for microprocessor which will be executed (always executed).
Services:
01 Key board input with echo
08 Echo off
02 Display console/Monitor
05 Printer out put
09 String out put (DX register load offset of string to be printed)
Note: All services required AH register.
Trace the out put of the following program.
Program 1 Out Put
; To Print an ASCCII no. on computer screen
;***************************************
3
Lab No 3
***
DATA_SEG SEGMENT
DATA_SEG ENDS
CODE_SEG SEGMENT
ASSUME CS:CODE_SEG, DS:DATA_SEG
CODE_SEG ENDS
END MAIN