8085 is a 8 bit microprocessor. It is also called accumulator based microprocessor.
some simple program are
1.write a program to add two numbers stored in memory location 2000h and 2001h and store the result in 2002h.
answer:
LDA 2000H
MOV B,A
LDA 2001H
ADD B
STA 2002H
JNC DOWN
MVI A,01H
STA 2003H
HLT
2. WAP to subtract two number stored in memory location 2000 and 2001 h and store the result in 2002h.
LDA 2000H
MOV B,A
LDA 2001H
SUB B
STA 2002H
3.10 bytes of data are stored at memory location starting from 2000h onwards. WAP to add these data and store the result in
memory location 3000h
LXI H,2000H
MVI B,0AH
MVI A,00H
UP1: ADD M
jnc down
inr d
down: INX H
DCR B
JNZ UP1
mov e,a
HLT
4.WAP to add given series of 8 bit data byte whose length is specified at the memory location 3000h and the series itself starts from 4000h onwards.The sum is to be stored at 5000h and the Carry(if produced ) at 5001h
LXI H,4000H
LDA 3000H
MOV B,A
MVI C,00H
MVI A,00H
UP1: ADD M
JNC DOWN
INR C
DOWN: INX H
DCR B
JNZ UP1
STA 5000H
MOV A,C
STA 5001H
HLT
5.WAP to copy 16 data from memory address 2000h onwards to 2020h onwards.
LXI B,2000H
LXI D,2020H
MVI H,0FH
UP1: LDAX B
STAX D
INX B
INX D
DCR H
JNZ UP1
HLT
6.WAP to copy 16 data from memory address 2040h-2049h to 2045h- 204eh
LXI B,2049H
LXI D,204EH
MVI H,0FH
UP1: LDAX B
STAX D
DCX B
DCX D
DCR H
JNZ UP1
HLT
7. WAP to find the square of a given number stored in memory address 2000h
LDA 2000H
MOV B,A
MOV C,A
MVI A,00H
UP1: ADD C
DCR B
JNZ UP1
MOV D,A
HLT
8. WAP to find the highest data in the array of 10 bytes .The array starts from 2000h. store the highest number in memory address 3000h.
lxi h,2000h
mvi c,0Ah
mov a,m
next:
cmp m
jnc down
mov a,m
down: inx h
dcr c
jnz next
mov b,a
hlt
9. WAP to find the lowest data in the array of 10 bytes .The array starts from 2000h. store the number in memory address 3000h.
lxi h,2000h
mvi c,09h
mov a,m
next:
cmp m
jc down
mov a,m
down: inx h
dcr c
jnz next
mov b,a
hlt
10.write a program to sort 10 items in ascending order starting from 2000h
start: lxi h,2000h
mvi d,00h
mvi c,05h
check: mov a ,m
inx h
cmp m
jc nxt
mov b,m
mov m,a
dcx h
mov m,b
inx h
mvi d,01h
nxt: dcr c
jnz check
mov a,d
rrc
jc start
hlt
11.write a program to sort 10 items in decending order starting from 2000h
start: lxi h,2000h
mvi d,00h
mvi c,05h
check: mov a ,m
inx h
cmp m
jnc nxt
mov b,m
mov m,a
dcx h
mov m,b
inx h
mvi d,01h
nxt: dcr c
jnz check
mov a,d
rrc
jc start
hlt
12.Wrte a program to multiply two numbers stored in memory location 2000h and 2001h AND store the result in 2002 and .
LDA 2000H
MOV B,A
LDA 2001
MOV C,A
MVI D,00H
MVI A,00H
UP1: ADD C
JNC DOWN
INR D
DCR B
JNZ UP1
STA 3000H
MOV A,D
STA 3001H
HLT
13.Write a program to divide two numbers.
;divide 6 by 3
mvi c,00h
mvi b,06h
mvi d,03h
up1: mov a,b
sub d
jc down
mov b,a
inr c
jmp up1
down: mov e,b
mov a,c
hlt
14.Write a program to find out total numbers of even and odd numbers from a given array of 20 numbers which starts from memory location 3000h onwards and store the result in 2000h and 2001h.
lxi h,3000h
mvi c,14h
mvi b,00h
mvi d,00h
up1: mov a ,m
rrc
jnc down
inr b
jmp down1
down: inr d
down1: inx h
dcr c
jnz up1
mov a,b
sta 2000h
mov a,d
sta 2001h
hlt
15.Write a program to find out total numbers of even and odd numbers from a given array of 20 numbers which starts from memory location 2000h onwards and store the even number from memory location 4000h and odd number from 3000h.
lxi h,2000h
lxi d,3000h
lxi b,4000h
up1: mov a ,m
rrc
jnc down
rlc
stax b
inx b
jmp down1
down: rlc
stax d
inx d
down1: inx h
mov a,l
cpi 14h ; represent the counter, if you want to change the value of counter change
jnz up1
hlt
16.WAP to perform multibyte addition
0134f044f
+f12988322
-------------------------
mvi a,4fh
adi 22h
sta 2000h
mvi a,04h
mvi b,32h
adc b
sta 2001h
mvi a,4fh
mvi b,98h
adc b
sta 2002h
mvi a,13h
mvi b,12h
adc b
sta 2003h
mvi a,00h
mvi b,0fh
adc b
sta 2004h
jnc down
mvi a,01h
sta 2005h
down: hlt
17. write a program to view the content of flag at port 10h
lxi sp,500ah
push psw
pop b
mov a,b; the contents of flags
out 10h
mov a,c; contents of accumulator
out 10h
hlt
18.Two 10 bytes number are stored ,one number starting from 4000h and the other number starting from 4050h. add these two numbers and store the result starting from 5000h
lxi b,4000h
lxi h,4050h
lxi d,5000h
up1: ldax b
add m
stax d
jnc down
mvi a,01h
INX D
STAX D
DOWN: inx b
inx d
inx h
cpi 0ah
jnz up1
Thursday, July 5, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment