Code: Select all
M_PRINTF "\nBlah blah"
Code: Select all
Blah blah
Code: Select all
<procName>: Blah blah
<procName1>: Helloworld
Code: Select all
<procName> proc far
....
M_PRINTF "\nBlah blah"
....
<procName> endp
<procName1> proc far
....
M_PRINTF "\nHelloworld"
....
<procName1> endp
I did this exactly in python using one of the python library, printing out calling function name in prefix automatiicaly with any print out is huge debugging clarity and assistance.
So far I looked through most comprehensive ASM X86 manual and looked through pre-defined macros so far, not finding anything.
Thanks.,
Here is my M_PRINTF macro which you can use to print any string on the fly without defining it on data segment and pass pointers to it:
it can currently process new line chars but i am planning to enhance further too:
Code: Select all
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
ENDM