Click here to Skip to main content
15,860,943 members
Articles / Programming Languages / ASM

Why Learn Assembly Language?

Rate me:
Please Sign up or sign in to vote.
4.69/5 (22 votes)
28 Jun 2010CPOL4 min read 213.7K   29   31
An article explaining the benefits of learning assembly language

Introduction

REVISION 2

"Assembly language? Isn't that the hard to read instructions on how to assemble your brand new computer desk?"...

No..

What is Assembly Language?

x86 Assembly is a programming language for the x86 class of processors (specifically the 32bit x86 processors IA-32 - http://en.wikipedia.org/wiki/IA-32). The instruction set defined by the IA-32 architecture is targeted towards the family of microprocessors installed in the vast majority of personal computers on the planet. Assembly language is machine specific and considered a "low level" language. This means that the code and syntax is much closer to the computer's processor, memory, and I/O system. A high level language is designed with keywords, libraries, and a syntax that introduces a high level of abstraction between the language and the hardware.

Background

I thought assembly was a dead language, why waste the time?

Though it's true, you probably won't find yourself writing your next customer's app in assembly, there is still much to gain from learning assembly. Today, assembly language is used primarily for direct hardware manipulation, access to specialized processor instructions, or to address critical performance issues. Typical uses are device drivers, low-level embedded systems, and real-time systems (EDIT:Thanks Trollslayer). The fact of the matter is, the more complex high level languages become, and the more ADT (abstract data types) that are written, the more overhead is incurred to support these options. In the instances of .NET, perhaps bloated MSIL. Imagine if you knew MSIL. This is where assembly language shines. (EDIT)Assembly language is as close to the processor as you can get as a programmer so a well designed algorithm is blazing -- assembly is great for speed optimization. It's all about performance and efficiency. Assembly language gives you complete control over the system's resources. Much like an assembly line, you write code to push single values into registers, deal with memory addresses directly to retrieve values or pointers. To write in assembly is to understand exactly how the processor and memory work together to "make things happen". Be warned, assembly language is cryptic, and the applications source code size is much much larger than that of a high-level language. But make no mistake about it, if you are willing to put in the time and the effort to master assembly, you will get better, and you will become a stand out in the field.

So why should you care?

Points of Interest

Wirth's Law

I remember dialling into a BBS on my 486 with my brand new 2400bps modem. Fast-forward 14 years and now we are only limited by our imagination. With all of these amazing technological breakthroughs, there is a glaring anomaly; a paradox. This is referred to as Wirth's law. Wirth's law states that software is getting slower more rapidly than hardware becomes faster. There's no one reason why this is the case, but I'd like to think that the further we as developers drift away from the lower level details of software development, we write less than stellar (inefficient code). Hold the phone! I'm not calling anyone stupid. It's just that these new languages and supercharged processors have abstracted us so far from the machine, that we no longer have to be concerned with things like garbage collection, variable initialization, memory address pointers, etc. All of these features and more are now standard in today's languages/runtimes/IDEs. The result is a new breed of developers that rely on superior hardware power for performance rather than striving to write concise, cohesive, efficient code.

My Eyes are Open!

I realize now that learning assembly language will teach me about the inner workings of the computer. I'll learn how the CPU/CPU registers work with memory addresses to achieve the end result one instruction at a time. This doesn't mean that I'm going to begin coding everything in assembly, however, I will learn which data types to use and when. I'll learn how to write smaller, faster, more efficient routines. I will understand software development at a level that most of my peers don't. I'm even opening up to the possibility of looking into writing my own compiler.

So if you are serious about getting a leg up on the competition in your field, I'd recommend trying to learn assembly language.

Resources on Learning Assembly

Introduction to x86 Assembly Language

History

I plan to update this blog with links to tutorials/articles/books/sample source code.

Well, as always,
Thanks for reading.
Buddy B.

http://www.twitter.com/budbjames
http://www.bytepushers.com

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer bytepushers.com
United States United States
I'm a 28 year old software engineer from Tennessee. I've been programming since I was 13 years old. I'm fortunate enough to be able to do what I love for a living.

VB.NET, ASP.NET, C#, assembly, HTML, JavaScript, AJAX

I'm MCP, MCAD, MCSD.NET certified.

follow me on twitter

http://www.twitter.com/budbjames

Comments and Discussions

 
QuestionAssembly Language for a Beginner Pin
Mur25017-Apr-16 5:29
Mur25017-Apr-16 5:29 
QuestionWhy Learn Assembly Language? Pin
Tasos Kipriotis20-Feb-16 8:29
Tasos Kipriotis20-Feb-16 8:29 
QuestionSecurity Reasons Pin
Lee Wang Hao1-Nov-14 3:56
Lee Wang Hao1-Nov-14 3:56 
SuggestionOnline video course for x86 assembly Pin
Member 111387798-Oct-14 7:24
Member 111387798-Oct-14 7:24 
QuestionMy vote of 5 Pin
Josef Manurung30-Dec-11 6:00
Josef Manurung30-Dec-11 6:00 
QuestionAssembly language. Pin
nigel wright3-Oct-11 11:10
nigel wright3-Oct-11 11:10 
GeneralFew Queries Pin
popchecker13-Sep-10 15:48
popchecker13-Sep-10 15:48 
GeneralRe: Few Queries Pin
buddy.james23-Sep-10 21:20
buddy.james23-Sep-10 21:20 
GeneralFor a different take on the pros & cons of asm over other languages. Pin
Euhemerus7-Jul-10 9:24
Euhemerus7-Jul-10 9:24 
GeneralRe: For a different take on the pros & cons of asm over other languages. Pin
bjames027-Jul-10 18:25
bjames027-Jul-10 18:25 
GeneralMy vote of 3 Pin
Bit_flipper1-Jul-10 18:05
Bit_flipper1-Jul-10 18:05 
GeneralPE File Format Pin
mnjrupp29-Jun-10 4:50
mnjrupp29-Jun-10 4:50 
GeneralOveral cost Pin
Daniel Joubert29-Jun-10 3:58
professionalDaniel Joubert29-Jun-10 3:58 
GeneralRe: Overal cost Pin
bjames0229-Jun-10 4:43
bjames0229-Jun-10 4:43 
GeneralRe: Overal cost Pin
supercat929-Jun-10 5:17
supercat929-Jun-10 5:17 
GeneralRe: Overal cost Pin
Daniel Joubert29-Jun-10 22:02
professionalDaniel Joubert29-Jun-10 22:02 
GeneralRe: Overal cost Pin
bjames0230-Jun-10 5:32
bjames0230-Jun-10 5:32 
GeneralRe: Overal cost Pin
supercat930-Jun-10 5:36
supercat930-Jun-10 5:36 
GeneralRe: Overal cost Pin
ke4vtw20-Jul-10 5:00
ke4vtw20-Jul-10 5:00 
I had a similar experience in the early 90's. I was working on an application that searched a text file for specific patterns using wildcards (standard DOS style '*' and '?' replacements). Due to the nature of the application, I had to have an execution time of less than a second. Borland's Pascal, as good as it was, couldn't do the wildcard searches in time. A simple replacement of the core search functionality with a small assembler routine reduced the execution time to less than 1/3 of a second.

I certainly don't advocate writing huge sections of critical business systems in assembler, but there are times and situations where it's definitely an advantage to be able to drop to that level.
Generalassambly Pin
Adrabi Abderrahim25-Jun-10 15:28
Adrabi Abderrahim25-Jun-10 15:28 
GeneralRe: assambly Pin
bjames0225-Jun-10 18:08
bjames0225-Jun-10 18:08 
GeneralTrue worth of knowleged gained from learning Pin
w3bdev25-Jun-10 5:48
w3bdev25-Jun-10 5:48 
GeneralWaiting for examples and tutorials Pin
JoseMenendez25-Jun-10 5:39
JoseMenendez25-Jun-10 5:39 
GeneralRe: Waiting for examples and tutorials Pin
bjames0225-Jun-10 5:43
bjames0225-Jun-10 5:43 
GeneralRe: Waiting for examples and tutorials Pin
vizEQ28-Jun-10 14:09
vizEQ28-Jun-10 14:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.