flat assembler
Message board for the users of flat assembler.

Index > Main > push 64 bit immediate value?

Author
Thread Post new topic Reply to topic
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
Hello, i was wondering how i could push 64 bits onto the stack for a functions arguments by only using an immediate value, without using 'double' macro.
I know how to do it if the value is in memory by pushing [val+4] then [val].
I realize that using invoke someFunc,double 1.0 is how to do it the easy way.
But if i continue to use these high level macro i will never really learn whats going on under the hood.
After browsing win32ax.inc i only became more confused on how it was done.
So what this boils down to is taking a 32 bit value and casting it to 64 bits then i can push the high and low part separately.
Is the cdq instruction what i need to use? (from chapter 2.1.2 in the manual)
Maybe like..
Code:
mov eax,1.0
cdq
push edx
push eax
call [someFunc]
    

Ok, thanks for your time..
Post 23 Sep 2008, 22:38
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Code:
val = 1.0
push val shr 32
push val and $FFFFFFFF
    
Question
Post 23 Sep 2008, 23:01
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
Yep, that works nice, i didn't realize you could concatenate like that.
Since this value is constant we don't need to calculate it at run-time.
I guess now what i need to do is write a little program that takes a 32 bit input value and displays the high and low 32 bit parts after casting it into 64 bits.
Thanks LocoDelAssembly, you have been great!
Post 23 Sep 2008, 23:37
View user's profile Send private message 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-2020, Tomasz Grysztar.

Powered by rwasa.