flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > [solved].if .elseif etc for bit/flags testing |
Author |
|
revolution 19 Sep 2022, 14:21
elseiflabel is defined twice. I assume the second definition is supposed to be endiflabel?
|
|||
19 Sep 2022, 14:21 |
|
Overclick 19 Sep 2022, 14:25
Quote:
elseiflabel equ endiflabel |
|||
19 Sep 2022, 14:25 |
|
Overclick 19 Sep 2022, 14:28
I use here principle that used before at @@@ macro
Code: macro @@@ t& { local anonymous @F1=$ @B5 equ @B4 @B4 equ @B3 @B3 equ @B2 @B2 equ @B1 @B1 equ @F1 @F1 equ @F2 @F2 equ @F3 @F3 equ @F4 @F4 equ @F5 @F5 equ anonymous match =: arg,t \{ arg \} } |
|||
19 Sep 2022, 14:28 |
|
Overclick 19 Sep 2022, 15:58
Ok, solved
Code: macro .if arg { local temp1,temp2 elseiflabel equ temp1 endiflabel equ temp2 test rax,arg if defined elseiflabel jz elseiflabel else jz endiflabel end if macro .else \{ jmp endiflabel elseiflabel = $ \} macro .endif \{ endiflabel = $ restore elseiflabel,endiflabel purge .else,.endif \} } |
|||
19 Sep 2022, 15:58 |
|
Overclick 20 Sep 2022, 04:20
Update:
Code: macro .if arg { local temp1,temp2,temp3 elseiflabel equ temp1 elselabel equ temp2 newendiflabel equ endiflabel endiflabel equ temp3 test [CurrentTesting],arg if defined elseiflabel jz elseiflabel else if defined elselabel jz elselabel else jz endiflabel end if macro .elseif arg \{ jmp newendiflabel elseiflabel = $ restore elselabel,elseiflabel,endiflabel purge .elseif,.else,.endif .if arg \} macro .else \{ jmp endiflabel elselabel = $ \} macro .endif \{ endiflabel = $ restore elseiflabel,elselabel,endiflabel purge .elseif,.else,.endif \} } I made it for bits/flags testing in my render engine. Looks cool, isn't it? )
|
||||||||||
20 Sep 2022, 04:20 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.