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: 201
alorent
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: 17716
Location: In your JS exploiting you and your system
revolution
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
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: 6038
Location: Poland
MHajduk
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
... 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: 17716
Location: In your JS exploiting you and your system
revolution
... 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: 6038
Location: Poland
MHajduk
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
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: 6038
Location: Poland
MHajduk
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: 115
Location: i@grompe.org.ru
Grom PE
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
Location: Michigan, USA
windwakr
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: 9182
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
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: 201
alorent
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
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
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
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
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.