NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: bitbit on March 06, 2011, 02:24:10 PM

Title: times 512 -($-$$) db 0
Post by: bitbit on March 06, 2011, 02:24:10 PM
Code: [Select]
times 512 -($-$$) db 0What does $ and $$ stand for?
What says the argument 512 -($-$$) of times in this context?


bitbit
Title: Re: times 512 -($-$$) db 0
Post by: Frank Kotler on March 06, 2011, 03:26:50 PM
'$' is roughly "here" (in this context). '$$' is "beginning of section". So "$-$$" is an expression that calculates the length of your code, so far. So your code gets padded out to 512 bytes.

Best,
Frank

Title: Re: times 512 -($-$$) db 0
Post by: Keith Kanios on March 06, 2011, 09:18:09 PM
It's all explained in the NASM Documentation (http://www.nasm.us/docs.php).