2022-6-21
neg eax
sbb eax,eax
① neg: complement command. Specific operation: neg eax==>eax=0-eax, that is, 0 minus the operand.
neg eax affects CF, SF, PF, AF, ZF
When eax=0, eax=0x00000000. At this time PF=1, ZF=1, CF=0, AF=0
When eax>0, eax=-eax, CF, PF, AF, SF all become 1.
当eax<0,eax=-eax,CF=AF=1。
② sbb: Subtraction with borrow. Specific operation: sbb eax,eax==>eax=eax-eax-CF.
So the final code depends on whether the CF bit is 0 or 1. If CF==1, then eax=0xFFFFFFFF, if CF=0, then eax=0x0
③ Summary
The above two lines of code verify whether eax is 0, if eax is 0, the final result of eax is 0; if eax is not 0, the final result of eax is -1
2022-6-28
test eax,eax;
jz xxxxxxxx;
if eax=0, it jumps. If eax=1, do not jump,
that is, test eax,eax. If eax=0, then ZF=1; if eax=1, then ZF=0