circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 
Test Your EQ #146— Answer

Answer 7

In assembly language, the if-then becomes a series of instructions ending in a conditional jump. Note that the condition of this jump is the opposite of what the boolean expression would imply, because this instruction is jumping to the "else" clause if the expression is false.

The "else" keyword marks the end of the "then" clause, and it becomes an unconditional jump to the "endif", followed by the target label for the conditional jump instruction above.

Finally, the "endif" keyword becomes the target label for the unconditional jump. These relationships are shown below.
if (expression) then

  .
  . statements executed
  . if (expression) true
  .
else
  .
  . statements executed
  . if (expression) false
  .
endif
 
    ; code to evaluate
    ; (expression)
    jump if false to labelA
        ;
        ; code executed if
        ; (expression) true
        ;
    jump to labelB
labelA:
        ;
        ; code executed if
        ; (expression) false
        ;
labelB:
 

 

Contributor: Dave Tweed


Published: September-2002

   

E-mail eq@circuitcellar.com with questions or comments.

Back to Questions