title: mov instructions with byte destination for immediate to memory
body: <p>I am reading a textbook entitled <em>Introduction to 80x86 Assembly Language and Computer Architecture</em> by Richard C. Detmer</p>
  <p>I have a question about immediate to memory <code>mov</code> opcode. Here the portion of text I am referring too:</p>
  <blockquote>
  <p>Continuing down figure 4.1, the next row is for immediate-to-memory moves. Each of these instructions has opcode <code>C6</code>, a ModR/M byte, additional address bytes (if needed), and finally a byte containing the immediate operand. The address is encoded as described above for memory-to-register moves. If, for example, <code>smallCounter</code> references a byte in memory and the instruction <code>mov smallCounter, 100</code> is assembled, the assembler will generate 7 (3+4) bytes of object code, <code>C6 05 xx xx xx xx 64</code>, where <code>xx xx xx xx</code> represents the address in memory, and 64 is the byte-size hex version of 100. The ModR/M byte 05 is <code>00 000 101</code>, Mod=00 and R/M=101 for direct memory addressing with the Reg field not needed and set to 000.</p>
  <p>As another example, consider <code>mov BYTE PTR [edx], -1</code> with the memory destination using register indirect mode. The opcode is still C6 and the immediate byte (which always comes last) is now FF for -1. The second byte is the ModR/M byte with Mod=00 for register indirect, Reg=000 (unused), and R/M=010 for EDX, making <code>00 000 010</code> or 02. The object code is there for <code>C6 02 FF</code>.</p>
  <p><sup>page 92, chapter 4, section 1 - Copying Data</sup></p>
  </blockquote>
  <p>Figure 4.1 - entitled <em>mov instructions with byte destination</em>- is a chart with four columns:</p>
  <ul>
  <li>the first listing the <em>destination</em></li>
  <li>the second listing the <em>source</em></li>
  <li>the third listing the <em>Opcode</em></li>
  <li>and the fourth listing the <em>Bytes of Object code</em></li>
  </ul>
  <p>The line in the chart the above portion is referring too is:</p>
  <blockquote>
  <p>Destination: <em>memory byte</em> Source: <em>immediate byte</em> Opcode: <em>C6</em> Bytes of Object Code: <em>3+</em></p>
  </blockquote>
  <p>Forgive me for putting all that, but I wish for you and I to be on the same page for what my book is saying. I understand the part with the <em>smallCounter</em> but what perplexes me, is that the object code for the <code>mov BYTE PTR [edx], -1</code> is without an address in memory. It is in indirect mode, so <em>edx</em> is taking the place as a pointer, so why doesn't the object code contain the address in memory it is pointing too? Is that only for variables like with <em>smallCounter</em>'s opcode having an address? Why is overall the opcode the way it is for <em>smallCounter</em> in comparison with the other statement?</p>