flat assembler
Message board for the users of flat assembler.
Index
> Main > which flags "test" updates? |
Author |
|
vivik 20 Mar 2017, 17:43
This page https://flatassembler.net/docs.php?article=manual says:
>test performs the same action as the and instruction, but it does not alter the destination operand, only updates flags. Rules for the operands are the same as for the and instruction. >and, or and xor instructions perform the standard logical operations. They update the SF, ZF and PF flags. Rules for the operands are the same as for the add instruction. , but this page http://stackoverflow.com/questions/147173/x86-assembly-testl-eax-against-eax says: >CF and OF cleared (AND/TEST always does that, and subtracting zero never produces a carry) >ZF, SF and PF according to the value in EAX. (a = a&a = a-0) So I guess, that's something to add in the fasm documentation? I'm asking this because in the second link you can find this: >It tests whether eax is 0, or above, or below. But I'm not sure if it can test for "above" or "below", does it set enough flags for that? Also, is that a signed or unsigned comparasion? |
|||
20 Mar 2017, 17:43 |
|
revolution 21 Mar 2017, 02:04
vivik: I suggest you download either the Intel Manuals, or the AMD manuals, or both. There are thousands of little details that the fasm manual doesn't cover. Without the source manuals you will be lost.
|
|||
21 Mar 2017, 02:04 |
|
vivik 21 Mar 2017, 05:40
@zhak
Thanks for clearing things out! @revolution >There are thousands of little details that the fasm manual doesn't cover. Can I get some examples? |
|||
21 Mar 2017, 05:40 |
|
system error 21 Mar 2017, 05:55
@vivik
FASM manual is a description about FASM - it describes mostly how it implements x86 instruction sets and how it may or may not differ from the ISA. So, FASM manual just goes a quick walkthrough of the entire instruction sets without bothering about the details. The technical details of such implementations are described in the Intel/AMD manuals instead. For example, it could be that FASM implements a symbolic MOVTOREG to represent intel's <mov reg,source> instruction. Assembler's manual is used to explain such things. |
|||
21 Mar 2017, 05:55 |
|
vivik 21 Mar 2017, 06:25
hm... fasm manual seems to be enough for practical needs, it's verbose just enough for me to understand.
Can you give me other details that may be important during assembly programming but are not mentioned in fasm manual? |
|||
21 Mar 2017, 06:25 |
|
system error 21 Mar 2017, 06:38
vivik wrote: hm... fasm manual seems to be enough for practical needs, it's verbose just enough for me to understand. Example: not all instructions mentioned in FASM manuals come with explanations of the affected flags. Example: there's no instruction mnemonics (which are important for debuggers, disassemblers) We are lucky enough that FASM emulates all instructions as close as possible to the Intel/AMD definitions. In MASM for example, MOVQ is implemented differently than the Intel Manual. So assuming MOVQ of FASM and MOVQ of MASM behaves the same is wrong. That's the purpose of assembler's manual - to explain WHAT it implements and HOW they may differ. |
|||
21 Mar 2017, 06:38 |
|
vivik 21 Mar 2017, 07:12
Always thought that MOV, AND, TEST actually are the mnemonics, was I wrong?
|
|||
21 Mar 2017, 07:12 |
|
system error 21 Mar 2017, 07:54
What I meant to say was encoding. I personally prefer the term SYMBOLS when referring to textual representations of instructions because it applies to all programming languages when it comes to syntax.
|
|||
21 Mar 2017, 07:54 |
|
vivik 21 Mar 2017, 08:12
Ok, I see. Thanks.
|
|||
21 Mar 2017, 08:12 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.