I guess you simplified the example, but so much, that it doesn't make sense to me.
The code will in 1.13.2 emit error:
"Issue_fwd_ref_in_macro.asm(13): warning: Label has different value in pass 3: previous value 10 not equal 9"
if label2 is 9 (put "org 8" ahead of "label1 nop" line). It's no error only when the condition is always false. If you know it's always false, you can just delete the macro. If it's true sometimes, it will produce error even in older versions (didn't check how many of them, but as the code is wrong, the error should be there).
The later versions just warn you about the problem sooner and more consistently.
The forward-references can be sometimes worked out in multi-pass assemblers, but you can still produce code which will never settle down, like:
This will in every odd pass get "false" in IF and set label to 9, and in every even pass then the IF is "true" and label becomes 10, this will never settle down, even in multi-pass assembler = this source can't be assembled.Код:ORG 9 IF label = 9 nop ENDIF label nop
So I don't understand what are you trying to achieve, but as sjasmplus is only 3-pass assembler, you should write source in a way to produce stable amount of machine code through all three passes (especially second pass must produce same amount of machine code as third pass, some changes after first pass may work, if you know what you are doing).
if those label1/label2 are more like config-constants affecting which parts of code are produced, define them ahead of the first macro usage.
if they are really labels inside the code and the IF block can move them, then you should rethink your code architecture to avoid the forward-reference, as it's not clear what is the correct output in such case (even to me, and of course not to assembler).
The small examples - as is - doesn't make sense, you can just delete the macros completely, they don't do anything useful. (I guess the true purpose was lost as you tried to make it small)




Ответить с цитированием