Professional Documents
Culture Documents
CHAPTER 3
ARITHMETIC
INSTRUCTIONS
Example 3.11
Example 3.12
Adds 10 bytes stored in memory. The sum of
Example 3.17
Find the biggest of 10 bytes stored in memory.
10
Example 3.19
Two bytes stored in the data segment are
11
12
13
Example 3.23
Find the result and the state of the flags CF,
14
15
16
17
is to be done.
If the count > 1, load it in CL, otherwise use 1 in the
immediate mode.
The x86 Microprocessor - Lyla B Das
18
SHIFT LEFT
SAL/SHL Shift Left
Arithmetic/Shift Left
Logical.
Usage: SAL/SHL dest,
count.
19
SHIFT LEFT
Examples:
SHL BX, 1
SAL AL, CL
SHL DATA2, CL
SHL BYTE PTR [BX][DI], 1
SAL WORD PTR [DI], CL
20
Example 3.24
Find the weight of modulo sum of two
numbers
21
22
SHIFT RIGHT
SHR Shift Right Logical.
Usage: SHR dest,
count
23
SHIFT RIGHT
Examples
SHR DX, 1
SHR WORD PTR [SI] THERE, CL
SHR CH, CL
SHR BYTE PTR [BP][SI], 1
24
Example 3.25
Convert a packed BCD byte to two unpacked
bytes
25
26
Rotate Instructions
ROL Rotate Left
Usage: ROL dest,
count
Modifies Flags: CF OF
27
Rotate Left
Examples:
ROL SI, CL
ROL BYTE PTR [DI][BX], 1
28
29
Left.
Usage: RCL dest, count.
Modifies Flags: CF OF
30
31
32
33
Example 3.27
Find the values in the
34
35