Ken Pergola wrote: > > GOTO $-adr_word always works > > Hi Olin, > > I'm curious why this notation is still used by people for the > operands of branches (long or short). I can see the temptation to > use this style, but it appears to me it is an accident waiting to > happen (as far as future code maintenance/modification is > concerned), when a simple label will work. Ken: I know you asked for Olin's opinion, but I'll give you mine while you're waiting. All of the following is for one-word-per-instruction PICs; if I used PIC18s, I'd probably #define NEXT $+2 and #define PREVIOUS $-2. For jumping forward, I only do GOTO $+1, in order to get a two-cycle NOP. Any other forward jump has a label as its destination. For jumping backward, I use GOTO $-1 and GOTO $-2, but never use that form for looping backward more than 1 or 2 lines. I also almost never use it for anything other than polling a single signal; $-1 is for loops that don't include CLRWDT, and $-2 is for loops that unavoidably do. In those cases, the GOTO is so close to the top of the loop that there's no chance that I'll insert instructions in the loop without seeing that the GOTO has to change. Also, those loops never need any additional code additions, anyway; if the function of the loop changes from polling one signal to something more complex, that change warrants adding a label at the top of the loop to document what the loop does. -Andy === Andrew Warren -- aiw@cypress.com === Principal Design Engineer === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu