title: x86 NASM 'org' directive meaning
body: <p>I am following this tutorial as a first foray into bootloader/OS development for x86 using NASM:</p>
  
  <p><a href="http://joelgompert.com/OS/TableOfContents.htm" rel="noreferrer">http://joelgompert.com/OS/TableOfContents.htm</a></p>
  
  <p>And I'm on Lesson 4, which is making my bootloader print the "Hello, world" string.
  I'm not understanding the meaning of the <code>org</code> instruction (directive?).</p>
  
  <p>As I understand it, <code>org</code> defines where the program being executed is loaded into memory. This is needed when using any sort of labels or relative addresses in the program.</p>
  
  <p>Suppose I have a string defined with a label like this in my program:</p>
  
  <pre><code>szHello db 'Hello, world!', 0
  </code></pre>
  
  <p>And I then later try to reference that label like this (only relevant snippets):</p>
  
  <pre><code>org 0x7c00
  xor ax, ax
  mov ds, 0
  ...
  mov si, szHello
  lodsb
  ...
  int 0x10 ; Print first character of szHello
  </code></pre>
  
  <p>My question is, why is that not equivalent to this? :</p>
  
  <pre><code>org 0
  mov ds, 0x7c00
  ...
  mov si, szHello
  lodsb
  ...
  int 0x10
  </code></pre>
  
  <p>When I run the first example, my string appears correctly. The second example does not work.</p>
  
  <p>Pointers to relevant documentation would also be greatly appreciated, if the issue is a conceptual problem on my part.</p>