flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution
Pinecone_ wrote: How can i make "Temporary Labels" only avaliable in the proc |
|||
![]() |
|
Pinecone_
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 |
|||
![]() |
|
revolution
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] |
|||
![]() |
|
Pinecone_
That makes complete sense, and yet i still managed to fail
![]() using this... Code: Local SomeLabel IF ~ Args EQ ArgCount = ArgCount + 1 Label SomeLabel Dword AT Ebp + 4 + (ArgCount * 4) Args EQU SomeLabel End IF |
|||
![]() |
|
revolution
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.
|
|||
![]() |
|
baldr
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: } |
|||
![]() |
|
Pinecone_
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 \} } |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.