title: MIPS — print a value in a variable
body: <p>Following is the code:</p>
  
  <pre><code>.text
  .ent    main
  .type   main, @function
  main:
  .frame  $fp,24,$31      # vars= 8, regs= 1/0, args= 0, gp= 8
  
  addiu   $sp,$sp,-24
  sw  $fp,20($sp)
  move    $fp,$sp
  li  $2,1            # 0x1
  sw  $2,12($fp)
  li  $2,1            # 0x1
  sw  $2,8($fp)
  
      # now print -------------------------------------
      li      $2,1
      li      $a0,10
      syscall
  
  move    $2,$0
  move    $sp,$fp
  lw  $fp,20($sp)
  addiu   $sp,$sp,24
  j   $31
  nop
  </code></pre>
  
  <p>How did I generate this — by writing a single program:</p>
  
  <pre><code>int main(){
    int i = 1;
  }
  </code></pre>
  
  <p>And then simply added the syscall statements myself. I am unsure if this is right or wrong.</p>