LinuxQuestions.org
Help answer threads with 0 replies.
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 11-17-2008, 11:45 AM   #1
mannclay
Member
 
Registered: Nov 2007
Location: Brooklyn, NY
Distribution: eeeMint
Posts: 52

Rep: Reputation: 15
x 86 assembly programming


I have an opportunity to take an assembly programming class and wanted to read opinions about its future use among all these "powerful" high levels languages. (I'm clear that assembly is not one language)

I'm new to programming. Been playing with C and Python for 2 months.

Does anyone do work in assembly exclusively, possibly mixed in with C?

Would anyone recommend learning assembly??

Last edited by mannclay; 11-17-2008 at 12:09 PM.
 
Old 11-17-2008, 01:03 PM   #2
penguiniator
Member
 
Registered: Feb 2004
Location: Olympia, WA
Distribution: SolydK
Posts: 442
Blog Entries: 3

Rep: Reputation: 60
Learning assembly will teach you about the registers specific to x86 processors and the operations built-in to the processor. If nothing else, it will give you a different perspective on higher-level languages and an appreciation of language features such as loops and branching statements. If you intend to work in assembler on Linux consider reading http://www.faqs.org/docs/Linux-HOWTO...bly-HOWTO.html.
 
Old 11-17-2008, 01:38 PM   #3
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by mannclay View Post
Does anyone do work in assembly exclusively, possibly mixed in with C?

Would anyone recommend learning assembly??
I had many years of coding primarily in assembly. In recent years I have done near zero (not quite zero) assembly coding. I'm sure there are still a few people who work exclusively in assembly, but very few, especially few for desktop and larger systems (as opposed to embedded).

However, I still use my knowledge of assembly almost every day while working with C++.

1) Debugging: There are lots of flaws in all the debuggers I have available and even more flaws when I must debug optimized code (which for various reasons is fairly often). I always debug with one window on the source code and one on the assembly. That way I always know whether any strange behavior I see is really in the program being debugged or is in the operation of the debugger.

2) Understanding obscure bugs: I work with heavily templated, very complicated code. Some of the bugs are too tricky to ever understand looking at just the C++ source code and the results (even single stepped intermediate value results in a debugger). I only really understand what is happening when I step through the asm code.
C++ is complicated enough that in those few cases where the bug is in the compiler, not the C++ code, it is almost impossible to figure that out without understanding the asm code generated.

3) Optimizing code: An ordinary C++ programmer has a very hard time predicting or even understanding which constructs in his C++ code will run optimally vs. those that waste CPU time. When performance really matters, you need to have experience looking at the asm code the compiler generates in order to write code that will run fast.
 
Old 11-17-2008, 07:02 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
I learned assembly language for a few different CPUs before I learned C. I think that made me understand what the C language is all about, and learning it felt about as natural as anything I've ever learned in computing. It seems reasonable that you might benefit in the same way. As a productive tool, assembly language will forever be a niche language, in my opinion. There was a day when it was good for writing complete programs, but not any more except for embedded systems on small CPU's and maybe for the odd low-level components in device drivers for bigger machines.
--- rod.
 
Old 11-17-2008, 08:50 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
Whenever a group of hardware engineers sets out to design "an altogether new processor" (which isn't too often, these days...) they spend a lot of time pondering how to design an efficient hardware architecture that will prove itself capable of meeting the demands of modern software without generating too much heat.

Meanwhile... as a software engineer, you simply want "the screen to look exactly the same as it does on a Windows machine, as it does when it is seen on this iPhone."

The assembly-language programmer is where these two points-of-view meet, but only on a single set of hardware.

It is, therefore, extremely useful to have acquired an in-depth knowledge of the hardware of any computer ... x86 or otherwise ... so that you might understand first-hand what sort of "issues" arise when "these two points-of-view meet."

But... "is this 'how it is done, today?'" No. The Linux source distribution has a /arch subdirectory with at least twenty-five entries in it. Nearly all of them are "assembly-language architectures." All of them must somehow be equally supported.
 
Old 11-18-2008, 01:43 AM   #6
resetreset
Senior Member
 
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Rep: Reputation: 62
Quote:
Originally Posted by mannclay View Post
I have an opportunity to take an assembly programming class and wanted to read opinions about its future use among all these "powerful" high levels languages. (I'm clear that assembly is not one language)

I'm new to programming. Been playing with C and Python for 2 months.

Does anyone do work in assembly exclusively, possibly mixed in with C?

Would anyone recommend learning assembly??

Yes, definitely learn assembly - the joy of being on the raw hardware is unparalleled.
 
Old 11-18-2008, 02:30 PM   #7
mannclay
Member
 
Registered: Nov 2007
Location: Brooklyn, NY
Distribution: eeeMint
Posts: 52

Original Poster
Rep: Reputation: 15
This is great!

I thought people might say that assembly is not worth the trouble and useless for work, but I wanted to taste bare metal... Thanks.

the book I will use is "8086/8088, 80286, 80386 and 80486 Assembly Language Programming"
ISBN: 0023142472

Anyone used this book before??

Last edited by mannclay; 11-18-2008 at 02:48 PM.
 
Old 11-18-2008, 03:45 PM   #8
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
I've never used that book, but assembly for the 80386 is a very good start because it's nice and simple - and most of the 32-bit instructions are still used in the latest x86 class of CPUs. Also, the 80386 I think is the first CPU in its family with a virtual memory manager.

When you've had enough fun playing with that, you can pick up the appropriate datasheets for newer classes of x86 CPU and see the new features (too many to remember) and the multimedia instructions. Maybe stick to the latest multimedia instruction sets (SSE2, 3DNow!, - hmm, what's 'MMX' called these days?) Nothing wrong with learning the older 'multimedia extensions' except that it's not of much value unless you're working with a pretty old CPU.
 
  


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 programming advice please nifund9 Programming 8 04-01-2008 06:15 PM
assembly programming Ephracis Programming 5 05-08-2005 02:04 AM
How to start Assembly Programming ? indian Programming 17 04-19-2005 10:51 PM
Assembly Programming Page programmershous Programming 6 07-17-2004 04:17 PM
assembly programming in linux chriscoelphoto Linux - Newbie 2 05-02-2004 05:21 PM

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

All times are GMT -5. The time now is 06:46 PM.

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