3-633
INSTRUCTION SET REFERENCE
SETcc—Set Byte on Condition (Continued)
Many of the SETcc instruction opcodes have alternate mnemonics. For example, the SETG (set
byte if greater) and SETNLE (set if not less or equal) both have the same opcode and test for the
same condition: ZF equals 0 and SF equals OF. These alternate mnemonics are provided to make
code more intelligible. Appendix B, EFLAGS Condition Codes, in the Intel Architecture Soft-
ware DeveloperÂ’s Manual, Volume 1, shows the alternate mnemonics for various test conditions.
Some languages represent a logical one as an integer with all bits set. This representation can be
obtained by choosing the logically opposite condition for the SETcc instruction, then decre-
menting the result. For example, to test for overflow, use the SETNO instruction, then decre-
ment the result.
Operation
IF condition
THEN DEST
<
1
ELSE DEST
<
0;
FI;
Flags Affected
None.
Protected Mode Exceptions
#GP(0)
If the destination is located in a nonwritable segment.
If a memory operand effective address is outside the CS, DS, ES, FS, or
GS segment limit.
If the DS, ES, FS, or GS register contains a null segment selector.
#SS(0)
If a memory operand effective address is outside the SS segment limit.
#PF(fault-code)If a page fault occurs.
Real-Address Mode Exceptions
#GP
If a memory operand effective address is outside the CS, DS, ES, FS, or
GS segment limit.
#SS
If a memory operand effective address is outside the SS segment limit.
Virtual-8086 Mode Exceptions
#GP(0)
If a memory operand effective address is outside the CS, DS, ES, FS, or
GS segment limit.
#SS(0)
If a memory operand effective address is outside the SS segment limit.
#PF(fault-code)If a page fault occurs.