ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Let me get this right, each assembly is different once you use different hardware like PPC, x86 then the two assembly language would be different, right?? but by how much??
does it really matter that much??
I mean can't I use Assembly in PPC and x86 by just correcting a few code??
Chris
I mean can't I use Assembly in PPC and x86 by just correcting a few code??
Correct. The x86 and PPC architectures are very different. Translating assembly between them would take lots of work. If you wanted to translate between similar architectures, though, like x86 and x86_64 then it wouldn't be so hard.
If you want portable code, use a higher-level language.
You gotta keep in mind that when you program in assembly, you are giving fairly direct instructions to the CPU. Most CPUs operate in the same basic way, but different architectures (like PPC and x86) are often quite different in the kind of instructions they can receive. The Wikipedia article on assembly language gives a pretty good explanation of why it isn't portable.
Well, I haven't attempted coding in assembly for a long time. But from what I remember, Windows ASM is generally based on issuing interruptions for the various operations. Linux ASM however only allows the kernel interrupt to be intercepted, all others are ignored. So basically, the way they fundamentally function is different. I don't believe that that is the only difference but it was enough to put me off ASM completely and just use higher-level languages and just hand optimize if necessary.
And like I said I haven't coded in ASM for a very long time, so what I said could be wrong, so if it is, please feel free to correct me.
I've not done much assembly in Windows, and none in Linux, but I am fairly sure the basic concepts and instructions are the same in Windows or Linux (assuming, of course, that your Linux is running on an x86 machine). You may want to check out linuxassembly.org for some more clues.
The question you should first be asking yourself is "Why do I want to learn assembly language?" Unless you have a particular reason to learn it, it may not be the right language for you. If you're just curious about it (as I am), you're less likely to devote the time required to learning it. The question you especially should answer is "Why do I want to learn assembly language for two different architectures?" If you are really interested in it, I would suggest becoming familiar with assembly in one architecture first (probably the one you use most often); learn the basics, and see if it is something of interest to you. That may give you a better idea of why it's not portable between architectures. As mentioned, if you are more interested in portability, then C, C++, Python, Java, or one of the many other available high-level languages would be a better way to start out.
Thanks.....Well I'm just really curious about Low-level computer language, since I know most of C and a bit on Python, I wanted to know exactly whats going on in the computer by learning a low level programming language such as Assembly. I'm also thinking of buying a new computer as well, I currently use a x86 laptop, but would love to buy a powerbook, but I'm telling myself to wait till christmas as Apple might release their New G5 powerbooks (at least thats what I think)
anyway is there like a basic concept of Assembly that they all share, and then they start to specify with different arch??
In the sense that all modern architectures are register load-store archtectures, yes, the basic concepts of assembly are shared between architectures. The implementation and the details, however, vary widely.
http://www.planetpdf.com/developer/a...ContentID=6633
I have made it through the first coupel hundred pages, it's really interesting stuff, and made my Micro Architecture I course a breeze. (It helped that I printed out a hard copy version at office depot for $7 too)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.