1st and 2nd Lab - 8085
1st and 2nd Lab - 8085
1st and 2nd Lab - 8085
Microprocessor
🞇 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
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 –
Program No. 2.2: Write a program for addition of two 8-bit numbers.
Output –
[ 8500 ] – 90
Program No. 2.3: Write a program to add 8-bit numbers using direct and indirect
addressing mode.
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
LDAX B 8006 0A
LHLD 8502 8004, 8005, 8006 2A, 02, 85
ADD D 8007 82
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
RST 5 8014 EF
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
Program No. 2.6: Write a program to find 1’s complement and 2’s complement of a 8-bit
number.
Code Code
CMA
CMA
INR A
STA 8501H
STA 8501H
RST 5
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
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
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
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
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
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] – 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
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
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
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