Example 15. Using Nested Macros

in_block .macro y,a . ; visible parameters are y,a and x,z from the calling macro .endm out_block .macro x,y,z . ; visible parameters are x,y,z . in_block x,y ; macro call with x and y as arguments . . .endm out_block ; macro call

Example 16 shows recursive and fact macros. The fact macro produces assembly code necessary to calculate the factorial of n, where n is an immediate value. The result is placed in data memory address loc. The fact macro accomplishes this by calling fact1, which calls itself recursively.