title: What's the default segment register when using square brackets to read values in NASM?
body: <p>As we all know, we can read the value of an address using square brackets in NASM, such as that:</p>
  
  <pre><code>mov esi,  [ebp +8]
  mov edi, [var]   --&gt;  (var is a variable)
  </code></pre>
  
  <p>Those values in square brackets represent the offset address, but when we read values using that format, we absolutely need a segment, whether we are in real or protected mode, so what's the default segment register that NASM uses? I know that Windows uses flat mode, but if I set different values to different segment register(cs, ss, ds, es, fs, gs), which segment register will NASM use? I guess it is <code>ds</code>, right? Is the segment register different when using different expressions in square brackets? Is the default segment register the same both in real and protected mode? Thanks.</p>