I have made a macro in NASM as follows:
%MACRO PRINT 1
MOV SI, %1
.start
MOV AH, 0x0E
LODSB
CMP AL, 0x00
JE .end
INT 0x10
JMP .start
.end
%ENDMACRO
Sometimes it workes when I call it but other times it has an error compiling, saying: .end already defined and .start already define or something around those lines. Anyone know how to fix this?
Macro problem
Re:Macro problem
I would think that since .start and .end would be associated with the last main label (One without a '.') that you are using it more than once in a label. One way to fix it would be to put the actual printing code in a function and use the macro to call the function instead of writing the code out repeatedly.
Re:Macro problem
You can also create a macro local label with %%start and %%end instead of .start and .end. See the nasm documentation for further information on that topic: http://nasm.sourceforge.net/doc/html/nasmdoc4.html#section-4.3.2