0% found this document useful (0 votes)
33 views44 pages

Microprocessors and Microcontrollers Laboratory

The document describes Assembly Language Programs (ALPs) for performing basic arithmetic operations on 16-bit numbers using an 8086 microprocessor. It includes ALPs for addition, subtraction, multiplication, and division of two 16-bit numbers by loading values from memory locations into registers, performing the operation, and storing the result back in memory. The programs are provided along with sample input/output values and confirmation that the ALPs successfully completed the intended operations.

Uploaded by

Gurusreenu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views44 pages

Microprocessors and Microcontrollers Laboratory

The document describes Assembly Language Programs (ALPs) for performing basic arithmetic operations on 16-bit numbers using an 8086 microprocessor. It includes ALPs for addition, subtraction, multiplication, and division of two 16-bit numbers by loading values from memory locations into registers, performing the operation, and storing the result back in memory. The programs are provided along with sample input/output values and confirmation that the ALPs successfully completed the intended operations.

Uploaded by

Gurusreenu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 44

Microprocessors and Microcontroller Laboratory

MICROPROCESSORS AND
MICROCONTROLLER LAB

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

8086
Programs

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

1A. ADDITION OF TWO 16-BIT


NUMBERS

AIM:

To write an ALP program for addition of two 16-bit numbers using 8086

APPARATUS:

8086

Microprocesso

r kit Power

supply

Keyboard

PROGRAM CODE:

ADDRESS OP-CODE INSTRUCTIONS COMMENTS


MNEMONICS OPERANDS
0000:2000 8B 06 0030 MOV AX,@3000 Move the Content at the
Memory location [3000] to AX
register
0000:2004 8A 1E 0230 MOV BX,@3002 Move the Content at the
Memory location [3002] to BX
register

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

0000:2008 03C3 ADD AX,BX Add contents of AX and BX


Register and store the result in
AX register
0000:200AA3 04 30 MOV @3004,AX Move the content form AX
register to the memory location
[3004]
0000:200D89 16 06 30 MOV @3006,DX Move the content form DX
register to the memory location
[3006]
0000:2011 CC INT 03 Interrupt/ address for execution

INPUT:
S-3000 22

S-3002 44

OUPUT:

G 2000

S 3004-66

RESULT:

Hence ,the ALP to perform addition in 8086 Microprocessor was


successfully completed

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

1B. SUBTRACTIONOF TWO 16-BIT


NUMBERS

AIM:

To write an ALP program for Subtraction of two 16-bit numbers using 8086

APPARATUS:

8086

Microprocesso

r kit

Power supply

Keyboard

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

PROGRAM CODE:

ADDRESS OP-CODE INSTRUCTIONS COMMENTS


MNEMONICS OPERANDS
0000:2000 8B 06 0030 MOV AX,@3000 Move the Content at the
Memory location [3000] to
AX register
0000:2004 8A 1E 0230 MOV BX,@3002 Move the Content at the
Memory location [3002] to
BX register
0000:2008 03C3 SUB AX,BX Subtraction the contents of
AX and BX Register and
store the result in AX
register
0000:200AA3 04 30 MOV @3004,AX Move the content form AX
register to the memory
location [3004]
0000:200D89 16 06 30 MOV @3006,DX Move the content form DX
register to the memory
location [3006]
0000:2011 CC INT 03 Interrupt/ address for
execution

INPUT:
S-3000 44

S-3002 22

OUPUT:

G 2000

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

S 3004-22

RESULT:

Hence ,the ALP to perform Subtraction in 8086 Microprocessor was


successfully completed

1C. MULTIPLICATION OF TWO 16-BIT NUMBERS

AIM:

To write an ALP program for Multiplication of two 16-bit numbers using 8086

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

APPARATUS:

8086

Microprocesso

r kit Power

supply

Keyboard

PROGRAM CODE:

ADDRESS OP-CODE INSTRUCTIONS COMMENTS


MNEMONICS OPERANDS
0000:2000 8B 06 0030 MOV AX,@3000 Move the Content at the
Memory location [3000] to
AX register
0000:2004 8A 1E 0230 MOV BX,@3002 Move the Content at the
Memory location [3002] to
BX register
0000:2008 03C3 MUL BX Multiply the contents of AX
and BX Register and store
the result in AX register
0000:200AA3 04 30 MOV @3004,AX Move the content form AX
register to the memory
location [3004]
0000:200D89 16 06 30 MOV @3006,DX Move the content form DX
register to the memory
location [3006]
0000:2011 CC INT 03 Interrupt/ address for
execution

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

INPUT:
S-3000 06

S-3001 04

S-3002 03

S-3003 05

OUPUT:

G 2000

S 3004-12
S 3005-14

RESULT:

Hence ,the Assembly Language Program for Multiplication of two 16-bit


number using 8086 Microprocessor was successfully completed

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

1D. DIVISIONOF TWO 16-BIT NUMBERS

AIM:

To write an ALP program for Division of two 16-bit numbers using 8086

APPARATUS:

8086

Microprocesso

r kit Power

supply

Keyboard

PROGRAM CODE:

ADDRESS OP-CODE INSTRUCTIONS COMMENTS


MNEMONICS OPERANDS
0000:2000 8B 06 0030 MOV AX,@3000 Move the Content at the
Memory location [3000] to
AX register
0000:2004 8A 1E 0230 MOV BL@3002 Move the Content at the
Memory location [3002] to
BX register
0000:2008 F6F3 DIV BL Divide the contents of AX
and BX Register and store
the result in AX register
0000:200AA3 04 30 MOV @3004,AX Move the content form AX
register to the memory
location [3004]

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

0000:200D89 16 06 30 MOV @3006,DX Move the content form DX


register to the memory
location [3006]
0000:2011 CC INT 03 Interrupt/ address for
execution

INPUT:
S-3000 09

S-3001 00

S-3002 03

OUPUT:

G 2000

S 3004-03
S 3005-00

RESULT:

Hence ,the Assembly Language Program for Division of two 16-bit number
using 8086 Microprocessor was successfully completed

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

2A). MULTI BYTE ADDITION

AIM:

To write an ALP program in 8086 to perform Multi byte addition.

APPARATUS:

8086

Microprocesso

r kit Power

supply

Keyboard

PROGRAM CODE:

ADDRESS OP-CODE LABEL INSTRUCTIONS COMMENTS


MNEMONICS OPERANDS
0000:2000 BE 00 30 MOV SI,3000 Initialize SI Register
0000:2003 BE 00 40 MOV DI,4000 Initialize DI Register

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

0000:2006 BE 00 50 MUL BP,5000 Initialize BP Register

0000:2009 B9 04 00 MOV CX,05 Load the length of the given


data into count Register
0000:200B 8504 (UP) MOV AX,[SI] Move the Content from SI
Register to AX Register
0000:200D 83 1D MOV BX,[DI] Move the Content from DI
Register to AX Register
0000:200F 13 C3 ADC AX,BX Add contents of AX and BX
Register and store the result in
AX register(Add with carry)
0000:2011 80 46 00 MOV [BP],AX Copy contents of AL into BP

0000:2014 46 INC SI Increment SI by one

0000:2015 47 INC DI Increment DI by one

0000:2016 45 INC BP Increment BP by one

0000:2017 C9 DEC CX Decrement CX by one

0000:2019 75 F1 JNZ 200B (UP) For non zero value of CX jump


to address 200B
0000:201B CC INT 03 halt the Program

INPUT:
S-3000 11

S-3001 12

S-3002 13

S-3003 14

S-3004 11

S-4000 11

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

S-4001 11

S-4002 11

S-4003 11

S-4004 11
OUPUT:

G 2000

S 5000-
S 5001-
S 5002-
S 5003-
S 5004-

RESULT:

Hence ,the Assembly Language Program for Multi Byte Addition using 8086
Microprocessor was successfully completed.
2B). MULTI BYTE SUBTRACTION

AIM:

To write an ALP program in 8086 to perform Multi byte Subtraction.

APPARATUS:

8086

Microprocesso

r kit Power

supply

Keyboard

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

PROGRAM CODE:

ADDRESS OP-CODE LABEL INSTRUCTIONS COMMENTS


MNEMONICS OPERANDS
0000:2000 BE 00 30 MOV SI,3000 Initialize SI Register
0000:2003 BE 00 40 MOV DI,4000 Initialize DI Register

0000:2006 BE 00 50 MUL BP,5000 Initialize BP Register

0000:2009 B9 04 00 MOV CX,05 Load the length of the given


data into count Register
0000:200B 85 04 (UP) MOV AX,[SI] Move the Content from SI
Register to AX Register
0000:200D 83 1D MOV BX,[DI] Move the Content from DI
Register to AX Register
0000:200F 13 C3 SBB AX,BX Subtract contents of AX and BX
Register and store the result in
AX register(Add with carry)
0000:2011 80 46 00 MOV [BP],AX Copy contents of AL into BP

0000:2014 46 INC SI Increment SI by one

0000:2015 47 INC DI Increment DI by one

0000:2016 45 INC BP Increment BP by one

0000:2017 C9 DEC CX Decrement CX by one

0000:2019 75 F1 JNZ 200B (UP) For non zero value of CX jump


to address 200B
0000:201B CC INT 03 halt the Program

INPUT:
S-3000 11

S-3001 12

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

S-3002 13

S-3003 14

S-3004 11

S-4000 11

S-4001 11

S-4002 11

S-4003 11

S-4004 11
OUPUT:

G 2000

S 5000-
S 5001-
S 5002-
S 5003-
S 5004-

RESULT:

Hence ,the Assembly Language Program for Multi byte Subtraction using
8086 Microprocessor was successfully completed
3. REVERSE OF A STRING

AIM:

To write an ALP program in 8086 to perform Multi byte Subtraction.

APPARATUS:

8086

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

Microprocesso

r kit Power

supply

Keyboard

PROGRAM CODE:

ADDRESS OP-CODE LABEL INSTRUCTIONS COMMENTS


MNEMONICS OPERANDS
0000:2000 BE 00 30 MOV SI,3000 Initialize SI Register
0000:2003 BE 00 40 MOV DI,4000 Initialize DI Register
0000:2006 B906 00 MOV CX,06 Load the length of the given
datainto count Register
0000:2009 81 C6 05 ADD SI,05 Add contents of AX and BX
00 Register and store the result
in AX register
0000:200D8A 04 (UP) MOV AL,[SI] Move the Content from SI
Register to AX Register
0000:200F 8805 MOV [DI],AL Move the Content from DI
Register to AX Register
0000:2011 47 INC DI Increment DI by one
0000:2012 4E DEC SI Decrement SI by one
0000:2013 49 DEC CX Decrement CX by one
0000:2014 75 F7 JNZ 200D (UP) For non zero value of CX jump
to address 200D
0000:2016 CC INT 03 Increment BP by one

INPUT:
S 3000 A

S 3001 B

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

S 3002 C

S 3003 D

S 3004 E

S 3005 F
OUPUT:

G 2000

S 4000 F

S 4001 E

S 4002 D

S 4003 C

S 4004 B

S 4005 A

RESULT:

Hence ,the Assembly Language Program for Reverse of a String using 8086
Microprocessor was successfully completed

4. LENGTH OF A STRING

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

AIM:

To write an ALP program in 8086 to Find length of string.

APPARATUS:

8086

Microprocesso

r kit Power

supply

Keyboard

PROGRAM CODE:

ADDRESS OP-CODE LABEL INSTRUCTIONS COMMENTS


MNEMONICS OPERANDS
0000:2000 BE 00 30 MOV SI,3000 Initialize SI Register
0000:2003 B9 00 00 MOV CX,0000 Load the length of the given
data
into count Register
0000:2006 B4 FF MOV AH,0FF Move OFF to AH Register

0000:2008 8A 04 MOV AL,[SI] Move the Content from SI


Register to AX Register
0000:200A 3A C4 CMP AL,AH Compare AL & AH Register

0000:200C 74 04 JZ 2012 (UP) For zero value of CX jump to


address 2012
0000:200E 41 INC CX Increment CX by one
0000:200F 46 INC SI Increment SI by one
0000:2010 EB F6 JMP 2008 jump to 2008
0000:2012 890E 0530 (UP) MOV @4000,CX Move result to CX Register
0000:2016 CC INT 03 Increment BP by one

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

INPUT:
S 3000 A

S 3001 B

S 3002 C

S 3003 D

S 3004 E

S 3005 F

S 3006 FF
OUPUT:

G 2000

S 4000 06

RESULT:

Hence ,the Assembly Language Program for Length of a String using 8086
Microprocessor was successfully completed

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

5. HELLO WORLD

AIM:

To write an ALP program in 8086 to perform the display of “HELLO WORLD!”.

APPARATUS:

8086

Microprocesso

r kit Power

supply

Keyboard

PROGRAM CODE:

ADDRESS OP-CODE LABEL INSTRUCTIONS COMMENTS


MNEMONICS OPERANDS
0000:2000 BE 00 25 MOV SI,2500 Initialize SI Register
0000:2003 B1 0E MOV CL,0E Load the length of the given data
into count Register
0000:2005 8A04 (UP) MOV AL,[SI] Move the Content from SI
Register to AX Register
0000:2007 9A 0000 CALLS 0FE00:0000 Call OUT_CHAR

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

00 FE
0000:200C 46 INC SI Increment SI by one

0000:200DE2 F6 LOOP 2005 (UP) Repeat display


0000:200F 9A A9 00 CALLS 0FE00:00A9 Call GET_CHAR
00 FE
0000:2014 CC INT 03 Return to monitor

INPUT:
S 2500

The user should fill the locations from 0:2500H to 0:250DH with the
following Hexadecimal data bytes. These bytes are the HEX
equivalents of the ASCII characters contained in the output message.
0000:25 0 0 4 4 4 4 4 20 5 4 5 4 4 2 20
00 to A A 8 5 C C F 7 F 2 C 4 1
0:250DH
ASCII L L H E L L O Spac W O R L D ! Spac
Code F F e e

Welcome to SVUCE

0000: 0A 0A 57 65 6C 63 6F 6D 65 20 7 6F 20 53 56 55 4 45 20
2500 7 3

ASCII LF LF W e L c o M e Space t O Space S V U C E Space


Code

OUPUT:

“HELLO WORLD!”

RESULT:

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

A message “HELLOW WORLD!” and Welcome to SVUCE are displayed on


the LCD display of ESA 86E Micro processor Trainer Kit.

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

8051 Mcirocontroller

11A. ADDITION IN 8051

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

AIM:

To write an ALP program to perform addition in 8051

APPARATUS:

8051 icrocontroller kit Power


supply Keyboard
PROGRAM CODE:

ADDRESS OP-CODE MNEMONICS COMMENTS


0000:8000 74 05 MOV A,#02 Move the value 02 to A
0000:8002 75 F0 03 MOV B,#03 Move the value 03 to 0F
0000:8005 25 00 ADD A,B Add contents of A and B
0000:8007 90 50 00 MOV DPTR,#5000 Move the address 5000 toDPTR
0000:800A F0 MOVX @DPTR,A Move the contents fromA to DPTR
0000:800B 02 00 00 LJMP 0 Long Jump to address0000H

INPUT:
A-08
B-01

OUPUT:

G 8000
MD 5000-09

RESULT:

Hence ,the ALP to perform addition in 8051 was successfully completed


11B. SUBTRACTION IN 8051

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

AIM:
To write an ALP program to perform subtraction in 8051

APPARATUS:
8051 microcontroller kit
Power Supply
Keyboard
PROGRAM CODE:

ADDRESS OPCODE MNEMONICS COMMENTS


0000:8000 74 09 MOV A,#09 Move the value 09 toA
0000:8002 75 F0 0B MOV B,#03 Move the value 03 to0F0
0000:8005 95 FB SUBB A,B Subtracts the contentsof B from A
0000:8007 90 52 00 MOV DPTR,#5200 Move the address5200 to DPTR
0000:800A F0 MOVX @DPTR,A Move the value fromA to DPTR
0000:800B 02 00 00 LJMP 0 Long jump to 0000H
INPUT :
A-9
B-3

OUPUT:
G 8000
MD 5200-06

RESULT:
Hence ,the ALP to perform subtraction in 8051 was executed successfully.
11C.MULTIPLICATION

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

AIM:
To write an ALP program to perform multiplication in 8051.

APPARATUS:
ESA trainer kit-8051

Keyboard

Power supply.

PROGRAM:
ADDRESS OP CODE MNEMONICS COMMENTS
0000:8000 74 13 MOV A,#13 Move the value 13 to A
0000:8002 75 F0 49 MOV 0F0,#49 Move the value 49 to 0F0
0000:8005 A4 MUL AB Multiplies contents of A and B
0000:8006 90 52 00 MOV DPTR,#5200 Move the address 5200 to DPTR
0000:8009 F0 MOVX @DPTR,A Move the result from A to DPTR
0000:800A A3 MOV A,OFO Move the contents from 0F0 to A
0000:800C F0 INC DPTR Increment DPTR by 1
0000:800D 02 00 00 MOVX @DPTR,A Move contents to DPTR from A
0000:800E LJMP 03 Long jump to address 0000H
INPUT:
A-13
B-49
OUTPUT:
0000:5200-F9H
0000:5201-04H.
RESULT:
Hence the ALP program to perform multiplication in 8051 was executed
successfully.

11D.DIVISION

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

AIM:
To write an ALP program to perform division in 8051.

APPARATUS:
ESA trainer kit-8051
Keyboard
Power supply.
PROGRAM:
ADDRESS OP CODE MNEMONICS COMMENTS
0000:8000 74 AB MOV A,#ABH Move the value AB to A
0000:8002 75 F0 12 MOV 0F0,#12H Move the value 12 to 0F0
0000:8005 84 DIV A,B Divides contents of A by B
0000:8006 90 52 00 MOV DPTR,#5200 Move the address 5200 to DPTR
0000:8009 F0 MOVX @DPTR,A Move the address from A to DPTR
0000:800A E5 F0 MOV A,0F0 Move the contents from A to DPTR
0000:800C A3 INC DPTR Increment DPTR by 1
0000:800D F0 MOVX @DPTR,A Move value from A to DPTR
0000:800E 02 00 00 LJMP 0 Long jump to address 0000H
INPUT:
A-ABH
B-12H
OUTPUT:
0000:5200-09H
0000:5201-09H
RESULT:
Hence the ALP program to perform division in 8051 was executed
successfully.

12. 1’S AND 2’S COMPLIMENT IN AN ARRAY

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

AIM:
To write an ALP program to find 1’s and 2’s compliment in an array.

APPARATUS:
ESA trainer kit-8051
Keyboard
Power supply.
PROGRAM:
ADDRESS OP CODE MNEMONICS COMMENTS
8000 74 05 MOV A,05 Give the value to A as 05
8002 F4 CPL A Compliment of A
8003 90 42 00 MOV DPTR,#4200 Give the address 4200 to DPTR
8006 F0 MOVX @DPTR,A Move the result from A to DPTR
8007 04 INC A Increment of A
8008 A3 INC DPTR Increment of DPTR
8009 F0 MOVX @DPTR,A Move contents to DPTR from A
8008 FC LJMP 03 Long jump to address 8008

OUTPUT:
MD 4200[FA]

MD 4201[FB]

RESULT:
Hence to write an ALP program to find 1’s and 2’s compliment in an
array was successfully completed.

13.FACTORIAL OF A GIVEN NUMBER

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

AIM:
To write an ALP program to find the factorial of a given number.

APPARATUS:
8051 Microcontroller Kit

Keyboard

Power supply

PROGRAM CODE:

ADDRESS OPCODE INSTRUCTIONS


MNEMONICS COMMENTS
8000 90 42 00 MOV DPTR,#4200 Move 4200 address to DPTR
8003 EO MOVX A,@DPTR Move DPTR address to A
8004 F9 MOV R1,A Move A to R1
8005 19 LOOP: DEC R1 Decrement R1
8006 89 FO MOV 0F0,R1 Move R1 to 0F0
8008 A4 MUL AB Multiply A and B
8009 B9 01 F9 CJNE R1,#01,LOOP Carry jump if R1 is not equal to 01 to loop
800C 90 42 01 MOV DPTR,#4201 Move 4201 address to DPTR
800F F0 MOV @DPTR,A Move A address to DPTR
8010 02 00 03 LJMP 03 Set address for execution
INPUT:
MD 4200 = 03

OUTPUT:
MD 4201 = 06

RESULT:
Hence to find the factorial of a given number was successfully completed.

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

MASM Programs

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

13a. ADDITION
AIM:To Write an ALP to perform addition using MASM software

APPARATUS:MASM Microsoft (R) Macro assembler version 6.14.8444

PROGRAM CODE:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
ORG 0100H
X DW 0007
Y DW 0004
Z DW 2000
DATA ENDS
CODE SEGMENT
ORG 200H
START: MOV AX,DATA
MOV DS,AX
MOV AX,X
MOV BX,Y
ADD AX,BX
MOV DI,OFFSET Z
MOV [DI],AX
INT 21H
CODE ENDS
END START

RESULT:

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

13b. SUBTRACTION
AIM:To Write an ALP to perform subtraction using MASM software

APPARATUS:MASM Microsoft (R) Macro assembler version 6.14.8444

PROGRAM CODE:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
ORG 0100H
X DW 0007
Y DW 0004
Z DW 2000
DATA ENDS
CODE SEGMENT
ORG 200H
START: MOV AX,DATA
MOV DS,AX
MOV AX,X
MOV BX,Y
SUB AX,BX
MOV DI,OFFSET Z
MOV [DI],AX
INT 21H
CODE ENDS
END START

RESULT:

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

13c. MULTIPLICATION
AIM:To Write an ALP to perform multiplication using MASM software

APPARATUS:MASM Microsoft (R) Macro assembler version 6.14.8444

PROGRAM CODE:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
ORG 0100H
X DW 0008
Y DW 0004
Z DW 2000
DATA ENDS
CODE SEGMENT
ORG 200H
START: MOV AX,DATA
MOV DS,AX
MOV AX,X
MOV BX,Y
MUL BX
MOV DI,OFFSET Z
MOV [DI],AX
INT 21H
CODE ENDS
END START

RESULT:

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

13d. DIVISION
AIM:To Write an ALP to perform division using MASM software

APPARATUS:MASM Microsoft (R) Macro assembler version 6.14.8444

PROGRAM CODE:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
ORG 0100H
X DW 0008
Y DW 0004
Z DW 2000
DATA ENDS
CODE SEGMENT
ORG 200H
START: MOV AX,DATA
MOV DS,AX
MOV AX,X
MOV BX,Y
DIV BX
MOV DI,OFFSET Z
MOV [DI],AX
INT 21H
CODE ENDS
END START

RESULT:

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

14. DISPLAY THE STRING IN REVERSE ORDER

AIM:To Write an ALP to perform display the reverse string using MASM software

APPARATUS:MASM Microsoft (R) Macro assembler version 6.14.8444

PROGRAM CODE:

ASSUME CS:CODE , DS:DATA, ES:EXTRA


DATA SEGMENT
SRT1 BD ‘SVUNIVERSITY’
DATA ENDS
EXTRA SEGMENT
STR2 DB ?
EXTRA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV AX,EXTRA
MOV ES,AX
LEA SI,STR1+11
LEA DI,STR2
UP: STD
LODSB
CLD
STOSB
DEC CL
JNZ UP
INT 03
CODE ENDS
END START

RESULT:

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

15a. SORTING OF NUMBERS

AIM:To write an ALP program to arrange ‘n’ number in ascending order using
MASM software

APPARATUS:MASM Microsoft (R) Macro assembler version 6.14.8444

PROGRAM CODE:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
A DB 05H,03H,01H,04H,02H
DATA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV DL,04H
UP2: MOV CL,DL
LEA SI,A
UP1: MOV AL,[SI]
CMP AL,[SI+1]
JA DOWN
XCHG AL,[SI+1]
XCHG AL,[SI]
DOWN: INC SI
DEC CL
JNZ UP1
INT 03
CODE ENDS
END START

RESULT:

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

15b. SORTING OF NUMBERS


AIM:To write an ALP program to arrange ‘n’ number in Descending order using
MASM software

APPARATUS:MASM Microsoft (R) Macro assembler version 6.14.8444

PROGRAM CODE:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
A DB 05H,03H,01H,04H,02H
DATA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV DL,04H
UP2: MOV CL,DL
LEA SI,A
UP1: MOV AL,[SI]
CMP AL,[SI+1]
JB DOWN
XCHG AL,[SI+1]
XCHG AL,[SI]
DOWN: INC SI
DEC CL
JNZ UP1
INT 03
CODE ENDS
END START

RESULT:

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

16. BIOS/DOS CALLS – DISPLAY

AIM:To display a message on the CRT screen of a microcomputer using DOS calls.
ALGORITHM:
1. Initialize the data segment and the message to be displayed.
2. Set function value for display.
3. Point to the message and run the interrupt to display the message in the
CRT monitor.
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
STR1 DB “GOOD MORNING”
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
LEA SI,STR1
CLD
MOV CL,12
INT 03H
CODE ENDS
END START
RESULT:A message “GOOD MORNING”, is displayed on the CRT screen of a
microcomputer using DOS calls.

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

8085
Programs

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

17. ADDITION OF TWO NUMBERS

AIM:

To write an ALP program for addition of two 16-bit numbers using 8085

APPARATUS:

8086 Microprocessor kit

Power supply

Keyboard

PROGRAM CODE:

ADDRESS OP-CODE INSTRUCTIONS COMMENTS


MNEMONICS OPERANDS
0000:8000 3E 02 MVI A,02 Move the Content immediately
at 02 to A
0000:8002 47 MOV B,A Move the Content of A to B
0000:8003 3E 03 MOVI A,03 Move the Content immediately
at 03 to A
0000:8005 80 ADD B ADD the content of A to B

0000:8006 32 00 85 STA 8500 Store the output of 8500


memory location
0000:8009 76 HLT stop

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

INPUT:
A- 03

B- 02

OUPUT:

8500- 05

RESULT:

Thus,the ALP for addition of two numbers using 8085 was executed
successfully.

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

18. SUBTRACTION OF TWO NUMBERS

AIM:

To write an ALP program for subtraction of two 16-bit numbers using 8085

APPARATUS:

8086 Microprocessor kit

Power supply

Keyboard

PROGRAM CODE:

ADDRESS OP-CODE INSTRUCTIONS COMMENTS


MNEMONICS OPERANDS
0000:8000 3E 02 MVI A,04 Move the Content immediately
at 02 to A
0000:8002 47 MOV B,A Move the Content of A to B
0000:8003 3E 03 MOVI A,06 Move the Content immediately
at 06 to A
0000:8005 90 ADD B Subtract content of A to B

0000:8006 32 00 85 STA 8500 Store the output of 8500


memory location
0000:8009 76 HLT stop

INPUT:
A- 06

Department of Electronics and Communication Engineering: SVUCE


Microprocessors and Microcontroller Laboratory

B- 04

OUPUT:

8500- 02

RESULT:

Thus,the ALP for addition of two numbers using 8085 was executed
successfully.

Department of Electronics and Communication Engineering: SVUCE

You might also like