flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > In macro match not see label from other match. |
Author |
|
macomics 13 Apr 2023, 10:30
So the first match didn't work and .l1 is not declared.
Here I have the same thing working fine. Code: macro .idata [libs] { common purge .idata macro .idata args& \{ err \} section '.idata' import data readable writeable import.data: forward libs#.spec:if defined libs#.value dd RVA libs#.look, 0, 0, RVA libs#.value, RVA libs#.addr end if common if $ > import.data dd 5 dup (0) end if } macro import lib,[fnc] { common rb (- RVA $) and 7 match name==from, lib \{ if defined name\#.spec name\#.look: \} forward local .text match name==from, lib \{ match proc==text, fnc \\{ if used proc label proc qword at name\\#_\\#proc end if if used name\\#_\\#proc if text eqtype '' dq RVA .text else dq 0x8000000000000000 + text end if end if \\} \} common match name==from, lib \{ if $ > name\#.look dq 0 end if name\#.addr: \} forward match name==from, lib \{ match proc==text, fnc \\{ if used name\\#_\\#proc if text eqtype '' name\\#_\\#proc dq .text else name\\#_\\#proc dq 0x8000000000000000 + text end if end if \\} \} common match name==from, lib \{ if $ > name\#.addr dq 0 name\#.value db from, 0 rb RVA $ and 1 end if \} forward match name==from, lib \{ match proc==text, fnc \\{ if used name\\#_\\#proc & text eqtype '' .text dw 0 db text, 0 rb RVA $ and 1 end if \\} \} common match name==from, lib \{ end if \} } .idata kernel32.dll = "kernel32.dll" import kernel32.dll,\ ExitProcess = "ExitProcess" Last edited by macomics on 13 Apr 2023, 10:35; edited 3 times in total |
|||
13 Apr 2023, 10:30 |
|
Roman 13 Apr 2023, 10:31
I write simple example. For focus on main problem.
In my code work both match, but second match not see label from first match. Maybe(this is problem) in my case first run second match, then run first match. |
|||
13 Apr 2023, 10:31 |
|
macomics 13 Apr 2023, 10:41
Do you happen to have no global label declaration between the first and second match?
Code: Macro a { local .l1 match \{.l1: Lbb equ .l1 \} global_label: ; <<< ? match \{jnz .l1 ;fasm error undefined .l1 jnz Lbb ;this variant work and compiled fine \} } |
|||
13 Apr 2023, 10:41 |
|
Roman 13 Apr 2023, 10:46
Code: macro flex22 a,[p] { local .up ;this is problem error common fl_oo equ 0 cnt = 0 define _a2 a forward match =for d, p \{ ;local .up xor ecx,ecx .up: ;fl_eqlb equ .up display 'for',13,10 define _a2 a+ecx cnt = d \} match =mout d, p \{ inc ecx cmp ecx,cnt jb .up ;fasm error undefined .up?Sg \} } flex22 eax,for 20,mout ptxt ;ptxt db 0,0,0,0,0,0,0,0,0 This compiled OK ! Code: macro flex22 a,[p] { common fl_oo equ 0 cnt = 0 define _a2 a local .up forward match =for d, p \{ ;local .up xor ecx,ecx .up: ;fl_eqlb equ .up display 'for',13,10 define _a2 a+ecx cnt = d \} match =mout d, p \{ inc ecx cmp ecx,cnt jb .up ;fasm error undefined .up?Sg \} } flex22 eax,for 20,mout ptxt ;ptxt db 0,0,0,0,0,0,0,0,0 |
|||
13 Apr 2023, 10:46 |
|
revolution 13 Apr 2023, 10:58
Code: macro flex22 a,[p] { local .up common ;...} It is the same as: Code: macro flex22 a,[p] { forward local .up common ;...} |
|||
13 Apr 2023, 10:58 |
|
Roman 13 Apr 2023, 11:02
Now I understand my error completely.
|
|||
13 Apr 2023, 11:02 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.