LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-27-2004, 07:47 PM   #1
chutsu
Member
 
Registered: Nov 2003
Location: UK
Distribution: Debian Lenny
Posts: 255

Rep: Reputation: 31
Ok I'm getting really confused about Assembly


Ok I'm getting really confused about Assembly

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
 
Old 10-27-2004, 08:32 PM   #2
spuzzzzzzz
Member
 
Registered: Sep 2003
Location: Australia
Distribution: Gentoo
Posts: 465

Rep: Reputation: 30
Quote:
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.
 
Old 10-27-2004, 09:59 PM   #3
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
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.
 
Old 10-28-2004, 04:09 AM   #4
chutsu
Member
 
Registered: Nov 2003
Location: UK
Distribution: Debian Lenny
Posts: 255

Original Poster
Rep: Reputation: 31
Is it hard to learn Both??
Whats the difference between Window assembly and linux assembly??
Chris
 
Old 10-28-2004, 04:28 AM   #5
deveraux83
Member
 
Registered: Jul 2003
Location: Malaysia
Distribution: Red Hat, Slackware 9.1
Posts: 76

Rep: Reputation: 15
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.
 
Old 10-28-2004, 12:09 PM   #6
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
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.
 
Old 10-28-2004, 08:13 PM   #7
chutsu
Member
 
Registered: Nov 2003
Location: UK
Distribution: Debian Lenny
Posts: 255

Original Poster
Rep: Reputation: 31
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??
 
Old 10-28-2004, 09:34 PM   #8
spuzzzzzzz
Member
 
Registered: Sep 2003
Location: Australia
Distribution: Gentoo
Posts: 465

Rep: Reputation: 30
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.
 
Old 10-28-2004, 10:06 PM   #9
95se
Member
 
Registered: Apr 2002
Location: Windsor, ON, CA
Distribution: Ubuntu
Posts: 740

Rep: Reputation: 32
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)

Last edited by 95se; 10-28-2004 at 10:10 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
assembly ? blackzone Programming 3 10-15-2004 02:36 AM
Assembly jinksys Programming 3 09-14-2003 04:33 PM
I need help for Assembly skb Programming 10 08-01-2003 04:51 PM
assembly genghis Programming 2 06-12-2003 07:46 AM
assembly sanjay pradhan Programming 1 02-01-2002 10:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration