Using MASM 6.15, I have an assert macro for GUI programs that pops up a
messagebox with some data. I would like to at the filename and linenumber
to it (like __FILE__ & __LINE__) in C. I found @FileName and @Line of course,
but it seems they are only useful with .ERR, since I cannot find a way to
get their actual content during assembly to be stored in the data segment.
Anyone an idea how to archive this ?
Thanks,
Jerry.
--
-- Jerry van Dijk | email: jd...@acm.org
-- Team-Ada | web: home.trouwweb.nl/Jerry
-- Paris, France | Leiden, Holland
>
>[it seems I cannot post to comp.lang.asm.x86, so I am trying here]
>
>Using MASM 6.15, I have an assert macro for GUI programs that pops up a
>messagebox with some data. I would like to at the filename and linenumber
>to it (like __FILE__ & __LINE__) in C. I found @FileName and @Line of course,
>but it seems they are only useful with .ERR, since I cannot find a way to
>get their actual content during assembly to be stored in the data segment.
>
>Anyone an idea how to archive this ?
something like:
% db "VeRsIoN= &@FileName &@Date &@Time",0
works for me.
--
Arargh (at enteract dot com) http://www.arargh.com
Thanks for the idea, but
> something like:
>
> % db "VeRsIoN= &@FileName &@Date &@Time",0
>
> works for me.
it doesn't for me, it complains about either a syntax error for the '&'
when used with a local label, like
Oops MACRO
LOCAL Skip, Name
jmp Skip
Name BYTE &@FileName, 0
Skip:
ENDM
or about the content of FileName being an undefined symbol when used with
an anomymous label, like:
Oops MACRO
LOCAL Skip
jmp Skip
% BYTE &@FileName, 0
Skip:
ENDM
>
>Arargh! <Ara...@Enteract.com> writes:
>
>Thanks for the idea, but
>
>> something like:
>>
>> % db "VeRsIoN= &@FileName &@Date &@Time",0
>>
>> works for me.
>
>it doesn't for me, it complains about either a syntax error for the '&'
>when used with a local label, like
>
>Oops MACRO
> LOCAL Skip, Name
> jmp Skip
>Name BYTE &@FileName, 0
>Skip:
>ENDM
>
>or about the content of FileName being an undefined symbol when used with
>an anomymous label, like:
>
>Oops MACRO
> LOCAL Skip
> jmp Skip
>% BYTE &@FileName, 0
>Skip:
>ENDM
Seems to work for me :-) How about some Quotes? :-)
BTW, the % is required to force evuatation of the expression.
Sample:
<heading snipped>
Oops1 MACRO
LOCAL Skip, Name
jmp @f
Name label BYTE
% db "&@FileName", 0
@@:
ENDM
Oops2 MACRO
jmp @f
% BYTE "&@FileName", 0
@@:
ENDM
.model medium,c
0000 .code
0000 zxcv proc
Oops1
0000 EB 03 1 jmp @f
0002 1 ??0001 label BYTE
0002 5A 58 00 1 % db "&@FileName", 0
0005 1 @@:
0005 90 nop
Oops2
0006 EB 03 1 jmp @f
0008 5A 58 00 1 % BYTE "&@FileName", 0
000B 1 @@:
000B CB ret
000C zxcv endp
end
<rest of listing snipped>
> Seems to work for me :-) How about some Quotes? :-)
>
> BTW, the % is required to force evuatation of the expression.
>
> Oops1 MACRO
> LOCAL Skip, Name
> jmp @f
> Name label BYTE
> % db "&@FileName", 0
> @@:
> ENDM
Ouch, of course, that's it... My only excuse is that I never had to use any
predefined symbols before. Thanks for your help.