flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > [fasmg] get data size of struc element |
Author |
|
Tomasz Grysztar 10 Feb 2017, 17:02
If you define a label with associated size, like:
Code: data1 db ?
label data2 : word Code: dd data1 metadata 0 ; 1 dd data2 metadata 0 ; 2 Code: dd sizeof data1 ; 1 dd sizeof data2 ; 2 As you may already know (because the basic "struct" macro uses it) when STORE directive has no declared size, the size that is associated with address is then used: Code: label name : type store value : type at name store value : sizeof name at name ; same as above but uses "name" only store value at name ; also the same result |
|||
10 Feb 2017, 17:02 |
|
zhak 11 Feb 2017, 00:07
Thanks Tomasz!
Another question: how can I pull first param value outside match? From the above macro, Code: match name:value, def . . . end match ; here want to use name I tried equ, define, and even =, but none worked. Something like Code: local param ;define param match name:value, def param equ .name ; or redefine param name end match display sizeof param ;or .param |
|||
11 Feb 2017, 00:07 |
|
Tomasz Grysztar 11 Feb 2017, 10:49
Yes, it's the EQU (or DEFINE) that should work for this purpose:
Code: match name:value, x:1 name dd value param equ name end match display '0' + sizeof param But sometimes you may need to extract the value of symbolic variable into a parameter with MATCH: Code: match name:value, x:1 param equ name v = value end match match name, param name dd v end match display '0' + sizeof param |
|||
11 Feb 2017, 10:49 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.