(FPU) cheatsheet


FCOM/FCOMPP/FCOMPP

ConditionC3C2C0
ST(0) > SRC000
ST(0) < SRC001
ST(0) = SRC100

FPU status word

                                                                   
F(N)STSW AX AX  
AH AL  
  8 7 6 5 4 3 2 1 8 7 6 5 4 3 2 1  
  15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0  
  B C3 TOP C2 C1 C0 ES SF PE UE OE ZE DE IE  
   
FPU Busy Top of
Stack Pointer
Invalid Operand Exception
Condition Code Denormal Operand Exception
Error Summary Status Zero Divide Exception
Stack Fault Overflow Exception
Precision Exception Underflow Exception

FCOMP scenario #1

FLD  [EAX]
FCOMP  [ECX]
FNSTSW  AX
TEST  AH, 1
JNZ  branch ;take branch when [eax] < [ecx]

FCOMP scenario #2

FLD  [EAX]
FCOMP  [ECX]
FNSTSW  AX
TEST  AH, 41h
JP  branch ;take branch when [eax] > [ecx]

REP: for ecx repetitions

STOSB/W/D: copy from EAX to EDI, inc EDI

MOVS/W/D: copy from ESI to EDI, inc ESI and EDI