Figure 3-16 Evaluating an expression with double-precision operands.

Data related directives, input, and other code
X, Y, W, and Z are defined as word variables
     MOV    AX,X      ;ADD THE DOUBLE PRECISION
     MOV    DX,X+2    ;NUMBER IN X AND X+2
     ADD    AX,Y      ;TO THE DOUBLE PRECISION
     ADC    DX,Y+2    ;NUMBER IN Y AND Y+2
     ADD    AX,24     ;ADD THE DOUBLE PRECISION
     ADC    DX,0      ;NUMBER 24 TO THE RESULT
     SUB    AX,Z      ;SUBTRACT THE DOUBLE PRECISION
     SBB    DX,Z+2    ;NUMBER IN Z AND Z+2 FROM THE SUM
     MOV    W,AX      ;STORE THE OVERALL
     MOV    W+2,DX    ;RESULT IN W AND W+2
Output and other code

Figure 3-17 Sign-extension instructions.

NameMnemonic and FormatDescription
Convert byte to word
CBW
Extend sign of AL to AH
Convert word to double word
CWD
Extend sign of AX to DX

Flags: None of the flags are affected.

Addressing modes: Operand must be in AL or AX.

Figure 3-18 Single operand binary arithmetic instructions and the compare instruction.

NameMnemonic and FormatDescription
Increment
INC    OPR
(OPR)(OPR)+1
Decrement
DEC    OPR
(OPR)(OPR)-1
Negate
NEG    OPR
(OPR)-(OPR)
Compare
CMP    OPR1,OPR2
(OPR1)-(OPR2)

Flags: All condition flags are affected except that INC and DEC do not change the CF flag.

Addressing modes: INC, DEC, and NEG must not use the immediate mode. Unless the OPR2 is immediate, one of the operands for a CMP instruction must be in a register; the other operand may have any addressing mode except that OPR1 cannot be immediate.


Table of Contents | Next page | Previous page

This is page 29.