flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > how to use macro in structure initialization? |
Author |
|
revolution 09 May 2013, 23:24
Macros and strucs are the same thing except for the label usage:
Code: struc padded_str len, text { local length length = $ db text length = $-length db len-length dup (0x20) } s padded_str 32, sz_some_text |
|||
09 May 2013, 23:24 |
|
baldr 11 May 2013, 19:01
Because struc requires label to precede its invocation, it could be shortened to
Code: struc padded_str len*, pad=' ', [text*] { common . db text db .+len-$ dup pad } s padded_str 32,, sz_some_text |
|||
11 May 2013, 19:01 |
|
zhak 12 May 2013, 00:41
I use this prefix (sz) to address null-terminated strings. like some sort of an acronym to String,Zero. But in this example, with padding, looks strange, I agree
|
|||
12 May 2013, 00:41 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.