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 04 Dec 2004, 22:25
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 05 Dec 2004, 11:49
.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: 3499
Location: Bulgaria
JohnFound 05 Dec 2004, 14:17
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 05 Dec 2004, 21:29
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 05 Dec 2004, 22:16
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 06 Dec 2004, 09:45
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.