You are on page 1of 44

Lab Manual

of
Microprocessor and
Assembly Language
Programming
(3330705)
Semester – 3

Government Polytechnic, Ahmedabad


Programme :Diploma in Computer Engineering

Name of Student :_________________________________________________________________

Enrollment No :_________________________________________________________________________

Shift : Morning / Evening Division : ______________

GTU Term Date :_____ / _____ / _________ To _____ / ______ / __________


GOVERNMENT POLYTECHNIC, AHMEDABAD
COMPUTER ENGINEERING DEPARTMENT

CERTIFICATE

This is to certify that Mr./Miss ________________________________________

of Diploma in Computer Engineering, Semester ____________, Enrollment No.

___________________ has satisfactorily completed his/her term work in ___________

__________________________________ for the term ending in __________________.

Date of Submission: - _____/_____/________

V.N.Soni Prof.H.J.Baldaniya

(Course in Charge) Head of the Department

Index
Sr.No Page
Practical Name Date Grade Sign
. No
Study various simulators.
1
Implement program to transfer content from one
2
register to another register.
Implement program to swap contents of two different
3
registers.
Implement a program to copy the content of the one
4
memory location to other.
Implement program to swap contents of two different
5
memory locations.
Implement program to perform addition of two 8 bit
6
numbers.
Implement program to perform subtraction of two 8
7
bit numbers.
8 Implement program to add two 16 bit numbers.
9 Implement program to subtract two 16 bit numbers.
10 Implement program to perform BCD addition.
Implement a program to mask the lower four bits of
11
content of the memory location.
Implement a program to set higher four bits of
12
content of the memory location to 1.
Implement a program to perform AND operation of
13
two numbers stored in different memory locations.
Implement a program to perform OR operation of
14
two numbers stored in memory.
Implement a program to perform XOR of two
15
numbers stored in memory.
Implement a program to compare two numbers using
16 CMP and CPI. And examine the content of flag
register.
Implement program to perform 8 bit subtraction
17
using 1’s Complement and 2’s Complement.
Implement a program to find sum of integers from 0
18
to 9.
Implement a program to find sum of integers stored
19 in memory block. First memory location stored size
of array. Store result in register.
Implement a program to count no of 1’s in
20
Accumulator stored result in register B.
Implement a program to check whether a number is
even or odd which is stored in memory location. store
21
00H in register B if number is even else store FFH in
register B.
Implement a program to count no of zero, positive
22 and negative values in given block of data, stored
result in B,C,D registers.
Implement a program to find minimum from two
23 numbers stored in memory.Store minimum number
in register B.
Implement a program to move a block of the memory
24 starts at location 2050h to 4050h. the length of block
is given in register B.
Implement a program to multiply two numbers.
25
26 Implement program to find factorial of given number.
Implement a program to reverse a given array using
stack operation push and pop. Size of array is stored
27
in register C. Store reverse string in different memory
area.
Implement a program to count from 00H to FFH with
28
1 ms delay. with crystal frequency is 5MHz.
Implement a program to count from 00 to 99 (BCD)
29
with 1 ms delay. with clock frequency is 2MHz.
Implement a program to count from 00H to FFH and
30 FFH to 00H repeatedly with 1 ms delay. with crystal
frequency is 5MHz.

Practical-1: Study various simulators.


Overview :

(1) Main Screen of 8085 Simulator


(2) Menu Bar
(3) Save the Mnemonics Code
(4) Editor
(5) Assembler
(6) Registers
(7) Memory
(8) Interfacing Devices
(9) Flag Registers
(10) Interrupt Signals
(11) Example

 8085 microprocessor first time represented by INTEL in 1976.


 8085 Simulator is very useful application for educators. It provides graphical user interface to
user. It is use for to study about 8085 microprocessor which is based on 8-bit.
 8085 Simulator contains Compiler, Assembler, Dissembler, Debugger.

(1) Main Screen of 8085 Simulator :

Main Layout of 8085 Simulator is shown above.

 On the main screen of 8085 Simulator, Menu Bar, Editor, Assembler, Registers, Flags
Registers, Memory, Devices.

(2) Menu Bar :


 File


 Edit 


 
 

  Tools

 Settings

 Simulation
 Subroutine

 View

 Load Sample Program


 Help

(3) Save the Mnemonics Code :


To save the mnemonics code in your System, Press [CTRL + S] or go to File menu and
click on Save the Assembly Language Code.

The file will save with .asm extension. ASM means Assembler language Simulation
Module.

(4) Editor :

Here, editor is use for to write mnemonics code. We write here instruction like LDA, STA,
MVI, MOV, HLT, ADD etc.

(5) Assembler :
After clicking on Assemble, we will redirect to Assembler window. Here,
we get information of the register address, mnemonics code execution, Hex Code, Bytes
occupied by instruction, M-Cycles, T-States.

(6) Register :

There are 8-bit Registers for data,called A, B, C, D, E, H, and L. Six of


these registers can also be used in pairs to hold 16-bit quantities. These pairs are BC, DE and
HL, where B, D and H hold the MSB of the value and C, E and L hold the LSB, respectively.

(7) Memory :
The range of memory in 8085 microprocessor is 0000 H to FFFF H. There are 3
options for memory to be show :
1) Show entire memory content
2) Show only loaded memory location
3) Show directly to specified memory location.

(8) Interfacing Devices :


Interfacing Devices communicate with connected peripherals to the system. They
managed the I/O interface between microprocessor and peripheral device.
8085 pins used for interfacing with other devices :
A8 – A15 (High Address Bus)
AD0 – AD7 (Low Address/Data Bus)
ALE – Address Latch Enable
RD – Read Memory
WR – Write Memory
Ready – Use to send signal to I/O device for new data etc…

(9) Flag Resister :


The flag register in 8085 is an 8-bit register which contains 5 bit positions. - These
five flags are of 1bit.

 S->Sign Flag Register


 Z ->Zero Flag Register
 AC ->Auxiliary Carry Flag Register
 P ->Parity Flag Register
 CY - > Carry Flag Register

(10) Interrupt Signals:

Microprocessor based system the interrupts are used for data transfer between the
peripheral devices and the microprocessor. FIVE types of interrupt in 8085 microprocessor:

 TRAP
 INTR
 RST 5.5
 RST 6.5
 RST 7.5

(11) Example
Here, I take an example :
Addition of two register’s values and store it in another register.
1. We write mnemonics code in editor->Assembler.
2. Then click on Assemble option which is given at the bottom right corner.
3. After clicking on Assemble, we will redirect to Assembler window.
4. Here, we get information of the register address, mnemonics code execution, Hex Code,
Bytes occupied by instruction, M-Cycles, T-States.
5. Then click on “Run all at a Time” for execute out mnemonics code.

Then the output will come as shown below...

OUTPUT ->
Explanation :

 We store 20H in Register B using MVI B,20H.


 Then Store 40H in Register D using MVI D,40H.
 After that, We ADD B Register’s value in Accumulator by using ADD B instruction.
 Then we use ADD D instruction to add D Register’s value with old accumulator
value.
 Then, we move Accumulator’s value to H Register using MOV H, A instruction.
 Then we assign 00H Register to Accumulator using MVI A,00H instruction.
 Then stop the process using HLT.

Practical-2: Implement program to transfer content


from one register to another register.
Program Code:

Output:

Teacher’s Signature______________ Grade_______________

Practical-3: Implement program to swap contents of


two different registers.

Program Code:
Output:

Teacher’s Signature______________ Grade_______________

Practical-4: Implement a program to copy the content


of the one memory location to other.

Program Code:
Output:

Teacher’s Signature______________ Grade_______________

Practical-5: Implement program to swap contents of


two different memory locations.

Program Code:
Output:

Teacher’s Signature______________ Grade_______________

Practical-6: Implement program to perform addition of


two 8 bit numbers.

Program Code:
Output:

Teacher’s Signature______________ Grade_______________

Practical-7: Implement program to perform subtraction


of two 8 bit numbers.

Program Code:
Output:

Teacher’s Signature______________ Grade_______________

Practical-8: Implement program to add two 16 bit


numbers.

Program Code:
Output:

Teacher’s Signature______________ Grade_______________

Practical-9: Implement program to subtract two 16 bit


numbers.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-10: Implement program to perform BCD


addition.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-11: Implement a program to mask the lower


four bits of content of the memory location.
Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-12: Implement a program to set higher four


bits of content of the memory location to 1.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-13: Implement a program to perform AND


operation of two numbers stored in different memory
locations.
Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-14: Implement a program to perform OR


operation of two numbers stored in memory.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-15: Implement a program to perform XOR of


two numbers stored in memory.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-16: Implement a program to compare two


numbers using CMP and CPI. And examine the content
of flag register.
Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-17: Implement program to perform 8 bit


subtraction using 1’s Complement and 2’s Complement.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-18: Implement a program to find sum of


integers from 0 to 9.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-19: Implement a program to find sum of


integers stored in memory block. First memory location
stored size of array. Store result in register.
Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-20: Implement a program to count no of 1’s in


Accumulator stored result in register B.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-21: Implement a program to check whether a


number is even or odd which is stored in memory
location. stored 00H in register B if number is even else
store FFH in register B.
Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-22: Implement a program to count no of zero,


positive and negative values in given block of data,
stored result in B,C,D registers.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-23: Implement a program to find minimum


from two numbers stored in memory.Store minimum
number in register B.
Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-24: Implement a program to move a block of


the memory starts at location 2050h to 4050h. the length
of block is given in register B.
Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-25: Implement a program to multiply two


numbers.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-26: Implement program to find factorial of


given number.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-27: Implement a program to reverse a given


array using stack operation push and pop. Array ends
with 0Dh. Store reverse string in different memory area.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-28: Implement a program to count from 00H


to FFH with 1 ms delay. with crystal frequency is
5MHz.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-29: Implement a program to count from 00 to


99 (BCD) with 1 ms delay. with clock frequency is
2MHz.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

Practical-30: Implement a program to count from 00H


to FFH and FFH to 00H repeatedly with 1 ms delay.
with crystal frequency is 5MHz.

Program Code:

Output:
Teacher’s Signature______________ Grade_______________

You might also like