
Сообщение от
Sayman
Вопрос: условия в макросах добавили или нет ещё?
What do you mean precisely? The reasonably simple cases work for me, like:
Код:
; conditions_in_macro.asm
testCond MACRO arg1?, arg2?, arg3?
IF arg1?
DB arg2?
IF !arg1?
never happens
ENDIF
ELSE
DB arg3?
IF $8004 <= $
DB "..."
ELSE
jr nc,.localLabelInCondition + '!'
ENDIF
.localLabelInCondition
ENDIF
ENDM
DEVICE ZXSPECTRUM48 : ORG $8000
OUTPUT "conditions_in_macro.bin"
testCond 1, 'A', 'B' ; A
testCond 0, 'A', 'B' ; B0!
DB " " ; " "
testCond 0, 'C', 'D' ; D...
OUTEND
The binary contains expected "AB0! D..."
Maybe if you would combine them also with DUP and emit macro inside macro which has conditionals, etc... I'm not claiming it's 100% bug free, but AFAIK it works.
If you have some example of something what doesn't produce correct result, just post it here or open issue on github, thank you. 
-----------------------------------------------------------------
EDIT: one thing "obviously" (if you know how sjasmplus works, hehe) does NOT work, you can't only start/end conditional block in macro, i.e. the whole block must belong to the same macro.. i.e. things like:
Код:
MyEndIf MACRO
ENDIF
ENDM
IF 1
nop
MyEndIf
will NOT work, and I don't have any plan to support them, not even in v2.x (I mean, they may happen by accident if I rewrite the parser in certain way and I was toying with that idea for a short while, but I don't find these important, actually opposite, seems like code smell).
edit2: unfortunately, similar logic does apply DUP/EDUP blocks and others, basically any block (dup-edup, if-endif, macro-endm) should be nested in other block fully, interleaving start/end of different types of blocks will in 99% not work... and that's something I'm thinking about for v2.x, to allow things like conditional EDUP, but it's very complicated, so rather do not expect this ever working. I'm also not completely convinced this is real limitation, so far I had never issues to organize my code around these rules, but as always, by posting real-world issue with real project helps tremendously to shift my bias...