flat assembler
Message board for the users of flat assembler.

Index > Main > PUSH IMM problem in USE64

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 07 Jan 2006, 12:02
Hello,

use32
push 0F0000000h

It assembles OK with FASM.

use64
push 0F0000000h

[ERROR:] Value out of range.

Is this a bug or I'm doing something wrong?

Thanks.
Post 07 Jan 2006, 12:02
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 07 Jan 2006, 13:57
In long mode 32-bit values are sign-extended into 64 bits when pushed, thus PUSH instruction with 0F0000000h immediate does push the 0FFFFFFFFF0000000h value on the stack. If you do PUSH 0FFFFFFFFF0000000h, fasm will generate the proper opcode, but if you want to push actually the 0F0000000h, it's impossible this way, since it doesn't fit in the signed 32-bit immediate range. Thus you should do it rather this way:
Code:
mov eax,0F0000000h ; this does the zero-extension to RAX
push rax    
Post 07 Jan 2006, 13:57
View user's profile Send private message Visit poster's website Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 07 Jan 2006, 19:50
Thanks again Tomasz, you are my hero! Very Happy
Post 07 Jan 2006, 19:50
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 10 Jan 2006, 05:11
and designer of this 64bit extension isn't my hero
Post 10 Jan 2006, 05:11
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.