flat assembler
Message board for the users of flat assembler.
Index
> Main > Nice GAS feature ".end" |
Author |
|
revolution 17 Jan 2018, 03:39
What name would you suggest for fasm? ".end" is already in use for the Windows library and import macros.
|
|||
17 Jan 2018, 03:39 |
|
fasmnewbie 17 Jan 2018, 03:53
I prefer ".footnote" because it gives the idea that it should be put at the end of the source and nowhere else. Or ".nb" perhaps. I don't know... just a thought. It should give users more freedom in documenting their codes (useful for students too!)
|
|||
17 Jan 2018, 03:53 |
|
revolution 17 Jan 2018, 04:50
Or perhaps:
|
|||
17 Jan 2018, 04:50 |
|
ProMiNick 17 Jan 2018, 05:53
may be sth name like force_eof
End source will be hard to port in concepts of fasmg, but some kind of alternate end of file could. |
|||
17 Jan 2018, 05:53 |
|
Tomasz Grysztar 17 Jan 2018, 09:03
For fasmg it has been briefly discussed here: https://board.flatassembler.net/topic.php?p=190291#190291
Note that all fasm versions since the beginning respect the actual EOF byte or a null byte to terminate the file. If the editor you use is able to handle inserting such bytes in a middle of text, you can use them for such purpose. |
|||
17 Jan 2018, 09:03 |
|
revolution 17 Jan 2018, 09:50
Tomasz Grysztar wrote: Note that all fasm versions since the beginning respect the actual EOF byte or a null byte to terminate the file. If the editor you use is able to handle inserting such bytes in a middle of text, you can use them for such purpose. Testing for some control characters: Code: text. Text after control characters. |
|||
17 Jan 2018, 09:50 |
|
Tomasz Grysztar 17 Jan 2018, 12:01
revolution wrote: While some editors can do such tricks, it is not common. And it isn't potable. If someone posts code here using the EOF byte a lot of people won't be able to properly use it or see it. Copy and paste will be difficult. |
|||
17 Jan 2018, 12:01 |
|
Furs 17 Jan 2018, 13:23
Code: macro footnote { These comments are ignored by the assembler after the .end directive. Now I am free to write some notes for this little code outside the busy coding area. AT&T syntax is confusing. This is within the same source } On a side-note, .end is actually really useful for "hacks" (but it has nothing to do with FASM) You can't stop GCC with LTO (done at link-time!) from assembling the last file, so what I did is use my GCC plugin to insert an .error and then .end at the very beginning of the file when it is generated. GCC will error when it comes to this (final) assembly stage, but I filter out this error in my makefile. Then I simply remove the .error and .end and parse the asm with a script etc, then assemble it manually. Otherwise it's not possible to manually parse the final asm with LTO. (btw yes, .error doesn't stop assembly, GAS is one of those "error avalanche" thingies, so it would parse it for no reason in my hack above, .end stops it immediately though) |
|||
17 Jan 2018, 13:23 |
|
fasmnewbie 17 Jan 2018, 14:01
These symbol-less free-flowing end-comments IMO would allow more activity to the source.
Useful for; 1. Collaborative works (discussions, alternative codes etc) 2. Personal productivity (TO-DO list, reminder, notes, idea, thoughts etc) 3. Eliminate the need for some "include" files. For example, by placing all my "public" entries at the bottom, I can easily turn my executables into a DLL or an object file in an instant by moving them all at the top. 4. Pseudocodes, replacement codes and algorithms can be included in the sources more freely. That would be awesome. |
|||
17 Jan 2018, 14:01 |
|
revolution 17 Jan 2018, 14:06
Using the "macro" method is open to problems with a closing curly bracket within the comment. You can also use the assembler stage "if 0" / "end if", but that also breaks with certain embedded things in the comments.
Personally I use my editors ability to insert/remove bulk ";" characters before each line. It has the advantage of not having any negative character sequences and it displays the comments in the comment style (the colour and font change accordingly). |
|||
17 Jan 2018, 14:06 |
|
Tomasz Grysztar 17 Jan 2018, 14:58
Now that I think of it, "macro ?!" could perhaps be another feature of fasmg that might be back-ported to fasm 1.
|
|||
17 Jan 2018, 14:58 |
|
revolution 17 Jan 2018, 17:05
Block have been discussed here in the past, a few times.
I am in favour of some repeating characters for start/end Code: ;... <<<<< ;start the comment Random comments go here end if }}}}}} <--- these won't cause any problem macro ignored {} rept 999999999 {display 'blah'} rb -1 err mov al,0xFFFFFFFF db "unfinished string >>>>> ;finish the comment |
|||
17 Jan 2018, 17:05 |
|
Furs 17 Jan 2018, 21:38
Maybe something similar to bash "here documents": http://tldp.org/LDP/abs/html/here-docs.html
Seems way overkill though. |
|||
17 Jan 2018, 21:38 |
|
yeohhs 17 Jan 2018, 23:39
The truth is always in the code. Over-worked and tired programmers make changes to code but forget to change the comments.
|
|||
17 Jan 2018, 23:39 |
|
fasmnewbie 18 Jan 2018, 00:21
revolution wrote: Block have been discussed here in the past, a few times. The first code above was from Linux "gedit" and this one below is on Win32, using "fasmw" editors. Code: # # For Win32. Demo using GAS and CPULIB (cpu32.dll) # as this.asm -o this.obj --32 # gcc -m32 this.obj cpu32.dll -o this.exe # .code32 #force 32-bit code .globl _WinMain@16 #entry point for C .section .data .align 4 hello: .asciz "Hello World\n" .section .text _WinMain@16: push %ebp mov %esp,%ebp push $hello call _printf add $4,%esp call _dumpreg pop %ebp ret .end Free-flowing notes: Manglish is the best English syntax in the world. come try lah! Basic skeleton for a 32-bit GAS on Win32 mov <source>,<destination> No "db", "dw" etc. Sorry Registers come with % prefix. Ask Oracle for reference add esp,4 is CDECL stack cleanup and convention Can I just use .text instead of .section .text? I DON'T KNOW, ADRIANNNNN!!! int main() { printf("Hello World\n"); return 0; } Equivalent Intel Syntax for "terrer" people push ebp mov ebp,esp push hello call _printf add esp,4 call _dumpreg pop ebp ret output: Hello World EAX|0000000C EBX|00000001 ECX|76EBC620 EDX|77A36BF4 ESI|00890F30 EDI|00000007 EBP|0022FE98 ESP|0022FE98 EIP|00401580 With this feature, imagine the level of expressions, information and 'dramatization' that can be injected into the otherwise a lifeless source. ;D You don't have to worry about anything at all. |
|||
18 Jan 2018, 00:21 |
|
revolution 18 Jan 2018, 01:32
fasmnewbie wrote: You don't have to worry about anything at all. |
|||
18 Jan 2018, 01:32 |
|
rugxulo 07 Feb 2018, 20:16
What you really want is a shar / shell archive (pure text). Unfortunately, I don't know of a perfect way to bootstrap such a thing for all platforms. I ended up using various tools (unshar, sed, AWK, REXX) on various OSes. For Windows, you'd probably be better off using VBscript or PowerShell or maybe even Javascript, dunno.
|
|||
07 Feb 2018, 20:16 |
|
fasmnewbie 14 Feb 2018, 00:31
revolution wrote:
is it difficult to ask the assembler to stop parsing / tokenizing a source or whatever it is called after like, ".stop" sign? In my cluless opinion, it's just a matter of text processing. Something like so Code: while not .stop or EOF or end-of-source keep assembling... endwhile |
|||
14 Feb 2018, 00:31 |
|
revolution 14 Feb 2018, 03:26
fasmnewbie wrote: is it difficult to ask the assembler to stop parsing / tokenizing a source or whatever it is called after like, ".stop" sign? In my cluless opinion, it's just a matter of text processing. |
|||
14 Feb 2018, 03:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.