Add instruction-part1

235 views 9 slides May 21, 2020
Slide 1
Slide 1 of 9
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9

About This Presentation

Add instruction in Assembly programming with examples:
video link: https://www.youtube.com/watch?v=LtYX_pkWghE&feature=youtu.be


Slide Content

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 13 CF= 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.