Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 15th, 2005, 11:15 AM   #1
Xero
Hobbyist Programmer
 
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4 Xero is on a distinguished road
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
Xero is offline   Reply With Quote
Old Jan 15th, 2005, 11:26 AM   #2
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
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
Mjordan2nd is offline   Reply With Quote
Old Jan 15th, 2005, 11:48 AM   #3
Dizzutch
Professional Programmer
 
Dizzutch's Avatar
 
Join Date: Dec 2004
Location: Worcester, MA
Posts: 441
Rep Power: 4 Dizzutch is on a distinguished road
Send a message via ICQ to Dizzutch Send a message via AIM to Dizzutch Send a message via MSN to Dizzutch Send a message via Yahoo to Dizzutch
it differs per processor, not just per processor type. even though some are backwards compatible, you can't always count on it.
__________________
naked pictures of you | PFO F@H stats
Dizzutch is offline   Reply With Quote
Old Jan 15th, 2005, 3:33 PM   #4
Lance
Programmer
 
Lance's Avatar
 
Join Date: Oct 2004
Location: Chicago, IL USA
Posts: 74
Rep Power: 4 Lance is on a distinguished road
Send a message via AIM to Lance
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.
Lance is offline   Reply With Quote
Old Jan 16th, 2005, 2:34 AM   #5
Xero
Hobbyist Programmer
 
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4 Xero is on a distinguished road
how much does it differ by? it it like learning assembly all over again from the assumption that one already knows C++?
Xero is offline   Reply With Quote
Old Jan 16th, 2005, 1:11 PM   #6
Lance
Programmer
 
Lance's Avatar
 
Join Date: Oct 2004
Location: Chicago, IL USA
Posts: 74
Rep Power: 4 Lance is on a distinguished road
Send a message via AIM to Lance
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";
Lance is offline   Reply With Quote
Old Jan 16th, 2005, 4:15 PM   #7
Xero
Hobbyist Programmer
 
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4 Xero is on a distinguished road
Thanks

How about learning Assembly for 80x86 vs for Motorolla 68HC11? From what I read so far the syntax seems a lot different.
Xero is offline   Reply With Quote
Old Jan 17th, 2005, 2:57 AM   #8
Lance
Programmer
 
Lance's Avatar
 
Join Date: Oct 2004
Location: Chicago, IL USA
Posts: 74
Rep Power: 4 Lance is on a distinguished road
Send a message via AIM to Lance
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";
Lance is offline   Reply With Quote
Old Jan 17th, 2005, 8:50 AM   #9
Xero
Hobbyist Programmer
 
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4 Xero is on a distinguished road
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.
Xero is offline   Reply With Quote
Old Jan 17th, 2005, 11:34 AM   #10
Lance
Programmer
 
Lance's Avatar
 
Join Date: Oct 2004
Location: Chicago, IL USA
Posts: 74
Rep Power: 4 Lance is on a distinguished road
Send a message via AIM to Lance
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";
Lance is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:23 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC