반응형


점프 할때의 플래그들 정리

비슷한 의미 별로 그룹화 시켜놓은것들, 필요 할 때 참고삼아


Getting the sense for jumps and flags has long been a troublesome area for me, especially since the Intel assembler book shows 32 of these, all with similar-sounding names. Looking more closely I found that many of the instructions were synonyms for each other, and in practice the whole gamut is not needed, and in the process found that my copy of Intel's 80386 Programmer's Reference Manual gave an incorrect description for one of the instructions.

So I have grouped these functionally, with all instruction synonyms in the same row.

InstructionDescriptionsigned-nessFlagsshort 
jump 
opcodes
near 
jump 
opcodes
JOJump if overflow OF = 1700F 80
JNOJump if not overflow OF = 0710F 81
JSJump if sign SF = 1780F 88
JNSJump if not sign SF = 0790F 89
JE 
JZ
Jump if equal 
Jump if zero
 ZF = 1740F 84
JNE 
JNZ
Jump if not equal 
Jump if not zero
 ZF = 0750F 85
JB 
JNAE 
JC
Jump if below 
Jump if not above or equal 
Jump if carry
unsignedCF = 1720F 82
JNB 
JAE 
JNC
Jump if not below 
Jump if above or equal 
Jump if not carry
unsignedCF = 0730F 83
JBE 
JNA
Jump if below or equal 
Jump if not above
unsignedCF = 1 or ZF = 1760F 86
JA 
JNBE
Jump if above 
Jump if not below or equal
unsignedCF = 0 and ZF = 0770F 87
JL 
JNGE
Jump if less 
Jump if not greater or equal
signedSF <> OF7C0F 8C
JGE 
JNL
Jump if greater or equal 
Jump if not less
signedSF = OF7D0F 8D
JLE 
JNG
Jump if less or equal 
Jump if not greater
signedZF = 1 or SF <> OF7E0F 8E
JG 
JNLE
Jump if greater 
Jump if not less or equal
signedZF = 0 and SF = OF7F0F 8F
JP 
JPE
Jump if parity 
Jump if parity even
 PF = 17A0F 8A
JNP 
JPO
Jump if not parity 
Jump if parity odd
 PF = 07B0F 8B
JCXZ 
JECXZ
Jump if %CX register is 0 
Jump if %ECX register is 0
 %CX = 0 
%ECX = 0
E3 

Processor Flags

The x86 processors have a large set of flags that represent the state of the processor, and the conditional jump instructions can key off of them in combination.

CF - carry flag(c에서는 CY)
Set on high-order bit carry or borrow; cleared otherwise
PF - parity flag(c에서는 PE)
Set if low-order eight bits of result contain an even number of "1" bits; cleared otherwise
ZF - zero flags(c에서는 ZR)
Set if result is zero; cleared otherwise
SF - sign flag(c에서는 PL이던디)
Set equal to high-order bit of result (0 if positive 1 if negative)
OF - overflow flag(c에서는 OV)
Set if result is too large a positive number or too small a negative number (excluding sign bit) to fit in destination operand; cleared otherwise



http://unixwiz.net/techtips/x86-jumps.html


반응형

+ Recent posts