title: How is machine code stored in the EXE file?
body: <p>My questions are as follows:</p>
  
  <ol>
  <li>How does the Portable Executable format (on Windows/Unix) relate to the x86/x64 instruction set in general?</li>
  <li>Does the PE format store the exact set of opcodes supported by the processor, or is it a more generic format that the OS converts to match the CPU?</li>
  <li>How does the EXE file indicate the instruction set extensions needed (like 3DNOW! or SSE/MMX?)</li>
  <li>Are the opcodes common across all platforms like Windows, Mac and unix?</li>
  <li>Intel i386 compatible CPU chips like ones from Intel and AMD use a common instruction set. But I'm sure ARM-powered CPUs use different opcodes. Are these <em>very very</em> different or are the concepts similar? registers, int/float/double, SIMD, etc?</li>
  </ol>
  
  <p>On newer platforms like .NET, Java or Flash, the instruction sets are stack-based opcodes that a JIT converts to the native format at runtime. Being accustomed to such a format I'd like to know how the "old" native EXE format is executed and formatted. For example, "registers" are usually unavailable in newer platform opcodes, since the JIT converts stack commands to the 16/32 available CPU registers as it deems necessary. But in native formats you need to refer to registers by index, and work out which registers can be reused and how often.</p>