FSTSW           Store status word                    Exceptions: None
FNSTSW Store status word, no wait C3 C2 C1 C0: ? ? ? ?

FSTSW destination
FNSTSW destination

Logic destination ← status word

FSTSW stores the current value of the status word in destination,
a 16-bit memory location, or -- in the 287+ -- the AX register of
the 80x86. FSTSW checks for unmasked FP error conditions before
storing the status word; FNSTSW does not make this check.


Note
FSTSW/FNSTSW are primarily used for conditional branching after a
comparison instruction (FPREM, FPREM1, or FXAM). They can also be
used to invoke exception handlers (by polling the exception bits) in
environments that do not use interrupts.


Example
p287
fstsw ax ; read FPU status word
sahf ; copy condition codes to flags
jc @@c0 ; jc ~ C0, jp ~ C2, jz ~ C3


Opcode Format
9B DF /7 FSTSW m16
9B DF E0 FSTSW AX
DF /7 FNSTSW m16
DF E0 FNSTSW AX


Timing
Variations/
operand 8087 287 387 486 Pentium
fstsw m16 12-18 12-18 15 3 2 NP
fstsw ax - 10-16 13 3 2 NP
fnstsw m16 12-18 12-18 15 3 2 NP
fnstsw ax - 10-16 13 3 2 NP

The wait version may take additional cycles