+ 2
You can invoke macros with the following example syntax: %macro macro_name number_of_params <macro body> %endmacro If you need to use some sequence of instructions many times in a program, you can put those instructions in a macro and use it instead of writing The instructions all the time. Like this: mov edx,len ;message length mov ecx,msg ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4. ;system call number (sys_write) int 0x80. ;call kernel In the previous example, the registers EAX, EBX, ECX and EDX have been used by the INT 80H function call. So, each time you need to display on screen, you need to save these registers on the stack, invoke INT 80H and then restore the original value of the registers from the stack. So, it could be useful to write two macros for saving and restoring data.
27th Dec 2019, 9:45 AM
Ikan
Ikan - avatar