On Mon, 19 Aug 2002 20:11:44 +0200 Quentin writes: > You are asuming correct. > $ means the current value in program counter (PC) and goto $+1 > means add 1 > to PC, which in this case will only move it to the next step. > goto $+2 will jump over next step, > and goto $-1 will go back one step. > Be careful how you use this. If you have say goto $+12 and you add > an extra > line with in the 12 steps you are jumping, then you have to change > it to > goto $+13. When you have a few of these, it gets confusing. Also > when you > use macros in your code, it gets waaayy confusing. > > Rather stick to labels. As a rule of thumb, I only use this notation > with in > 2 steps, ex: > btfss porta, 0 ; is porta,0 released (keyup)? > goto $-1 ; wait for keyup > ;carry on with code I agree with MOST of this, but I think we need to distinguish between the address of the current instruction and the address in the program counter. One of the first thing the processor does in executing an instruction is to increment the program counter, so the "current program counter" value is a bit ambiguous. For example, goto $+1 nop executes the nop. However (ignoring pclath for now), movlw 1 addwf pcl,f nop movlw something adds one to the program counter, causing the NOP to be skipped and the movlw something to be executed. So, $ is the address of the instruction, which is indeed the current program counter prior to the start of execution of the instruction... Picky picky picky! Harold FCC Rules Online at http://hallikainen.com/FccRules Lighting control for theatre and television at http://www.dovesystems.com Reach broadcasters, engineers, manufacturers, compliance labs, and attorneys. Advertise at http://www.hallikainen.com/FccRules/ . ________________________________________________________________ GET INTERNET ACCESS FROM JUNO! Juno offers FREE or PREMIUM Internet access for less! Join Juno today! For your FREE software, visit: http://dl.www.juno.com/get/web/. -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu