flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Temporary Labels |
Author |
|
revolution 20 Nov 2008, 14:59
Pinecone_ wrote: How can i make "Temporary Labels" only avaliable in the proc |
|||
20 Nov 2008, 14:59 |
|
Pinecone_ 20 Nov 2008, 15:08
Is local not only for the macro language? Whatever i define in local would not be avaliable for use in between the Proc and EndP if my understanding of them is correct... I don't quite see how that would work.
I wish to use the above macro like... Code: Proc Test, Arg1, Arg2, Arg3 Mov Eax, [Arg1] Ret EndP Code: Push Ebp Mov Ebp, Esp Mov Eax, [Ebp + 0x08] Leave Ret 0x0C |
|||
20 Nov 2008, 15:08 |
|
revolution 20 Nov 2008, 15:20
Have a look at the fasm proc macro in the download to see how it is easily done.
Since proc is a macro you can use local to define labels and then use an equ to map it to the desired programmer selected name. Code: local someLabel ;internally defined as someLabel?blahblah label somelabel ... MyLabel equ someLabel mov eax,[MyLabel] |
|||
20 Nov 2008, 15:20 |
|
Pinecone_ 20 Nov 2008, 15:30
That makes complete sense, and yet i still managed to fail After trying what you said, i'm getting error "undefined symbol 'SomeLabel?QT'."
using this... Code: Local SomeLabel IF ~ Args EQ ArgCount = ArgCount + 1 Label SomeLabel Dword AT Ebp + 4 + (ArgCount * 4) Args EQU SomeLabel End IF |
|||
20 Nov 2008, 15:30 |
|
revolution 20 Nov 2008, 16:31
Remember that if and equ are processed at different stages. However since you have not posted the entire macro and it's instantiation code we cannot help you to fix it.
|
|||
20 Nov 2008, 16:31 |
|
baldr 20 Nov 2008, 19:09
Pinecone_,
You may look at proc macro from STDCALL.INC in earlier versions of fasm. For example, 1.51: Code: macro proc name,[arg] ; define procedure { common name: virtual at ebp+8 if ~ arg eq forward local ..arg ..arg dd ? arg equ ..arg common end if ..ret = $ - (ebp+8) end virtual local ..dynamic_data,..dynamic_size dynamic_data equ ..dynamic_data dynamic_size equ ..dynamic_size virtual at ebp - dynamic_size dynamic_data: } |
|||
20 Nov 2008, 19:09 |
|
Pinecone_ 21 Nov 2008, 00:55
Thank you revolution and baldr. And revolution, i forgot to mention that i edited the first post and gave the whole macro after you posted. Here's the macro now working. (Thank you!)
Code: Macro Proc Name, [Args] { Common Label Name Push Ebp Mov Ebp, Esp Local ArgCount ArgCount = 0 IF ~ Args EQ Virtual AT Ebp + 8 Forward ArgCount = ArgCount + 1 Local ..Arg ..Arg DD ? Args EQU ..Arg Common End Virtual End IF Macro Ret \{ Leave Ret ArgCount * 4 \} Macro EndP \{ Forward IF ~ Args EQ Args EQU End IF Common Purge Ret Purge EndP \} } |
|||
21 Nov 2008, 00:55 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.