From: Per J. <pe...@co...> - 2011-06-19 14:36:05
|
Frank Kotler wrote: > Hi Per, > Hi List, > > As "owner" of this list, I got the following... > >> As list administrator, your authorization is requested for the >> following mailing list posting: > > blah, blah, blah... > > But when I logged in to approve it, I was informed that there were "no > pending requests". Did you "cancel" it somehow, Per? (how?) Or is SF > just messin' with me (us)? Hi Frank yes I can cancelled it - I worked out the answer myself. >> I'm trying generate labels using a macro, e.g. like this: >> >> %macro blop 1 >> %assign n 0 >> >> %rep %1 >> %assign n n+1 >> label_n: >> somecode >> %endrep >> >> %endmacro >> >> I was hoping to end up with a set of labels >> >> label_1: >> somecode >> label_2: >> somecode >> etcetera >> >> I'm feeling pretty stupid having to ask, but how do I get the >> variable 'n' expanded in(to) the label? > > It's a better question than it might seem at first! At one time, in some > cases, Nasm would have done what you want. But it's been "tightened up" > in recent versions, and you really need to use the "%+" operator! Ah, thanks - my solition was to use label_%[n] which also worked. I like %+n better though. >> Later I also want to generate: >> >> global label_n:func >> lenlab_n db *-label_n >> >> (with 'n' being my variable). > > I suspect you want '$', not '*'. The '$' is evaluated where it occurs, > so this length calculation needs to be done right after the "label" Yep, the '*' was a typo ('*' is used as location counter in S390 assembler, iirc). > FWIW, I created this list at the request of another developer, to keep > this kind of question off the "developer's list". It gets very little > traffic. There's the "Nasm Forum" here: > > http://forum.nasm.us > > which is also suitable for this kind of question. You might get better > results there. I'm too lazy to use forums - I sometimes post a question, but then I forget where I posted it .... /Per |