flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Overclick 25 Aug 2020, 16:52
Seems it works. But what if } in the line of some commands? Can I force it to next line?
Code: macro used_macro Params& { \} fix xor eax,eax \} macro Params } macro fix used_macro Is that fix located for next line macro Params only? Can I localisate it somehow? Or maybe exist some other solution? |
|||
![]() |
|
DimonSoft 25 Aug 2020, 17:35
Just define a new macro and call the original one from it. The only problem is to get the macro name without parameters but I’ve shown the trick in the original suggestion.
|
|||
![]() |
|
Overclick 25 Aug 2020, 17:45
Read remark there.
|
|||
![]() |
|
Overclick 25 Aug 2020, 18:23
Do you mean like this? Then I have to declare default macro body in bottom -- it's a problem as I have to redefine it with correct name and params
Code: macro ifused_macro Params& { macro Params ; seems macro Params needs to be in the end ifused_macro_Param equ Params \# ! ifused_macro_clear equ Params match name rest, ifused_macro_Param \{ macro ifused_macro_clear \\{ name rest ; some extra operator here... \\} \} } macro fix ifused_macro |
|||
![]() |
|
DimonSoft 26 Aug 2020, 09:34
Ah, now I see your problem: you want to add something to the macro you’re defining while doing previously discussed bookkeeping.
The easiest solution I can see is to trick the one who defines macro. Something along the lines of: Code: macro ifused_macro Params& { ; Bookkeeping goes here or wherever you wish local realimpl, def match name rest , Params ! \{ macro name p& \\{ ; Do anything realimpl p ; Do more of anything \\} \} match name any , Params \{ def equ macro realimpl any rept 0 \\{ \} match , \{ def equ macro realimpl \} def } macro fix ifused_macro |
|||
![]() |
|
Overclick 26 Aug 2020, 12:42
I fixed your macro but it still not working. Read comments.
Code: macro ifused_macro Params& { local realimpl, def, clear_string clear_string equ Params ; it cuts off extra data match name rest,clear_string ! ; '!' adds pseudo argument \{ macro name [p] ; fixed \\{ ; Do anything realimpl p ; Do more of anything \\} \} ; 'match' need to be once as 'any' contain extra data any way match name any,Params \{ macro realimpl any ;I cannot use 'equ' as it cuts off extra data \} } macro fix ifused_macro |
|||
![]() |
|
DimonSoft 26 Aug 2020, 13:26
I didn’t really try the code I gave in my previous post, just wrote it in browser to show the idea: use the name specified to define your own macro which does anything you wish and calls the real macro. The real macro now has to have another name, which can be generated with local.
Note also that your asssumption that any always contains something is wrong. What if I define a macro like this? Code: macro align_to_sector { db 512 - ($ - $$) mod 512 dup(0) } |
|||
![]() |
|
Overclick 26 Aug 2020, 15:35
It contains next strings as you made it by Params&. As I understand this...
I shown you example where it works with any kind of macros and { in other thread. Check that example. |
|||
![]() |
|
Overclick 06 Sep 2020, 23:38
Any more ideas? Don't let it die...
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.