Test (the two operands are AND respectively, which only modifies the flag bit and does not send back the result).
Test performs AND operation on two parameters (target and source) and sets the flag register according to the result. The result itself will not be saved. Testing AX, BX and AX, BX commands have the same effect. Grammar: TEST r/m, r/m/data.
Impact symbols: C, O, P, Z, S (where the two symbols C and O will be set to 0). Example:
1.Test is used to test a bit, such as registers: test eax,100b; The suffix b stands for binary.
Jnz * * * * * If the third digit from the right of eax is 1, JNZ will jump. I think so, too. The condition of jnz jump is ZF = 0, which means that ZF (zero flag) is not set, which means that the result of logical AND is 1.2. A very common use of test is to test whether a register is empty: test ecx, ecx.
If ecx is zero somewhere in Jz, set ZF zero flag as 1, and JZ jump CMP is an arithmetic operation instruction function: compare two values (register, memory, direct value).
Grammar: CMP r/m, r/m/data
Markers: C, P, A, Z, O CMP comparison. (When two operands are subtracted, only the flag bit is modified, and the result is not sent back).
Cmp is actually a subtraction that only sets the flag without saving the structure, and sets the Z flag (zero flag).
Much like carry, the zero flag is also a bit in the internal flag register. For example:
Cmp eax,2; If eax-2=0, that is, EAX = 2, set the zero flag to 1.
JZ * * * If the zero flag is set, jump to the test logic, the operation result is zero, and set ZF (zero flag) as1;
If the result of cmp arithmetic subtraction is zero, set ZF (zero mark) to 1.