flat assembler
Message board for the users of flat assembler.
Index
> Windows > [x64] Question about sign-extension |
Author |
|
Tomasz Grysztar 07 Jan 2012, 12:08
yoshimitsu wrote: "mov rax,12345678h" gives "mov rax,0000000012345678h" and something like "mov rax,dword 12345678h" is invalid. yoshimitsu wrote: But "mov qword [var],87654321h" fails to assemble because of the value being out of range, although I was expecting sign-extension. When you write assembly language instruction, it focuses on what the instruction has to do, not how is it going to be encoded. So if you write what value you want to put into qword variable, you should really specify the value that you want to put there and not the value that you expect to get in the encoding. So the correct form would be: Code: mov qword [var],0FFFFFFFF87654321h Code: mov qword [var],-789ABCDFh yoshimitsu wrote: Additionally, I've got another question in reference to LEA: |
|||
07 Jan 2012, 12:08 |
|
yoshimitsu 07 Jan 2012, 18:44
Sorry, I did not use "mov rax,12345678h", but "mov rax,87654321h" in which case you can't take the sign-extended 32-bit immediate, because it'd have a false result which wouldn't match the actual instruction.
Tomasz Grysztar wrote: [...] you should really specify the value that you want to put there and not the value that you expect to get in the encoding [...] So FASM throws "value out of range" because "87654321h" isn't explicitly negative? |
|||
07 Jan 2012, 18:44 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.