Go Back   The UNIX and Linux Forums > The Lounge > What's on Your Mind?


What's on Your Mind? Come inside and relax a while. Discuss whatever is on your mind. However, technical Q&A should happen in our other forums.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-22-2012
Registered User
 
Join Date: Jun 2012
Posts: 3
Thanks: 3
Thanked 0 Times in 0 Posts
Tools Can assembly language be dispensed with ?

Hi. I learned C in high school and am proficient in it. At the college while learning microcontrollers there was a short course on assembly language which I skipped but had no trouble as most of the application programming had to be done in C. Should I go back n learn assembly language as I have heard it gives good insight into the hardware? Is it at of any (significant) use in embedded systems?
Sponsored Links
    #2  
Old 06-22-2012
Mead Rotor
 
Join Date: Aug 2005
Location: Saskatchewan
Posts: 16,407
Thanks: 492
Thanked 2,538 Times in 2,421 Posts
Embedded systems are often restricted and picky. There will definitely be things which can't be done in pure C, only assembler -- system-specific things and the like. (you can often do inline assembler in C to avoid having to make large sections of it, though).

Learning how to program them in assembler would help to explain what the system limits mean to C.
The Following User Says Thank You to Corona688 For This Useful Post:
priyadarshianu (06-23-2012)
Sponsored Links
    #3  
Old 06-22-2012
kduffin's Avatar
kduffin kduffin is offline Forum Advisor  
UN1X
 
Join Date: Nov 2003
Location: Belize
Posts: 484
Thanks: 0
Thanked 3 Times in 2 Posts
The real advantage to learning assembly language is a low-level understanding of pointers and memory handling. You'll have a better understanding of the real operation and cost versus someone who has not. I really enjoyed my foray into assembler and still revisit it on occasion. A simple internet search of 'assembler emulator linux tutorial' will provide of wealth of suggestions for your iteration over a set of integers... The world is filled with average developers; it pays to stretch yourself.
The Following 2 Users Say Thank You to kduffin For This Useful Post:
figaro (06-24-2012), priyadarshianu (06-23-2012)
    #4  
Old 06-23-2012
elixir_sinari's Avatar
Gotham Knight
 
Join Date: Mar 2012
Location: India
Posts: 1,372
Thanks: 87
Thanked 478 Times in 458 Posts
Quote:
Originally Posted by kduffin View Post
The world is filled with average developers; it pays to stretch yourself.
Sponsored Links
    #5  
Old 06-23-2012
Registered User
 
Join Date: Jun 2012
Posts: 3
Thanks: 3
Thanked 0 Times in 0 Posts
got it. need to grab my gear n fall in
Sponsored Links
    #6  
Old 06-24-2012
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 3,303
Thanks: 27
Thanked 459 Times in 358 Posts
I started my career back in the late seventies and on IBM mainframes there was either COBOL or assembler - with the 2.5 KB real memory my first system (already outdated at that time) had the choice was quite clear: learn assembler and every dirty trick there was to save some bits here, some cycles there ....

Later, in the eighties, i wrote software for DSPs and embedded systems, mainly the DSPs of Analog Devices and the Motorola 56k-series. Again, it was assembler to the fullest extent: when you write the internal software for a telephone switchboard and the company wants to sell a few millions the only thing that counts is: how many cycles did you use for that task? The lower cycles, the lower the clock rates could be, which means you can buy lower graded CPUs, which cost exponentially less which means a BIG difference in customer price. If you could save one arithmetic unit or one register, the custom-built processors could be built without these parts which made them cheaper too.

We used to beat optimizing compilers by a very large margin. OK, we couldn't decipher our own code three months after "tape-out" (the tasks got simulated on an ICE and finally the tape with the processor specification was sent to the provider of the DSPs to be built on order), but it was expected to write the next version from scratch anyway.

One of my first jobs on a PC was to write a DOS device driver for a specialized file system for the real-time storage of acoustic data. This was the time of MFM-disks and the data rate for a usual 16-bit sampling in stereo frequency (44.1 kHz) is just a tad below the bandwidth of the ST-506 interface. My driver had to use every ounce of bandwidth it could get just keep up. Mind you, we had one of the brand-new hot 16 MHz NEAT 286, an extremely fast system!

Sure, these are extremes. But ones uses assembly language for the same reason we used to use assembly throughout computing history: for its unparalleled speed and for the sheer control it gives you over the system and its hardware. C is a language nicely suited for rapid prototyping, but i'm still quite confident to be able to beat any C-compiler in terms of speed of execution with hand-crafted assembler code. Even with all those nifty optimizations switched on.

This is nothing to say against C - in fact i like C. But to really understand what C is about you have to have experienced the problems solved/avoided by its use. You have to have been at the very bottom at least once to appreciate being on top. And, who knows, you might even start to like being at the source of things.

bakunin
The Following 2 Users Say Thank You to bakunin For This Useful Post:
Corona688 (06-26-2012), priyadarshianu (06-27-2012)
Sponsored Links
    #7  
Old 06-25-2012
Registered User
 
Join Date: Jun 2012
Posts: 3
Thanks: 3
Thanked 0 Times in 0 Posts
invaluable...
Sponsored Links
Closed Thread

Tags
assembly language, embedded system, microcontroller

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Assembly 8085 giampoul Programming 9 05-24-2012 04:58 AM
Why Assembly Language? gabam Programming 9 12-08-2011 01:06 PM
Help with assembly code Learnerabc Programming 2 09-24-2010 10:41 AM
Assembly Language ( compile ) Learnerabc Programming 3 09-23-2010 11:17 PM
Unix assembly help ac09 Shell Programming and Scripting 1 05-09-2009 07:05 PM



All times are GMT -4. The time now is 11:25 PM.