title: Make switch, case structure in assembly
body: <p>How to make switch, case structure in assembler? What is right way or more corect?</p>
  
  <p>This is my code in C, what I want to write in assembler.</p>
  
  <pre><code>if (diode_on == 1)
      {
          switch(diode_num)
              {
              case 0:
                  //score += 3;
                  break;
  
              case 1:
                  //score += 3;                
                  break;
  
              case 2:
                  //score += 3;
                  break;
  
              case 3:
                  //score += 3;
                  break;
  
              default:
                  break;
              }
          diode_on = 0;
      }
  </code></pre>
  
  <p>I need this for my project, MMSP430F5XX. The condition of the project is that one breaking routin is written in assembler. And this is code of breaking routin in C, what I try to write in assembler.</p>
  
  <pre><code>    #pragma vector=PORT2_VECTOR
  __interrupt void port2handler(void)
  {
      __delay_cycles(1000);
  
      if (diode_on == 1)
      {
          switch(diode_num)
              {
              case 0:
                  if((P2IFG &amp; BIT4)!=0)
                  {
                      if ((P2IN &amp; BIT4)==0)
                          //score += 3;
                          calculationScore(3);
                  }
                  else
                      //score--;
                      calculationScore(-1);
                  break;
  
              case 1:
                  if((P2IFG &amp; BIT5)!=0)
                  {
                      if ((P2IN &amp; BIT5)==0)
                          //score += 3;
                          calculationScore(3);
                  }
                  else
                      //score--;
                      calculationScore(-1);
                  break;
  
              case 2:
                  if((P2IFG &amp; BIT6)!=0)
                  {
                      if ((P2IN &amp; BIT6)==0)
                          //score += 3;
                          calculationScore(3);
                  }
                  else
                      //score--;
                      calculationScore(-1);
                  break;
  
              case 3:
                  if((P2IFG &amp; BIT7)!=0)
                  {
                      if ((P2IN &amp; BIT7)==0)
                          //score += 3;
                          calculationScore(3);
                  }
                  else
                      //score--;
                      calculationScore(-1);
                  break;
  
              default:
                  break;
              }
  
          P4OUT &amp;= ~(BIT3 | BIT4 | BIT5 | BIT6);          //gasimo diode
          diode_on = 0;
      }
  
      P2IFG &amp;= ~(BIT4 | BIT5 | BIT6 | BIT7);              // brisanje flega
  }
  </code></pre>