Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The GNU Assembler Preprocessor - <b>conditional assembly</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Conditional assembly
====================

   The conditional-assembly directives allow you to include or exclude
portions of an assembly depending on how a pair of expressions, or a
pair of strings, compare.

   The overall structure of conditionals is familiar from many other
contexts.  `.AIF' marks the start of a conditional, and precedes
assembly for the case when the condition is true.   An optional
`.AELSE' precedes assembly for the converse case, and an `.AENDI' marks
the end of the condition.

   You may nest conditionals up to a depth of 100; GASP rejects nesting
beyond that, because it may indicate a bug in your macro structure.

   Conditionals are primarily useful inside macro definitions, where you
often need different effects depending on argument values.  *Note
Defining your own directives: Macros, for details about defining macros.

`.AIF EXPRA CMP EXPRB'
`.AIF "STRA" CMP "STRB"'
     The governing condition goes on the same line as the `.AIF'
     preprocessor command.  You may compare either two strings, or two
     expressions.

     When you compare strings, only two conditional CMP comparison
     operators are available: `EQ' (true if STRA and STRB are
     identical), and `NE' (the opposite).

     When you compare two expressions, *both expressions must be
     absolute* (Arithmetic expressions in GASP: Expressions).   
     You can use these CMP comparison operators with expressions:

    `EQ'
          Are EXPRA and EXPRB equal?  (For strings, are STRA and STRB
          identical?)

    `NE'
          Are EXPRA and EXPRB different?  (For strings, are STRA and
          STRB different?

    `LT'
          Is EXPRA less than EXPRB?  (Not allowed for strings.)

    `LE'
          Is EXPRA less than or equal to EXPRB?  (Not allowed for
          strings.)

    `GT'
          Is EXPRA greater than EXPRB?  (Not allowed for strings.)

    `GE'
          Is EXPRA greater than or equal to EXPRB?  (Not allowed for
          strings.)

`.AELSE'
     Marks the start of assembly code to be included if the condition
     fails.  Optional, and only allowed within a conditional (between
     `.AIF' and `.AENDI').

`.AENDI'
     Marks the end of a conditional assembly.


See Also: Expressions

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson