
inter
Bit Position
8
9
10
BASIC INSTRUCTION SET
Table 3·2. Control Flags'Functions
Name | Function |
TF | Trap (Single Step) |
| occurs after the next instruction executes. TF is cleared by |
| the single step interrupt. |
IF | |
| cause the CPU to transfer control to an interrupt vector- |
| specified location. |
OF | Direction |
| ment the appropriate index registers when set. Clearing OF |
| causes auto increment. |
An arithmetic operation may consist of two register operands, a general register source operand with a memory destination operand, a memory source operand with a register destination operand, or an immediate field with either a register or memory destination operand, but not two memory operands. Arithmetic instructions can operate on either byte or word operands.
3.3.1 Addition Instructions
ADD (Add Integers) replaces the destination operand with the sum of the source and destination operands. ADD affects OF, SF, AF, PF, CF, and ZF.
Example: ADD BL, BYTEOPRND. Adds the contents of the memory byte labeled BYTEOPRND to the contents of BL, and replaces BL with the resulting sum.
ADC (Add Integers with Carry) sums the operands, adds one if CF is set, and replaces the destination operand with the result. ADC can be used to add numbers longer than 16 bits. ADt affects OF, SF, AF, PF, CF, and ZF.
Example: ADC BX, Cx. Replaces the contents of the destination operand BX with the sum of BX,
.CS, and 1 (if CF is set). If CF is cleared, ADC performs the same operation as the ADD instruction.
INC (Increment) adds one to the destination operand. The processor treats the operand as an unsigned binary number. INC updates AF, OF, PF, SF, and ZF, but it does not affect CF. Use ADD with an immediate value of 1 if an increment that updates carry (CF) is needed.
Example: INC BL. Adds 1 to the contents of BL.
3.3.2 Subtraction Instructions
SUB (Subtract Integers) subtracts the source operand from the destination operand and replaces the destination operand with the result. If a borrow is required, carry flag is set. The operands may be signed or unsigned bytes or words. SUB affects OF, SF, ZF, AF, PF, and CF.