Author Topic: What exactly is ORG directive used for?  (Read 10511 times)

Offline ben321

  • Full Member
  • **
  • Posts: 185
What exactly is ORG directive used for?
« 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?

Offline Bryant Keller

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 360
  • Country: us
    • About Bryant Keller
Re: What exactly is ORG directive used for?
« Reply #1 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.

About Bryant Keller
bkeller@about.me