This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RE: Special Symbols in AS?
- From: "Dave Korn" <dk at artimi dot com>
- To: <binutils at sources dot redhat dot com>
- Date: Wed, 21 Apr 2004 19:57:41 +0100
- Subject: RE: Special Symbols in AS?
> -----Original Message-----
> From: binutils-owner On Behalf Of Ryan Sommers
> Sent: 21 April 2004 19:46
> Are there any special symbols available in the GAS syntax?
> I'm writing ax
> x86 bootsector and it would be really nice if I could put:
>
> .space (510-$$)
> .word 0xaa55
>
> at the end, where $$ represents the current assembled
> position, instead of
> calculating how long the file is and then adjusting it
> everytime I change
> the length.
Heh, yes, of course. The symbol '.' (a single period) refers to the
program counter in all versions of gas. You want:
.space (510-.)
.word 0xaa55
[ Note that you can also do things like ". = 0x100" to achieve the same
effect as an .org command, or ". = . + 4" to do the same as a ds.l ]
cheers,
DaveK
--
Can't think of a witty .sigline today....