Author Topic: times 512 -($-$$) db 0  (Read 13755 times)

Offline bitbit

  • New Member
  • Posts: 1
times 512 -($-$$) db 0
« 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

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: times 512 -($-$$) db 0
« Reply #1 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


Offline Keith Kanios

  • Full Member
  • **
  • Posts: 383
  • Country: us
    • Personal Homepage
Re: times 512 -($-$$) db 0
« Reply #2 on: March 06, 2011, 09:18:09 PM »
It's all explained in the NASM Documentation.