flat assembler
Message board for the users of flat assembler.
Index
> Main > how to update the size metadata of a label? |
Author |
|
sylware 20 Dec 2021, 15:24
I tried to update the size metadata of a label after its definition, and it seems we cannot do it, or I forgot the right part of the manual again.
|
|||
20 Dec 2021, 15:24 |
|
sylware 20 Dec 2021, 19:11
I thought so but needed verification. I guess I have to use forward-referencable constants to define the size metadata of my labels using the "label" command.
thx. |
|||
20 Dec 2021, 19:11 |
|
Tomasz Grysztar 20 Dec 2021, 19:17
sylware wrote: I thought so but needed verification. I guess I have to use forward-referencable constants to define the size metadata of my labels using the "label" command. |
|||
20 Dec 2021, 19:17 |
|
ProMiNick 20 Dec 2021, 21:44
almost...
Code: macro typecast [sizer] { label dummy@#sizer sizer at 0 macro sizer statement& \{ match any rest,statement : \\{ match =:,rest \\\{ restore statement statement equ dummy@#sizer+statement \\\} \\} match sym == val,statement \\{ restore sym statement sym equ dummy@#sizer+sym \\} \} } typecast byte,word,dword,qword usecase: Code: dword a=0 byte b=a+20 use32 mov [b],0 looks working but not work match resolves statement, but in curent case needed match equivalent that dont resolve statement because Code: dword a=0 byte a=a+20 ; restore hidden in macros get not a use32 mov [a],0; not works this one works Code: dword a=0 restore a ; if we force restoring a outside of macro all works byte a=a+20 use32 mov [a],0 So, feature request: needed match analog that dosn`t resolves equs & defines. |
|||
20 Dec 2021, 21:44 |
|
Tomasz Grysztar 20 Dec 2021, 22:10
ProMiNick wrote: So, feature request: needed match analog that dosn`t resolves equs & defines. Code: define proxy statement match sym ==== val, proxy ; ... |
|||
20 Dec 2021, 22:10 |
|
ProMiNick 20 Dec 2021, 23:16
Thanks
final working variant Code: macro typecast [sizer] { label dummy@#sizer sizer at 0 macro sizer statement& \{ local proxy define proxy statement match any rest,proxy : \\{ restore any match == val =:,rest \\\{ proxy \\\} any equ dummy@#sizer+any \\} \} } macro void statement& { local proxy define proxy statement match any rest,proxy : \\{ restore any match == val =:,rest \\\{ proxy \\\} \\} \} } typecast byte,word,dword,qword Code: dword a=0 use32 mov [a],0 byte a=a+20 mov [a],0 void a ; or restore a - released a for future calculations b=a+1 But I can`t see any advantage of such syntax. for ex, this set leave us free to calculate a without additional overhead to preprocessor for restoring & storing a Code: label dummy@byte byte at 0 label dummy@word word at 0 label dummy@dword dword at 0 define a.byte a + dummy@byte define a.word a + dummy@word define a.dword a + dummy@dword |
|||
20 Dec 2021, 23:16 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.