![](/images/new-backgrounds/1112527/112527127x1.webp)
BASIC INSTRUCTION SET
Example: SUB WORDOPRND, AX. Replaces the contents of the destination operand WORDOPRND with the result obtained by subtracting the contents of AX from the contents of the memory word labeled WORDOPRND.
SBB (Subtract Integers with Borrow) subtracts the source operand from the destination operand, subtracts 1 if CF is set, and returns the result to the destination operand. The operands may be signed or unsigned bytes or words. SBB may be used to subtract numbers longer than 16 bits. This instruction affects OF, SF, ZF, AF, PF, and CF. The carry flag is set if a borrow is required.
Example: SBB BL, 32. Subtracts 32 from the contents of BL and then decrements the result of this subtraction by one if CF is set. If CF is cleared, SBB performs the same operation as SUB.
DEC (Decrement) subtracts 1 from the destination operand. DEC updates AF, OF, PF, SF, and ZF, but it does not affect CF. Use SUB with an immediate value of 1 to perform a decrement that affects carry.
Example: DEC BX. Subtracts 1 from the contents of BX and places the result back in BX.
3.3.3 Multiplication Instructions
MUL (Unsigned Integer Multiply) performs an unsigned multiplication of the source operand and the accumulator. If the source is a byte, the processor multiplies it by the contents of AL and returns the
If the source operand is a word, the processor multiplies it by the contents of AX and returns the
Example: MUL BX. Replaces the contents of DX and AX with the product of BX and AX. The low- order 16 bits of the result replace the contents of AX; the
IMUL (Signed Integer Multiply) performs a signed multiplication operation. IMUL uses AX and DX in the same way as the MUL instruction, except when used in the immediate form.
The immediate form of IMUL aiiows the specificaiion of a destination register other than the combi- nation of DX and AX. In this case, the result cannot exceed 16 bits without causing an overflow. If the immediate operand is a byte, the processor automatically extends it to 16 bits before performing the multiplication.
The immediate form of IMUL may also be used with unsigned operands because the low 16 bits of a signed or unsigned multiplication of two
IMUL clears CF and OF to indicaie ihai iht: upper half of thc rcsult b the gig!'! of the low,,"! h~Jf This instruction leaves SF, ZF, AF, and PF undefined.
Example: IMUL BL. Replaces the contents of AX with the product of BL and AL. The processor sets CF and OF if the result is more than 8 bits long.
Example: IMUL BX, SI, 5. Replaces the contents of BX with the product of the contents of SI and an immediate value of 5. The processor sets CF and OF if the signed result is longer than 16 bits.