flat assembler
Message board for the users of flat assembler.

Index > Main > x64 native FASM?

Goto page Previous  1, 2, 3
Author
Thread Post new topic Reply to topic
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias 23 Aug 2006, 10:39
Offering a mild rebuke of my notion of the PARAMOUNT importance of readability versus ANY other parameter, especially EXECUTION speed, or memory utilization, RedGhost (and many others, in thought) suggested:
Quote:

If you think readability is more important than size and speed maybe you are posting on the wrong type of forum?

This comment was misunderstood by some members of the forum, who may have also misunderstood my statement concerning readability, the key to making CHANGES IN FASM-->the initial thrust of this thread by Garthower. RedGhost did not misunderstand me, he simply disagrees with my position, as is certainly his right.... However, my position may have been misunderstood by other forum members, as indicating mere DISSATISFACTION with the documentation of the CODE upon which FASM rests. Some forum members may share my unhappiness with the absence of appropriate commentary in the code, hence the kind hearted response to RedGhost, from MHajduk:
Quote:

Every compiler ignores (omits) comments, so they haven't influence on the size of the output file (and speed of the program).

But, RedGhost is correct here, it is not simply the commentary's absence which so troubles me, but the type, and utilization of instructions, which, I claim, underscores FASM's hostility to readability. In my opinion, those, like RedGhost, who believe, erroneously, that FASM, when written with clarity as the prime objective, rather than optimizing for space or speed, would suffer as a result, are simply uninformed and inexperienced. (hint: less THC, more reading, please begin with Brooks "mythical man month")
http://en.wikipedia.org/wiki/The_Mythical_Man-Month

Absence of comments in FASM code is annoying, to be sure, but it is not CRITICAL. Line by line commentary is REQUIRED in some corporate environments, others are more lax about this, what is, however, NOT permitted, at least, not in any corporate environment in which I have ever worked, is the DELIBERATE obfuscation of the code, by introducing, inappropriately, Boolean functions to PREVENT understanding, i.e. to deter readability, to enhance the cryptic character of the project.

In another thread, recently, Tomasz referenced the autocompilation time for FASM, at the beginning, many years ago, running on a 386, and indicated that several minutes had been required for that process. In that thread, RedGhost suggested that on his machine, of recent vintage, autocompilation of FASM required only a few seconds at the most, THEREBY MAKING THE CASE FOR MY ARGUMENT, that improving EXECUTION SPEED for compilation is DEAD LAST in the list of improvements needed for FASM.


Garthower's question, how to proceed with MODIFYING FASM to accommodate some new feature, highlights what IS NOW, TODAY, AND ALWAYS HAS BEEN, the critical issue in ANY computer programming assignment:
MODIFICATION.
End of story. No readability: no modifiability. I can't count the number of projects in corporate society, where the decision was made to simply JUNK the existing code--throw it away, dispose of it, rather than try to figure out what the authors had been trying to accomplish, in order to modify the software to embrace new capabilities.

Defending FASM's supposed readability, Fudder suggested that FASM possessed some degree of modularity. Hmm.
Not likely. Modularity implies that one could REUSE some function, or some data structure, or some control function, in any significant revision of FASM, such as would be required by Garthower. If FASM were modular, someone else, say Bogdan, for example, who is designing his own assembler, could scavenge relevant components, maybe the parser, for instance. But, I don't see people lining up, with their hands out, hoping to acquire some of these supposedly modular components of FASM. A piece of software is not deemed modular, by virtue of a commentator's opinion, even one as learned as Fudder. It is acknowledged to be modular upon recognition that one or more of its constituent parts has been adopted by some other, distinct piece of software. Is there some other program in existance, which owes a debt of gratitude to Tomasz, for supplying NOT SIMPLY THE CONCEPT, not just the IDEA, but the actual code itself, taken right out of FASM? Rolling Eyes
Post 23 Aug 2006, 10:39
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Aug 2006, 10:42
Quote:
I fail to see the relevance of this question to the central issue discussed in this thread, i.e. whether or not FASM is amenable to modification, as Garthower inquired.

FASM has heavy use of pointers. Heavy use of pointers is one of problems with going to 64bi. Many pointers are used right inside this table. Still fail to see relevance of this question?

rest is just matter of personal opinions, i can read fasm code quite fluently, and for me "or eax, eax" is same as "test eax, eax". Maybe you should improve your reading ability.

Another your problem with "reading" is that you are too strongly biased on standard math/theoretical informatics. "or" instruction IS NOT same os or boolean arithmetic operation. "or" instruction has some extra effects. Of course that if you try to read it just as operation, then it's errorous use. Read definition of boolean OR operation, and read definition of OR instruction, you will see they are different things (with something in common - "or" instr. is designed to allow (among other things) perform or operation, plus it does much more.

It's like you are trying to read english text using german vocabulary.


Last edited by vid on 23 Aug 2006, 11:33; edited 1 time in total
Post 23 Aug 2006, 10:42
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Aug 2006, 11:31
Quote:
If FASM were modular, someone else, say Bogdan, for example, who is designing his own assembler, could scavenge relevant components, maybe the parser, for instance. But, I don't see people lining up, with their hands out, hoping to acquire some of these supposedly modular components of FASM.

http://board.flatassembler.net/topic.php?t=4191
Post 23 Aug 2006, 11:31
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 23 Aug 2006, 12:06
vid wrote:
... I can read fasm code quite fluently...
As Big Brother used to say: "I'm impressed". Smile

S pozdravom,
M.H.
Post 23 Aug 2006, 12:06
View user's profile Send private message Visit poster's website Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias 23 Aug 2006, 18:04
vid offered, in response to my question requesting an illustration of FASM's supposed modularity, (as proposed, previously in this thread, by Fudder,) this link from 2005:
http://board.flatassembler.net/topic.php?t=4191

There, revolution wrote:
Quote:

Most of the FASM-ARM code assembler style is the same as standard ARM style with a few differences to account for FASM specific style.
...


FASM-ARM generates ARM code binaries but FASM-ARM still runs on the X86 processor, it does not run on the ARM processor. So strickly speaking FASM-ARM is a cross assembler.


Tomasz replied:

Quote:

I think you should at least replace the FORMATS.INC with the alternative for ARM,.....


Revolution's comment in response:

Quote:

I had thought about doing that but decided against it. I wanted to see how far I could get by only changing one file.


Having not studied the problem, i.e. having not yet downloaded the ARM specs, or the software in question, it appears to me that this illustrates the very opposite of modularity. It seems, from these comments, that Revolution has taken THE WHOLE OF FASM, even when Tomasz suggested that it might be better to pare back some of the files, Revolution replied that he wanted to see what could be done by changing AS LITTLE AS POSSIBLE. This is the OPPOSITE approach to modular programming. Here, Revolution is acknowledging, without so writing, that it is arduous to try and dissect FASM, it is easier to simply leave FASM intact, even though, most of FASM should be irrelvant to ARM, as Tomasz hinted. This is less a testament to the supposed modularity of FASM, and more a confirmation that it is nearly impossible to break FASM apart, and use only some module or modules for a new application. This reference, to me, repudiates, rather than reinforces the notion of modularity in FASM.
Post 23 Aug 2006, 18:04
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 23 Aug 2006, 18:21
tom tobias, why you constantly refer to f0dder as Fudder? Just typo error?

BTW, why do you think that changing a code as little as possible is opposite to modular programming? Is not suppossed that modular programming is intented to simplify future modification by doing less job that a non modular program?

Regards,
Hernán
Post 23 Aug 2006, 18:21
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Aug 2006, 18:24
he didn't take some modules from FASM, as you may have thought. He replaced one module with another, specifcly x86 assembler module was replaced by ARM assembler module. Rest remained same (preprocessor, parser, formatter).
Post 23 Aug 2006, 18:24
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias 23 Aug 2006, 19:45
Quote:

why you constantly refer to f0dder as Fudder? Just typo error?

1. yes, typo error, of sorts, actually, sign of inadequate DNA;
2. prejudice against all FUDDERS;
3. unskillful
4. no umlaut on the keyboard, and too lazy to download a universal font
5. long, many DECADES of incorrectly typing Fudder instead of fudder.
6. BUT I PROMISE to try and improve....
(old dogs, new tricks, you know what I mean......)
Quote:

He replaced one module with another, specifcly x86 assembler module was replaced by ARM assembler module.

I suppose you are correct. I am mistaken. fudder is right, I am wrong.
Embarassed
Post 23 Aug 2006, 19:45
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 28 Aug 2006, 13:59
tom tobias wrote:
If my life depended upon it, I could not explain what this code fragment is supposed to accomplish. I did not remove the comments--there simply are none.
Is it well written? I don't know. Is it concise? I don't know. Is it efficient? I don't know. Could it be improved?? I haven't the slightest idea....I am so ignorant here, and so completely lost, that I cannot, for example explain to someone why XOR is used to clear edx, but OR is used for eax. For all I know, "OR" represents a typographical error, and it should be XOR, instead???? I have no idea why edx is being pushed, but not ebx. I don't know why edx is being pushed onto the stack instead of being assigned to a variable....Is shl eax,16 intended as a multiplication, or some kind of exchange operation? I surely haven't the foggiest notion of why one needs to divide 182 in ebx? Why is there only one operand in mul ebx? What happens to the product?
Ok, my turn:
Quote:
Wenn mein Leben nach ihm abhing, könnte ich nicht erklären, was dieses Codefragment vollenden soll. Ich entfernte nicht die Anmerkungen--es gibt einfach keine.
If my life depended upon it, I could not explain what these two phrases are supposed to accomplish. I did not remove the comments--there simply are none. (in fact, the above quote is just your text translated with google)

Is it well written? I don't know. Is it correct? I don't know. Is it gramatically correct written? I don't know. Could the syntax be improved?? I haven't the slightest idea....I am so ignorant here, and so completely lost, that... (and so on)

Second, criticizing someone's work is a sign of weakness, and you no doubt have that. That is, it's YOUR fault that you are "not clever". Did you ever bother to learn asm in "our (fanatical from your point of view) way", did you ever appreciate every creation, every low-level thing? Did you ever appreciate computers? So you see, it's in fact your fault that you don't even want to learn the language "the proper way", and you bash our work because you are not able to understand it. So what? Write it better. If you can't, then why do you criticize us instead of appreciating us (I'm mainly referring to Tomasz, since he is your main target, from what I see, you criticize Fasm)?

Ok, let's take an example (it's only an example): I want to "understand" ALL the languages in the world. That damn chinese language... it uses such a different alphabet that I am unable to comprehend even a single word. Maybe I should start criticizing the chinese because they make it so very unreadable for me. Is it their fault or is it actually MY fault that I do not "try" to learn their language? I just want to clap and understand it? Maybe I should put some effort?

That example was not very far from your perspective, really. But of course I am not such a bastard (that's why it was only an example). Tomasz writes Fasm in "his" way, why do you criticize him? Write it your way.. oh, I'm sorry, I forgot you're not clever (or at least you claim you're not clever) and want to write an assembler without any knowledge of it. Don't worry, you can start criticizing others and perhaps you'll gain more than working honestly and learning, while putting EFFORT in it to truly show that you WANT to do it, like we did it.

Again I said this a thousand of times: asm is NOT designed for READABILITY. Don't you ever get it? It was designed for us "fanatics", and those who appreciate low-level stuff (like CPU writers), NOT for READABILITY. Tell me, if asm is readable, how does that make HLLs? More readable? And if so, why use asm at all, if it is the same as a HLL? I don't know why you would never simply understand this simple fact. But you'd better get back to work -- you know, criticizing everyone else, including "old" computers which you call crap, though you never actually started to understand what they really are.
Post 28 Aug 2006, 13:59
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 08 Sep 2006, 07:10
i think this thread no longer belongs to Projects, i move it to Main (without the discussion, it could go to Compiler Internals)...
Post 08 Sep 2006, 07:10
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
arafel



Joined: 29 Aug 2006
Posts: 131
Location: Jerusalem, Israel
arafel 16 Oct 2006, 11:25
Hehe, it was really fun reading this thread. Smile

Tom, you raise some interesting points. And while I agree with most of them, your opinion on deliberate code obfuscation (as in the 'or' case) has nothing to do with code readability that you have stressed so much.
A house built with bolts, is not less a house than the one built with nails. As well as using xor eax, eax to clear a register is no less legitimate way than using mov eax, 0; sub eax, eax; or dec while not zero. with the only difference being speed, size, and/or developer personal preference. And unless the application incorporates some high code optimizations which need to be commented on line-by-line basis, it really shouldn't be commented in the source why one instruction was chosen over the other in some particular case. Third party reading the source and having adequate knowledge of a given language will understand anyway the purpose of particular instruction and if not than it's not really an author's fault.


The_Grey_Beast wrote:
Second, criticizing someone's work is a sign of weakness,

Constructive criticism is ALWAYS a good thing, and sometimes even a necessity for a product intended for a public use.

Quote:

Ok, let's take an example (it's only an example): I want to "understand" ALL the languages in the world. That damn chinese language... it uses such a different alphabet that I am unable to comprehend even a single word. Maybe I should start criticizing the chinese because they make it so very unreadable for me. Is it their fault or is it actually MY fault that I do not "try" to learn their language? I just want to clap and understand it? Maybe I should put some effort?

It's no one's fault. At any given moment you can go to a bookshop, purchase book and start learning. But only because there ARE books commenting and describing the language. Imagine how harder it would be if the only source of information was only a Chinese writings without any commentary.

Quote:

Again I said this a thousand of times: asm is NOT designed for READABILITY. Don't you ever get it? It was designed for us "fanatics", and those who appreciate low-level stuff (like CPU writers), NOT for READABILITY.

So you basically claim that Assembly can be used only for hobby programming?
Post 16 Oct 2006, 11:25
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 16 Oct 2006, 11:54
hehe, asm wasn't designed for readability nor for fanatics. it was just symbolic version of machine language. and asm code can be written readable. even readable considered by tom tobias (it is rumored that smiddy writes such code)
Post 16 Oct 2006, 11:54
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 19 Oct 2006, 17:08
arafel wrote:
Constructive criticism is ALWAYS a good thing, and sometimes even a necessity for a product intended for a public use.
Yeah, but that's not what I call constructive criticism. And besides the one criticizing should at least have experience, not like tom (or at least he claims so).. he doesn't know asm. It is amazing how many people just bash asm from what they've heard. I can bash Pascal too, but that only makes me an idiot, since just because I never touched it doesn't mean it's crap.

arafel wrote:
So you basically claim that Assembly can be used only for hobby programming?
No, not at all. I tried to say that asm's primary goal IS NOT readability -- i.e who cares about speed/size?!? Then, if readability is indeed it's primary goal, then why not use HLLs?

Asm is meant to be used for optimizing. That's why there are so many HLLs out there -- to accomodate each ones preferences. Most HLL focus on readability and (so called) clear syntax. Asm is just different in that it focuses on internals and optimization.

However, like Tomasz, I do see programming as a kind of art. It doesn't matter what language I use -- the design is some "art"-ish piece of thing. You have to use imagination. Of course I'm reffering for original things -- i.e buying some software and using it is no art at all Smile


vid: don't get me wrong. I was not telling we are "fanatics". I did so from tom's point of view -- he sees us as the ones who fall in darkness and need some enlightment.


ps: I'm a bit tired of reading such topics, especially since they're so long. Never really took them seriously anyway Razz

happy coding

_________________
Previously known as The_Grey_Beast
Post 19 Oct 2006, 17:08
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 02 Dec 2006, 20:05
just for fun, i copypasted few tom's posts to this Mark V Shaney, to see how it can mimick his style:

Mark V Shaney wrote:

I believe, that Tomasz, by his response, has explained the rationale for this cryptic appearance: HE WANTS IT TO BE, an artistic endeavor, not a software engineering project.

Thank you vid, for soliciting my opinion concerning access of elements within a data structure.

I fail to see what could be done by changing AS LITTLE AS POSSIBLE.

This is the DELIBERATE obfuscation of the numeric constant, what is it, 182, or some such eminently readable value.

Obviously, NORMAL people, can see that value, and UNDERSTAND what it signifies, so tom must have an impairment, a relatively severe form of dyslexia.

I will conclude my ramblings on this topic by acknowledging with gratitude the excellent rejoinder, which Garthower offered, above, in reply to the central issue discussed in this thread, i.e.

Obviously, if "OR" CAN be used NORMALLY, with two operands, but using the second operand would then make the CODE readable, instead of authoring CODE.

some are good Very Happy
Post 02 Dec 2006, 20:05
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Goplat



Joined: 15 Sep 2006
Posts: 181
Goplat 02 Dec 2006, 21:43
tom tobias wrote:
If my life depended upon it, I could not explain what this code fragment is supposed to accomplish. I did not remove the comments--there simply are none.
This is actually easy to read, for me anyway. I could tell what it's doing without even having to look at the context.

mov ah,9 / mov dx,_passes_suffix / call dos_int
Displays the string at _passes_suffix.

xor ah,ah / int 1Ah
Puts the BIOS's counter of timer ticks in CX:DX.

mov ax,cx / shl eax,16 / mov ax,dx / sub eax,[start_time]
Put the value in EAX and subtract the saved value of the counter from when fasm was started. Result is the number of ticks that have occurred during compilation.

mov ebx,100 / mul ebx / mov ebx,182 / div ebx
Converts tick count into a number of tenths of a second. (There are about 18.2 timer ticks in a second)

or eax,eax / jz display_bytes_count
If it's zero, don't bother with it, just skip to displaying the output size.

xor edx,edx / mov ebx,10 / div ebx / push edx
This is incomplete, but it looks like it's the start of the code to turn the number into ASCII in order to display it.

Before criticizing other people's assembly code, maybe you should actually learn assembly? Smile
Post 02 Dec 2006, 21:43
View user's profile Send private message Reply with quote
Filter



Joined: 08 Oct 2006
Posts: 67
Filter 03 Dec 2006, 23:40
Well this is an interesting conversation. I feel like adding my own opinions.

Tomasz does this for free so he can do what he feels like. Although, it is nice when code is well commented. It helps idiots like me understand what is going on.

Most of the time when assembler is used it is not so the code can be obscure but rather faster and with smaller resulting binaries. Even assembler should be well commented. Having the idea that it doesn't matter is assembler is obscure because it is low level anyway doesn't make sense in my view.

FASM is the only assembler that I have actually been able to learn anything on. I would get too tied up with all the semantics that I think are weird like .small and trying to remember what they all do instead of just trying to learn how to code in itself. With FASM I didn't have to do that and now I am understanding assembler.

I sincerely thank Tomasz from the bottom of my heart for creating such a great assembler. I hope one day I will be able to look at the code from FASM and understand what is going on, better comments or not.
Post 03 Dec 2006, 23:40
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3

< 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.