Hi,

i need to put a label inside a macro but i get an error compiling...

there is a way or the only way is using a procedure instade of the macro ?

THX, A
Posted on 2001-10-16 12:39:33 by Bit7
I believe you just have to do "local labelname" as the first line inside
your macro. But I'm not the macro warrior :).
Posted on 2001-10-16 15:31:13 by f0dder
thank you f0dder. Now i know there is a way.. i will atudy tasm manual..

Thx A
Posted on 2001-10-16 16:45:22 by Bit7
I can only speak for MASM, and I have heard that TASM doesn't do so well with MASM macros. Here is some example code:
TestMacro MACRO

LOCAL TempLabel, TempVariable

TempLabel:
TempVariable = 0

GlobalLabel:

LABEL AnotherGlobalLabel

ENDM
MASM prefixes the names so they are unique each macro call. Macros within other macros are the exception - local variables persist across the inner macro calls as long as the outer macro isn't called again - cool feature that could bite one in the arse if depended apon. :)

Does this kind of stuff work in TASM?
Posted on 2001-10-16 17:07:14 by bitRAKE
fSize MACRO file
push ebx
mov ebx, 0
Begin:
cmp ebx, SIZEOF file
je Fin
cmp file, 0
je Fin
inc ebx
jmp Begin
Fin:
mov eax, ebx
pop ebx
ENDM

This is a macro I made for determining the true size of a file. As you can see, I put two labels in this macro, and (you'll have to take my word for it) it works fine. I did not get any errors, though I wondered what would happen if I called it twice.

Not sure about TASM......
Posted on 2001-10-16 17:36:56 by lackluster
lackluster, you should get an error if you call it twice, or use those labels within your program elsewhere. I usually only want the macro name itself to be global - creating a bunch of global labels makes label name conficts more frequent, or limits the global use of macros. I like to code and forget, or I really should say that I like to only have to remember the interfaces.
Posted on 2001-10-16 17:54:17 by bitRAKE
hi all and thanks for your support !

I've lokked @ Tasm manual, in the macro section:

-local directive put insude the macro doesn't work.
-they explain several ways to repeat a part of code, but i can't still get it work.... At my opinion examples are not clear, following that syntax i get compiling error :eek:

Now i'm going to look if i find some Tasm example in the macroes i have somewhere on HD.

Bye & thanks
Posted on 2001-10-18 13:43:40 by Bit7
ok, for them who are interested,this is the ISSUE for Tasm..

macro GinoFritz A, B, Z
local Mario

Work correct but ...

macro GinoFritz A, B, Z

local Mario

give compile error ! :(

the only difference is the blank line !!!

Now i have another trouble:
macro GinoPino A, X, Z
uses ecx, ebx, esi, edi
macro code ...

is compiled without error but don't work.. I have to use

macro GinoPino A, X, Z
push ecx ebx esi edi
& pop @the end of the macro ...

only with push and pop the it work correctly...

If some help ..
Bye All
Posted on 2001-10-19 18:46:09 by Bit7
The uses keyword doesn't work in MASM macros either. TASM looks too picky on syntax for me - MASM is more flexible than I once thought, and it does look like M$ is going to keep it updated (VS.NET has MASM version 7.0 :))
Posted on 2001-10-19 22:35:51 by bitRAKE
so i suppose is correct to use push and pop inside the macro code ..

I've bought Tasm some years ago... This the only reason i don't want to pass to masm.... :)

Thanks , A
Posted on 2001-10-20 05:02:54 by Bit7
You might have wasted money on tasm... but why waste *time* on
it, when it seems that it's pretty inferior to masm? (Gee, never thought
I'd favour a m$ product over anything else... but that was until
I found visual studio, masm, and win2k :P).
Posted on 2001-10-20 09:24:56 by f0dder