News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

About MASM macro label

Started by gabalwto, August 31, 2010, 04:23:07 AM

Previous topic - Next topic

gabalwto

MASM macro use local label for each callers, when it called, the local label is replaced by a unique label. such like ??0001

Now I write a macro uses serval local labels,Once I use it for many times the error occured.Then I use /EP option to output preprocessed code,I find the unique label scroll back to ??0000。

I known the maximum number of unique label now in MASM32 is 0xFFFF,How can I solve this problem?

PS: I'm sorry for my poor English!!

jj2007

Try using two global variables:
include \masm32\include\masm32rt.inc

TheCt = 0
ManyVars MACRO
  TheCt = TheCt +1
  tmp$ CATSTR <MyLabel>, %TheCt
ENDM

.code
AppName db "Masm32:", 0

start:
REPEAT 100000
ManyVars
ENDM
% echo tmp$
MsgBox 0, "Hello World", addr AppName, MB_OK
exit

end start

You will see MyLabel100000 in the output window.

gabalwto

Oh,That's seems to be a good idea!

Thank you very much!!

gabalwto

Well, I find another problem, such label $tmp can not be used for its CATSTR operation.(i mean what label the $tmp stand for)

jj2007

Quote from: gabalwto on September 03, 2010, 03:06:10 PM
Well, I find another problem, such label $tmp can not be used for its CATSTR operation.(i mean what label the $tmp stand for)

Can you post example code please?

gabalwto

Well,I have solved my problem. A global label that represented another label can not join the CATSTR SUBSTR expression calculate,finally,I use a for statement to make the calculation enabled.