Difference between revisions of "Assembler:Commands:TEST"
Jump to navigation
Jump to search
Hanslhansl (talk | contribs) m |
|||
(3 intermediate revisions by one other user not shown) | |||
Line 4: | Line 4: | ||
The TEST instruction works same as the [[Assembler:Commands:AND|AND]] operation, but unlike [[Assembler:Commands:AND|AND]] instruction, it does not change the first operand. | The TEST instruction works same as the [[Assembler:Commands:AND|AND]] operation, but unlike [[Assembler:Commands:AND|AND]] instruction, it does not change the first operand. | ||
− | The ''' | + | The '''SF''' flag is set to the most significant bit of the result of the AND. If the result is 0, the '''ZF''' flag is set to 1, otherwise set to 0. The '''PF''' flag is set to the bitwise XNOR of the least significant byte of the result, 1 if the number of ones in that byte is even, 0 otherwise. The '''OF''' and '''CF''' flags are set to 0. The value of '''AF''' is undefined. |
Line 10: | Line 10: | ||
Computes the bit-wise logical AND of first operand (source 1 operand) and the second operand (source 2 operand) and sets the SF, ZF, and PF status flags according to the result. The result is then discarded. | Computes the bit-wise logical AND of first operand (source 1 operand) and the second operand (source 2 operand) and sets the SF, ZF, and PF status flags according to the result. The result is then discarded. | ||
− | [http://x86 | + | [http://c9x.me/x86/html/file_module_x86_id_315.html c9x.me/x86/html/file_module_x86_id_315.html] |
</div> | </div> | ||
Line 56: | Line 56: | ||
test [SomeSymbol],rax | test [SomeSymbol],rax | ||
− | + | {{AssemblerCommandSeeAlso}} | |
− | |||
− | |||
− | |||
− | + | {{Template:AssemblerCommandExternalLinks}} | |
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 21:19, 25 March 2022
command test destination, source
The TEST instruction works same as the AND operation, but unlike AND instruction, it does not change the first operand.
The SF flag is set to the most significant bit of the result of the AND. If the result is 0, the ZF flag is set to 1, otherwise set to 0. The PF flag is set to the bitwise XNOR of the least significant byte of the result, 1 if the number of ones in that byte is even, 0 otherwise. The OF and CF flags are set to 0. The value of AF is undefined.
Computes the bit-wise logical AND of first operand (source 1 operand) and the second operand (source 2 operand) and sets the SF, ZF, and PF status flags according to the result. The result is then discarded.
Command Parameters[edit]
Parameter | Description |
---|---|
destination | The destination operand |
source | The source operand |
Examples[edit]
test al,1
test ax,1
test ax,1
test eax,1
test rax,1
test al,al
test ax,ax
test ax,ax
test eax,eax
test rax,rax
test [eax],eax
test [rax],rax
test [00123ABC],eax
test [SomeSymbol],rax