I've found that it can depend on the assembler. The assembler usually sets $ to the PC value of the current instruction, not to the value that would exist after the goto is executed; therefore goto $ would be the proper notation for an infinite loop. goto $-1 would go to the previous instruction. The assembler will take care of the fact that PC has changed by the time the goto executes. If fact, your examples are inconsistent on this matter. If " goto $-1" returns you to the current instruction, then goto $+1 would send you two words downstream instead of to the next instruction. ______________________________ Reply Separator _________________________________ Subject: Re: Code error Author: Andy Kunz at Internet Date: 2/20/97 4:18 PM >Isn't an infinite loop done with: goto $ No, because PC has been incremented to point to the next instruction. Standard notation is to do it goto $-1 for a 1-word wide instruction. If you were using a Z-80, you could JP $-3, since JP is a three-byte instruction (0xC3, LSB, MSB). Funny, but that's the way it is. >In your example, if the statement previous was some other goto, it might not be >infinite. ie: goto $+2 > goto $-1 Here's a hint. If you have to a waste time, and you would normally write it as NOP NOP NOP NOP try using the following instead. goto $+1 goto $+1 Both take 4 instruction cycles, but you only need half as many instructions to do it. Warning - if you're using interrupts and need very close catching of the interrupt, go with the NOPs instead. The interrupt won't be serviced until the current instruction is finished, which takes 2 times rather than 1 in this case. Andy ================================================================== Andy Kunz - Montana Design - 409 S 6th St - Phillipsburg, NJ 08865 Hardware & Software for Industry & R/C Hobbies "Go fast, turn right, and keep the wet side down!" ==================================================================