flat assembler
Message board for the users of flat assembler.
Index
> Main > equ with if |
Author |
|
revolution 12 Nov 2017, 18:06
You can replace the if with match and make bitness an equ.
Code: Bitness equ 16 match =16,Bitness { BaseReg equ bp } match =32,Bitness { BaseReg equ ebp } |
|||
12 Nov 2017, 18:06 |
|
CandyMan 12 Nov 2017, 18:09
thank you!
|
|||
12 Nov 2017, 18:09 |
|
Tomasz Grysztar 12 Nov 2017, 18:17
Alternatively:
Code: Bitness = 16 if Bitness=16 label BaseReg at bp else label BaseReg at ebp end if |
|||
12 Nov 2017, 18:17 |
|
CandyMan 12 Nov 2017, 18:32
Tomasz, your alternative is the best!
|
|||
12 Nov 2017, 18:32 |
|
Tomasz Grysztar 12 Nov 2017, 18:47
Note that it has a potential problem that you cannot re-define BaseReg for other part of code when it is defined as a label. If such problem occurs, you can get around it with a simple "undefine" macro:
Code: macro undefine name { local new define name new } Bitness = 32 undefine BaseReg if Bitness=16 label BaseReg at bp else label BaseReg at ebp end if |
|||
12 Nov 2017, 18:47 |
|
CandyMan 12 Nov 2017, 22:34
version with "equ" however is better because it doesn't refer only to addressing.
Code: push BaseReg ;push (e)bp is possible _________________ smaller is better |
|||
12 Nov 2017, 22:34 |
|
Tomasz Grysztar 12 Nov 2017, 22:54
Oh, you're right. This is a limitation of fasm 1 engine that I managed to get rid of in fasm g.
|
|||
12 Nov 2017, 22:54 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.