title: Mixing 32 bit and 16 bit code with nasm
body: <p>This is a low-level systems question.</p>
  
  <p>I need to mix 32 bit and 16 bit code because I'm trying to return to real-mode from protected mode. As a bit of background information, my code is doing this just after GRUB boots so I don't have any pesky operating system to tell me what I can and can't do.</p>
  
  <p>Anyway, I use [BITS 32] and [BITS 16] with my assembly to tell nasm which types of operations it should use, but when I test my code use bochs it looks like the for some operations bochs isn't executing the code that I wrote. It looks like the assembler is sticking in extras <code>0x66</code> and <code>0x67</code>'s which confuses bochs.</p>
  
  <p>So, how do I get nasm to successfully assemble code where I mix 32 bit and 16 bit code in the same file? Is there some kind of trick?
  ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>