This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]