ADD instructions
Part #1
University of Duhok,
Computer Science Dept.
ADD instruction
The ADD instruction has the following format:
ADD destination,source
The ADD instruction tells the CPU to add the source and the
destination operands and put the result in the destination.
Destination = Destination + Source
• The destination operand can be a register or a memory location.
• The source operand can be an immediate, a register, or a memory
location.
By: Jawaher A. Fadhil Computer Science Dept.
• Two memory operands cannot be used in one instruction.
• When an immediate value is used as an operand, it is sign-
extended to the length of the destination operand format.
ADD AL,1355H
ADD instruction
ADD [500],[502]
By: Jawaher A. Fadhil Computer Science Dept.
Example#1
To add two numbers such as 25H and 34H, each can be
moved to a register and then added together:
MOV AL,25h
MOV BL,34h
ADD AL,BL AL= 25H +34H
AL=59H BL=34H
By: Jawaher A. Fadhil Computer Science Dept.
Example#2
Write the Assembly language instructions to add the values
6BH and A8H. Place the result in register AX?
MOV AX,0000
MOV AL,6BH
ADD AL,A8
By: Jawaher A. Fadhil Computer Science Dept.
AL=AL+A8
6 B
+
A 8
HEX
0
1
2
.
.
9
A
B
C
D
E
F
10
11
12
13
14
15
16
3
1
1 1
AX= 00 13CF= 1
Example#2
Write the Assembly language instructions to add the values
6BH and A8H. Place the result in register AX?
MOV AX,0000
MOV AL,6BH
ADD AX,A8
By: Jawaher A. Fadhil Computer Science Dept.
AX=AL+A8
6 B
+
A 8
3
1
1 1
AX= 01 13
CF= 0
By: Jawaher A. Fadhil Computer Science Dept.
Add instruction-part1

Add instruction-part1

  • 1.
    ADD instructions Part #1 Universityof Duhok, Computer Science Dept.
  • 2.
    ADD instruction The ADDinstruction has the following format: ADD destination,source The ADD instruction tells the CPU to add the source and the destination operands and put the result in the destination. Destination = Destination + Source • The destination operand can be a register or a memory location. • The source operand can be an immediate, a register, or a memory location. By: Jawaher A. Fadhil Computer Science Dept.
  • 3.
    • Two memoryoperands cannot be used in one instruction. • When an immediate value is used as an operand, it is sign- extended to the length of the destination operand format. ADD AL,1355H ADD instruction ADD [500],[502] By: Jawaher A. Fadhil Computer Science Dept.
  • 4.
    Example#1 To add twonumbers such as 25H and 34H, each can be moved to a register and then added together: MOV AL,25h MOV BL,34h ADD AL,BL AL= 25H +34H AL=59H BL=34H By: Jawaher A. Fadhil Computer Science Dept.
  • 5.
    Example#2 Write the Assemblylanguage instructions to add the values 6BH and A8H. Place the result in register AX? MOV AX,0000 MOV AL,6BH ADD AL,A8 By: Jawaher A. Fadhil Computer Science Dept. AL=AL+A8 6 B + A 8 HEX 0 1 2 . . 9 A B C D E F 10 11 12 13 14 15 16 3 1 1 1 AX= 00 13CF= 1
  • 7.
    Example#2 Write the Assemblylanguage instructions to add the values 6BH and A8H. Place the result in register AX? MOV AX,0000 MOV AL,6BH ADD AX,A8 By: Jawaher A. Fadhil Computer Science Dept. AX=AL+A8 6 B + A 8 3 1 1 1 AX= 01 13 CF= 0
  • 8.
    By: Jawaher A.Fadhil Computer Science Dept.