0% found this document useful (0 votes)
29 views

Experiment 2 Updated

This document describes experiments to verify arithmetic operations in 8086 assembly language using different registers. It provides examples of adding, subtracting, multiplying and dividing 8-bit and 16-bit numbers using instructions like ADD, SUB, MUL, DIV. It also lists some practice problems and their solutions to write assembly code for various arithmetic operations using allowed registers.

Uploaded by

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

Experiment 2 Updated

This document describes experiments to verify arithmetic operations in 8086 assembly language using different registers. It provides examples of adding, subtracting, multiplying and dividing 8-bit and 16-bit numbers using instructions like ADD, SUB, MUL, DIV. It also lists some practice problems and their solutions to write assembly code for various arithmetic operations using allowed registers.

Uploaded by

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

Experiment 2: Verification

of Arithmetic Operations in
8086
BITS Pilani Department of EEE
Hyderabad Campus
"Assembly Language Programming” to be completed

Registers to be used
Operation
8-bit 16-bit
Addition CL, DL AX, BX
Subtraction CL, DL BX, CX
Multiplication AL, BL AX, BX
Division AL, BL AX, BX

Title| Presenter 2 BITS Pilani, Hyderabad Campus


2.1 Addition of two 8-bit numbers

Instruction to be used: ADD


Instruction Operands Usage Description
REG, memory Operand 1 = Operand 1 + Operand 2
memory, REG
Example:
ADD REG, REG ADD AL,BL
memory, immediate ADD AL,05h
Operates on 8-bit numbers.
REG, immediate

Example Code:
MOV CL,12H
MOV DL,45H
ADD CL,DL
INT 03H
Title| Presenter 3 BITS Pilani, Hyderabad Campus
2.2 Addition of two 16-bit numbers

Instruction Operands Usage Description


REG, memory Operand 1 = Operand 1 + Operand 2
memory, REG
Example:
ADD REG, REG ADD AX,BX
memory, immediate ADD AX,05H
Operates on16-bit numbers.
REG, immediate

Example Code:
MOV AX,1234H
MOV BX,4567H
ADD AX,BX
INT 03H

Title| Presenter 4 BITS Pilani, Hyderabad Campus


2.3 Subtraction of two 8-bit numbers

Instruction to be used: SUB

Instruction Operands Usage Description


REG, memory Operand 1 = Operand 1 - Operand 2
memory, REG
Example:
SUB REG, REG SUB AL,BL
memory, immediate SUB AL,1
REG, immediate Operates on 8-bit numbers.

Example Code:
MOV CL,34H
MOV DL,21H
SUB CL,DL
INT 03H
Title| Presenter 5 BITS Pilani, Hyderabad Campus
2.4 Subtraction of two 16-bit numbers
Instruction to be used: SUB
Instruction Operands Usage Description
REG, memory Operand 1 = Operand 1 - Operand 2
memory, REG
Example:
SUB REG, REG SUB AX,BX
memory, immediate SUB AX,1
REG, immediate Operates on 16-bit numbers.

Example Code:
MOV BX,1334H
MOV CX,1221H
SUB BX,CX
MOV AX,BX
INT 03H

Title| Presenter 6 BITS Pilani, Hyderabad Campus


2.5 Multiplication of two 8-bit numbers
Instruction to be used: MUL

Instruction Operands Usage Description


REG When operand is a byte:
AX = AL × operand.
MUL
memory When operand is a word:
(DX AX) = AX × operand.

Example Code
MOV AL,03H
MOV BL,07H
MUL BL
MOV DL,BL
INT 03H
Title| Presenter 7 BITS Pilani, Hyderabad Campus
2.6 Multiplication of two 16-bit numbers

Instruction to be used: MUL


Instruction Operands Usage Description
REG When operand is a byte:
AX = AL × operand.
MUL
memory When operand is a word:
(DX AX) = AX × operand.

Example Code:
MOV AX, 1203H
MOV BX, 0007H
MUL BX
MOV CX,AX
INT 03H

Title| Presenter 8 BITS Pilani, Hyderabad Campus


2.7 Division of two 8-bit numbers
Instruction to be used: DIV

Instruction Operands Usage Description


REG When operand is a byte:
AL = AX / operand
AH = remainder (modulus)
DIV memory When operand is a word:
AX = (DX AX) / operand
DX = remainder (modulus)

Example Code:
MOV AL,21H
MOV BL,03H
DIV BL
MOV CL,AL
INT 03H
Title| Presenter 9 BITS Pilani, Hyderabad Campus
2.8 Division of two 16-bit numbers
Instruction to be used: DIV
Instruction Operands Usage Description
REG When operand is a byte:
AL = AX / operand
AH = remainder (modulus)
DIV memory
When operand is a word:
AX = (DX AX) / operand
DX = remainder (modulus)
Example Code:

MOV AX,1221H
MOV DX,0000H
MOV BX,1103H
DIV BX
MOV CX,AX
INT 03H

Title| Presenter 10 BITS Pilani, Hyderabad Campus


Exercise
Write ALP codes for the following arithmetic operations:
Problem No. Arithmetic Operation to be Done Allowed registers

1 12H + 9AH CL, DL

2 1A4CH + 1BDEH AX, BX

3 7AH – 4CH CL, DL

4 3B7AH – 1C42H BX, CX

5 1DH × 77H AL, BL

6 1EFAH × 5CD0H AX, BX

7 19H ÷ 03H AL, BL

8 1233H ÷ 0034H AX, BX

In each case interpret the results of different flags. Crosscheck your


results by converting them into decimal numbers. You can also choose any
values of your choice to complete the same.

Title| Presenter 11 BITS Pilani, Hyderabad Campus

You might also like