----- Original Message ----- From: William Chops Westfield To: Sent: Tuesday, November 12, 2002 11:22 PM Subject: Re: [PIC]: simple 16F877 long call strategy needed > Unfortunately, MPASM can't deal with macros that aren't > fixed-length. > > I still don't get it? Most macro assemblers have problems with macros that > evaluate to different lengths during different assembler passes due to > unresolved forward references (or values that change) during the first pass > (and most assemblers have two passes), but that's a pretty small subset of > "macros that aren't fixed length"... > > I CAN do something like this, right: > > mystring macro text > dt text > endm > > Isn't that a non-fixed-length macro? > > BillW A variable length macro would by something like st16 .macro dst, arg .if (arg & $ff) == 0 clrf dst+0 .else movlw arg & $ff movwf dst+0 .endif .if (arg & $ff00) == 0 clrf dst+1 .else movlw (arg >> 8) & $ff movwf dst+1 .endif .endm calling st16 with an undefined label (a forward reference) would result in zero the first time round (generating two instructions the first time) and then a non zero the second time round (generating three or four instructions the second time) Regards Sergio Masci http://www.xcprod.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads