Experiment 2 Updated
Experiment 2 Updated
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
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
Example Code:
MOV AX,1234H
MOV BX,4567H
ADD AX,BX
INT 03H
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
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
Example Code:
MOV AX, 1203H
MOV BX, 0007H
MUL BX
MOV CX,AX
INT 03H
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