MP SemIV Lab Manual
MP SemIV Lab Manual
MICROPROCESSOR
Subject Code: CSL 404
Semester – IV
Prepared by
Prof. Samita Patil
VISION
To impart high quality technical education for creating competent and ethically
strong professionals with capabilities of accepting new challenges.
MISSION
Our efforts are dedicated to impart high quality technical education based on a
balanced program of instructions and practical experiences.
Our endeavor is to impart in depth knowledge and versatility to meet the global
challenges.
Shivajirao S Jondhale College of Engineering, Dombivli (E)
MISSION
Ability to use software methodology and various software tools for developing system
programs, high quality web apps and solutions to complex real world problems.
Ability to identify and use suitable data structure and analyze the various algorithm
for given problem from different domains
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering
Microprocessor Lab(CSL404)
Semester – IV
Objectives :
Outcomes :
Microprocessor Lab(CSL404)
Semester – IV
List of experiment
Microprocessor Lab(CSL404)
Experiments to LO Mapping
Experiment No: 1
Theory :
Using this software user can enter the assembly language program for 8086
microprocessor, data and execute the program. Result of the program can be
checked if these are present in the registers of microprocessor or memory.
Commands:
1. a (Assemble)
Format: -a starting-address <enter>
It is used to enter the assembly language program in the code segment from
the given offset address.
2. e (Enter)
Format: -e memory-address <enter>
It is used to edit (modify) or enter data in the data segment from the given
offset address. To enter data in consecutive memory locations use space bar
for next memory location.
3. u (Un assemble)
Format: -u starting-address ending-address <enter>
MP/Sem IV 1
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
It displays program or part of the program along with its operation codes
from the staring-address to ending-address.
4. g (go)
Format: -g=staring –address ending-address <enter>
5. d (Dump or display)
Format: -d starting-address ending address <enter>
It is used to display the contents of the memory locations from the given
address range. Hence it can be used to display result of the program if it is
stored in the memory.
Conclusion:
All above commands of debug are studied by entering test program, data,
executing program and displaying the contents of 8086 registers as well as contents
of memory locations.
MP/Sem IV 2
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Experiment No : 2
Aim : Write a program to add two 8 bit numbers present at memory location
0200H and 0201H and store the result at memory location 0300H using degugger.
Algorithm :
Step 1 : Start.
Step 5: Stop.
Program :
; stop
Data: [0200] = 25 H
[0201] = 50 H
MP/Sem IV 3
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Result: [0300] = 75 H
Output:
MP/Sem IV 4
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Experiment No: 3
Algorithm:
Step 1: start.
MP/Sem IV 5
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Program :
MOV [DI], AL
INC SI
BACK INC DI
DEC CL
JNZ BACK
HLT
Data: [0200] = 11 H
[0201] = 22 H
[0202] = 33 H
[0203] = 44 H
[0204] = 55 H
[0205] = 66 H
[0206] = 77 H
[0207] = 88 H
[0208] = 99 H
[0209] = AA H
MP/Sem IV 6
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Result: [0300] = 11 H
[0301] = 22 H
[0302] = 33 H
[0303] = 44 H
[0304] = 55 H
[0305] = 66 H
[0306] = 77 H
[0307] = 88 H
[0308] = 99 H
[0309] = AA H
Output:
MP/Sem IV 7
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Experiment No : 4
Aim : Write a program to find out smallest element from the contents of a
memory block of 10 bytes, which starts from memory location 200 H. Store
smallest element at memory location 300 H using degugger.
Algorithm :
Step 8: take data from source register and store the memory location300H.
Step 9 : Stop.
Program :
BACK INC SI
JC XYZ
MP/Sem IV 8
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
XYZ DEC CL
JNZ BACK
MOV [300], AL
HLT
Data: [0200] = 55 H
[0201] = 22 H
[0202] = 33 H
[0203] = 44 H
[0204] = 55 H
[0205] = 66 H
[0206] = 77 H
[0207] = 88 H
[0208] = 99 H
[0209] = AA H
Result: [0300] = 22 H
MP/Sem IV 9
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Output :
Conclusion : Thus we have studied a program to find out smallest element from
the contents of a memory block of 10 bytes, which starts from memory location
200 H. Store smallest element at memory location 300 H.
MP/Sem IV 10
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Experiment No : 5
Aim : Write a program to count number of even elements present in a memory block
of 10 bytes using debugger.
Algorithm:
Initialize BL as 0AH
Initialize DL as 00H
Step 10 : Stop.
Program :
data segment
array db 20h, 30h, 40h, 03h, 77h, 20h, a1h, 66h 40h, ffh
evenno db ?
data ends
code segment
assume cs:code, ds:data
start: mov ax, data
MP/Sem IV 11
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
mov ds, ax
mov si, offset array
mov cl, 01h
mov bl, 0ah
mov dl,00h
back: mov al, [si]
ror al, cl
jc xyz
inc dl
xyz: dec bl
jnz back
mov evenno, dl
mov ah, 4ch
int 21h
code ends
end start
Output :
MP/Sem IV 12
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Experiment No : 6
Aim : Study of Assembler and its directives
Theory:
Assembler directives:
MP/Sem IV 13
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
3. DB, DW, DD, DQ and DT: These are used to define different types of
variables or set aside one or more storage locations of corresponding data
type in the memory. These are known as data control directives.
DB – Define byte DW – define word DD – define double
word
DQ – define quad word DT – define ten byte
4. DUP: It is used to initialize several locations and assign values to this
location.
Example: TABLE DW 10 dup (0)
It reserves an array of 10 words with 0 in each location and named as
TABLE
Conclusion:
MP/Sem IV 14
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Experiment No : 7
Aim : . Write a program to arrange given numbers in ascending order using
TASM.
Algorithm :
Step 1: Start.
Step2 : Initialize data segment.
Step 3: Take 05H and atore in CL.
Take 10 H and store in CH
Step 4 : Load effective address of array into register box.
Step 5 : Take data into array from address of register box.
Step 6: Increment BX.
Step 7: Compare AL with [BX]
Step 8: Decrement BX
Step 9: Decrement CL.
Step 10 : increment 21H.
Step 11 : Stop.
Program :
data segment
array db 10h,05h,29h,15h,20h
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov ch,10h
mov cl,05h
lea bx,array
L2: mov al,[bx]
inc bx
MP/Sem IV 15
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
cmp al,[bx]
jc L1
mov ah,[bx]
mov [bx],al
dec bx
mov [bx],ah
inc bx
L1: dec cl
jnz L2
dec ch
mov ah,4ch
int 21h
code ends
end start
Output :
MP/Sem IV 16
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Experiment No : 8
Algorithm :
Step 1: Start.
Program :
data segment
ARR1 db "abcde"
ARR2 db 5 DUP(?)
cnt dw 5h
data ends
code segment
assume cs: code, ds: data
start: MOV AX, DATA
MP/Sem IV 17
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
MOV DS, AX
MOV ES, AX
MOV SI, OFFSET ARR1
MOV dI, OFFSET ARR2
MOV CX, CNT
ADD DI, 04H
agn: CLD
LODSB
STD
STOSB
LOOP agn
MOV AH,4CH
INT 21H
code ends
end start
Output:
MP/Sem IV 18
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Experiment No : 9
Algorithm:
Step 1: Start.
MP/Sem IV 19
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
ARR1 DB "MADAN"
c DB ?
data ends
code segment
ASSUME CS:code, ES:data
START: MOV AX, data
MOV ES, AX
MOV DI, offset ARR1
MOV CL, 05h
MOV DL,00h
CLD
MOV AL, "A"
back: SCASB
JNZ abc
INC DL
abc: DEC CL
JNZ back
MOV C, DL
MOV AH,4CH
INT 21H
code ends
end START
MP/Sem IV 20
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Output :
MP/Sem IV 21
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Experiment No : 10
Aim: Write 8086 Assembly program to find largest number from given numbers
using TASM.
Program :
MP/Sem IV 22
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING
Output:
Conclusion:
MP/Sem IV 23