title: Assembly Language: Memory Bytes and Offsets
body: <p>I am confused as to how memory is stored when declaring variables in assembly language. I have this block of sample code:</p>
  
  <pre><code>val1  db  1,2
  val2  dw  1,2
  val3  db  '12'
  </code></pre>
  
  <p>From my study guide, it says that the total number of bytes required in memory to store the data declared by these three data definitions is 8 bytes (in decimal). How do I go about calculating this?</p>
  
  <p>It also says that the offset into the data segment of <strong>val3</strong> is 6 bytes and the hex byte at offset 5 is 00. I'm lost as to how to calculate these bytes and offsets.</p>
  
  <p>Also, reading <strong>val1</strong> into memory will produce 0102 but reading <strong>val3</strong> into memory produces 3132. Are apostrophes represented by the 3 or where does it come from? How would <strong>val2</strong> be read into memory?</p>