Just wanted to thank you all..... I am enlightened. Great Group! ----- Original Message ----- From: Roman Black To: Sent: Monday, August 19, 2002 2:24 PM Subject: Re: [PIC]: what does this notation mean? > Tom Messenger wrote: > > > >Been seeing this notation in various bits of code, and can't quite > > ascertain what it really means. Assumed it was related to pushing the > > program counter, or making jumps in code: > > > > > The dollar sign - $ - means 'here'. So goto $ + 1 means to increment the pc > > by one. This is used in two ways, (at least). The usual idea is that when > > writing your program, you don't know where the assembler will stick your > > code. If you need to reference a nearby location, you say $ which means > > where the current pc is. $ + 1 means to go to the next location. > > > I like these 3 home made mnemonics; > #define skp1 goto $+1+1 ; skips one instruction > #define skp2 goto $+1+2 ; skips 2 instructions > #define skp3 goto $+1+3 ; skips 3 instructions > (never needed skp4) > > These can really neaten-up code and avoid the use > of messy un-needed goto labels when all you want > to do is skip the next 3 instructions; > > btfss input,2 ; test input > skp3 ; > movlw b'11001100' ; input == hi, so do these 3 > movwf lastb ; > movwf PORTB ; > > I don't know if that makes the .asm purists cringe > but I see it as part of the natural evolution of > the .asm language that you develop new "instructions" > that make it easier to read, code, work with etc. > In many cases of .asm logic branching the goto > labels are not symbolic at all and just represent > "miss the next 3 instructions". I feel that these > particular labels can often be replaced by a neater > mnemonic, especially in complex logic trees. :o) > -Roman > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu