OK I posted the entire function below:
Currently i changed the order as 0xd, 0xa in which case, I notice both on cmd line console and redirected file it is adding 1 more extra redundant line
Previously order was 0xa, 0xd in which case, on cmd line console: one extra line but then redirected to a file it is adding 2 more extra redundant line
Btw, mov cx, 03h line just before has no meaning, at least i dont see, i just kept there in case something not get broken, i should as well remove and test to make sure nothing affected.
Thanks.,
; create string specified by pStr on the fly in code segment
; and outputs the string. useful to call: M_PRINT "str" without
; specifying address somewhere else in the memory.
M_PRINTF MACRO pStr
local skipStr, printfLoop, exitMacro, printfStr, m_printf_skip_esc_char
IF OPTION_ENABLE_M_PRINT
push ax
push dx
push bp
push cx
jmp skipStr
printfStr db pStr, '$'
skipStr:
lea bp, cs:printfStr
mov cx, 3h
printfLoop:
mov ah, 02h
mov dl, cs:[bp]
cmp dl, '$'
je ExitMacro
cmp dl, '\'
jne m_printf_skip_esc_char
cmp byte ptr cs:[bp+1], 'n'
jne m_printf_skip_esc_char
inc bp
mov dl, 0dh
mov ah, 02h
int 21h
mov dl, 0ah
mov ah, 02h
int 21h
m_printf_skip_esc_char:
int 21h
inc bp
dec cx
; jz exitMacro
jmp printfLoop
exitMacro:
pop cx
pop bp
pop dx
pop ax
ENDIF
ENDM