NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: ben321 on June 13, 2016, 12:07:11 AM

Title: What exactly is ORG directive used for?
Post by: ben321 on June 13, 2016, 12:07:11 AM
I know it sets some origin of the program, but is this used by NASM for calculating offsets when using other compiler directives (such as SECTION .mysection start=0x1234) where the value of ORG is then added to the offset specified in the other directive, or is the value specified with ORG actually used for calculating offsets used in actual opcodes (such as JMP, CALL, MOV, etc) that access memory locations?
Title: Re: What exactly is ORG directive used for?
Post by: Bryant Keller on June 23, 2016, 09:10:13 AM
ORG sets the origin of the object file (where the file is expected to be loaded into memory) when compiling the code as a flat binary. This adjusts the program counter for working out the addresses of labels during assembly.