![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4
![]() |
Does assembly language vary per machine?
If I was to learn assembly for an intel 8086 processesor would it be different than learning it for a Motorola 69HC11? Or is assembly language generally the same overall?
Thanks |
|
|
|
|
|
#2 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
It would be different. Unfortunately, there's no standard for Assembly.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
|
|
#3 |
|
Professional Programmer
|
it differs per processor, not just per processor type. even though some are backwards compatible, you can't always count on it.
|
|
|
|
|
|
#4 |
|
Programmer
|
The reason it differs, is not all processors have the same instructions.
Like, for example: PPC processors have many more complex instructions than x86, which is one of the reasons proper code on PPC runs faster than proper code on x86, even with the same Hz. Also, 32bit processors have different registers than their 16bit precessors, not to mention different instructions for handling different sizes of data. (ie. movl, movb) I haven't worked with 64bit processors, but I bet they treat data in bigger sizes as well. But yes, 80386 instructions work even on 80686 P4's. So there is some backwards compatibility. But that's what compilers are for! The compiler knows how to translate your code into assembly for a certain proc, and then it just assembles from there. So if you're doing assembly, you're usually doing it to learn, to optimize, or just for fun. So just go learn x86 or PPC and have fun!
__________________
/* LANCE */ C++; /* this makes C bigger but returns the old value */ char *site = "slackwise.net", *home = "lance.slackwise.net", *pics = "flickr.com/photos/slackwise"; Last edited by Lance; Jan 16th, 2005 at 1:14 PM. Reason: Spelling corrections. |
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4
![]() |
how much does it differ by? it it like learning assembly all over again from the assumption that one already knows C++?
|
|
|
|
|
|
#6 |
|
Programmer
|
Oh, no way!
Most concepts transfer from processor to processor. It's just the names of the instructions, and some quirks. It's not like you have to learn all the programming all over again. You just need to adapt to a different instruction set (or possibly even syntax). It's not as hard as it seems, but it can be frustrating. I'd say, work your way down from popular architectures (i.e. x86/PPC) to Alpha/ARM, etc. I suggest you have a strong understanding of C, and how operating systems really work, before you attempt to code Assembly. You have to understand how system calls work, and how the kernel works... How memory is arranged... It's stuff you actually learn as you progress thrugh your C studies. Unix is open enough for you to see every part of it, especially Linux. What I'm trying to say is, Unix has the proper abstrations that give you the mindset of a programmer, since it is absolutely based around C. So if you know C, you will understand Unix. It's really that simple. ![]() Also, C++ is a terrible start to move from to Assembly. Assembly is pure procedural, so not understanding C and it's fundamental memory management system will cripple you in the long run. :/ But don't take my word for it. If you're motivated enough, you can probably learn anytime, from any point, without any knowledge. I"m just talking from my personal experience with it.
__________________
/* LANCE */ C++; /* this makes C bigger but returns the old value */ char *site = "slackwise.net", *home = "lance.slackwise.net", *pics = "flickr.com/photos/slackwise"; |
|
|
|
|
|
#7 |
|
Hobbyist Programmer
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4
![]() |
Thanks
How about learning Assembly for 80x86 vs for Motorolla 68HC11? From what I read so far the syntax seems a lot different. |
|
|
|
|
|
#8 |
|
Programmer
|
Yes, because x86 uses either AT&T or Intel syntax. I don't even know what Motorola has concocted. (I wish had my OSX spellchecker...) But yes, syntax can differ. The programming mindset remains the same.
(For the most part...)Either way, you won't understand until you try. So go start learning. Now! Don't waste time thinking about differences, just get your hands dirty. Start fscking around and learn what you can. Then you can compare the two. ![]() Off subject; I find that the more time you spend thinking, the less you end up doing. Thinking leads to discouragement. Especially if it's a daunting project. Booze helps you forget about all that. Granted... you swear at every little mistake... you still end up more productive! At least I do...
__________________
/* LANCE */ C++; /* this makes C bigger but returns the old value */ char *site = "slackwise.net", *home = "lance.slackwise.net", *pics = "flickr.com/photos/slackwise"; |
|
|
|
|
|
#9 |
|
Hobbyist Programmer
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4
![]() |
Thanks...
I started to learn Assembly for the x86 on my own, but then I realized that one of my classes was covering or is going to cover the Motorolla. Just wanted to make sure that I didnt buy a book for nothing. |
|
|
|
|
|
#10 |
|
Programmer
|
lol, understood. I'd hate to spend any more money on books... I lost $600 this term.
![]() Well, I hope you have fun coding for Motorola procs. ![]()
__________________
/* LANCE */ C++; /* this makes C bigger but returns the old value */ char *site = "slackwise.net", *home = "lance.slackwise.net", *pics = "flickr.com/photos/slackwise"; |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|