| 1 |
%macro DosPrintMsg 1+ |
| 2 |
%ifnid %1 |
| 3 |
section .data |
| 4 |
|
| 5 |
%%str_to_print:db %1 |
| 6 |
|
| 7 |
section .text |
| 8 |
|
| 9 |
mov dx,%%str_to_print |
| 10 |
mov ah,9 |
| 11 |
int 0x21 |
| 12 |
%else |
| 13 |
mov dx,(%1) |
| 14 |
mov ah,9 |
| 15 |
int 0x21 |
| 16 |
%endif |
| 17 |
%endmacro |
| 18 |
|
| 19 |
%macro DosExit 1 |
| 20 |
%if (%1) == 0 |
| 21 |
;use short-form return 0 exit |
| 22 |
int 0x20 |
| 23 |
%elif ((%1) < 256) && ((%1) > 0) |
| 24 |
mov ax,0x4C00 | (%1) |
| 25 |
int 0x21 |
| 26 |
%else |
| 27 |
%error Invalid return value |
| 28 |
%endif |
| 29 |
%endmacro |
| 30 |
|
| 31 |
section .text |
| 32 |
DosPrintMsg predefined_str |
| 33 |
DosPrintMsg "Using string with macro-defined label",10,0 |
| 34 |
DosExit 0 |
| 35 |
DosExit 1 |
| 36 |
|
| 37 |
section .data |
| 38 |
predefined_str:db "Using string with predefined label",10,0 |