AARM User's Guide

Discontinued

Calling Standard Macros

The following defines a macro named BMOVE that takes three arguments: source, destination, and count. The macro produces code that copies any number of bytes from one part of memory to another.

BMOVE   MACRO   src, dst, cnt
LOCAL   lab
        MOV     R2,#cnt
        MOV     R1,#src
        MOV     R0,#dst
lab:    MOVB    [R0+],[R1]
        ADD     R1,#1
        CMPD1   R2,#0
        JMP     CC_NZ, lab
        ENDM

To call this macro, specify the macro name and the list of parameters. For example, the above macro may be called as follows:

BMOVE array1, array2, 10

The macro is expanded as:

          MOV      R2,#10
          MOV      R1,#array1
          MOV      R0,#array2
??0000:   MOVB     [R0+],[R1]
          ADD      R1,#1
          CMPD1    R2,#0
          JMP      CC_NZ, ??0000

Note

  • The above example produces assembly errors because the source file includes no section definitions.
  • The GEN and GENONLY directives may be used to include macro definition and macro calls in the assembler listing file.