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





 
Test Your EQ #146— Answer

Answer 8

In this case, the if-then becomes a series of instructions ending in a conditional skip, followed immediately by a jump. Note that the condition of the skip is such that the skip is taken (jumping to the "then" clause) if the expression is true.

The "else" keyword marks the end of the "then" clause, and as before, 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)
    skip next instruction if true
    jump 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