gnupic@linuxhacker.org

gnupic@linuxhacker.org


Subject: Re: Documentation for $ shortcut for line number
From: Colin Kuskie
Date: Wed, 15 Jan 2003 08:45:38 -0800

On Tue, Jan 14, 2003 at 06:49:51PM -0800, Eric Smith wrote:
> Colin Kuskie wrote:
> 
> > I've borrowed a few books in order to try to learn PIC programming, and
> > in one of them I noticed this construct:
> >
> > 	GOTO	$ - 1
> >
> > where it explains that $ is expanded to the current line number.  I
> > tried this in gpasm and was pleased to see that it's supported, but
> > appears to be undocumented in the manual.
> 
> $ does not expand to a "line number", which would be all but worthless.
> It expands to the address of the instruction currently being assembled.
> If it's used in a context other than an instruction, such as a
> conditional, it expands to the address the next instruction would occupy,
> since the assembler's idea of current address is incremented after an
> instruction is assembled.

Mind if I quote you? :)

Colin

gnupic@linuxhacker.org