flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > union at structure |
Author |
|
macomics 20 Mar 2023, 07:49
Code: struc SomeStruc { label .name dword label .another1 word .altName1 db ? .altName2 db ? label .another2 word .altName3 db ? .altName4 db ? } |
|||
20 Mar 2023, 07:49 |
|
revolution 20 Mar 2023, 07:58
struc is the same as macro with the only difference that it require a label name upon instantiation.
What you post above looks perfectly fine. |
|||
20 Mar 2023, 07:58 |
|
Overclick 21 Mar 2023, 00:01
I just thinking how useful can be macro like union. How can I manage it to use predefined values. Seems I need some sort of switcher between virtual clones otherwise it is not accepted to real data
Code: macro union autounion=0 { currentunion = $ sizeofunion = autounion purge clone,endunion macro clone \{ purge clone macro clone \\{ if $-currentunion > sizeofunion sizeofunion = $-currentunion end if end virtual virtual at currentunion \\} virtual at currentunion \} macro endunion \{ if $-currentunion > sizeofunion sizeofunion = $-currentunion end if end virtual if $-currentunion > sizeofunion sizeofunion = $-currentunion end if if autounion > 0 & autounion < sizeofunion display "Overflow fixed size of union.",13,10 end if times sizeofunion-($-currentunion) db ? \} } Code: struc SomeStruc Lab=0,Param=0,Matrix=0 { .adr dq Lab .param dd Param dd ? union 32 .matrix dd Matrix clone .point1.X dd ? .point1.Y dd ? .point2.X dd ? .point2.Y dd ? clone .mesh db 24 dup(?) endunion } |
|||
21 Mar 2023, 00:01 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.