flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Macro instruction define |
Author |
|
yoshimitsu 07 Nov 2012, 22:37
You'd need to define IsAcc as a macro (as macros already are like C's defines with way more facilities), but FASM's macros can't return a value like MASM's can. They're also no simple textual substitution that can occur anywhere in the source like in C, they have to be invoked properly, so sth like "if IsAcc" is not possible.
What I did with TASM's macros back then was passing a local symbolic constant (equ) as a 'pointer' to the sub-macro. TASM handled those differently than FASM. With FASM, however, there is the preprocessing stage and the assembly stage. "if xx in <xx, xy>" is assembly stage, so equ (which is preprocessor stage) wouldn't work with it. But you can use constants ('=' instead of 'equ') which are assembly stage, like: Code: macro IsAcc reg,ret { if reg in <al,ax,eax> ret = 1 else ret = 0 end if } macro test arg { local ret IsAcc arg,ret if ret display 'alright' else display 'nope' end if } |
|||
07 Nov 2012, 22:37 |
|
rydemstorm 07 Nov 2012, 23:17
I use something like that to solve the problem:
http://board.flatassembler.net/topic.php?t=14750 |
|||
07 Nov 2012, 23:17 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.