Everything
5.4.1 Outline

This macro function is very convenient function to describe serial instruction group for number of times in the program.

Macro function is the function that is deployed at the location where serial instruction group defined as macro body is referred by macros as per .MACRO, .ENDM directives.

Macro differs from subroutine as it is used to improve description of the source.

Macro and subroutine has features respectively as follows. Use them effectively according to the respective purposes.

-

Subroutine

Process required many times in program is described as one subroutine. Subroutine is converted in machine language only once by assembler.

Subroutine/call instruction (generally instruction for argument setting is required before and after it) is described only in subroutine reference. Consequently, memory of program can be used effectively by using subroutine.

It is possible to draw structure of program by executing subroutine for process collected serially in program (Because program is structured, entire program structure can be easily understood as well setting of the program also becomes easy.).

-

Macro

Basic function of macro is to replace instruction group.

Serial instruction group defined as macro body by .MACRO, .ENDM directives are deployed in that location at the time of referring macro. Assembler deploys macro/body that detects macro reference and converts the instruction group to machine language while replacing temporary parameter of macro/body to actual parameter at the time of reference.

Macro can describe a parameter.

For example, when process sequence is the same but data described in operand is different, macro is defined by assigning temporary parameter in that data. When referring the macro, by describing macro name and actual parameter, handling of various instruction groups whose dercription is different in some parts only is possible.

 

Subroutine technique is used to improve efficiency of coding for macro to use to draw structure of program and reducing memory size.