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>repetitive sections of assembly</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Repetitive sections of assembly
===============================

   Two preprocessor directives allow you to repeatedly issue copies of
the same block of assembly code.

`.AREPEAT AEXP'
`.AENDR'
     If you simply need to repeat the same block of assembly over and
     over a fixed number of times, sandwich one instance of the
     repeated block between `.AREPEAT' and `.AENDR'.  Specify the
     number of copies as AEXP (which must be an absolute expression).
     For example, this repeats two assembly statements three times in
     succession:

                  .AREPEAT        3
                  rotcl   r2
                  div1    r0,r1
                  .AENDR

`.AWHILE EXPRA CMP EXPRB'
`.AENDW'
`.AWHILE STRA CMP STRB'
`.AENDW'
     To repeat a block of assembly depending on a conditional test,
     rather than repeating it for a specific number of times, use
     `.AWHILE'.  `.AENDW' marks the end of the repeated block.  The
     conditional comparison works exactly the same way as for `.AIF',
     with the same comparison operators (*note Conditional assembly:
     Conditionals.).

     Since the terms of the comparison must be absolute expression,
     `.AWHILE' is primarily useful within macros.  Defining your
     own directives: Macros

   You can use the `.EXITM' preprocessor directive to break out of
loops early (as well as to break out of macros).  Defining your
own directives: Macros


See Also: Macros Macros

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