flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > macro not see value. |
Author |
|
Roman 19 Dec 2022, 18:07
My variant.
Code: macro StateHero val { inc [ecx+.v1-.v1] sub [ecx+.v2-.v1],10 } ;I have 3 equal procs like proc A proc A mov edx,.Hero mov ecx,.v1 call B ret .v1 db 0 align 16 .Hero dd 0,0,0,0 dd 0,0,0,0 .v2 dd 0 endp proc B StateHero edx ret .v1 db 0 align 16 .Hero dd 0,0,0,0 dd 0,0,0,0 .v2 dd 0 endp |
|||
19 Dec 2022, 18:07 |
|
revolution 19 Dec 2022, 20:17
The macro has nothing to do with the problem.
Code: A: .v1 db ? ; local name has limited scope B: mov al,[A.v1] ; Okay mov al,[.v1] ; undefined B.v1 Code: A: ..v1 db ? ; global name is seen everywhere. B: mov al,[..v1] ; Okay |
|||
19 Dec 2022, 20:17 |
|
Roman 19 Dec 2022, 21:36
Quote:
I have three procs with .v1 |
|||
19 Dec 2022, 21:36 |
|
Overclick 19 Dec 2022, 21:50
Do not forget to call your procedures from anywhere. Othervice the procedure's body will be blank for rest of your program.
Use global label trick for short names. |
|||
19 Dec 2022, 21:50 |
|
revolution 19 Dec 2022, 22:04
To fully qualify the name you need to give the prefix.
Code: macro StateHero prefix,val { inc [prefix#.v1] sub [prefix#.v2],val } proc A .v1: .v2: endp proc B StateHero A,foo ;... |
|||
19 Dec 2022, 22:04 |
|
Roman 20 Dec 2022, 05:31
This variant not for my task.
Proc B call three procs. Proc A, proc A2, proc A3 Code: proc A mov edx,.Hero call B ret .v1 db 0 align 16 .Hero dd 0,0,0,0 dd 0,0,0,0 .v2 dd 0 endp proc A2 mov edx,.Hero call B ret .v1 db 0 align 16 .Hero dd 0,0,0,0 dd 0,0,0,0 .v2 dd 0 endp proc A3 mov edx,.Hero call B ret .v1 db 0 align 16 .Hero dd 0,0,0,0 dd 0,0,0,0 .v2 dd 0 endp |
|||
20 Dec 2022, 05:31 |
|
Roman 20 Dec 2022, 08:13
virtual not support align 16 ! fasm get error on align 16 in virtual.
|
|||
20 Dec 2022, 08:13 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.