0% found this document useful (0 votes)
2 views

MP SemIV Lab Manual

The document is a laboratory manual for a Microprocessor course (CSL 404) at Shivajirao S. Jondhale College of Engineering. It outlines the vision and mission of the department, program educational objectives, and specific outcomes, along with a detailed list of experiments for students to perform in the lab. Each experiment includes aims, algorithms, and sample programs related to assembly language programming for the Intel 8086 processor.

Uploaded by

Karuna Sawant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

MP SemIV Lab Manual

The document is a laboratory manual for a Microprocessor course (CSL 404) at Shivajirao S. Jondhale College of Engineering. It outlines the vision and mission of the department, program educational objectives, and specific outcomes, along with a detailed list of experiments for students to perform in the lab. Each experiment includes aims, algorithms, and sample programs related to assembly language programming for the Intel 8086 processor.

Uploaded by

Karuna Sawant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Laboratory Manual

MICROPROCESSOR
Subject Code: CSL 404

Semester – IV

Prepared by
Prof. Samita Patil

Department of Computer Engineering


Shivajirao S. Jondhale College of Engineering,
Dombivli (E)
Affiliated to University of Mumbai
Shivajirao S Jondhale College of Engineering, Dombivli (E)

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 strength is to provide value based technical education to develop core


competencies and ethics for overall personality development.

Our endeavor is to impart in depth knowledge and versatility to meet the global
challenges.
Shivajirao S Jondhale College of Engineering, Dombivli (E)

Department of Computer Engineering


VISION
To impart quality technical education in the department of Computer Engineering for creating
competent and ethically strong engineers with capabilities of accepting new challenges.

MISSION

 Our efforts are dedicated to impart quality technical education to prepare


engineering graduates who excel in programming skills.
 Our strength is to serve society by producing globally competent professionals.
 Our endeavor is to provide all possible support to build strong teaching environment
to provide quality education in Computer Engineering.

PROGRAM EDUCATIONAL OBJECTIVES (PEOS)

 To prepare learners with a sound foundation in the mathematical, scientific and


Engineering fundamentals
 To develop among learners ability to formulate, analyze and solve engineering
problems in real life
 To encourage, motivate and prepare learners to inculcate professional and ethical
attitude for lifelong learning
 To prepare learner to become generalist engineers and for pursuing higher studies

Program Specific Outcomes (PSOs)

 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 :

1. To emphasize on use of Assembly language program.


2. To prepare students for advanced subjects like embedded system and IOT

Outcomes :

1. Use appropriate instructions to program microprocessor to perform various


task.
2. Develop the program in assembly/ mixed language for Intel 8086 processor.
3. Demonstrate the execution and debugging of assembly/ mixed language
program
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Microprocessor Lab(CSL404)
Semester – IV
List of experiment

Sr. No. Title of the Experiment Page No.

1 To study debugging commands. 1


2 WAP to add 2 8bit-numbers present at 0200H and 3
0201H and store at 0311H location using debugger
3 Write a Program to transfer content of memory block of 10 5
bytes starting from 0200H to new position 0300H using
debugger.

4 Write a Program to find smallest element from 8


content of memory blocks of 10 bytes starting from
0200H to and store smallest element at 0300H using
debugger.
5 WAP to count number of even elements present in memory 11
block of 10 bytes using debugger.
6 13
To study assembler and assembler directives.

7 WAP to arrange given numbers in ascending order using 15


TASM.
8 Write a program to reverse a string using TASM. 17
9 WAP to count number of A’s present in string of characters 19
using TASM.
10 Write 8086 Assembly program to find largest number from 22
given numbers using TASM.
Shivajirao S Jondhale College of Engineering, Dombivli (E)
Department of Computer Engineering

Microprocessor Lab(CSL404)
Experiments to LO Mapping

Experimen Title Prior References Mapped


t Number Concep LO
t
1 To study debugging commands Debugg T1,R1 LO1
er
2 WAP to add 2 8bit-numbers present at 0200H Debugg T1,R1 LO2
and 0201H and store at 0311H location using er
debugger.
3 Write a Program to transfer content of memory Debugg T1,R1 LO2
block of 10 bytes starting from 0200H to new er
position 0300H using debugger.

4 Write a Program to find smallest element from Debugg T1,R1,R2 LO2


content of memory blocks of 10 bytes starting er
from 0200H to and store smallest element at
0300H using debugger.
5 To study assembler and assembler directives. Study T1,R1,R2 LO1

6 WAP to count number of even elements present TASM T1,R1,R2 LO3


in memory block of 10 bytes using TASM.

7 WAP to arrange given numbers in ascending TASM T1,R1,R2 LO3


order using TASM.
8 Write a program to reverse a string using TASM TASM T1,R1,R2 LO3
9 WAP to count number of A’s present in string of TASM T1,R1,R2 LO3
characters using TASM
10 Write a Program to find largest element from TASM T1,R1,R2 LO3
content of memory blocks of 10 bytes using
TASM
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING

Experiment No: 1

Aim: To study Debugging commands.

Theory :

The debug is software designed by Microsoft. It is used to create environment of


8086 Microprocessor in the computer system. Computer system requires window
operating system (window 7 with 32 bit version or lower versions).

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>

It is used to unassemble program or part of the program. It displays Program


or part of the program in the following format

MP/Sem IV 1
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING

Address op code mnemonic operand


XXXX:YYYY

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>

It is used to execute program or part of the program which is present in code


segment from the starting-address to ending address. It displays the result if
it is present in the registers of the 8086 microprocessor.

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 2: Take first data at 0200 memory location.

Step 3: Add number with data at memory location 0201H.

Step 4 : Store result at 0300H memory location.

Step 5: Stop.

Program :

Memory address Label Instruction Comments

MOV AL, [0200] ; Take first data item into


Reg. AL
ADD AL, [0201]
; Add both data items
MOV [300], AL
; store result
HLT

; 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:

Conclusion : Thus we have studied a program of addition of two 8 bit numbers


present at given memory location

MP/Sem IV 4
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING

Experiment No: 3

Aim : Write a program to transfer contents of a memory block of 10 bytes, which


starts from memory location 200 H to new position from memory location 300 H
using degugger.

Algorithm:

Step 1: start.

Step 2 : take source pointer at 0200H memory location.

Step 3: Take destination pointer at 0300H memory location.

Step 4 : initialize counter.

Step 5: Take data from sourse pointer of register AL.

Step 6 : take data from destination pointer to register AL.

Step 7 : Increment source pointer.

Step 8: Decrement destination pointer.

Step 9 : Decrement pointer.

Step 10: Stop.

MP/Sem IV 5
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING

Program :

MOV SI, 200H

MOV DI, 300H

MOV CL, 0AH

MOV AL, [SI]

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:

Coclusion : Thus we have studied a program to transfer contents of a memory block


of 10 bytes, which starts from memory location 200 H to new position from memory
location 300 H.

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 1: Initialise source pointer at 200H memory location

Step 2: initialize counter.

Step3 : Take data from source pointer to register.

Step 4 : increment source pointer.

Step 5. :compare data of register and source pointer.

Step 6 : take data from source pointer to register.

Step 7: decrement counter.

Step 8: take data from source register and store the memory location300H.

Step 9 : Stop.

Program :

MOV SI, 200H

MOV CL, 09H

MOV AL, [SI]

BACK INC SI

CMP AL, [SI]

JC XYZ

MP/Sem IV 8
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING

MOV AL, [SI]

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:

Step 1: Initialize data counter.

Step 2: Take data from offset array to source pointer.

Step 3 : Initialize CL as 01H

Initialize BL as 0AH

Initialize DL as 00H

Step 4 : Take data from source pointer into register.

Step 5 : Rotate right shift.

Step 6: increment DL.

Step 7: increment BL.

Step 8: Take data from DL to even number.

Step 9: increment 21H.

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 :

Conclusion : thus we have studied a program to count number of even elements


present in a memory block of 10 bytes.

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:

The Assembler is software. It is used to convert Assembly language


program into machine equivalent program, which can be then executed by the
microprocessor.

Steps to use Assembler

1. First user has to select proper path c:\tasm\bin:>


2. Enter assembly language program using editor. Save the program with
.asm extension.
3. Then program has to be assemble using command
Tasm/zi name of the file.asm
4. It displays if any grammatical error is present in the program.
5. If error is present then user has to correct the program.
6. After correcting the program. The program should be linked with
following command
Tlink/v name of the file
7. Next step is to open the program using a debugger using following
command
Td name of the file.exe
8. Execute the program in single step mode so that user can observe the
contents of the registers as well as variables

Assembler directives:

Assembler directives are the instructions to the assembler, linker and


loader. These are used to give direction to the assembler to perform the task of
assembly process. They indicate how operand or section of a program is to be
processed by the assembler. Assembler directives are not translated in to machine
codes.

Common assembler directives are

MP/Sem IV 13
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING

1. SEGMENT and ENDS: Segment directive is used to indicate the


beginning of a logical segment. The Ends directive indicates the end of the
segment.

2. ASSUME: The Assume directive assigns a logical segment to a physical


segment. It tells the assembler which address will be in the segment
register at execution time.

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

5. OFFSET: It is an operator which tells assembler to determine the offset of


a variable from the starting address of a segment. It is used to load the
offset of a variable into a register.
Example: MOV SI, OFFSET XYZ

Conclusion:

I studied Turbo assembler by entering and executing a test program.

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 :

Conclusion: Thus we have studied program to arrange given numbers in


ascending order:

MP/Sem IV 16
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING

Experiment No : 8

Aim : Write a program to reverse a string of 10 characters using TASM.


.

Algorithm :

Step 1: Start.

Step 2: Initialize data segment and extra segment.

Step 3: Load effective address of sarray into SI.

Step 4: Load effective address of darray into DI.

Step 5: add DL and 04H.

Step 6: Clear the direction flag.

Step7 : Load String.

Step 8: Set direction flag.

Step 9: Store string

Step 10: Take data from 4CH to AH

Step 11: Increment SI and DI.

Step 12: Stop.

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:

Conclusion: Thus we have studied a program to reverse a string of 10 characters.

MP/Sem IV 18
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING

Experiment No : 9

Aim : Write a program to count number of A’s present in a string of 05 character


using TASM.

Algorithm:

Step 1: Start.

Step 2: Initialize extra segment.

Step 3: Take data into DI from offset array

Step 4: Clear direction flag.

Step 5: Initialize AL with ‘A’.

Step 6: Compare AL with bytes in extra segment.

Step 7: Increment DL.

Step 8:Decrement CL.

Step 9: Take data into C from DL.

Step 10: Take 4CH into register AH.

Step 11: increment 21H.

Step 12: Stop

MP/Sem IV 19
SHIVAJIRAO S. JONDHALE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING

Program : data segment

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 :

.Conclusion : Hence, we have studies a program to count number of A’s present


in a string of 05 characters.

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:

Thus we have studied 8086 Assembly program to find largest


number from given numbers using TASM.

MP/Sem IV 23

You might also like