flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Problem with fasmw proc macro.

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
I'd like to be able to do something like this:
Code:
proc function,x,y,z
     .num dd 1.16
     enter
     .... more code
     return
endp    


but .num number is wrong, doesn't seem to work correctly.
Does anyone have a solution for this?
Matt (MadMatt)

_________________
Gimme a sledge hammer! I'LL FIX IT!
Post 04 Dec 2004, 22:25
View user's profile Send private message Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
.num is a local variable, and you can't define such variable statically. Only thing that you can do here is to add "mov [.num],116" just after the enter macro.
Post 05 Dec 2004, 11:49
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
The procedure local variables doesn't exists in the compiled binary file. These variables are dinamically allocated in the stack on the entering procedure and they are also deallocated on exit. So, you must initialize them in the code.

Regards
Post 05 Dec 2004, 14:17
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Hmmm, all right, thanks guys. Looks like I'll have to find a work-around.
Matt (MadMatt)
Post 05 Dec 2004, 21:29
View user's profile Send private message Reply with quote
rea



Joined: 14 Nov 2004
Posts: 92
rea
you can do this: declare numbers or strings in the data section, and then load the values when you enter to a function, in fact that is what do the compilers, they cant like asm cant in fact initialize the stack directly.
Post 05 Dec 2004, 22:16
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Well I know that you can do that, but for large projects I needed the variables close at hand so I wouldn't have to scroll very far if I forgot a variable, or if I needed to add more constants/variables. Anyhow, I found a solution, so no more troubles.
Matt (MadMatt)
Post 06 Dec 2004, 09:45
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.