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

IMP APY microprocessor and interface important

The document contains a series of assembly language programs for the 8085 microprocessor, covering various operations such as loading registers, transferring data, arithmetic operations, and manipulating memory. Each program is presented with its corresponding assembly code and a brief description of its functionality. The programs include tasks like adding, subtracting, sorting arrays, and handling BCD numbers.

Uploaded by

Crystal
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)
6 views

IMP APY microprocessor and interface important

The document contains a series of assembly language programs for the 8085 microprocessor, covering various operations such as loading registers, transferring data, arithmetic operations, and manipulating memory. Each program is presented with its corresponding assembly code and a brief description of its functionality. The programs include tasks like adding, subtracting, sorting arrays, and handling BCD numbers.

Uploaded by

Crystal
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/ 32

Programs With Solutions

1. Write Assembly language program to load register B with data 14H, register C with
FFH, register D with 29H and register E with 67H.

MVI B ,
14h MVI C ,
FFH MVI D ,
29H MVI E ,
67H Hlt

OUTPUT :
2.Write an Assembly language program to transfer data from register B to C

MOV C,B
Hlt

OUTPUT :

2|Page
3. Write an Assembly language program to store data of register B into memory location
2050H.
LXI H ,
2050H MOV M,B
Hlt

3|Page
4. Write an Assembly language program which directly store data 56H into memory
location 2050H.
LXI H , 2050H
MVI M , 56H
hlt

4|Page
5. Write an Assembly language program for exchanging two 8-bit numbers stored in
memory locations 2050H and 2051H.
MVI A, 02H
STA 2050H
MVI A,03H
STA 2051H
LDA 2050H
MOV B,A
LDA 2051H
STA 2050H
MOV A,B
STA 2051H
Hlt

5|Page
6. Write an Assembly language program to interchange 16-bit data stored in register
BC and DE without XCHG instruction.
MVI B,02h
STA 2050H
MVI D,03H
STA 2051H
LDA 2053H
MOV A,B
MOV B,D
MOV D,A
Hlt

6|Page
7. Write an Assembly language program to interchange 16-bit data stored in register
BC and DE with XCHG instruction.
MVI D,02h
STA 2050H
MVI H,03H
STA 2051H
XCHG
Hlt

7|Page
8. Write an Assembly language program to store the content of B and C registers on
the stack

MVI B,02h
STA 2050H
MVI C,02h
STA 2051H
PUSH B
Hlt

8|Page
9. Write an Assembly language program to delete (make it 00H) data byte stored at
location mentioned in DE pair

MVI D,02h
STA 2050H
MOV D,A
hlt

9|Page
10. Write an Assembly language program to add two numbers stored at locations
2050H and 2051H. Store result in location 2052H.

lxi h, 2050h
mov a, m
lxi h, 2051h
mov b, m
add b
lxi h, 2052h
mov m, a
hlt

10 | P a g e
11. Write an Assembly language program to subtract 8- bit data stored at location
2050H from data stored at 2051H and store result at 2052H

lxi h, 2050h
mov a, m
lxi h, 2051h
mov b, m
sub b
lxi h, 2052h
mov m, a
hlt

11 | P a g e
12. Write 8085 Assembly language program to add two 16 bit numbers stored in
memory.

lxi h, 2050h
mov b, m
lxi h, 2051h
mov c, m
lxi h, 2052h
mov d, m
lxi h, 2053h
mov e, m
mov a,c
add e
lxi h, 2055h
mov m, a
mov a,b
adc d
lxi h, 2054h
mov m, a
hlt

12 | P a g e
13. Write 8085 Assembly language program to find the number of 1’s binary
representation of given 8 bit number.

mvi b, 34h
mvi c, 20h
mvi e, 05h
mov a, b
ora c
ana e
mov d, a
hlt

13 | P a g e
14. Implement the Boolean equation D= (B+C).E, where B, C, D and E represents
data in various register of 8085

lxi h, 2050h
mov a, m
inx h
mov b, m
mvi c, 00h
add b
daa
jnc skip
inr c
skip: inx h
mov m, a
inx h
mov m, c
hlt

14 | P a g e
15. Write an 8085 assembly language program to add two decimal numbers using
DAA instruction.

LXI H , 2050H
MOV A, M
INX H
MOV B,M
ADD B
DAA ;
JNC skpi
INR C
skpi : INXH ;
MOV M,A
INX H
MOV M,C
HLT

15 | P a g e
16. Write an 8085 assembly language program to find the minimum from two 8 bit
numbers

lxi h, 2050h
mov a, m
lxi h, 2051h
mov b ,m
lxi h, 2052h
cmp b
jz equal
jc lesser
mov m, b
hlt
equal: mov m, a
hlt
lesser: mov m, b
hlt

16 | P a g e
17. Write an 8085 program to copy block of five numbers starting from 2001H to
location starting from 3001H.

mvi b, 5h
lxi d, 3001h
lxi h, 2001h
move: mov a, m
stax d
inx d
inx h
dcr b
mov a, b
cpi 0h
jz quit
jmp move
quit: nop
hlt

17 | P a g e
18. An Array of ten data bytes is stored on memory locations 2100H onwards. Write
an 8085 assembly language program to find largest number and store it on memory
location 2200H.

lxi h, 2001h
mvi b, ah
check: mov a, m
cmp c
jnc max
back: inx h
dcr b
mov a, b
cpi 00h
jz quit
jmp check
max: mov c, a
jmp back
quit: lxi h, 2200h
mov m, c
hlt

18 | P a g e
19. Write an 8085 assembly language program to add block of 8 bit numbers.

LXI H , 1100H
LXI B , 1110H
LXI D , 1120H
BACK: LDAX B
ADD M
STAX D
INX H
INX B
INX D
MOV A,L
JNZ BACK
HLT

19 | P a g e
20. Write an 8085 assembly language program to count the length of string ended
with 0DH starting from location 2050H (Store length in register B).

Sum B
lxi h, 2050h
loop: mov a, m
cpi 0dh
jz quit
inx h
inr b
jmp loop
quit: nop
hlt

20 | P a g e
21. An Array of ten numbers is stored from memory location 2000H onwards. Write
an assembly language program to separate out and store the EVEN and ODD
numbers on new Array from 2100H and 2200H respectively.

lxi h, 2000h
lxi b, 2100h
lxi d, 2200h
loop: mov a, m
ani 1h
jz even
mov a, m
stax d
inx d
back: nop
mov a, l
cpi 9h
jz quit
inx h
jmp loop
even: nop
mov a, m–
stax b
inx b
jmp back
quit: nop
hlt

21 | P a g e
22. An array of ten bytes is stored on memory locations 2100H onwards. Write an
8085 assembly language program to find the bytes having complemented nibbles (e.g.
2DH,3CH,78H etc.) and store them on new array starting from memory locations
2200H onwards.

lxi h, 2100h
lxi d, 2200h

loop: mov a, m
ani 0Fh
mov c, a
mov a, m
ani F0h
rar
rar
rar
rar
cma
ani 0Fh
cmp c
jz comp
back: inx h
mov a, l
cpi 5h
jz quit
jmp loop

comp: mov a, m
stax d
inx d
jmp back

quit: nop
hlt

22 | P a g e
23. Write an 8085 assembly language program to count the positive numbers,
negative numbers, zeros and to find the maximum number from an array of twenty
bytes stored on memory location 2000H onwards. Store these three counts and the
maximum number on memory locations 3001H to 3004H respectively

lxi h, 2000h
mvi b, 20
loop: mov a, m
cmp c
jnc max
sign: mov a, m
adi 0h
jz zero
jm negative
jp positive
back:dcr b
mov a, b
cpi 00h
jz quit
inx h
jmp loop
positive: xchg
lxi h, 3001h
mov a, m
inr a
mov m, a
xchg
jmp back
negative: xchg
lxi h, 3002h
mov a, m
inr a
mov m, a
xchg
jmp back
zero: xchg
lxi h, 3003h
mov a, m

23 | P a g e
inr a
mov m, a
xchg
jmp back
max: xchg
lxi h, 3004h
mov m, a
mov c, a
xchg
jmp sign
quit: nop
hlt

24 | P a g e
24. Write an 8085 assembly language program to separate out the numbers between
20 and 40 from an array of ten numbers stored on memory location 2000H onwards.
Store the separated numbers on a new array from 3000H onwards.

lxi h, 2000h
lxi d, 3000h
mvi b, ah
loop: mov a, m
cpi 20h
jp check1
back: dcr b
mov a, b
cpi 0h
jz quit
inx h
jmp loop
check1: mov a, m
cpi 40h
jm check2
jmp back
check2: mov a, m
stax d
inx d
jmp back
quit: nop
hlt

25 | P a g e
25 . Write an 8085 assembly language program to sort an array of twenty bytes stored
on memory location 2000H onwards in descending order.

mvi b, 14h
mvi c, 01h
shld 3000h
lda 4100h
sta 4200h

l1: lhld 3000h


mov a, m
inx h
dcr b
jz over
shld 3000h
lxi h, 4200h
mov d, c

l2: cmp m
jz l1
inx h
dcr d
jnz l2
mov m, a
inr c
jmp l1

over: nop
hlt

26 | P a g e
26. An array of twenty data bytes is stored on memory location 4100H onwards.
Write an 8085 assembly language program to remove the duplicate entries from the
array and store compressed array on a new array starting from memory location
4200H onwards.

mvi b, 14h
mvi c, 01h
shld 3000h
lda 4100h
sta 4200h

l1: lhld 3000h


mov a, m
inx h
dcr b
jz over
shld 3000h
lxi h, 4200h
mov d, c

l2: cmp m
jz l1
inx h
dcr d
jnz l2
mov m, a
inr c
jmp l1

over: nop
hlt

27 | P a g e
27. Write an ALP to pack the two unpacked BCD numbers stored in memory location
2200H and 2201H and Store result in memory location 2300H.Assume the least
significant digit is stored at 2200H

mvi c, 4
lxi h, 2200h

mov a, m

loop: ral
dcr c
jnz loop

ani F0h
inx h
add m

lxi h, 2300h
mov m, a

hlt

28 | P a g e
28. Write a set of 8085 assembly language instruction to unpack the upper nibble of
BCD number.

mvi c, 4h
mvi a, 98h
lxi h, 2000h

mov b, a
ani F0h

loop: rar
dcr c
jnz loop

inx h
mov m, a
mov a, b
ani 0Fh
inx h
mov m, a

hlt

29 | P a g e
29. Write assembly language program to subtract two 16 bit BCD numbers.

lxi h, 2000h

mov b, m
inx h
mov c, m
inx h
mov d, m
inx h
mov e, m
inx h
mov a, c
add e
daa
mov c, a
mov a, b
adc d
daa
mov b, a
mov m, b
inx h
mov m, c

hlt

30 | P a g e
30. Write an 8085 assembly language program to continuously read an input port
with address 50H. Also write an ISR to send the same data to output port with
address A0H when 8085 receives an interrupt request on it RST 5.5 pin
31. Write an Assembly language program to generate a square wave of 2.5 KHz
frequency. Use D0 bits output port ACH to output the square wave

31 | P a g e

You might also like