flat assembler
Message board for the users of flat assembler.
Index
> Main > fasm support for local variables??? |
Author |
|
Dunduk 15 Oct 2003, 02:32
silkodyssey wrote: Does fasm have support for declaring local variables like the local directive with masm? If fasm doesn't have a similiar feature I would like to know if its possible to implement it with macros. I would like to be able to declare local variables and structures and access the structure members by the member names. Any help would be appreciated. Sure, fasm has it. Example: Code: proc some_proc, var1,var2,... .localvar1 db ? .localvar2 dd ? .localvar3 SOME_STRUCTURE enter ... lea eax, [.localvar3] ... mov [.localvar3.some_strusture_member], 0 ... mov [.localvar1], 0ffh ... return Proc, enter, return - are macroses. See include in fasmw package. Did I answer your question? |
|||
15 Oct 2003, 02:32 |
|
silkodyssey 15 Oct 2003, 10:41
Thanks a lot Dunduk. I think you answered my question and I'm happy with the answer .
_________________ silkodyssey |
|||
15 Oct 2003, 10:41 |
|
Beginner 15 Oct 2003, 16:28
Hi,
can someone tell me, please, why this code doesn't work? Code: include '%include%\win32ax.inc' .data GlobalString db 'Global',0 .code proc Put,arg .LocalString db 'Local',0 enter invoke MessageBox,0,.LocalString,GlobalString,0 return start: stdcall Put,0 invoke ExitProcess,0 .end start |
|||
15 Oct 2003, 16:28 |
|
decard 15 Oct 2003, 16:36
Proably a mistake is here:
Code: proc Put,arg .LocalString db 'Local',0 enter AFAIK you can't declare a local variable and put some value there as you can do with globals. You need to put the string to your variable in run-time, ie. add some code that sets .LocalString to proper value. And your declaration should look like: Code: .LocalString rb 6 |
|||
15 Oct 2003, 16:36 |
|
Tomasz Grysztar 15 Oct 2003, 16:36
Local variables are not initialized to any predefined values, even when you specify them.
|
|||
15 Oct 2003, 16:36 |
|
eet_1024 17 Oct 2003, 19:27
Locals are allocated into the stack when the function is called. Runtime code is required to initialize them. It is your responsibility for writing that code.
|
|||
17 Oct 2003, 19:27 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.