0% found this document useful (0 votes)
143 views14 pages

Assembly Language Programming 8086

The document describes 10 programs for performing arithmetic and logical operations on 16-bit numbers using 8086 assembly language. The programs include adding, subtracting, multiplying and dividing two 16-bit numbers; multiplying, dividing and sorting arrays of numbers; finding the largest/smallest number in an array; calculating the sum of cubes; and searching for a number in a string. Flowcharts and code snippets are provided to demonstrate how each operation is implemented on the 8086 architecture.

Uploaded by

Senthil Kumar
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)
143 views14 pages

Assembly Language Programming 8086

The document describes 10 programs for performing arithmetic and logical operations on 16-bit numbers using 8086 assembly language. The programs include adding, subtracting, multiplying and dividing two 16-bit numbers; multiplying, dividing and sorting arrays of numbers; finding the largest/smallest number in an array; calculating the sum of cubes; and searching for a number in a string. Flowcharts and code snippets are provided to demonstrate how each operation is implemented on the 8086 architecture.

Uploaded by

Senthil Kumar
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/ 14

1. ALP TO ADD,SUB,MUL,DIV TWO 16-BIT NUMBERS.

PROGRAM CODE:-

XOR AX,AX
MOV ES,AX
MOV DI,3000
XOR BX,BX
XOR CX,CX
XOR DX,DX
MOV AX,5555
MOV BX,2222
ADD AX,BX
MOV [DI],AX
INC DI
INC DI
MOV AX,5555
SUB AX,BX
MOV [DI],AX
INC DI
INC DI
MOV AX,5555
MUL BX
MOV [DI],AX
INC DI
INC DI
INC DI
INC DI
MOV AX,5555
XOR DX,DX
DIV BX
MOV [DI],AX
INC DI
INC DI
MOV[DI],DX
INT 03

I/P:AX=5555 BX=2222
O/P: ES:DI
0000:3000 77
0000:3001 77 } Add(AX)
0000:3002 33}
0000:3003 33} Sub(AX)
0000:3004 4A}
0000:3005 9F} AX
0000:3006 60}
0000:3007 0B } DX MUL(AX,DX)

0000:3008 02}
0000:3009 00} AX Quotient}

0000:300A 11}
0000:300B 11} DX Reminder } DIV
Flow chart:

Start

Get the first number

Get the second number

ADD the two numbers

Carry=0 Carry=1

Is carry flag set

Store result and carry in


memory

Stop
2. MULTIPLICAION OF TWO 16-BIT DATA

PROGRAM CODE:

MOV AX,[0300]
MOV BX,[0302]
MUL BX
INT A5

RESULT:

Input Data (Before Execution)

0000:030 4
0 4
0000:030 4
1 4
0000:030 1
2 1
0000:030 1
3 1

Output Data (After Execution)


A 4
L 4
A 4
H 4
D 0
L 0
D 0
H 0
3. DIVISION OF TWO 16-BIT DATA

PROGRAM CODE:

MOV AX,[0300]
MOV BX,[0302]
DIV BX
INT A5

RESULT:

Input Data (Before Execution)

0000:030 4
0 4
0000:030 4
1 4
0000:030 2
2 2
0000:030 2
3 2

Output Data (After Execution)

A 2
L 2
A 2
H 2
D 0
L 0
D 0
H 0
4 MULTIPLICAION OF SIGNED NUMBERS

PROGRAM CODE:

MOV AX,0200
MOV DS,AX
MOV AL,[1500]
NEG AL
MOV BL,[1501]
MUL BL
MOV [1505],AX
INT A5
RESULT:

Input Data (Before Execution)

2000:1500 10
2000:1501 15

Output Data (After Execution)

2000:1505 B0
2000:1506 13
5.ASCENDING ORDER DESCENDING ORDER OF AN ARRAY
OF NUMBERS

PROGRAM CODE:

MOV CX,0005
DEC CX
Again MOV DX,CX
MOV SI,0200
Up MOV AL,[SI]
INC SI
MOV BL,[SI]
CMP AL,BL
JLE/JGE Next
XCHG AL,BL
MOV [SI],BL
DEC SI
MOV [SI],AL
INC SI
Next DEC DX
JNZ Up
DEC CX
JNZ Again
INT A5
RESULT

Input Data (Before Execution)

0000:020 3
0 8
0000:020 4
1 7
0000:020 0
2 2
0000:020 1
3 1
0000:020 2
4 9

Output Data (After Execution)

Ascending order Descending


order
0000:0200 02 47
0000:0201 11 38
0000:0202 29 29
0000:0203 38 11
0000:0204 47 02
6. FINDING LARGEST SMALLEST NUMBERS IN AN ARRAY OF
NUMBERS

PROGRAM CODE:

XOR AX,AX
MOV DS,AX
MOV SI,5000
MOV CL,06
MOV AL,[SI]
L1: INC SI
MOV BL,[SI]
CMP AL,BL
JL 7014(L2)
XCHG AL,BL
L2: LOOP 700B(L1)
INT 03
7. To find the Greatest number

PROGRAM CODE:

XOR AX,AX
MOV DS,AX
MOV SI,5000
MOV CL,06
MOV AL,[SI]
L1: INC SI
MOV BL,[SI]
CMP AL,BL
JG 7014(L2)
XCHG AL,BL
L2: LOOP 700B(L1)
INT 03
8. PROGRAM FOR SORTING AN ARRAY FOR 8086

PROGRAM CODE:

MOV SI,[0300]
MOV CL,[SI]
MOV DI,0220
MOV BX,0000
MOV AH,00
Up INC SI
MOV AL,[SI]
MUL AL
ADD [DI],AX
DEC CL
JNZ Up
INT A5
9. SUM OF CUBES OF ‘N’ NUMBERS

PROGRAM CODE:

MOV SI,0200
MOV DI,0220
MO CL,0A
MOV AX,0000
MOV [DI],AX
MOV AL,[SI]
MOV BL,AL
MUL AL
MUL BL
ADD [DI],AX
Up INC SI
DEC CL
JNZ Up
INT A5
RESULT

Input Data Output Data

0000:020 01 0220 D1
0
0000:020 02 0221 0b
1
0000:020 03
2
0000:020 04
3
0000:020 05
4
0000:020 06
5
0000:020 07
6
0000:020 08
7
0000:020 09
8
0000:020 0A
9
10.Program for Searching A for A Number in a Sting for 8086.

PROGRAM CODE:

XORW AX, AX
XORW BX, BX
MOVW DS,AX
MOVW SI, 6000
MOVW CX, 0007
MOVB AL,09
MOVB BL,[SI]
CMP AL, BL
JZ : L1
INCW SI
LOOP L2
MOV DX, SI
INT 03

You might also like