Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get file & line using MASM

0 views
Skip to first unread message

Jerry van Dijk

unread,
Mar 7, 2001, 5:37:15 PM3/7/01
to

[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 ?

Thanks,
Jerry.

--
-- Jerry van Dijk | email: jd...@acm.org
-- Team-Ada | web: home.trouwweb.nl/Jerry
-- Paris, France | Leiden, Holland

Arargh!

unread,
Mar 7, 2001, 9:01:57 PM3/7/01
to
On 07 Mar 2001 23:37:15 +0100, Jerry van Dijk <jva...@attglobal.net>
wrote:

>
>[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

Jerry van Dijk

unread,
Mar 7, 2001, 11:02:11 PM3/7/01
to

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

Arargh!

unread,
Mar 8, 2001, 4:22:28 AM3/8/01
to
On 08 Mar 2001 05:02:11 +0100, Jerry van Dijk <jva...@attglobal.net>
wrote:

>


>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>

Jerry van Dijk

unread,
Mar 8, 2001, 6:21:44 AM3/8/01
to

Arargh! <Ara...@Enteract.com> writes:

> 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.

0 new messages