flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tomasz Grysztar 08 Jul 2018, 13:33
IRPS directive is there for this purpose.
Code: macro popr [regs] { reverse irps reg,regs \{ \reverse pop reg \} } But if you need to also handle some multi-token operands, you may have to use MATCH. |
|||
![]() |
|
Jin X 08 Jul 2018, 21:31
Thanks!
But now I cant use [ecx] or smth like this. popr eax ebx [ecx] |
|||
![]() |
|
Tomasz Grysztar 08 Jul 2018, 23:00
This what I mentioned, that for multi-token operands you'd have to do some MATCHing to tell the boundaries of operands. This in general is quite hard to do with the macros of fasm 1, here's a version that handles [ecx] syntax but no other variations:
Code: macro popr [args] { common local list,more reverse define list define more 0 irps token,args \{ match =0 any, more list \\{ list equ list, \\} list equ list token match [, token \\{ define more 1 \\} match ], token \\{ define more 0 \\} \} match ops,list \{ irp op,ops \\{ \\reverse popd op \\} \} } Note that this kind of syntax in general is quite problematic and better avoided unless you can define a clear and simple rule that you are going to follow. Interpreting spaces as delimiters is a possible version of such rules, and as you can see in the mentioned thread it can be done with fasmg - unfortunately this is not possible in fasm 1, where the tokenizer does not leave any information about the whitespace in the stream of tokens it generates when reading line from the source. |
|||
![]() |
|
Jin X 09 Jul 2018, 16:27
Thanks!
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.