8085 Microprocessor Practical Guide
8085 Microprocessor Practical Guide
FOR
XII (S.Y.J.C)
COMPUTER
SCIENCE
BIFOCAL DEPARTMENT
INDEX
COMPUTER SCIENCE (PAPER-II)
SR. PAGE
TITLE
NO. NO.
01. Introduction to 8085 microprocessor and its kit. 3
02. Addition of two 8-bit hex numbers. 5
03. Addition of two 8-bit BCD numbers. 7
04. Addition of block of data using DAA instruction. 9
05. Addition of block of data using DAD instruction. 11
06. Subtraction of two 8-bit hex numbers. 13
07. Multiplication of two 1-byte hex numbers. 15
08. Division of two 1-byte hex numbers. 17
09. Transfer a block of data in reverse order. 19
10. Exchange contents of two data blocks. 21
11. Searching first occurrence of data in data block. 24
12. Counting the occurrence of data in data block. 26
13. Counting number of Zeros in 1-byte hex number. 28
14. Counting Even and Odd numbers in data block. 30
15. Searching Smallest as well as Greatest in data block. 32
16. Separation of nibbles and multiplication of these nibbles. 34
17. Checking whether a 4-byte hex number is Palindrome or not. 37
18. Conversion of 1-byte decimal number to hex number. 39
19. Conversion of 1-byte hex number to ASCII value. 41
20. Accept two hex numbers using keyboard subroutine. 43
21. Addition using keyboard monitor subroutines. 45
Expt. No. 1: Introduction to 8085 microprocessor and its kit.
Microprocessor is a multipurpose, programmable logic device that accepts digital data as input,
processes it according to instructions stored in its memory, and provides results as output.
Assembly Language
It is a low level programming language for microprocessors, microcontrollers, etc. Each
microprocessor has its own set of instructions. Instructions are in machine language (0 & 1) also
known as binary digits (bits). It is very difficult to write a program in machine language, so
special codes/ symbolic code for each instruction are developed which is known as mnemonics.
SET: Allows the user to examine & modify the contents of RAM and only examination of
contents is possible in case of EPROM.
INR: Increments memory address presently displayed in the address field of display.
DCR: Decrements memory address presently displayed in the address field of display.
REG: Allows the user to examine contents of CPU registers & modify them if necessary.
GO: Allows the user to load the program counter by the desired memory address which is the
starting address of the program that is to be executed.
CODE: Used for selecting one of the coded subroutines in the monitor.
STEP: Allows the user to execute the program in single step mode or breakpoint mode.
SAVE: Used for saving the contents of memory onto an audio cassette.
LOAD: Used for loading the program from audio cassette back to memory in RAM area.
U1..U4: These keys are user definable function keys. The functions of these keys can be defined
by the user, by loading the appropriate memory locations with vectors pointing to user
subroutines.
General instructions to enter data and program, execute the program and
check the output
1. Press SET to enter the starting address of the program.
2. Press INR to enter hex code in the memory location.
3. Press INR again to go to next memory location and enter the hex code.
4. Go on doing step 3 till last hex code is entered.
5. Press INR to save the last hex code and press RESET.
6. Press SET to enter the starting address of the data input.
7. Press INR to enter data contents in the memory location.
8. Press INR again to go to next memory location and enter the data contents.
9. Go on doing step 8 till last data content is entered.
10. Press INR to save the last data content and press RESET.
11. Press GO to enter the starting address of the program.
12. Press EXEC to get “FrIEnd” on the display indicating successful execution.
13. Press REG followed by A, to check reg. A contents after execution.
14. Press INR to check reg. B contents and so on till SPL.
15. Press RESET.
16. Press SET to enter the starting address of the data output.
17. Press INR to check data contents in the memory location.
18. After checking all the output data, press RESET to get display as “FrIEnd”
Expt. No. 2: Addition of two 8-bit hex numbers.
Aim:
a) Write a program that adds two 1-byte hexadecimal numbers stored in consecutive memory
locations starting from D000H. Store the 2-byte result in consecutive memory locations starting
from D002H beginning with lower order byte.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B* C D* E* F H L
0D 00 00 00 00 00 D0 01
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 0 0 0 0 0
Expt. No. 3: Addition of two 8-bit BCD numbers.
Aim:
a) Write a program that adds two 1-byte BCD numbers stored in consecutive memory locations
starting from D000H. Store the 2-byte result in consecutive memory locations starting from
D032H beginning with lower order byte.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B* C D* E* F H L
00 00 00 00 00 10 D0 01
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 1 0 0 0 0
Expt. No. 4: Addition of block of data using DAA instruction.
a) Write a program that add the BCD contents of a block memory. Block length in HEX not
exceeding 63 H=(99)10 is stored at C0FF and starting address of block is C100. Store the BCD
sum as result starting from memory location C060.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
GENERAL REGISTERS
A B C D E F H L
00 00 00 00 00 54 C1 05
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 5: Addition of block of data using DAD instruction.
Aim:
a) Write a program that adds contents of a block of memory using DAD instruction. Block length
is stored at D000H and block starting address is D001H. Store the 2-byte result below the end
of the block.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C D E F H L
00 00 02 00 12 54 D0 07
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 6: Subtraction of two 8-bit hex numbers.
Aim:
a) Write a program that subtracts the number stored in D001H from the number stored in D000H.
Store the absolute difference in memory location D050H as a result.
b) Enter the program on the microprocessor kit.
c) Execute the program for a positive as well as a negative difference. Write the contents of data
memory locations before and after execution and also the bit contents of all the five flags
individually. Verify the results.
Program:
GENERAL REGISTERS
A B* C* D* E* F H L
04 00 00 00 00 10 D0 01
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 1 0 0 0 0
GENERAL REGISTERS
A B* C* D* E* F H L
04 00 00 00 00 00 D0 01
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 0 0 0 0 0
Aim:
a) Write a program that multiplies two 1-byte hexadecimal numbers stored in consecutive
memory locations starting from D000H. Store the 2-byte result in consecutive memory
locations starting from D002H beginning with lower order byte.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C D* E* F H L
2D 00 00 00 00 54 D0 03
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 8: Division of two 8-bit hex numbers.
Aim:
a) Write a program that divides two 1-byte hexadecimal numbers where the dividend is stored in
D000H and the divisor is stored in D001H. Store the quotient and the remainder in next
consecutive memory locations respectively.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C* D* E* F H L
01 04 00 00 00 81 D0 03
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
1 0 0 0 0 0 0 1
Expt. No. 9: Transfer a block of data in reverse order.
Aim:
a) A block of data is stored from memory locations starting from D001H to D005H. Write a
program to transfer the data in reverse order to memory locations starting from D051H to
D055H.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C* D E F H L
04 00 00 D0 51 54 D0 06
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 10: Exchange contents of two data blocks.
Aim:
a) A block of data is stored from memory locations starting from D001H to D005H. Another
block of data of same length is stored in memory locations starting from D051H to
[Link] a program to exchange the contents of these two blocks.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C D E F H L
05 05 00 D0 56 54 D0 06
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 11: Searching first occurrence of data in data block.
Aim:
a) A block of data is stored in memory locations from D001H. The length of the block is stored
at D000H. Write a program that searches for the first occurance of data byte ABH in the given
block. Store the address of this occurance in HL pair. If the no. is not found, HL pair must
contain FFFFH.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C* D* E* F H L
AB 03 00 00 00 54 D0 03
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
When required data is not found
GENERAL REGISTERS
A B C* D* E* F H L
AB 00 00 00 00 54 FF FF
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 12: Counting the occurrence of data in data block.
Aim:
a) A block of data is stored from memory locations starting from D001H. The length of the
block is stored at D000H. Write a program that counts the occurrence of the number ABH in
the given block. Store the result in D050H.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C D* E* F H L
02 00 02 00 00 54 D0 05
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 13: Counting number of Zeros in 1-byte hex number.
Aim:
a) An 8-bit number is stored in memory location D000H. Write a program that counts the zeros
in the given number. Store the count in memory location D050H.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C D* E* F H* L*
03 03 00 00 00 54 FF FE
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 14: Counting Even and Odd numbers in data block.
Aim:
a) A block of data is stored from memory locations starting from D001H to D00AH. Write a
program to find the number of odd as well as even numbers in the given block. Store the
results immediately after the end of the block.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B* C D E* F H L
05 01 00 05 00 14 D0 0C
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 1 0 1 0 0
Expt. No. 15: Searching Smallest as well as Greatest in data block.
Aim:
a) A block of data is stored from memory locations starting from D001H to D00AH. Write a
program to find the smallest as well as the greatest number from the block using linear search.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C D* E F H L
08 0A 01 00 00 54 D0 0C
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 16: Separation of nibbles and multiplication of these nibbles.
Aim:
a) Write a program that separates two nibbles of a number stored in D000H and stores the same
in memory locations D001H and D002H. The program must also multiply the two nibbles and
store the product in D003H.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C D* E* F H L
08 24 00 00 00 54 D0 03
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 17: Checking whether a 4-byte hex number is Palindrome or not.
Aim:
a) A 4-byte Hex number beginning with lower order byte is stored in memory locationsD000H.
Write a program that checks whether the given number considered in hex, is palindrome or
not. If the number is palindrome then memory location D050H must contain 00H or else FFH.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C D E F H L
00 BA 0F F0 AB 54 D0 03
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
GENERAL REGISTERS
A B C D E F H L
FF 0B 0F F0 AB A4 D0 03
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
1 0 0 0 0 1 0 0
Expt. No. 18: Conversion of 1-byte decimal number to hex number.
Aim:
a) A decimal number is stored in memory location [Link] a program to convert this
number to its Hex equivalent, and store the result in memory location D001H.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C D E F H L
17 23 00 02 03 04 D0 01
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 0 0 1 0 0
Expt. No. 19: Conversion of 1-byte hex number to ASCII value.
Aim:
b) A hexadecimal number is stored in memory location [Link] a program to convert this
number to its ASCII equivalent, and store the result in memory location D001H and D002H.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C* D* E* F H L
35 45 00 00 38 04 D0 02
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 0 0 1 0 0
Expt. No. 20: Accept two hex numbers using keyboard subroutine.
Aim:
a) Write a program that uses keyboard subroutine having starting address 02E7H to accept two
digits from keyboard. Store them separately in consecutive memory locations D000H &
D001H. Store them as one byte result at memory location D050H and use monitor subroutine
036EH to display the same.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program:
GENERAL REGISTERS
A B C D E* F H* L*
56 D0 01 50 00 00 FF FE
(* indicates register not used in program. Data after execution for these registers can change)
FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 0 0 0 0 0
Expt. No. 21: Addition using keyboard monitor subroutines.
Aim:
b) Write a program for using microprocessor kit as calculator that would accept two digits from
keyboard using keyboard subroutine having starting address 02E7H. Add them and display
one byte result using monitor subroutine 036EH.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.
Program: