1st and 2nd Lab - 8085

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 25

8085

Microprocessor

Dr. Manju Khurana


Assistant Professor, CSED
TIET, Patiala
[email protected]
Introduction to Microprocessor Based Systems Design

LAB ASSIGNMENT (8085)


1. Introduction of 8085-microprocessor kit and steps for execution on the kit.
2. Familiarity with 8085-microprocessor kit.
i) Write a program to store 8-bit data into one register and then copy that to all registers.
ii) Write a program for addition of two 8-bit numbers.
iii) Write a program to add 8-bit numbers using direct and indirect addressing mode.
iv) Write a program to add 16-bit numbers using direct and indirect addressing mode.
v) Write a program to 8-bit numbers using carry. (using JNC instruction).
vi) Write a program to find 1’s complement and 2’s complement of 8-bit number.
3. Write a program for the sum of series of numbers.
4. Write a program for data transfer from memory block B1 to memory block B2.
5. Write a program for multiply two 8-bit numbers.
6. Write a program to add ten 8-bit numbers. Assume the numbers are stored in 8500-8509. Store the result in 850A and 850B memory address.
7. Write a program to find the negative numbers in a block of data.
8. Write a program to count the number of one's in a number.
9. Write a program to arrange numbers in Ascending order.
10. Calculate the sum of series of even numbers.
11. Write an assembly language program to verify how many bytes are present in a given set, which resembles 10101101 in 8085.
12. Write an assembly language program to find the numbers of even parity in ten consecutive memory locations in 8085.
13. Write an assembly language program to convert a BCD number into its equivalent binary in 8085.
14. Write an assembly language program for exchange the contents of memory location.
15. Write a program to find the largest number in an array of 10 elements.

UCS617: Microprocessor Based Systems Design 2


Introduction to Microprocessor Based Systems Design

Steps to perform on the Intel kit as well as on Simulator

🞇 Press Reset
🞇 Press Examine Memory
🞇 Enter starting address
🞇 Press Next
🞇 Enter opcodes by subsequently pressing Next
🞇 Press Reset
🞇 Press Go
🞇 Enter starting address of the program to compile
🞇 Press EXEC/FILL
🞇 Press Reset
🞇 Press Examine Memory
🞇 Enter Output Address
🞇 Press Next
UCS617: Microprocessor Based Systems Design
3
Introduction to Microprocessor Based Systems Design

Vikas Simulator Screenshot

UCS617: Microprocessor Based Systems Design


4
Introduction to Microprocessor Based Systems Design

Program No. 2.1: Write a program to store 8-bit data into one register and then copy
that to all registers.
Code Memory Location Opcode
MVI A, 48 8000, 8001 3E, 48
MOV B, A 8002 47
MOV C, A 8003 4F
MOV D, A 8004 57
MOV E, A 8005 5F
MOV H, A 8006 67
MOV L, A 8007 6F
RST 5 8008 EF

Output –

A – 48, B – 48, C – 48, D – 48, E – 48, H – 48, L – 48


UCS617: Microprocessor Based Systems Design 5
Introduction to Microprocessor Based Systems Design

Program No. 2.2: Write a program for addition of two 8-bit numbers.

Code Memory Location Opcode


MVI A, 48 8000, 8001 3E, 48
MVI B, 48 8002, 8003 06, 48
ADD B 8004 80
STA 8500 8005, 8006, 8007 32, 00, 85
RST 5 8008 EF

Output –

[ 8500 ] – 90

UCS617: Microprocessor Based Systems Design 6


Introduction to Microprocessor Based Systems Design

Program No. 2.3: Write a program to add 8-bit numbers using direct and indirect
addressing mode.

Code Memory Location Opcode Code Memory Location Opcode


LDA 8500 8000, 8001, 8002 3A, 00, 85 LXI H, 8500 8000, 8001, 8002 21, 00, 85
MOV B, A 8003 47 MOV A, M 8003 7E
LDA 8501 8004, 8005, 8006 3A, 01, 85 INX H 8004 23
ADD B 8007 80 ADD M 8005 86
STA 8502 8008, 8009, 800A 32, 02, 85 INX H 8006 23
RST 5 800B EF MOV M, A 8007 77
RST 5 8008 EF

Input - [ 8500 ] – 88, [ 8501 ] – 88 Input - [ 8500 ] – 88, [ 8501 ] – 88


Output - [ 8502 ] – 10 Output – A – 10
UCS617: Microprocessor Based Systems Design 7
8085
Microprocessor

Dr. Manju Khurana


Assistant Professor, CSED
TIET, Patiala
[email protected]
Introduction to Microprocessor Based Systems Design

Program No. 2.4: Write a program to add 16-bit numbers using direct and indirect
addressing mode.
Code Memory Location Opcode

Code Memory Location Opcode LXI B, 8500 8000, 8001, 8002 01, 00, 85

LDAX B 8003 0A
LHLD 8500 8000, 8001, 8002 2A, 00, 85 MOV D, A 8004 57

XCHG 8003 EB INX B 8005 03

LDAX B 8006 0A
LHLD 8502 8004, 8005, 8006 2A, 02, 85
ADD D 8007 82

DAD D 8007 19 STA 8504 8008, 8009, 800A 32, 04, 85

INX B 800B 03
SHLD 8504 8008, 8009, 800A 22, 04, 85
LDAX B 800C 0A
RST 5 800B EF MOV D, A 800D 57

INX B 800E 03

LDAX B 800F 0A

ADC D 8010 8A

Input - [ 8500 ] – 48, [ 8501 ] – 48,


STA 8505 8011, 8012, 8013 32, 05, 85

RST 5 8014 EF

[ 8502 ] – 48, [ 8503 ] – 48 Input - [ 8500 ] – 34, [ 8501 ] – 48,


Output - [ 8504 ] – 90, [ 8505 ] – 90 [ 8502 ] – 54, [ 8503 ] – 78
Output – [ 8504 ] – 7C [ 8505 ] – CC 9
Introduction to Microprocessor Based Systems Design

Program No. 2.5: Write a program to add 8-bit numbers using carry. (using JNC
instruction).
Code

MVI C, 00

LXI H, 8500

MOV A, M

INX H

ADD M
Input - [ 8500 ] – 88, [ 8501 ] – 88
JNC Next
Output - [ 8502 ] – 10, [ 8503 ] – 01
INR C

Next: INX H

MOV M, A

INX H

MOV M, C

RST 5

UCS617: Microprocessor Based Systems Design 10


Introduction to Microprocessor Based Systems Design

Program No. 2.6: Write a program to find 1’s complement and 2’s complement of a 8-bit
number.
Code Code

LDA 8500H LDA 8500H

CMA
CMA
INR A
STA 8501H
STA 8501H
RST 5
RST 5

Input - [ 8500 ] – 48 Input - [ 8500 ] – 48


Output - [ 8501 ] – B7 Output - [ 8501 ] – B8

UCS617: Microprocessor Based Systems Design 11


Introduction to Microprocessor Based Systems Design

Program No. 3: Write a program for the sum of series of numbers.


Code
LDA 8500H
MOV C, A
SUB A
LXI H, 8501H
Back: ADD M
INX H
DCR C
JNZ Back
STA 8600H
RST 5

Input - [8500] – 04, [8501] – 9A, [8502] – 52, [8503] – 89, [8504] – 3E
Result – 1B3 Output - [8600] – B3 UCS617: Microprocessor Based Systems Design 12
Introduction to Microprocessor Based Systems Design

Program No. 4: Write a program for data transfer from memory block B1 to memory
block B2.
Code
MVI C, 0AH
LXI H, 8500H
LXI D, 8600H
Back: MOV A, M
STAX D
INX H
INX D
DCR C
JNZ Back
RST 5

Input - [8500] – 01, [8501] – 02, [8502] – 03,……… [8509] – 0A


Output - [8600] – 01, [8601] – 02, [8602] – 03,……… [8609] – 0A
UCS617: Microprocessor Based Systems Design 13
Introduction to Microprocessor Based Systems Design

Program No. 5: Write a program for multiply two 8-bit numbers.


Code
LDA 8500H
MOV E, A
MVI D, 00
LDA 8501H
MOV C, A
LXI H, 0000H
Back: DAD D
DCR C
JNZ Back
SHLD 8600H
RST 5

Input - [8500] – B2, [8501] – 03


Result – B2 + B2 + B2 = 0216 H Output - [8600] – 16, [8601] – 02
UCS617: Microprocessor Based Systems Design 14
Introduction to Microprocessor Based Systems Design

Program No. 14: Write an ALP for exchange the contents of memory location.

Code
LDA 8500H
MOV B, A
LDA 8600H
STA 8500H
MOV A, B
STA 8600H
RST 5

Input - [8500] – 48, [8600] – 88


Output - [8500] – 88, [8600] – 48

UCS617: Microprocessor Based Systems Design 15


Introduction to Microprocessor Based Systems Design

Program No. 15: Write a program to find the largest number in an array of 10 elements.
Code
MVI B, 09
LXI H, 8500H
MOV A, M
INX H
Back: CMP M
JNC Next
MOV A, M
Next: INX H
DCR B
JNZ Back
STA 850AH
RST 5

Input - [8500] – 01, [8501] – 02, ………………………. [8509] – 0A


Output - [850A] – 0A
UCS617: Microprocessor Based Systems Design 16
Introduction to Microprocessor Based Systems Design

Program No. 6: Write a program to add ten 8-bit numbers. Assume the numbers are stored in 8500-
8509. Store the result in 850A and 850B memory address.
Code

MVI C, 00
MVI B, 09
LXI H, 8500H Input - [8500] – FF, [8501] – 01, [8502] –
MOV A, M 01, [8503] – 01, [8504] – 01, [8505] – 01,
Back: INX H
[8506] – 01, [8507] – 01, [8508] – 01,
ADD M
JNC Next
[8509] – 01
INR C
Next: DCR B Output - [850A] – 08, [850B] – 01
JNZ Back
INX H
MOV M, A
INX H
MOV M, C
RST 5

UCS617: Microprocessor Based Systems Design 17


Introduction to Microprocessor Based Systems Design

ProgramCode
No. 7: Write a program to find the negative numbers in a block of data.
LDA 8500H
MOV C, A
MVI B, 00
LXI H, 8501H
Back: MOV A, M
ANI 80H
JZ Skip
INR B
Skip: INX H
DCR C
JNZ Back
MOV A, B
STA 8600H
RST 5

Input - [8500] – 04, [8501] – 56, [8502] – A9, [8503] – 73, [8504] – 82
Result = 02 Output - [8600] – 02 UCS617: Microprocessor Based Systems Design 18
Introduction to Microprocessor Based Systems Design

Program No. 8: Write a program to count the number of one's in a number.

Code

LDA 8500H
MVI B, 08
MVI D, 00
Loop1: RLC
JNC Loop2
INR D
Loop2: DCR B
JNZ Loop1
MOV A, D
STA 8600H
RST 5

Input - [8500] – 25 0010 0101


Output - [8600] – 03 UCS617: Microprocessor Based Systems Design 19
Introduction to Microprocessor Based Systems Design

Program No. 9: Write a program to arrange numbers in Ascending order.


Code MOV B, M
LXI H, 8500H MOV M , A
MOV C, M DCX H
DCR C MOV M, B
Repeat: MOV D, C INX H
LXI H, 8501H
Skip: DCR D
Loop: MOV A, M
JNZ Loop
INX H
DCR C
CMP M
JNZ Repeat
JC Skip
RST5

Input - [8500] – 05, [8501] – 05, [8502] – 04, [8503] – 03, [8504] – 02, [8505] – 01
Input - [8500] – 05, [8501] – 01, [8502] – 02, [8503] – 03, [8504] – 04, [8505] – 05
UCS617: Microprocessor Based Systems Design 20
Introduction to Microprocessor Based Systems Design

Program No. 10: Write a program to calculate the sum of series of even numbers.
Code

LDA 8500H
MOV C, A
MVI B, 00
LXI H, 8501H
Input - [8500] – 04, [8501] – 20,
Back: MOV A, M [8502] – 15 , [8503] – 13, [8504] –
ANI 01 22
JNZ Skip
Output - [8600] – 42
MOV A, B
ADD M
MOV B, A
Skip: INX H
DCR C
JNZ Back
STA 8600H
RST 5

UCS617: Microprocessor Based Systems Design 21


Introduction to Microprocessor Based Systems Design

Program No. 11: Write an assembly language program to verify how many bytes are
present in a given set, which resembles 10101101 in 8085.
Code

MVI B, 0A
MVI D, AD
MVI C, 00 Input - [8500] – AD, [8501] – 01,
LXI H, 8500H [8502] – 01, [8503] – 01, [8504] –
Back: MOV A, M
01, [8505] – 01, [8506] – 01,
CMP D
JNZ Next
[8507] – 01, [8508] – 01, [8509] –
INR C 01
Next: INX H
DCR B
Output - [8600] – 01
JNZ Back
MOV A, C
STA 8600H
RST 5

UCS617: Microprocessor Based Systems Design 22


Introduction to Microprocessor Based Systems Design

Program No. 12: Write an assembly language program to find the numbers of even
parity in ten consecutive memory locations in 8085.
Code

MVI B, 0A
MVI C, 00
LXI H, 8500H Input - [8500] – 01, [8501] – 03,
Back: MOV A, M [8502] – 01, [8503] – 03, [8504] –
ANI FF
01, [8505] – 03, [8506] – 01,
JPO Next
INR C
[8507] – 03, [8508] – 01, [8509] –
Next: INX H 03
DCR B
JNZ Back
Output - [8600] – 05
MOV A, C
STA 8600H
RST 5

UCS617: Microprocessor Based Systems Design 23


Introduction to Microprocessor Based Systems Design

Program No. 13: Write an assembly language program to convert a BCD number into
its equivalent binary in 8085.
Code RRC
LDA 8500H MOV B, A
MOV B, A XRA A
ANI 0F MVI D, 0A
MOV C, A Sum: ADD D
MOV A, B DCR B
ANI F0 JNZ Sum
RRC ADD C
RRC STA 8600H
RRC RST 5

Input - [8500] – 67
Input - [8600] – 43
UCS617: Microprocessor Based Systems Design 24

You might also like