WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Forum

Pages: (2) [1] 2   ( Go to first unread post ) Reply to this topicStart new topicStart Poll

Using multi-line comments in MASM, Usage of the COMMENT MASM directive

samael
Posted: Sep 10 2007, 08:23 AM
Quote Post


Typo-lord
******

Group: Admins
Posts: 225
Member No.: 5187
Joined: 10-June 07



Originally posted by Lahar

How can i use multi-line comments in a file that is to be compiled by MASM?
Such as this one, from DevCpp:

CODE
/*
�Name:
�Copyright:
�Author:
�Date: 02/09/07 20:31
�Description:
*/


Thanks in advance,
__Lahar__

PM
Top
ragdog
Posted: Sep 10 2007, 09:24 AM
Quote Post


New Member
*

Group: Members
Posts: 7
Member No.: 5019
Joined: 13-May 07



hi

try this and i hope you mean this?

CODE
comment /*
Name:
Copyright:
Author:
Date: 02/09/07 20:31
Description:
/*



greets
ragdog
PMEmail Poster
Top
Lahar
Posted: Sep 10 2007, 09:56 AM
Quote Post


Member
**

Group: Members
Posts: 22
Member No.: 5522
Joined: 18-August 07



Well actually i wanted something like this directly from WinAsm Studio as an option , so that i can avoid some typo. I presume its not that hard to include into WinAsm Studio if its not one there.

__Lahar__
PMEmail Poster
Top
shoorick
Posted: Sep 10 2007, 10:07 AM
Quote Post


Extremely Active Member
******

Group: Admins
Posts: 1184
Member No.: 160
Joined: 22-June 04



select part of code and press F2
PMEmail Poster
Top
samael
Posted: Sep 10 2007, 10:20 AM
Quote Post


Typo-lord
******

Group: Admins
Posts: 225
Member No.: 5187
Joined: 10-June 07



Lahar,

This could be easily done with an addin.
You could try to code one that suits your needs, and we 'll give you all the help you 'll need.
Sorry for misunderstanding your question.

Anyway, just for reference, this is how the COMMENT directive works:

From MSDN:
QUOTE

CODE
COMMENT delimiter [[text]]
[[text]]
[[text]] delimiter [[text]]

Treats all text between or on the same line as the delimiters as a comment.


The delimiter can be ANY SINGLE character (case sencitive). At the second instance of the single character used as delimiter, the COMMENT directive range is assumed closed.

For instance, one could try to use the character "a" as delimiter, to comment the whole snippet below. (Note where the second instance of the delimiter occurs):
QUOTE
COMMENT a
szMessage1 db "Hello World 1",0
szMessage2 db "Hello World 2",0
szCaption db "I ran out of imagination...",0
a

The comment's range is defined by the first occurance of the character used as delimiter, to the last character of the line that contains the second instance of the delimiter.

This is what is assumed as comment by the MASM pre-compiler for the above snippet (in contrast to the programmers expectations):

QUOTE
COMMENT a
szMessage1 db "Hello World 1",0

szMessage2 db "Hello World 2",0
szCaption db "I ran out of imagination...",0
a

Because of this effect, someone should use as delimiter, any single character that is not frequently used in text or code, such as {"^", "~", "`" } etc.

Usually, and as an unofficial standard, the ASCII character "~" is used as delimiter for the COMMENT directive.

References:

Microsoft Macro Assembler Reference at MSDN - COMMENT (MASM)
PM
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Pages: (2) [1] 2  Reply to this topicStart new topicStart Poll