Hi, > Like if I create > macro PRINT character,iterations > default iterations=1 <- How to make this? > > endm > > So if i call it using > PRINT 'A',3 ; it will print "AAA" > PRINT 'A' ; it will print "A" > > Is it possible to make the assembler compile without all arguments are > defined, and let the macro detect and act on missing arguments? Like this: > (Following macro loads a literal to W and optionally stores it in one or > two registers) > LL macro literal,r1,r2 ;macro name L_oad L_iteral > movlw literal > if not defined r1 exitm <- How to make this? > movwf r1 > if not defined r1 exitm <- How to make this? > movwf r2 > endm > > Invocations: > LL ff,ADTMRL,ADTMRH ;sets PIC14000 A/D timer to max. > LL 0F,PORTA ;sets PORTS... > LL 24,PORTB ; > LL e0 ;=movlw e0 > I think this will work: LL macro literal,r1,r2 movlw literal ifdef r1 movwf r1 ;Do only if r1 is defined endif ifdef r2 movwf r2 ;Do only if r2 is defined endif endm Invocations: LL 0fh, PORTA, or LL 10,, You need to specify three parameters, always. Even if they are empty - hence the commas. Your furst example might be done like this: macro PRINT character,iterations ifndef iterations iterations=1 endif endm Calling: PRINT 'A',3 ; it will print "AAA" PRINT 'A', ; it will print "A" Hope this helps! Niki