flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Commenting out garbage: /* blah */ and skip blah endskip Goto page 1, 2 Next |
Author |
|
DOS386 07 Mar 2009, 10:14
.
. 2 suggestions, one of them is old (sorry for pointing again), one new: 1. /* blah */ 1.67.22 hack: http://board.flatassembler.net/topic.php?t=7115 (from 2007-May, almost 2 years ago) I wrote: > Making this official would be my wish for 1.67.23 Tomasz wrote: > There are some other reasons why it has not been done. Are they still valid ? The evil -D hack intruded into FASM in the meantime The reason why I need it "badly" is here (posted 2008-Mar, 1 year ago) - disassembled opcodes in the source. http://board.flatassembler.net/topic.php?p=73435#73435 2. Add directives skip and endskip Very high priority directives for skipping large amount of garbage. I frequently have such garbage in my sources (porting from C ), if works very badly in such cases. This solution IMHO is 99.99999999999% fool-proof (AFAIK no programming language has an "endskip" keyword, nor it is a standard English word, nor some popular variable/label/comment string), superior to "comment" directive of MASM (if I guess correctly how it works there at all), and would allow anything inside the comment block, including "fix", unbalanced "if" / "endif" , unbalanced "/*" junk, just discarding everything until the "magic" word endskip is encountered |
|||
07 Mar 2009, 10:14 |
|
revolution 07 Mar 2009, 10:51
'end skip', with the space, would be more in keeping with the other block assembly directives (if, while, repeat).
|
|||
07 Mar 2009, 10:51 |
|
DOS386 07 Mar 2009, 12:40
revolution wrote: An option without this modification above is to use: Thanks. Still, my skip and endskip or ( end skip ) solution would tolerate unbalanced curly brackets as well of course Quote: Most editors have good search and replace that can do this easily. Here the FASM IDE's do leave space for improvements. More: http://board.flatassembler.net/topic.php?p=112295#112295 EDIT : link to newer topic Last edited by DOS386 on 23 Mar 2010, 09:37; edited 1 time in total |
|||
07 Mar 2009, 12:40 |
|
Madis731 07 Mar 2009, 16:22
Actually I'm not against you - I also would like to have multiline comments, but your disassembly problem can be worked around:
1) Select the HEX-codes with FASMs very nice feature called Alt+Ins (a.k.a. 'vertical select') 2) Cut 3) Move to the end of the assembly-code and paste 4) Ctrl+H, replace ' 0000' with '; 0000' The result: Code: cmp eax,0x400 ; 00000377 81F800040000 jnz near 0x388 ; 0000037D 0F8505000000 call 0x31d ; 00000383 E895FFFFFF leave ; 00000388 C9 ret ; 00000389 C3 push ebp ; 0000038A 55 mov ebp,esp ; 0000038B 89E5 sub esp,0x0 ; 0000038D 81EC00000000 nop ; 00000393 90 mov eax,[ebp+0x8] ; 00000394 8B4508 test eax,eax ; 00000397 85C0 jnz near 0x3b6 ; 00000399 0F8517000000 mov eax,[0x3030] ; 0000039F 8B0530304000 cmp eax,0x20000 ; 000003A5 81F800000200 jnl near 0x3b6 ; 000003AB 0F8D05000000 jmp 0x428 ; 000003B1 E972000000 mov eax,[0x3030] ; 000003B6 8B0530304000 This example even fights agains the /* and */ construct, because you can't easily make the source commented with this. Only regex would be a way out of this I've got one idea, though: 1) ...with Ctrl+H replace ' 0000' with '/* 0000' 2) copy the '/' and '*'-symbols separately and vertically to the end of the code The result: Code: cmp eax,0x400 /* 00000377 81F800040000 */ jnz near 0x388 /* 0000037D 0F8505000000 */ call 0x31d /* 00000383 E895FFFFFF */ leave /* 00000388 C9 */ ret /* 00000389 C3 */ push ebp /* 0000038A 55 */ mov ebp,esp /* 0000038B 89E5 */ sub esp,0x0 /* 0000038D 81EC00000000 */ nop /* 00000393 90 */ mov eax,[ebp+0x8] /* 00000394 8B4508 */ test eax,eax /* 00000397 85C0 */ jnz near 0x3b6 /* 00000399 0F8517000000 */ mov eax,[0x3030] /* 0000039F 8B0530304000 */ cmp eax,0x20000 /* 000003A5 81F800000200 */ jnl near 0x3b6 /* 000003AB 0F8D05000000 */ jmp 0x428 /* 000003B1 E972000000 */ mov eax,[0x3030] /* 000003B6 8B0530304000 */ |
|||
07 Mar 2009, 16:22 |
|
DOS386 08 Mar 2009, 08:38
Madis731 wrote: Actually I'm not against you - I also would like to have multiline comments, but your disassembly problem can be worked around NO. I of course need the right side for "ordinary" comments. Code: /* 00000377 81F800040000 */ cmp eax,0x400 ; End of data ? /* 0000037D 0F8505000000 */ jnz near 0x388 ; NO /* 00000383 E895FFFFFF */ call 0x31d ; Finalize it /* 00000388 C9 */ leave /* 00000389 C3 */ ret /* 0000038A 55 */ push ebp /* 0000038B 89E5 */ mov ebp,esp /* 0000038D 81EC00000000 */ sub esp,0x0 ; Very efficient compiler /* 00000393 90 */ nop /* 00000394 8B4508 */ mov eax,[ebp+0x8] ; "pSomeFunnyVariable" /* 00000397 85C0 */ test eax,eax ; CMPNTQ EAX, 0 /* 00000399 0F8517000000 */ jnz near 0x3b6 ; YES, it's empty /* 0000039F 8B0530304000 */ mov eax,[0x3030] /* 000003A5 81F800000200 */ cmp eax,0x20000 ; 128 KiB /* 000003AB 0F8D05000000 */ jnl near 0x3b6 /* 000003B1 E972000000 */ jmp 0x428 ; Give up !!! /* 000003B6 8B0530304000 */ mov eax,[0x3030] ; This sucks .... Quote: example even fights agains the /* and */ construct, because you can't easily make the source commented with this. Trivial tool, not FASM IDE revolution wrote: make sure there are no bare closing curly brackets ('}'). Replace all closing curly brackets with a backslash-curly ('\}'). The problem of all those macro/matcho hacks is that most programming languages do use it: C, PASCAL, and last but not least FASM itself. Code: #include <stdio.h> int main(void) { printf("Hello, world!\n"); return 0; } |
|||
08 Mar 2009, 08:38 |
|
Azu 01 Apr 2009, 23:19
DOS386 wrote: . It would be better to have "skip X" start and "X" end so it doesn't matter what is in the block, you can just use something not in it as the X. |
|||
01 Apr 2009, 23:19 |
|
bitRAKE 02 Apr 2009, 00:58
Azu wrote: It would be better to have "skip X" start and "X" end so it doesn't matter what is in the block, you can just use something not in it as the X. |
|||
02 Apr 2009, 00:58 |
|
Azu 02 Apr 2009, 03:06
bitRAKE wrote:
Nonono not limited to anything. |
|||
02 Apr 2009, 03:06 |
|
DOS386 05 Apr 2009, 03:51
Azu wrote: I think this is a bad idea. It would be better to have "skip X" start and "X" end so it doesn't matter what is in the block, you can just use something not in it as the X. ONe char ? Bad idea. all chars are occupied Quote: Hopefully "X" is not limited to a single byte, or else UTF-8 encoded files could be a problem. Indeed. Something like: Code: skip mygarbage #include <stdio.h> int main(void) { printf("Hello, world!\n"); return 0; } mygarbage ; FASM example of writing 16-bit DOS .COM program format binary as "COM" use16 org $0100 mov ah, 9 mov dx, txhello int $21 mov ah, $4C int $21 txhello: db "Hello world!$" _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
05 Apr 2009, 03:51 |
|
revolution 05 Apr 2009, 04:43
How about we use the MIME format for sources:
Code: MIME-version: 1.0 Content-type: multipart/mixed; boundary="DOS386garbage" --DOS386garbage Content-type: asm/UTF8 ; FASM example of writing 16-bit DOS .COM program format binary as "COM" use16 org $0100 mov ah, 9 mov dx, txhello int $21 mov ah, $4C int $21 txhello: db "Hello world!$" --DOS386garbage Content-type: C/ASCII #include <stdio.h> int main(void) { printf("Hello, world!\n"); return 0; } --DOS386garbage-- |
|||
05 Apr 2009, 04:43 |
|
Azu 05 Apr 2009, 09:10
DOS386 wrote:
|
|||
05 Apr 2009, 09:10 |
|
DOS386 07 Apr 2009, 01:43
Azu wrote:
|
|||
07 Apr 2009, 01:43 |
|
Azu 07 Apr 2009, 03:45
DOS386 wrote:
|
|||
07 Apr 2009, 03:45 |
|
pelaillo 07 Apr 2009, 13:44
DOS386 wrote: At least excellent quoting skills First laugh of the day! Thanks |
|||
07 Apr 2009, 13:44 |
|
revolution 07 Apr 2009, 13:52
Azu, when quoting his own post, wrote: Hell_Killer wrote Joining the dots ... Azu == Hell_Killer_SS Freudian slip? |
|||
07 Apr 2009, 13:52 |
|
Azu 07 Apr 2009, 14:23
revolution (apparently also plagued with the inability to read) wrote:
In case not; I was quoting DOS386, hence the "DOS386 wrote:", rather then "Azu wrote:". I'm pretty sure it is the case though. You had to have gone out of your way on purpose to fuck up the quotes like that. Fixed it for you anyways. |
|||
07 Apr 2009, 14:23 |
|
revolution 07 Apr 2009, 14:35
Oh no, I don't act dumb, I am dumb. But just the same I also like a good practical joke and you have seem to have your broken funny bone.
|
|||
07 Apr 2009, 14:35 |
|
Azu 07 Apr 2009, 22:38
Sorry, I just find it extremely annoying when multiple people deliberately misinterpret me for no reason, without making it clear whether they really are confused or just doing it on purpose..
|
|||
07 Apr 2009, 22:38 |
|
bitRAKE 08 Apr 2009, 02:49
It is best to repeat yourself Azu than to assume malice - so many here are not native speakers of English, and I think we are all learning to communicate better -- I know I am. Quoting doesn't work if the mis-communication persists. Rephrase and expound on your ideas, or draw a picture (ASCII art, lol).
|
|||
08 Apr 2009, 02:49 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.