DECINVM—Invoke Macro

This control function lets you execute a stored macro. You store macros with the define macro (DECDMAC) control string. The terminal substitutes the DECINVM sequence with the contents of the macro definition and executes the macro.

Available in: VT level 4 mode only.




is the macro ID number. If the Pid is not associated with a particular macro, the terminal ignores the command.

Notes on DECINVM

Any functions executed with a macro invocation remain in affect after the terminal executes the macro.


Suppose you want to create a macro that clears all pages in page memory, writes the word "top" at the top of each page, and leaves the cursor on page 1.

First, you would write the string with ASCII characters as follows:

DCS 1 ; 0 ; 1 ! z CSI 6 SP P ! 6 ; CSI 1 ; 1 H CSI 2 J TOP CSI 1 V ; ST

Then, you must convert the string into hexadecimal code because the string uses the repeat (!) character. You can only use the repeat character with hexadecimal sequences. The following example is the same string written in hex:

DCS 1 ; 0 ; 1 ! z 9B 36 20 50 ! 6 ; 9B 31 3B 48 9B 32 49 54 4F 50 9B 31 56 ; ST

To invoke the macro, use the following sequence:

CSI 1 * z