Sunteți pe pagina 1din 18

Write a 8085 microprocessor ALP Program along with flowchart for addition of 8 bit number using

accumulator.

Aim:

Perform addition of two 8 bit numbers by using 8085 microprocessor

Description:
We have to take two values in two different register. One is accumulator, other one way any
one of B,C,D,E,H and L Register. Addition accumulator with stored value register.

Programm:

MVI A,30H
MVI B,40H
ADD B
STA 2000h
HLT
Output:
70H
Result:
Program exectued Successsfully

Write a 8085 microprocessor ALP Program along with flowchart for subtraction of 8 bit number
using accumulator.

Aim:

Perform Subtraction of two 8 bit numbers by using 8085 microprocessor

Description:
We have to take two values in two different register. One is accumulator, other one way any
one of B,C,D,E,H and L Register. Subtract accumulator with stored value register.

Programm:

MVI A,40H
MVI B,30H
SUB B
STA 2000h
HLT
Output:
10H
Result:
Program exectued Successsfully
Write a 8085 microprocessor ALP Program along with flowchart for addition of 8 bit number using
Memory pointer.

Aim:

Perform addition of two 8 bit numbers by using memory pointer

Description:
LXI is memory pointer which store data in memory register and address of memroy location
in H-L pair register.

Programm:

LXI H,3000h
MOV A,M
INX H //LXI H,3001H
ADD M
HLT

#ORG 3000H
#DB 40H,50H
Output:
90H
Result:
Program exectued Successsfully

Write a 8085 microprocessor ALP Program along with flowchart for Subtraction of 8 bit number
using Memory pointer.

Aim:

Perform subtraction of two 8 bit numbers by using memory pointer

Description:
LXI is memory pointer which store data in memory register and address of memroy location
in H-L pair register.

Programm:

LXI H,3000h
MOV A,M
INX H //LXI H,3001H
SUB M
HLT

#ORG 3000H
#DB 50H,20H
Output:
30H
Result:
Program exectued Successsfully
Write a 8085 microprocessor ALP Program along with flowchart for Swaping of two 8 bit number
using Accumulator.

Aim:

Perform swaping of two 8 bit numbers by using accumulator

Description:
LDA is the load the data from memroy loaction into accumulator which means value from
memroy is taken to load accumulator. STA is used to store the accumulator of data in specified
memory location.

Programm:

LDA 4000H
MOV C,A
LDA 4001H
STA 4000H
MOV A,C
STA 4001H
HLT

#ORG 4000H
#DB 80H,94H
Input:
4000 80H
4001 94H
Output:
4000 94H
4001 80H
Result:
Program exectued Successsfully

Write a 8085 microprocessor ALP Program along with flowchart for Swaping of two 8 bit number
using Memory pointer.

Aim:

Perform swaping of two 8 bit numbers by using memory pointer

Description:
INX is a increment instruction it increment by one value specified register. LXI is memory
pointer which store data in memory register and address of memroy location in H-L pair register.

Programm:

LXI H,3000h
MOV A,M
INX H
MOV B,M
MOV M,A
DEX H
MOV M,B
HLT

#ORG 3000H
#DB 40H,50H
Input:
3000 40H
3001 50H
Output:
3000 50H
3001 40H
Result:
Program exectued Successsfully

Write a 8085 microprocessor ALP Program along with flowchart for one's complement of given 8-
bit number.

Aim:

Perform one's complement of givrn 8-bit numbers by using 8085 microprocessor

Description:
One vlaue store in accumulator and then performing complement with help of CMA. It is
complemntary of accumulator value.

Programm:

LXI H,2000h
MOV A,M
CMA
HLT
#ORG 2000H
#DB 02H
Output:
FDh
Result:
Program exectued Successsfully

Write a 8085 microprocessor ALP Program along with flowchart for two's complement of given 8-
bit number.

Aim:

Perform two's complement of givrn 8-bit numbers by using 8085 microprocessor

Description:
One vlaue store in accumulator and then performing complement with help of CMA. It is
complemntary of accumulator value. 01 value we need to add that accumulator register value or
Increment the accumulator register by one value with help of INR

Programm:
LXI H,2000h
MOV A,M
CMA
INR A // MOV B,01H
// ADD B
HLT
#ORG 2000H
#DB 02H
Output:
FEh
Result:
Program exectued Successsfully

Write a 8085 microprocessor ALP Program along with flowchart for addition of 8 bit number store
the result in specified memroy loaction using Memory pointer.

Aim:

Perform addition of two 8 bit numbers by using memory pointer

Description:
LXI is memory pointer which store data in memory register and address of memroy location
in H-L pair register.

Programm:

LXI H,1000h
MOV A,M
INX H
MOV B,M
ADD B
JC CARRY
JM MINUS
LXI H,1500H
MOV M,A
HLT
CARRY:
JM CMINUS
LXI H, 2000H
MOV M,A
HLT
MINUS:
LXI H, 4000H
MOV M,A
HLT
CMINUS:
LXI H, 3000H
MOV M,A
HLT

#ORG 1000H
#DB 40H,50H
Input:
1000 40H
1001 50H
Output:
4000 90H
Result:
Program exectued Successsfully

Write a 8085 microprocessor ALP Program along with flowchart for Subtraction of 8 bit number
store the result in specified memroy loaction using Memory pointer.

Aim:

Perform Subtraction of two 8 bit numbers by using memory pointer

Description:
LXI is memory pointer which store data in memory register and address of memroy location
in H-L pair register.

Programm:

LXI H,2000h
MOV A,M
INX H
MOV B,M
SUB B
JC CARRY
JM MINUS
JZ ZERO
LXI H,2500H
MOV M,A
HLT
CARRY:
JM CMINUS
JZ CYZERO
LXI H, 2501H
MOV M,A
HLT
MINUS:
JZ MZERO
LXI H, 2502H
MOV M,A
HLT
CMINUS:
JZ ZCMINUS
LXI H, 2503H
MOV M,A
HLT
ZCMINUS:
LXI H,2504H
MOV M,A
HLT
CYZERO:
LXI H,2505H
MOV M,A
HLT
MZERO:
LXI H,2506H
MOV M,A
HLT
ZERO:
LXI H,2507H
MOV M,A
HLT

#ORG 2000H
#DB 40H,50H
Input:
2000 40H
2001 50H
Output:
2503 F0H
Result:
Program exectued Successsfully

Write a 8085 microprocessor ALP Program along with flowchart for addition of two 16 bit number
using DAD instruction.

Aim:

Perform addition of two 16 bit numbers by using DAD Instruction in 8085 microprocessor

Description:
To perform two 16 bit addition we use LHLD instruction it is used for load the content of
two sequence memroy loaction i.e. the 16 bit value load into H-L pair register only, the we need to
exchange the content of H-L pair register into D-E pair registe with help of XCHG instruction and
finaly we adding that two pairs of register content with help of DAD instruction. The addition result
stored in H-L Pair register only.
Programm:

LHLD 3000H
XCHG
LHLD 4000H
DAD D
HLT
#ORG 3000H
#DB 20H,25H
#ORG 4000H
#DB 40H,05H
Input:
3000H 20H
3001H 25H
4000H 40H
4001H 05H
Output:
2A60
Result:
Program exectued Successsfully

Write a 8085 microprocessor ALP Program along with flowchart for addition of two 16 bit number
without using DAD instruction.

Aim:

Perform addition of two 16 bit numbers by without using DAD Instruction in 8085
microprocessor

Description:
To perform two 16 bit addition we use LHLD instruction it is used for load the content of
two sequence memroy loaction i.e. the 16 bit value load into H-L pair register only, the we need to
exchange the content of H-L pair register into D-E pair registe with help of XCHG instruction and
then first we need to add two loarder register in pair registers and moving that result into lower
order register of H-L pair register, next with help of add with accumulator instruction adding the
higher order register in register pairs moving that result into higher order register of H-L pair
register. The addition result stored in H-L Pair register only.

Programm:

LHLD 3000H
XCHG
LHLD 4000H
MOV A,E
ADD L
MOV L,A
MOV A,D
ADC H
MOV H,A
HLT
#ORG 3000H
#DB 20H,25H
#ORG 4000H
#DB 40H,05H
Input:
3000H 20H
3001H 25H
4000H 40H
4001H 05H
Output:
2A60
Result:
Program exectued Successsfully
Write a 8086 microprocessor ALP Program for reading a charactor from buffer, stored into variable
and display that charactor on buffer

Aim:
read a charactor from user through buffer and display that charactor on buffer
Program:

INCLUDE "EMU8086.INC"
.MODEL SMALL
.DATA
VAR DB ?
.CODE
MOV AX,DATA
MOV DS,AX
MOV DX,OFFSET VAR
PRINT "ENTER ANY CHARACTOR: "
MOV AH,01H
INT 21H
MOV [VAR],AL
GOTOXY 5,5
PRINT "YOU ENTERED CHARACTOR IS:"
MOV DL,[VAR]
MOV AH,02H
INT 21H
END

Output:

Write a 8086 microprocessor ALP Program for reading a string from user, stored into variable and
display that string on buffer

Aim:
read a string from user through buffer and display that string on buffer
Program:

INCLUDE "EMU8086.INC"
.MODEL SMALL
.DATA

MSG DB 10,12, 'ENTER THE STRING :-----> : $'


MSG2 DB 10,12, 'YOUR STRING IS :-----> : $'
STR1 DB 30,?,30 DUP('$')

.CODE

BEGIN:
MOV AX,@DATA
MOV DS,AX

LEA DX,MSG+2
MOV AH,09H
INT 21H

LEA DX,STR1
MOV AH,0AH
INT 21H

GOTOXY 4,4
LEA DX,MSG+2
MOV AH,09H
INT 21H

LEA DX,STR1+2
MOV AH,09H
INT 21H
END BEGIN

Output:
Write a 8086 microprocessor ALP Program for reading a string from user, stored into variable and
find the length of the string and display that string & string length on buffer

Aim:
read and Display a string from user through buffer and find the length of that readed string
display the length

Program:

INCLUDE "EMU8086.INC"
.MODEL SMALL
.DATA

MSG DB 10,12, 'ENTER THE STRING :-----> : $'


MSG2 DB 10,12, 'YOUR STRING IS :-----> : $'
STR1 DB 30,?,30 DUP('$')
LMSG DB 10,12, "LENGTH OF THE GIVEN STRING IS:------->: $"

.CODE

BEGIN:
MOV AX,@DATA
MOV DS,AX

LEA DX,MSG+2
MOV AH,09H
INT 21H

LEA DX,STR1
MOV AH,0AH
INT 21H

GOTOXY 4,4
LEA DX,MSG+2
MOV AH,09H
INT 21H

LEA DX,STR1+2
MOV AH,09H
INT 21H

GOTOXY 5,5
LEA DX,LMSG+2
MOV AH,09H
INT 21H

MOV CX,0000H
MOV CL,STR1+1
MOV BL,CL
MOV AL,BL
AND AL,0F0H
ROL AL,04
CMP AL,09H
JBE BEQUAL
ADD AL,07H
BEQUAL:
ADD AL,30H
MOV DL,AL
MOV AH,02H
INT 21H

MOV AL,BL
AND AL,00FH
CMP AL,09H
JBE SBEQUAL
ADD AL,07H
SBEQUAL:
ADD AL,30H
MOV DL,AL
MOV AH,02H
INT 21H
END BEGIN
Write a 8086 microprocessor ALP Program for find the occurance of the charactor in given string
using macros.

Aim:
To find the occurance of the charactor in given string and display occurancess on buffer

Program:

print macro p
mov ah,09h
mov dx,offset p
int 21h
endm
read macro r
mov ah,0ah
mov dx, offset r
int 21h

endm
.model small
.data
msg db 10,13,"Enter any String: $"
display db 10,13, "Entred String is: $"
msg1 db 10,13,"Enter a charactor to search: $"
str db 90 dup("$")
display1 db 10,13, "The Charactor No.of times in string is: $"
.code
mov ax,data
mov ds,ax
print msg
read str
print display
print str+2
print msg1
mov ah,01
int 21h
mov cl,str+1
mov si,offset str+2
mov dh,00
string:
mov bl,[si]
cmp al,bl
jne notequal
inc dh

notequal:
inc si
dec cl
jnz string
mov bl,dh
print display1
mov al,bl
and al,0f0h
rol al,04
add al,30h
mov dl,al
mov ah,02h
int 21h
mov al,bl
and al,00fh
add al,30h
mov dl,al
mov ah,02h
int 21h
end
Write a 8086 microprocessor ALP Program for concatenation of two string.

Aim:
To read different two string and concatenation those two string.

Program:

print macro m
mov ah,09h
mov dx,offset m
int 21h
endm
Read macro r
mov ah,0ah
mov dx,offset r
int 21h
endm
.model small
.data
str1 db 30 dup('$')

mstring db 10,13, "Enter the string: $"


mstring2 db 10,13, "Enter second string: $"
str2 db 25 dup('$')
mconcat db 10,13, "Concatenated string: $"

.code
mov ax,data
mov ds,ax
print mstring
Read str1

;storing string in str2


print mstring2
Read str2

mov cl,str1+1 ;length of string1 in cl


mov si,offset str1
next: inc si
dec cl
jnz next
inc si

inc si
mov di,offset str2+2
;inc di
;inc di

mov cl,str2+1
move_next:
mov al,[di]
mov [si],al
inc si
inc di
dec cl
jnz move_next

print mconcat
print str1+2

end
Write a 8086 microprocessor ALP Program for reverse of the given string using macros.

Aim:
To read string and reverse that read string and display on buffer

Program:

print macro m
mov ah,09h
mov dx,offset m
int 21h
endm
Read macro r
mov ah,0ah
mov dx,offset r
int 21h
endm
.model small
.data
str db "yellav kr tiii tkugr$"
msg db 10,13, "Given String is: $"
msgr db 10,13, "After string reverse: $"

.code
mov ax,data
mov ds,ax
print msg
print str
mov cx,0000h
mov si,offset str

nequal:
inc si
inc cl
cmp [si],'$'
jne nequal
print msgr
mov dx,0000h

nzero:
dec si
mov dl,[si]
mov ah,02h
int 21h
dec cl
jnz nzero
end

S-ar putea să vă placă și