flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > union macro |
Author |
|
scientica 05 Jul 2003, 13:41
I just realised above can't do structures, so I had to rewrite it a little:
Code: macro union _at, [_item, _type] { common virtual at _at forward _item _type common end virtual } example of usage: struc WOHO{ .d dd ? .b dd ? } struc FTX{ .ddMasterTimeUnit dd ? union .ddMasterTimeUnit,\ .dwYear,dw ?,\ .dbMonth,db ?,\ .dbDay,db ?,\ .Test, WOHO } section '.data' data readable writeable stest FTX section '.code' code readable executable start: mov [stest.dbMonth], 1 mov [stest.Test.b],-1 Note with this verison you must specify "dd ?" instead of "dd", but now you can unify structures too. _________________ ... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself. - Bradley Kuhn |
|||
05 Jul 2003, 13:41 |
|
BiDark 06 Jul 2003, 03:52
My version (in the past).
Code: union equ UNION macro union main,[name] { common local _label _label: main forward virtual at _label name end virtual } struc TVITEM { .mask dd ? .hItem dd ? .state dd ? .stateMask dd ? .pszText dd ? .cchTextMax dd ? .iImage dd ? .iSelectedImage dd ? .cChildren dd ? .lParam dd ? } struc TVITEMEX { .mask dd ? .hItem dd ? .state dd ? .stateMask dd ? .pszText dd ? .cchTextMax dd ? .iImage dd ? .iSelectedImage dd ? .cChildren dd ? .lParam dd ? .iIntegral dd ? } struc ITEMTYPE { union <.itemex TVITEMEX>,\ ; put the largest member first <.item TVITEM> } |
|||
06 Jul 2003, 03:52 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.