flat assembler
Message board for the users of flat assembler.
Index
> Main > @@: "error: already defined"? |
Author |
|
Grom PE 14 Jul 2008, 21:12
Why this code gives an error?
Code: macro mymacro { @@: } repeat 5 mymacro end repeat How can I use macros with labels in "repeat" blocks then? |
|||
14 Jul 2008, 21:12 |
|
Tomasz Grysztar 14 Jul 2008, 21:32
In short: use REPT instead of REPEAT.
Code: macro mymacro { @@: } rept 5 { mymacro } |
|||
14 Jul 2008, 21:32 |
|
Grom PE 14 Jul 2008, 21:39
Oh well. That was just minimal code that gives an error.
I can't use "rept" because I have some assembly-time calculations and break in the loop. Is there assembly-time solutions? "while" doesn't solve this too, so I'm stuck. |
|||
14 Jul 2008, 21:39 |
|
LocoDelAssembly 14 Jul 2008, 22:00
Code: format pe gui 4.0 macro mymacro { local someLabel someLabel = $ jne someLabel } cmp eax, eax repeat 5 mymacro end repeat int3 Code: 00401000 > 39C0 CMP EAX,EAX 00401002 -75 FE JNZ SHORT macro.00401002 00401004 -75 FE JNZ SHORT macro.00401004 00401006 -75 FE JNZ SHORT macro.00401006 00401008 -75 FE JNZ SHORT macro.00401008 0040100A -75 FE JNZ SHORT macro.0040100A 0040100C CC INT3 |
|||
14 Jul 2008, 22:00 |
|
AlexP 14 Jul 2008, 22:05
^^ I think he means that the 'local' directive might help you out with labels inside of macros.
|
|||
14 Jul 2008, 22:05 |
|
Grom PE 14 Jul 2008, 22:07
LocoDelAssembly, thank you! It works like a charm =)
|
|||
14 Jul 2008, 22:07 |
|
LocoDelAssembly 14 Jul 2008, 22:09
The local is just for the purpose of making the assembly-time variable inaccessible outside the scope of the macro, the thing that fix the problem is using a variable instead of a label.
|
|||
14 Jul 2008, 22:09 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.