
Instruction Set
4-217
SBB
SBB
Flag Settings After Instruction
Examples
This example subtracts one 64-bit unsigned number in a register (the subtrahend) from
another 64-bit unsigned number in memory (the minuend).
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Processor Status
Flags Register
reserved
OF DF
IF TF SF ZF
AF
PF
CF
? = undefined; – = unchanged
OF=1 if result larger than destination operand
OF=0 otherwise
AF=1 if carry or borrow to low nibble
AF=0 otherwise
PF=1 if low byte of result has even number of set bits
PF=0 otherwise
CF=1 for carry or borrow to high-order bit
CF=0 otherwise
–
–
–
res
res
res
SF=1 if result is 0 or positive
SF=0 if result is negative
ZF=1 if result equal to 0
ZF=0 if result not equal to 0
UMINUEND
DQ
3B865520F4DE89A1h
USUBTRAHEND
DQ
0C285DE70893BB2Ah
WSIZE
EQU
2
QSIZE
EQU
8
; 64-bit unsigned subtraction: UMINUEND = UMINUEND - USUBTRAHEND
; left (low) word subtraction
MOV
AX,WORD PTR USUBTRAHEND
; copy subtrahend
SUB
WORD PTR UMINUEND,AX
; subtract
; set up bases and index
MOV
SI,WORD PTR UMINUEND
; minuend base
MOV
DI,WORD PTR USUBTRAHEND
; subtrahend base
MOV
BX,WSIZE
; set up index
NEXT:
; next higher word subtraction
MOV
AX,[BX][DI]
; copy subtrahend
SBB
[BX][SI],AX
; subtract with borrow
; increase index and compare
ADD
BX,WSIZE
; point to next word
CMP
BX,QSIZE
; is this the last word?
; if not last word, then jump to top of loop
JNE
NEXT
Summary of Contents for Am186 Series
Page 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Page 10: ...Table of Contents x...
Page 18: ...Programming 1 8...
Page 40: ...Instruction Set Listing 3 14...