title: Why, in my c++ mips disassembler, is something not printed out?
body: <p>In this code, a couple of hex numbers, which should be lw and sw, are not printed out.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  
  int main() 
  { 
      //char ch[4096];
      unsigned int asdf[]={0x022DA822, 0x12A70003, 0x8D930018, 0x02689820, 0xAD930018, 0x02697824, 0xAD8FFFF4,0x018C6020, 0x02A4A825, 0x158FFFF6, 0x8E59FFF0};
      char* ch=(char*)asdf;
      int br=sizeof(asdf);
  
      //printf("%i\n",int(1) &gt;&gt; 5);
      //while((br=read(0,ch,sizeof(ch)))&gt;0) {
      int l=br/4;
      int* ins_array=(int*)ch;
      for(short i=0x0; i&lt;l;i++) 
      {
          int ins=ins_array[i];
          int opcode=ins &amp; 0xFC000000;
          opcode = opcode &gt;&gt; 26;
  
          //printf("opcode: %i\n",opcode);
          int addr=0x7A060+i*4;
          switch(opcode)
          {
              case 0x00:
                  //add,sub
                  {   
                      int s=(ins &amp; 0x3E00000)&gt;&gt;21;
                      int t=(ins &amp; 0x1F0000)&gt;&gt;16;
                      int d=(ins &amp; 0xF800)&gt;&gt;11;
                      int tail=ins &amp; 0x7FF;
                      switch(tail) 
                      {
                          case 0x20:
                              //add
                              printf("%x: add $%i, $%i, $%i\n",addr,d,s,t);
                              break;
  
                          case 0x22:
                              //sub
                              printf("%x: sub $%i, $%i, $%i\n",addr,d,s,t);
                              break;
  
                          case 0x24:
                              //and
                              printf("%x: and $%i, $%i, $%i\n",addr,d,s,t);
                              break;
  
                          case 0x25:
                              //or
                              printf("%x: or  $%i, $%i, $%i\n",addr,d,s,t);
                              break;
  
                          case 0x2A:
                              //slt
                              printf("%x: slt $%i, $%i, $%i\n",addr,d,s,t);
                              break;
                      }
                      break;
                  }
              case 0x23:  //lw
              case 0x2B:  //sw
              case 0x04:  //beq
              case 0x05:  //bne
                  {
                      int s=(ins &amp; 0x3E00000)&gt;&gt;21;
                      int t=(ins &amp; 0x1F0000)&gt;&gt;16;
                      short I=(ins &amp; 0xFFFF);
                      short m=65536-I;
                      short n=(ins &amp; 0xFFFF)&lt;&lt;2;
                      switch(opcode) 
                      {
                          case 0x23:
                              if (I&lt;63)
                              {
                                  printf("%x: lw $%i, %i($%i)\n",addr,t,I,s);
                              }
                              else
                              {
                                  printf("%x: lw $%i, -%i($%i)\n",addr,t,m,s);
                              }
                              break;
  
                          case 0x2B:
                              if (I&lt;63)
                              {
                                  printf("%x: sw $%i, %i($%i)\n",addr,t,I,s);
                              }
                              else
                              {
                                  printf("%x: lw $%i, -%i($%i)\n",addr,t,m,s);
                              }
                              break;
  
                          case 0x04:
                              printf("%x: beq $%i, $%i, address %x\n",addr,s,t,n+addr);
                              break;
  
                          case 0x05:
                              printf("%x: bne $%i, $%i, address %x\n",addr,s,t,n+addr);
                              break;
                      }
                      break;
                  }
          }
      }
  }
  </code></pre>
  
  <p>My print out looks like this:</p>
  
  <pre><code>7a060:   sub $21, $17, $13
  7a064:   beq $21, $7, address 7a070
  7a06c:   add $19, $19, $8
  7a074:   and $15, $19, $9
  7a07c:   add $12, $12, $12
  7a080:   or  $21, $21, $4
  7a084:   bne $12, $15, address 7a05c
  </code></pre>
  
  <p>What I want is for it to print out like this:</p>
  
  <pre><code>7a060:   sub $21, $17, $13
  7a064:   beq $21, $7, address 7a070
  7a068:   lw  $19, 24($12)
  7a06c:   add $19, $19, $8
  7a070:   sw  $19, 24($12)
  7a074:   and $15, $19, $9
  7a078:   sw  $15, -12($12)
  7a07c:   add $12, $12, $12
  7a080:   or  $21, $21, $4
  7a084:   bne $12, $15, address 7a05c
  7a088:   lw  $25, -16($18)
  </code></pre>
  
  <p>What should I do to fix this problem?</p>