Microprocessor lab report (1)
Microprocessor lab report (1)
University Campus
Janakpurdham-08
LAB Report
Symbol No:-
SubmissionDate:-
Submitted to:
Department Of Science and Technology
Lab activity of 8085
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,
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.
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:-
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 AH,9
INT 21H
MOV DX,10
MOV AH,2
INT 21H
MOV DX,13
MOV AH,2
INT 21H
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
LOOP L1
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN
OUTPUT:-
9.Write an ALP by using array.
.MODEL SMALL
.STACK 100H
.DATA
.CODE
MAIN PROC
L1:;LABEL NAME
MOV AH,2
INT 21H
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 cl,ch
mov dl,ch
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
mov q,al
mov r,ah
mov dl,q
add dl,48
int 21h
mov dl,r
add dl,48
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
.code
main proc
mov ax,@data
mov ds,ax
mov ah,1
int 21h
cmpal,dl
je l1;jump if equal
int 21h
mov ah,4ch
int 21h
l1:
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 dl,15
mov dh,15
mov ah,4ch
int 21h
main endp
end main
OUTPUT:-