flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > "Local" in "proc" implementation questio |
Author |
|
vid 10 Mar 2006, 10:34
how about starting local name with "."?
Code: proc a local .loc endp proc b local .loc endp |
|||
10 Mar 2006, 10:34 |
|
IronFelix 10 Mar 2006, 11:46
Hi vid!
It is not needed, the following works fine, but i don't catch implementation Code: struct ASD A dd ? B dd ? C db ? ends proc A local str : ASD mov eax,[str.A] ret endp proc B local a : DWORD local str : ASD mov eax,[str.B] ret endp stdcall A stdcall B Regards. _________________ Flat Assembler is the best! |
|||
10 Mar 2006, 11:46 |
|
Tomasz Grysztar 10 Mar 2006, 16:40
The implementation abstract:
Code: A: ; proc A virtual at ebp-4 ..a?0001 dd ? a equ ..a?0001 end virtual mov eax,[a] ret restore a ; endp B: ; proc B virtual at ebp-4 ..a?0002 dd ? a equ ..a?0002 end virtual mov eax,[a] ret restore a ; endp |
|||
10 Mar 2006, 16:40 |
|
IronFelix 13 Mar 2006, 06:47
Of course it is the obvious decision, but i have made some experiments with your macro package and left only nessesary part. Please explain how it works:
Code: macro deflocal@proc name,def,val { local ..var ..var def val name equ ..var } macro do_local Name,Type,Pos { virtual at Pos macro label . ; <- why label is redefined? \{ deflocal@proc .,:, ; <- why it must be done with macro here? \} Name Type end virtual } struct ASD a dd ? b dd ? ends A: do_local a,ASD,esp+4 retn restore a B: do_local b,dd,esp+4 do_local c,ASD,esp+8 retn restore b Thanks and regards. _________________ Flat Assembler is the best! |
|||
13 Mar 2006, 06:47 |
|
Tomasz Grysztar 13 Mar 2006, 09:17
This is done this way so the structures can be put inside locals. The "struct" macro always defined main structure label with the "label" directive, so by re-defining the "label" here you can adjust that definition to your own.
Note that this means that "local" macro will work correctly with structures only if they were defined with official "struct" macro (from the same includes package). |
|||
13 Mar 2006, 09:17 |
|
IronFelix 15 Mar 2006, 15:02
Hi, Tomasz!
Please explain, why i got 'symbol already defined' error in this case? Code: macro deflocal@proc name,def,val { local ..var ..var def val name equ ..var } macro do_local Name,Type,Pos { virtual at Pos macro label . \{ deflocal@proc .,:, \} Name Type purge label end virtual } struct ASD a dd ? b dd ? ends A: do_local a,ASD,esp+4 retn restore a B: do_local a,ASD,esp+8 retn restore a Thanks and regards. _________________ Flat Assembler is the best! |
|||
15 Mar 2006, 15:02 |
|
Tomasz Grysztar 15 Mar 2006, 15:08
You did not restore the names for all the fields (including "a.a").
|
|||
15 Mar 2006, 15:08 |
|
IronFelix 15 Mar 2006, 15:27
But this doesn't work too. Maybe some other implementation needed to restore the values?
Code: macro deflocal@proc name,def,val { local ..var ..var def val name equ ..var } macro do_local Name,Type,Pos { virtual at Pos macro label . \{ deflocal@proc .,:, \} Name Type purge label end virtual } struct ASD a dd ? b dd ? ends A: do_local a,ASD,esp+4 retn restore a restore a.a restore a.b B: do_local a,ASD,esp+8 retn restore a Thanks and regards. _________________ Flat Assembler is the best! |
|||
15 Mar 2006, 15:27 |
|
Tomasz Grysztar 15 Mar 2006, 15:51
Oh, right, you also did not redefine "dd" to use deflocal@proc.
|
|||
15 Mar 2006, 15:51 |
|
IronFelix 16 Mar 2006, 08:09
Thanks, Tomasz!
It works fine. Regards. |
|||
16 Mar 2006, 08:09 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.