tags:

views:

52

answers:

1

Hi, can anyone give me a comprehensive description about ORG directive?
When and why is it used in assembly written applications?

Using Nasm on x86 or AMD64.

+3  A: 

ORG is used to set the assembler location counter. This may or may not translate to a load address at link time. It can be used to define absolute addresses, e.g. when defining something like interrupt vectors which may need to be at a fixed address, or it can be used to introduce padding or generate a specific alignment for the following code.

Paul R
Note also that the meaning of the `ORG` directive can vary between assemblers. For instance, using it to produce padding as Paul mentions will work on MASM, but [not on NASM](http://developer.apple.com/mac/library/documentation/DeveloperTools/nasm/nasmdo10.html#section-10.1.3).
bcat
`ORG' is an abbreviation for "origin".
starblue