Message board for the users of flat assembler.
> Heap > AT&T Syntax - Why?!?
Goto page Previous 1, 2
There is an advantage to writing the destination first in the list of operands. If one is to align all the the first operands to the same column then it is easy to scan the code to see where a register/variable was last updated.
I don't usually try to attribute using English to writing code so in my mind I don't think "move [into] eax [the value of] something" but if one wants to think in such a way then the English language does allow for a construct like that. However I would be very wary of trying to "think in an English way" when programming. The thought processes used for programming are different and attempting to force English onto the code is often not a good thing. Just as a silly example, follow the progression from something we would say in English slowly converted into assembly, "4+3=7" --> "4+3=eax" --> "ebx+ecx=eax" --> "ebx add ecx,eax".
If one learns other spoken languages then one finds that they differ considerably on the order of nouns/verbs/adjectives etc. I know a little bit of some other spoken languages and I get the impression that English is more like the exception rather then the rule in the way a sentence is constructed. So why try to impose English restrictions on the code. English is not even the most spoken language in the world.
The AT&T method with the brackets and % symbols are just ways to make the GCC assembler simpler and in the process make the programmer's job harder. vid, I sympathise with you for this task. It is going to be a nightmare for you the remember to reverse all your arguments. I can imagine bugs galore just because you occasionally forget to reverse your thought process.
|07 Apr 2006, 11:28||
btw, "move eax into edx" means that value from eax appeared in edx and disappeared in eax instead of "copy eax into edx" or "load edx from eax" (eg. Z80 syntax)
|07 Apr 2006, 11:55||
Maybe code, but not PROGRAMS. The main reason for demanding SOURCE, then destination is to REPUDIATE code, and SUPPORT programming. Logically, we FIRST specify WHAT we are going to move, THEN explain WHERE we will put the item. No one, at least not in the English language, (oh, excuse me, Revolution, LAST TIME I CHECKED, Intel's cpu manual was written in ENGLISH, and the mnemonics are not Arabic, Chinese, or Swahili) THINKS of saying "put on shelves the books." Yes, PROGRAMMING, contrary to CODING, requires that the PROGRAM, not the code, IS READABLE. ie. WRITTEN IN ENGLISH.
Fine, you are more than welcome to express this opinion, though I completely disagree, please identify WHICH parameters of Motorola's architecture you find less satisfactory than in the Intel design....surely not the plentiful REGISTERS, all general purpose, without any segment nonsense--a completely FLAT architecture from day 1 (since 1979). There is nothing wrong with making absolute pronouncements, I scarcely submit any response to this forum without engaging in such activity. But then, one needs to back it up.
So, if you genuinely believe that Intel has designed a cpu with characteristics SUPERIOR to those of Motorola, please teach me, EVEN ONE advantage. For I know of NONE.
|07 Apr 2006, 22:10||
tom tobias: english, as every language, is very unexact. Being unexact allows simpler use and easier understanding - like you don't always have to say "guy who i met last week", you say it once and later use "he" - it's called context. Using context isn't exact - you can't always say tell the context: "I met guy with long beard and another guy with FASM t-shirt, and he told me...". (this was just an example how language is enaxt, don't continue with contexts please, just an example)
Programming must be always exact. Using unexact language to form exact programming language is STUUUUPIIIID.
|07 Apr 2006, 23:45||
I have always lived with the knowledge that Intel ASM and C are logical and others that contradict are, well, illogical sorry
Its the way one has accustomed. If you have programmed Motorola all your life, then it won't come to you as logical as, for example, to me...
int x; int y=5; x=y*y-14; ;AND... mov eax,0 mov ebx,5 imul ebx,ebx lea eax,[ebx-14]
I posted some time ago the subtraction example, which I find rather funny, because you usually subtract "one" from "the other" like
so sub eax,ebx most logically means eax=eax-ebx
In case it were the other way around: the x=5-4 => x=-1
It gets more complicated in assembly world, because
sub eax,ebx means that you must take the EBX, subtract EAX and
finally put the result back to EBX. I really don't like jumping around
like this. Maybe others find it logical, but just not for me
PS. Why does the Polish Notation have the prefix REVERSE Think about it
Though it has little to do with our topic - that is interesting...
|08 Apr 2006, 09:35||
To most of the people in the world English is not their native language, so such a statement is not valid. Just because somethin is written in English does not automatically make it readable.
tom tobias wrote:
... requires that the PROGRAM, not the code, IS READABLE. ie. WRITTEN IN ENGLISH.
CPU's are mathematical devices and so it is only fair to expect that software languages which are based "close" to the CPU will be heavily mathematically based. More abstracted software languages, like COBOL, can start to look more like English. But using English is not the only way to do things. The world is a big place and many people have different ideas and thought processes. Ask a mathematician to explain the latest quantum theories in English and he/she will most likely tell you to go away and not come back until to can ask for something more sensible.
|08 Apr 2006, 13:59||
You know, I'm getting tired of your Code vs Program nonsense. I don't recall programming has anything to do with your sayings. Programming!=English, because you ARE NOT programming for a device which understands our STUPID languages. And this english is not even readable (in code) by MOST of us (even for native english-speakers). It uses it's own low-level language (circuits, etc.). And besides, a program is comments + code. That's the PROGRAM you are telling of. So, YOU CANNOT have readable code, you have readable comments in english. Just to remind you that a PROGRAM includes CODE. It's other subset are COMMENTS. So, you cannot HAVE a program WITHOUT CODE. When you want readability, stop being lazy and write some comments!
tom tobias wrote:
Maybe code, but not PROGRAMS. The main reason for demanding SOURCE, then destination is to REPUDIATE code, and SUPPORT programming.
Logically, we FIRST specify the destination register (it's much more logical to say x=5 than to say 5=x) and then the source. I don't really care what you call logical, but it is NOT true, and your words will not change anything
tom tobias wrote:
Logically, we FIRST specify WHAT we are going to move, THEN explain WHERE we will put the item.
So? Who said English is used internally inside computer chips? You?
tom tobias wrote:
No one, at least not in the English language, THINKS of saying "put on shelves the books."
Honestly Tom, when will you realize Asm is a low-level language, which DOES NOT abstract you from the computer's workings. High-level languages like COBOL implement an 'english-style', but that's why they are abstracted. Go choose them if you like this 'abstraction' and STUPID-human-thinking nonsense. And that's what are comments for, by the way (just to make 'code' more readable).
And besides, I didn't realize you really think in english when you program in assembly, until now. Seriously, a HLL will be a very smart move for those like you. Why don't YOU build up a computer chip with ENGLISH, if you are so great and say you own the greatest knowledge (that's it, english).
Okay tom, what if all of a sudden, english IS NOT used anymore for programming languages. What will you do? Well, you'll start to blame them for such an action, but why? Just because YOU are limited to the english language doesn't mean it is the SUPREME KNOWLEDGE and is readable for anyone else in programs (even for those native-english speakers). I don't care if you find it readable. I find other things readable. YOU program in your way, I in mine. You know english -- that's why you want everything to be done in it. If english is not used somewhere, you're lost. That's why you like it so much, 'cause you know it. Well, I remind you, you are not our supreme god who is the PERFECT being in his stupid knowledge (that's it, our human-languages are all stupid from the CPU's point of view).
And besides, assembly language is not abstracted. It's for those of us who like intellectual or low-level logical things, or simply for those of us who want no abstraction between them and the computer (that is, english is an abstraction of how the computer works, got it?). And since assembly doesn't imply high-level abstractions, you won't find english in it, because english (or any other human language) is just our STUPID way of communication.
Me: Let's use the XX language. It's the simplest to learn, etc..
You: Why? English, even with flaws and abstractions, is the language *I* know, thus we should use it, else I will not understand the PROGRAM. Thus, everything I don't know is simply ILLOGICAL.
translation: You guys just shut the fuck up! I'm the target and I'm the one who is going to execute your 'junk'. Just choose *MY* language, that is, bytes and bits, or circuits. I don't want your 'languages' nonsense, I just want to be able to execute something easy in MY language! Just like *YOU* want to be able to read it easily in YOUR language.
That's asm, which also implies a few low-level abstractions, since you don't write it in bytes If you don't like such low-level things, go away and choose higher-level abstractions, or don't even bother criticizing what others like and find logical.
First and foremost, I'm not going to give examples to you. Know why? because it proves no good. You will never change, especially not from my examples, so what's the point to give you an example? If I start to give them out, you'll probably say that I'm babblering and my motives are not 'readable' or somesuch. And besides, "It's better to tell the crazy guy he is right, no matter what his statements are, but every wise man will notice that the crazy guy's words won't change anything at all, so what's the point to contradict him? Just to anger him even more? Just say "You are Right" and that's all".
tom tobias wrote:
Please identify WHICH parameters of Motorola's architecture you find less satisfactory than in the Intel design....surely not the plentiful REGISTERS, all general purpose, without any segment nonsense--a completely FLAT architecture from day 1 (since 1979).
To make it even more clear, suppose I say (please, it's just an example): "There is an advantage of 1 bit" that means the segments can save 1 bit in some areas. See? There would have been an advantage, but I bet you would start to comment "Who cares about 1 bit". So you see, there's actually NO POINT in explaining you the advantages (and disadvantages) of it. There's no point, figure it out yourself why.
Secondly, just because you like FLAT doesn't mean it is better. I am certainly in a middle position, and don't criticize the segments because they are not necessary stupid. In some circumstances, they can indeed save off memory (oh, I forgot you are the 'brute-force' solution guy who wastes memory like a fat-sponge rather than an intellectual being). And they can also arrange your programs in entities. Then again, just because you DON'T like them doesn't mean they are crap. Maybe from your perspective... oh, it's sad you didn't create the world, tom. isn't it? I bet you would have employed english instead of atoms, or instead of "the laws of physics" there would be "the laws of english words", etc..
I concluded you don't like Intel's architecture. Okay, fine, I don't like Motorola either (it's more abstracted!), but that doesn't make Motorola's cpu's crap. Neither does it make Intel's crap. Maybe only if segments were absolutely useless in ALL circumstances, there would be no real use for them, but since (in my silly example) they can save 1 bit, that makes a difference between them and FLAT (okay, that example I wrote is JUST AN EXAMPLE, please don't reply to it and say it's not even true). If you don't like Intel and start to criticize their design/architecture (because you are obviously consumptive), skip it and go to Motorola or anything other thing you like (I strongly advise you to use HLLs, and forget about low-level logic). But your false words of saying x86 is illogical, unreadable won't change anything. That doesn't even imply that it is illogical, just in YOUR limited mind. That doesn't mean everyone must find it logical, that's why there are different things in all our life (different languages/syntaxes/preferences/cpus/everything).
Do you play chess? Well I enjoy playing it with my friends sometimes, because it's an intellectual game. It has no advantage over me -- no profit ($$$). It has no advantage over other things I could do with my time (like sleeping or lazyness), or every other limited-minded game. But for me, it is enjoyable. Why? Because we, humans, are intellectual beings. And as such, we (well, only some of us) are not savages who choose brute force solutions and waste everything just to make it easier for them. Profit and advantage ARE NOT the only things to look for in life, because we are gifted with intellectual thoughts. If I would tell you to do something and think for a better solution for an algorithm (i.e a torture for YOU because it's not the beloved english, but something I enjoy for ME), you would tell me: "Why?"
What's that why? Oh, I get it. You want profit/advantage. We assume the optimizations applied to the algorithm are not really profitable. So indeed why would you do it? Since you are savage and care only for your profit and advantage (you ignore the fact that we are not just "smart animals"), why would you do it? If I would give you a lot of profit $$$$, will you choose? I think so.
If you would have asked me for it, I would response (of course, if I had time for it): "Sure, why not. I like to think because it's a gift, and I don't care if it hasn't got any profit/advantage. That's what animal-limited-evolution capitalism we live in is all about, really, just profit. But I do NOT choose it, I use my gifts and understand that I am not a savage who looks only for his own good (i.e his advantages/profit), and don't choose brute-force solutions (EVEN if they give me a lot of profit than the intellectual-solutions).
After all, animals look only for their own good, because that's what they are -- animals. You should realize we are not only "smart animals"... And assembly (at least in my opinion) is like the language for those intellectual-oriented guys. You usually have higher profits in HLLs (but, IMHO, the cpu will 'suffer', just like animal hunters, they don't care if the prey suffers, as long as they have food to eat, thus profit).
I'm getting bored of explaining you this stuff, and honestly I know you will most probably ignore my post, so that's why I didn't give examples when you asked for them -- there's no point in it. I see Bogdan's point here, and I'm not going to explain it further so YOU can understand (if you can't figure it out yet). You are the kind of person who NEVER wants to believe what others say, if they contradict your opinions. So what? Your false words will not change anything at all. Go figure
happy hunting for english. if it will disappear, oh man, you will certainly blame someone for it, because how on earth will you then be able to understand something such illogical, since you don't know anything else except this imperfect language? "What??" will you say.. "That nonsense and illogical xxx language that replaced english..." will you complain. no problem, i figured your motives. the cpu is not english, physics is not english, math is NOT english. so you don't use english to code for the cpu! finished
Well, I see you really enjoy criticizing and explaining your "code vs program" nonsense. how many times are you going to say it, I wonder. we'll wait and see
|11 Apr 2006, 19:21||
just wanna say something,
would make EAX contained value 5
would also make EAX contained value 5
then, both of them are logic. (imho) as long as they produce intended result.
to specify (source,dest) or (dest,source) is just a matter of preference.
and the computer just cares bout binary 0 and 1. not A to Z.
|11 Apr 2006, 20:50||
A little history ,
When I was using my amiga int he late 80's with the motorola 680x0 processor, using the AT&T syntax came just as natural to me then as the intel syntax does to me now. I don't think one is worse than the other, one had it's time and was dominant in consoles(sega Genesis) and computer systems (Commodore Amiga , Apple Macintosh's, Atari ST, and others). In the 90's, Apple switched to the PowerPC (The whole instuction set changed, and also went to a RISC instead of a CISC architecture), and Commodore went belly up, Atari lost it's way, consoles moved on to other processors, and Intel was the only one there to fill the void for personal computer's (PC's). So point being, AT&T syntax is not bad. Linux's odd assembly syntax seems to be more for the gcc compilers benefit and not the programmers. Which would explain why some people have a hard time coding in assembly for this platform
|14 Apr 2006, 20:12||
A little history ,
now that i know the sega genesis was on an AT&T architecture i respect AT&T alot more , the sega genesis was like the only present i wanted when i was 4 years old and i got it for christmas and all my friends were jealous, mortal kombat and sonic were the best games, oh the memories ^
|14 Apr 2006, 20:55||
|Goto page Previous 1, 2
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar.
Powered by rwasa.