RajarshiJanak University
University Campus
Janakpurdham-08
LAB Report
Microprocessor Lab Report
Submitted By:
Name:- Signature
Symbol No:-
SubmissionDate:-
Submitted to:
Department Of Science and Technology
Lab activity of 8085
S. N Name of the experiment Date Signature Remarks
A. Write an ALP for addition of 8-bit 2077/10/04
numbers.
B. Write an ALP for addition of 16- 2077/10/04
1 bitnumbers.
C. Write an ALP to store two numbers 2077/10/06
at different locations, add these result
in another location.
A. write an ALP to subtract 8-bit 2077/10/06
numbers.
B. write ALP to subtract two 16-bit 2077/10/06
2
numbers.
Write an ALP to multiply two 8-bit 2077/10/07
number stored at 0100h and 0101h.
3
Store the result at 0102h.
Write an ALP for division of 8-bit 2077/10/07
4 numbers.
Write ALP to find out largest number 2077/10/08
5 in a given set of data.
Write an ALP to arrange an array of 2077/10/08
6 data in ascending order.
Write an ALP to find whether a 2077/10/09
7 number is odd or even.
Write an ALP to generate delay. 2077/10/10
A. By using register.
B. By using register pair
8
C. By using nested loop
Write an ALP for wave generation 2077/10/15
9 (square wave generation).
Write an ALP to convert 8-bit binary 2077/10/16
data to BCD data where the binary
10 data is stored in 8200h and store the
digit in 8201. The tens digit in 8202h
and hundreds digit in 8203h
Lab activity of 8086
S.N Name of the experiment Date Signature Remarks
1 Write an ALP to display hello. 2077/12/03
2 Write an ALP to display a 2077/12/03
character.
3 Write an ALP to input a 2077/12/04
character from user and display
it.
4 Write an ALP add two number. 2077/12/04
5 Write an ALP to subtract two 2077/12/05
number.
6 Write a program to convert 2077/12/05
capital letter to small letter.
7 Write an ALP to print two 2077/12/06
different string on two different
line.
8 Write an ALP to print 0 to 9. 2077/12/06
9 WRITE an ALP BY USING ARRAY 2077/12/07
10 ALP for multiplication of 2077/12/07
unsigned number(positive
number)
11 Write an ALP to divide two 2077/12/08
number and print quotient and
remainder.
12 Write an ALP to print the input 2077/12/08
is equal or not to given number.
13 Write an ALP to draw box. 2077/12/09
8085 programs
1 A. Write an ALP for addition of 8-bit.
MVI A 32h
MVI B 11h
ADD B
HLT
OUTPUT:-
B. Write ALP for addition of 16-bit.
LXI H 1122h
LXI B 4433h
DAD B
HLT
OUTPUT:-
C. Write ALP to store two numbers at different locations, add there number and store the result in
another location.
MVI A 32h
STA 4001h
MVI A 35h
STA 4002h
LDA 4001h
MOV B A
LDA 4002h
ADD B
STA 4003h
HLT
OUTPUT:-
2 A. write ALP to subtract 8-bit numbers.
MVI A 20h
MVI B 10h
SUB B
HLT
OUTPUT:-
B. write ALP to subtract two 16-bit numbers.
LHLD 9000h
XCHG
LHLD 9002h
LDA 9000h
SUB L
MOV L A
LDA 9001h
SBB H
MOV H A
SHLD 9004h
HLT
OUTPUT:-
3 Write an ALP to multiply two 8-bit number stored at 0100h and 0101h,
Store the result at 0102h.
LXI H 0100h
MOV B M
INX H
MOV C M
MVI A 00h
TOP: ADD B
DCR C
JNZ TOP
INX H
MOV M A
HLT
OUTPUT:-
4 Write an ALP for division of 8-bit numbers.
LXI H 1100h
MOV A M
MVI C 00h
INX H
MOV B M
LOOP: CMP B
JC SKIP
SUB B
INR C
JMP LOOP
SKIP: STA 1102 //remainder
MOV A C
STA 1103h //quotient
HLT
OUTPUT:-
5 Write ALP to find out largest number in a given set of data.
LXI H 2050h
MOV B M
DCR B
INX H
MOV A M
REPEAT: INX H
CMP M
JNC NEXT // JC->for smallest number.
MOV A M
NEXT: DCR B
JNZ REPEAT
INX H
MOV M A
HLT
OUTPUT:-
6 Write an ALP to arrange an array of data in ascending order.
REPEAT: MVI D FFh
LXI H 204Fh
MOV B M
DCR B
INX H
BACK: MOV A M
INX H
CMP M
JC FWD //JNC FNWD for descending
MOV C M
MOV M A
DCX H
MOV M C
INX H
DCR D
FWD: DCR B
JNZ BACK
MOV A D
CPI FFh
JNZ REPEAT
HLT
OUTPUT:-
7 Write an ALP to find whether a number is odd or even.
LDA C050h
RAR
JC LOOP
MVI A 00h
STA C055h
HLT
LOOP: MVI A 01h
STA C055h
HLT
OUTPUT:-
8 Write an ALP to generate delay.
a. By using register.
MVI C 05h; 7T
LOOP: DCR C; 4T
OUTPUT:-
b. By using register pair
LXI B 2348h; 10T
LOOP: DCX B; 6T
MOV A C; 4T
ORA B; 4T
JNZ LOOP; 1OT/7T
OUTPUT:-
c. By using nested loop
MVI B 38h
LOOP2: MVI C FFh
LOOP1: DCR C
JNZ LOOP1
DCR B
JNZ LOOP2
OUTPUT:-
9 Write an ALP for wave generation (square wave generation).
MVI D AAh
ROTATE: MOV A D
RLC
MOV D A
ANI 01h
OUT 01
MVI B 10h
DELAY: DCR B
JNZ DELAY
JMP ROTATE
HLT
OUTPUT:-
10. Write an ALP to convert 8-bit binary data to BCD data where the binary
data is stored in 8200h and store the digit in 8201. The tens digit in
8202h and hundreds digit in 8203h.
Or
Hexadecimal to BCD
Or
Binary to BCD
LDA 8200H
MVI B 00h
MOV C B
HELLO: CPI 64h
JC HUNT
SUI 64h
INR B
JMP HELLO
HUNT: CPI 0Ah
JC UNIT
SUI 0Ah
INR C
JMP HUNT
UNIT: STA 8201h
MOV A C
STA 8202h
MOV A B
STA 8203
HLT
OUTPUT:-
8086 programs
1. Write a program to display hello.
.MODEL SMALL
.STACK 100H
.DATA
MSG DB 'HELLO_!$'
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,MSG
MOV AH,9
INT 21h
MOV AH,4CH
INT 21h
MAIN ENDP
END MAIN
OUTPUT:-
2. Write an ALP to display a character.
dosseg
.model small
.stack 100h
.data
.code
main proc
mov dl,'a'
mov ah,2
int 21h
mov ah,4ch
int 21h
main endp
end main
OUTPUT:-
3.Write an ALP to input a character from user and display it.
dosseg
.model small
.stack 100h
.data
.code
main proc
mov ah,1
int 21h
mov dl,al
mov ah,2
int 21h
mov ah,4ch
int 21h
main endp
end main
OUTPUT:-
4.Write an ALP add two number.
.model small
.stack 100h
.data
.code
main proc
mov bl,1
mov cl,2
add bl,cl
add bl,48
mov dl,bl
mov ah,2
int 21h
mov ah,2
int 21h
main endp
end main
OUTPUT :-
5.Write an ALP to subtract two number.
.model small
.stack 100h
.data
.code
main proc
mov bl,3
mov cl,1
sub bl,cl
add bl,48
mov dl,bl
mov ah,2
int 21h
mov ah,4ch
int 21h
main endp
end main
OUTPUT:-
6.Write a program to convert capital letter to small letter.
.model small
.stack 100h
.data
.code
main proc
mov ah,1
int 21h
mov dl,al
add dl,32
mov ah,2
int 21h
mov ah,4ch
int 21h
main endp
end main
OUTPUT:-
7.Write an ALP to print two different string on two different line.
.MODEL SMALL
.STACK 100H
.DATA
MSG1 DB 'HELLO$'
MSG2 DB 'WORLD$'
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS ,AX
MOV DX,OFFSET MSG1
MOV AH,9
INT 21H
MOV DX,10
MOV AH,2
INT 21H
MOV DX,13
MOV AH,2
INT 21H
MOV DX,OFFSET MSG2
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN
OUTPUT:-
8.Write an ALP to print 0 to 9.
.MODEL SMALL
.STACK 100H
.DATA
.CODE
MAIN PROC
MOV CX,10
MOV DX,48
L1:
MOV AH,2
INT 21H
INC DX;OR ADD DX1
LOOP L1
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN
OUTPUT:-
9.Write an ALP by using array.
.MODEL SMALL
.STACK 100H
.DATA
ARRAY DB 'A','B','C';VARIABLE DECLARATION WITH INITALIZATION
.CODE
MAIN PROC
MOV AX,@DATA;ACCESSIGN THE DATA DECRITIVE OR LOCATION
MOV DS,AX; HEAP MEMORY FOR FAST ACCESS
MOV SI,OFFSET ARRAY;SOURCE INDEX REGISTER
MOV CX,3; COUNTER REGISTER TO RUN LOOP 3 TIMES
L1:;LABEL NAME
MOV DX,[SI];DATA REG
MOV AH,2
INT 21H
INC SI; INCREASE SOURCE INDEX ADDRESS
LOOP L1
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN
OUTPUT:-
10.ALP for multiplication of unsingednumber(positive number).
.model small
.stack 100h
.data
.code
main proc
mov al,3; al for 8-bit multiplicand if 16-bit multiplicand then ax accumulator is used
mov bl,2; bl for 8-bit multiplier if 16-bit multipler then bx is used
mul bl; multiply bl*al=3*2=6
aam ; ASCII adjust for multiplication
mov ch,ah; shifting from acc for free
mov cl,ch
mov dl,ch
add dl,48;for print 6
mov ah,2
int 21h
mov dl,cl
add dl,48
mov ah,2
int 21h
mov dl,4ch
mov ah,2
int 21h
main endp
end main
11. Program to divide two number and print quotient and remainder.
dosseg
.model small
.stack 100h
.data
q db ?; quotient variable
r db ?; remainder variable
.code
main proc
mov ax,26
mov bl,5
div bl; ax/bl=26/5=5
mov q,al
mov r,ah
mov dl,q
add dl,48
mov ah,2;display quotient
int 21h
mov dl,r
add dl,48
mov ah,2;display remainder
int 21h
mov ah,4ch
int 21h
main endp
end main
OUTPUT:-
12. Write an ALP to print the input is equal or not equal to given number.
.model small
.stack 100h
.data
msg1 db'number is equal $'
msg2 db'number is not equal $'
.code
main proc
mov ax,@data
mov ds,ax
mov dl,'3'; 3 take ascii
mov ah,1
int 21h
cmpal,dl
je l1;jump if equal
mov dx,offset msg2
mov ah,9; to display string
int 21h
mov ah,4ch
int 21h
l1:
mov dx,offset msg1
mov ah,9
int 21h
mov ah,4ch
int 21h
main endp
end main
OUTPUT:-
13. Write an ALP to draw box.
.model small
.stack 100h
.data
.code
main proc
mov ah,6; to request scroll window up
mov al,10; number of line to be scrolled in
mov bh,0011100b; color coding
mov ch,2; width
mov cl,3; height
mov dl,15
mov dh,15
int 10h; for graphic
mov ah,4ch
int 21h
main endp
end main
OUTPUT:-