This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

assembler conditional

  00DE                18     IXLENGTH equ 222;
                      19     
                      20     
                      21     $IF ((LOW IXLENGTH) = 0 )
0000 7E00             22             mov     r6,#HIGH IXLENGTH
                      23     $ELSE
                                     mov     r6,#((HIGH IXLENGTH) +1)
                             $ENDIF
                      26     
                      27     
  0100                28     XLENGTH equ 256;
                      29     
                      30     
                      31     $IF ((LOW XLENGTH) = 0 )
0002 7E01             32             mov     r6,#HIGH XLENGTH
                      33     $ELSE
                                     mov     r6,#((HIGH XLENGTH) +1)
                             $ENDIF

Am I or the assembler wrong here ?

Erik

  • Erik,

    This is a question that comes up now and then and I always have to refer to the manual for the IF directive. Here's what it says:

    "The conditional control statements IF, ELSE, ELSEIF, and ENDIF may be specified only in the source program. They are not allowed on the invocation line. Additionally, these controls may be specified both with and without the leading dollar sign ($).

    When prefixed with a dollar sign, the conditional control statements may only access symbols defined by the SET and RESET controls."

    So...

    If you change the $IF to IF everything works just fine.

    Jon

  • Thanks, Jon.

    I am somewhat embarrased being a Please read the manual proponent.

    Erik

  • I am somewhat embarrased being a Please read the manual proponent.

    It happens to me every day. :-)

    Jon