JNZ will check ZF and jump if it's not set, i.e. If you check the disassembly you'll notice that CMP is one byte longer: 83 F8 00 cmp eax, 0Īfter the above instructions the SF, ZF, PF, CF, OF (and AH with cmp) will be modified. However sometimes OR is also used (most likely emitted by the Delphi compiler) because OR reg, reg gives the same results as AND reg, reg. Str call strlen add esp, 0Ch xor ecx, ecx test eax, eax jle short. AND eax, eax can also be used, since it's exactly the same as TEST except it destroys the destination (but that's irrelevant in cases where source and dest are the same register like this). mov eax, ecx mov edx, ebx mov eax, edx mov edx, eax sar edx, 1Fh sar eax. As a result, shorter instructions are generally preferred For example to check if the high bits in rax are zero SHR rax, 32 JZ RAX_IS_0 can be used which saves a CMP. If the appropriate flag(s) are set they'll take the action, hence any instructions that affect the flag(s) can be used, not only CMP. After that, the jz instruction will get executed and the execution flow will jump to 0xABCD0000 if the ZF flag is set to 1 or the content of the EAX register is zero. If the content of the EAX register is zero, the Zero Flag (ZF) will be set to 1. X86 conditional branch and move instructions decide whether to jump/move or not depending on the flags. Here, the test instruction performs a bitwise AND between the content of the EAX register.
0 Comments
Leave a Reply. |