NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: nobody on September 18, 2007, 10:43:18 PM

Title: Help with setting 64 bit immediates with MOV
Post by: nobody on September 18, 2007, 10:43:18 PM
I am debugging some X64 code I assembled with NASM and I am getting odd results when setting a 64bit immediate value to a 64bit register.

When I'm using the following instruction:  

mov rax, 08080808080808080h

I'm expecting rax to have the hex value of 0x08080808080808080, However it appears that NASM is truncating the value to 4 bytes and then sign extending it, so I get the following value instead assigned to rax:

0xFFFFFFFF80808080

Is there some special syntax I'm missing? Any help would be greatly appreciated.

Chris

(If the helps I'm assembling with the '-t -f elf64' options and the CPU directive is set to X64)
Title: Re: Help with setting 64 bit immediates with MOV
Post by: nobody on September 19, 2007, 12:50:06 AM
hello,
try that: mov rax,qword 08080808080808080h
@++
Title: Re: Help with setting 64 bit immediates with MOV
Post by: nobody on September 19, 2007, 01:00:11 AM
I've already tried that and I get the same problem

Chris
Title: Re: Help with setting 64 bit immediates with MOV
Post by: Frank Kotler on September 19, 2007, 05:03:02 AM
I was going to ask what version of Nasm you're using (it's quite volatile, these days), and assure you that it *does* work with the latest release 0.99.02... but it works in "-f bin", but *not* in "-f elf64"!!!

Oh, oh! Stop the presses!

Thanks for the feedback, Chris!

Best,
Frank