0% found this document useful (0 votes)
3 views4 pages

Assembly Level Programs

Uploaded by

eldhojohn916
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)
3 views4 pages

Assembly Level Programs

Uploaded by

eldhojohn916
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

Assembly Level Programs (ALP)

Addition of Two 8-bit Numbers


ALP to perform addition of two 8-bit numbers stored at 4200H & 4201H and
store the result at 4202H :
MOV DPTR,#4200H
MOVX A,@DPTR
MOV R0,A
INC DPTR
MOVX A,@DPTR
ADD A,R0
INC DPTR
MOVX @DPTR,A
HERE: SJMP HERE

Subtraction of Two 8-bit Numbers


ALP to perform subtraction of two 8-bit numbers stored at 4300H & 4301H
and store the result at 4500H :
MOV DPTR,#4300H
MOVX A,@DPTR
MOV R0,A
INC DPTR
MOVX A,@DPTR
SUBB A,R0
MOV DPTR,#4500H
MOVX @DPTR,A
HERE: SJMP HERE
Multiplication of Two 8-bit Numbers
ALP to perform multiplication of two 8-bit numbers stored at 4300H &
4301H and store the result at 4500H (LSB) & 4501H (MSB) :
MOV DPTR,#4300H
MOVX A,@DPTR
MOV B,A
INC DPTR
MOVX A,@DPTR
MUL AB
MOV DPTR,#4500H
MOVX @DPTR,A
MOV A,B
INC DPTR
MOVX @DPTR,A
HERE: SJMP HERE

Division of Two 8-bit Numbers


ALP to perform division of two 8-bit numbers stored at 4300H & 4301H and
store the quotient at 4500H and remainder at 4501H.
MOV DPTR,#4300H
MOVX A,@DPTR
MOV B,A
INC DPTR
MOVX A,@DPTR
DIV AB
MOV DPTR,#4500H
MOVX @DPTR,A
MOV A,B
INC DPTR
MOVX @DPTR,A
HERE: SJMP HERE
BCD to ASCII Conversion
ALP to convert BCD data stored at 50H into ASCII and store the result at
51H & 52H.
MOV A,50H
MOV R2,A
ANL A,#0FH
ORL A,#30H
MOV 52H,A
MOV A,R2
SWAP A
ANL A,#0FH
ORL A,#30H
MOV 51H,A
HERE: SJMP HERE

ASCII to BCD Conversion


ALP to convert ASCII data stored at 50H & 51H into BCD and store the
result at 52H.
MOV A,50H
MOV R1,51H
SWAP A
ANL A,#0F0H
MOV R2,A
MOV A,R1
ANL A,#0FH
ORL A,R2
MOV 52H,A
HERE: SJMP HERE
BCD to Hexadecimal Conversion
ALP to convert BCD data stored at 50H into hexadecimal and store the
result at 51H.

MOV A,50H
MOV B,A
ANL A,#0FH
MOV R0,A
MOV A,B
ANL A,#0F0H
SWAP A
MOV B,#0AH
MUL AB
ADD A,R0
MOV 51H,A
HERE: SJMP HERE

Hexadecimal to BCD Conversion

ALP to convert hexadecimal data stored at 50H into BCD and store the
result at 51H.

MOV A,50H
MOV B,#0AH
DIV AB
MOV R0,B
SWAP A
ANL A,#0F0H
ORL A,R0
MOV 51H,A
HERE: SJMP HERE

You might also like