In assembly language programs, small sequence of codes of the same pattern are repeated frequently at different places which perform the same operation on the different data of same data type. Such repeated code can be written separately as a macro. It is the same as functions in any high level programming language.


When assembler encounters a macro name later in the source code, the block of code associated with the macro name is substituted or expanded at the point of call, known as macro expansion. That’s why macro is called as subroutine.

Macro should be used when its body has a few program statements; otherwise, the machine code of the program will be large on account of the same code being repeated in the position where macros are used.  The process of defining macros and using them to simplify the programming process is known as macros programming.