Arithmetic Instructions - Intel iAPX 86/88 User Manual

Table of Contents

Advertisement

8086/8088 CPU
Table 1-4 Arithmetic Instructions
ADDITION
ADD
Add byte or word
ADC
Add byte or word with carry
INC
Increment byte or word by 1
AAA
ASCII adjust for addition
DAA
Decimal adjust for addition
SUBTRACTION
SUB
Subtract byte or word
SBB
Subtract byte or word with
borrow
DEC
Decrement byte or word by 1
NEG
Negate byte or word
CMP
Compare byte or word
AAS
ASCII adjust for subtraction
DAS
Decimal adjust for subtraction
MULTIPLICATION
MUL
Multiply byte or word unsigned
IMUL
Integer multiply byte or word
AAM
ASCII adjust for multiply
DIVISION
DIV
Divide byte or word unsigned
IDIV
Integer divide byte or word
AAD
ASCII adjust for division
CBW
Convert byte to word
CWO
Convert word to doubleword
when converting 8080/8085 assembly language programs
to run on the 8086 or 8088. The address object instruc-
tions manipulate the addresses of variables instead of the
contents of values of the variables. This is useful for list
processing, based variable and string operations.
Arithmetic Instructions
The arithmetic instructions (see Table 1-4) perform opera-
tions on four types of numbers: 1) unsigned binary; 2)
signed binary (integers); 3) unsigned packed decimal; and
4) unsigned unpacked decimal. See Table 1-5. Binary
numbers may be 8 or 16 bits long. Decimal numbers are
stored in bytes, two digits per byte for packed decimal and
one digit per byte for unpacked decimal. The processor
always assumes that the operands specified in arithmetic
instructions contain data that represents valid numbers for
the type of instruction being performed. Invalid data may
produce unpredictable results.
Arithmetic instructions post certain characteristics of the
result of an operation to six flags. Refer to Chapter 3 in
the iAPX 86/88,186/188 User's Manual Programmers
Reference for a detailed description of the arithmetic in-
structions and flags.
Bit Manipulation Instructions
The 8086 and 8088 CPU's provide three groups of in-
structions for manipulating bits within both bytes and
word. These three groups are logicals, shifts and rotates.
Thble 1-6 lists these three groups of bit manipulation in-
structions with their functions.
a. Logical
The logical instructions include the boolean operators
"not", "and", "inclusive or", and "exclusive or". A
TEST instruction that sets the flags as a result of a bool-
ean "and" operation, but does not alter either of its oper-
ands, is also included.
b. Shifts
The bits in bytes and words may be shifted arithmetically
or logically. Up to 255 shifts may be performed, accord-
ing to the value of the count operand coded in the instruc-
tion. The count may be specified as a constant 1, or
register CL, allowing the shift count to be a variable sup-
plied at execution time. Arithmetic shifts may be used to
multiply and divide binary numbers by powers of two.
Logical shifts can be used to isolate bits in bytes or words.
c. Rotates
Bits in bytes and words can also be rotated. Bits rotated
out of an operand are not lost as in a shift, but are "cir-
cled" back into the other "end" of the operand. As in the
shift instructions, the number of bits to be rotated is taken
Table 1-5 Arithmetic Interpretation of 8-Bit Numbers
HEX
BIT PATTERN
UNSIGNED
SIGNED
UNPACKED
PACKED
BINARY
BINARY
DECIMAL
DECIMAL
07
00000111
7
+7
7
7
89
1 0001001
137
-119
invalid
89
C5
1 1000101
197
-59
invalid
invalid
1-14
210912-001

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Iapx 186/188

Table of Contents