flat assembler
Message board for the users of flat assembler.

Index > Windows > Local variables in windows procedures

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
How would you make local variables on the stack within a windows procedure?

Code:
proc myproc,x,y
     enter
     LOCALVARS a,b,c
     mov [a],123
     return
endp    


and a side question, Is there a way to load floating point constants directly?
like:
Code:
mov eax , [1.0] :: mov ebx , 1.0 :: mov [myvar],1.0     
Post 18 Sep 2004, 12:06
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
1)
Code:
proc myproc,x,y 
  a dd ?
     enter 
     mov [a],123 
     return 
endp    

(by the way: you don't have to put the "enter" word there unless you declare some local variables)
2)
Code:
mov eax,1.0
mov [myvar],1.0    

(for 32-bit FP values, for 64-bit ones it cannot be done with single instruction, you would have to use some macro).
Post 18 Sep 2004, 12:28
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Ok, thanks, can you also do something like fld 1.0 also? I've tried this one and it didn't work correctly.
Post 18 Sep 2004, 19:13
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
There is no such instruction in general, but you can use fld1, etc.
And you could still make some macro for it - but there is no such FPU instruction.
Post 18 Sep 2004, 19:15
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Ok, thanks, I'll probably use a local float constant the same way you would do an integer.
*MadMatt*
Post 18 Sep 2004, 21:27
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Hello everyone, problem only partly solved. I need a macro that would reserve DWORD sized varaibles on the stack,set some or all of those variables to values, and when finished, delete the stack space, and allow the same names of the variables to be used in other assembly procedures. Any Ideas?
MadMatt
Post 22 Sep 2004, 18:05
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo
madmatt wrote:
... allow the same names of the variables to be used in other assembly procedures. Any Ideas?

MadMatt, do you mean to use the same names, not the same variable contents?

If yes, the standard proc macro does everything you want exactly as you want if you keep your variable names local (preceded by dots).
Post 23 Sep 2004, 13:14
View user's profile Send private message Yahoo Messenger Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Quote:
MadMatt, do you mean to use the same names, not the same variable contents?

Yep, the same names.

Quote:
If yes, the standard proc macro does everything you want exactly as you want if you keep your variable names local (preceded by dots).

Haven't tried proceding the names with dots. Sounds like what I am looking for, thanks.
Post 23 Sep 2004, 18:51
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. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.