flat assembler
Message board for the users of flat assembler.

Index > Main > Comment a block of lines in FASM?

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 10 Oct 2008, 09:45
Hello guys,

I know that you can comment a line with a semicolon ";". But is it possible in FASM something like this in MASM?


Code:
comment ~

 these are my comments
 in several lines
 bla, bla,
 bla, bla

~    


Thanks in advance!
Post 10 Oct 2008, 09:45
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20337
Location: In your JS exploiting you and your system
revolution 10 Oct 2008, 10:20
Short answer: No.

Long answer: Yes

Answer with more detail: No, but yes if you alter the fasm sources. There are also some macro solutions already posted on this board, but they do not work in all situations, but may be suitable for your needs.
Post 10 Oct 2008, 10:20
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 10 Oct 2008, 10:27
I'd suggest to just use ";" in the beginning of every line. It is clean, and not so much effort.
Post 10 Oct 2008, 10:27
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 10 Oct 2008, 12:46
alorent

Some time ago I presented that some small changes done in 'PREPROCE.INC' (FASM preprocessor sources) allow us to use C-style /*...*/ multiline comments. Smile

Take a look at this topic: Multiline /*...*/ comments in FASM
Post 10 Oct 2008, 12:46
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 10 Oct 2008, 13:01
... and then no one else would be able to compile your sources
Post 10 Oct 2008, 13:01
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20337
Location: In your JS exploiting you and your system
revolution 10 Oct 2008, 13:15
... and you must modify your fasm sources every time there is a new version
Post 10 Oct 2008, 13:15
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 10 Oct 2008, 13:18
vid

... assuming that you want to publish sources of your program. In opposite case I see no problem.

This change is only proposition for those, who want make their work easier (I'm still wondering why this kind of comments isn't standard, but I will never receive an answer, of course).
Post 10 Oct 2008, 13:18
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 10 Oct 2008, 13:19
For custom hobby projects, and if you don't want to use newer FASM versions (as revolution pointed out), okay. Otherwise, it is a bad idea.
Post 10 Oct 2008, 13:19
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 10 Oct 2008, 13:22
Really, how often the file 'PREPROCE.INC' is changed? With every newer version of FASM? I don't think so, because main changes are made by adding new sets of the macros.
Post 10 Oct 2008, 13:22
View user's profile Send private message Visit poster's website Reply with quote
Grom PE



Joined: 13 Mar 2008
Posts: 114
Location: i@grompe.org.ru
Grom PE 10 Oct 2008, 15:11
Code:
macro comment {

 these are my comments 
 in several lines 
 bla, bla, 
 bla, bla 

}    
Doesn't work when lines have non-paired quotes or a "}", though.
Post 10 Oct 2008, 15:11
View user's profile Send private message Visit poster's website Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
windwakr 10 Oct 2008, 17:06
This is easier than the above, add this to start of your file:
Code:
comment fix macro comment    


then use like:
Code:
comment{
mov [blah],ax
add ax,[bleh]
xchg whatever,dx
....
}
    

_________________
----> * <---- My star, won HERE
Post 10 Oct 2008, 17:06
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12792
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 11 Oct 2008, 16:46
i actually think it is editor job to have the feature, multiblock comment instead of language.
Post 11 Oct 2008, 16:46
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 16 Oct 2008, 12:02
windwakr wrote:
This is easier than the above, add this to start of your file:
Code:
comment fix macro comment    


then use like:
Code:
comment{
mov [blah],ax
add ax,[bleh]
xchg whatever,dx
....
}
    


Wow, that works just great!!! Very Happy

Thanks a lot!
Post 16 Oct 2008, 12:02
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 20 Oct 2008, 21:23
alorent,

I'm using old C preprocessor technique of #if/#endif, as in
Code:
…
if 0
        invoke  ExitProcess, 0
end if
…    
It is as useful as windwakr's macro trick (same problem with nesting boundaries, as Grom PE stated).
Post 20 Oct 2008, 21:23
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 13 Jan 2009, 21:45
Code:
comment fix macro comment    


wonderful ! tks windwakr Wink
Post 13 Jan 2009, 21:45
View user's profile Send private message Send e-mail Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 14 Jan 2009, 01:35
hate to repeat the obvious, but when using "if 0" or "comment fi macro comment", don't use it to comment preprocessor code - it might not work.
Post 14 Jan 2009, 01:35
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 14 Jan 2009, 06:10
vid,

Yep. Any technique has it's limitations, programmer should clearly understand how his/her source will compile (especially when using advanced macros, like invoke Wink).
Post 14 Jan 2009, 06:10
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.