Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In a bootloader, the second last line is :

TIMES 510-($-$$) db 0

Now, will this command also do the same :

db 510-($-$$) DUP (0)

If not why?

I know what TIMES does, but its not mentioned in my x86 book by Mazidi (Pearson Publication). Any idea why?

And what is the meaning of the $ sign exactly? Different sites have different information about $.

And is the line TIMES 510-($-$$) db 0 absolutely necessary even if my bootloader code is of 512 bytes in size?

So can anyone help me with these questions?

share|improve this question
up vote 0 down vote accepted

TIMES and DUP are assembler specific commands, and as such aren't part of x86 assembly language. Same goes for $ and $$.

The $ symbol denotes the current address of the statement, and the $$ denotes the address of the beginning of current section. So the lines with DUP and TIMES calculate the current address in the section and subtracts it from 510. This effectively just zeroes out the section from the beginning to the current address.

share|improve this answer
Okay sir, that helped a lot but will both the statements have the same output. And my book discusses about DUP and it uses MASM. Does Masm also have Times ? – Total Anime Immersion Sep 16 '12 at 8:34
@TotalAnimeImmersion I am not familiar with MASM personally, but I think checking MASM's documentation would be a good start. – zxcdw Sep 16 '12 at 8:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.