Professional Documents
Culture Documents
Chapter Four New Updated
Chapter Four New Updated
This group of instructions provides the 8086 with its basic integer
math skills.
Addition, subtraction, multiplication, and division can all be
performed on different sizes and types of numbers.
Addition Instructions: includes
ADD: Addition
ADC: Addition with carry
INC: Increment (Add 1)
Subtraction Instructions: This group of instructions consist of the
following group of instructions.
SUB: Subtraction
SBB: Subtraction with borrow
DEC: Decrement
NEG: 2’s Complement of a number
Hu, Institute Of Technology Department Of Electrical And Computer Engineering
1
ADDITION OF NUMBERS
ADD destination , source
Destination operand = destination operand + source operand
The instructions ADD and ADC are used to add two operands.
The destination operand can be a register or in memory.
The source operand can be a register, in memory, or immediate.
Remember that memory-to-memory operations are never allowed in 80x86
Assembly language.
The instruction could change any of the ZF, SF, AF, CF, or PF bits of the flag
register, depending on the operands involved.
Example :- If AX and BX contain l234H and 2345H, respectively, what is
the result of ADD AX, BX?
Solution: Considering ADD AX, BX, adding 1234H to 2345H gives
3579H, which replaces the contents of AX, BX still contains 2345H.
In the program above, 25H is multiplied by 65H and the result is saved in
word-sized memory named RESULT.
Hu, Institute Of Technology Department Of Electrical And Computer Engineering
24
Cont…
WORD X WORD:
In word by word multiplication, registers AX and DX will contain the
result.
Since word x word multiplication can produce a 32-bit result, AX will
hold the lower word and DX the higher word.
Example: write a program to multiply two words and save a result in
two word memory location of RESULT1.
Solution:
SOLUTION:
The decimal equivalents of 2710H and 32H are 10,000
and 50, respectively.
The quotient of these two numbers is 200, which is
00C8H.
This is the byte placed into AL.
Because the division had no remainder, AH will
contain 00.
[READING ASSINGEMENT]
EXAMPLES :
AND CX, [SI] ;AND word in DS at offset [SI] with word in CX register
;Result in CX register