Last updated: February 27, 2020
Assembly Language: How To Learn To Code Assembly Today
Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
An assembly language is an extremely low-level programming language that has a 1-to-1 correspondence to machine code — the series of binary instructions which move values in and out of registers in a CPU (or other microprocessor).
A microprocessor is a mechanical calculator. It has a number of named registers, which are like holding pens for numbers. It receives instructions in the form of machine code, which is represented by a series of binary bits (1s and 0s). For example, here is a line of machine code:
The first few bits (
10110) are an instruction to copy a value into a register. The next three digits (
000) identify the register which the value will be copied into. The rest of it (
01100001) is the value which is to be copied.
10110 is meaningless, and the computer doesn't "know" that it means "copy the value." The processor is designed so that the series of electrical impulses represented by
10110 (on-off-on-on-off) causes the desired result. This is part of what is meant by "mechanical."
Now if you're going to write a program for the processor to execute, you can imagine writing thousands of lines of 1s and 0s would be both tedious and error prone. The solution is assembly language. Assembly language provides human-understandable substitutions for long strings of binary code.
For example, if
10110 means "move the value," then we could abbreviate it with the
We could also give the
000 register a easier to remember name (in this case, the register is named
Finally, we could render the value in a different numbering system, such as decimal (
91) or hexidecimal (
61). That line would then be
MOV AL,61. Once a whole program is written this way, an assembler can easily translate each line into the appropriate binary representation.
Computers do work (perform calculations, move data, transform data), by processing billions of these tiny instructions per second.
Very simple instructions (move this value, copy that value, add these two values together and save the value over there) combine to form complex operations, which combine at higher and higher levels to actually do things you would recognize as meaningful.
Assembly Language Resources
Tutorials and Basic Guides
Assembly Programming Tutorial from Tutorials Point
X86 Assembly Language Programming, another tutorial that places assembly language well in its OS programming context, this one in reference to Linux, Windows, and even a bit about Mac OS X
PC Assembly Language, this focuses on 32-bit PCs running Linux, Windows, or FreeBSD
X86 Assembly Guide, from the University of Virginia Computer Science department
Linux Assembly Tutorial
Assembly Language Programming Tutorial, a very thorough 55-video series on assembly, following the book Assembly Language for x86 Processors (6th Edition) by Kip Irvine (if you aren't following the videos, you'll probably want the more recent edition)
Assembly Language Intro, a class room lecture at Cornell, introducing assembly language
Assembly Language Programming, an hour-long introduction to assembly, and a great format if you really liked following algebra examples on an over-head projector when you were in high school (this is part of a larger series on Microprocessors and Microcontrollers).
X86 instruction listings, full list of all instructions for the x86 architectures, with notes on when each was added
Assemblers — there are a lot of assemblers available — here are a few of the most popular free and open source assemblers:
IDEs (Integrated Development Environments):
SASM, Simple crossplatform IDE for NASM, MASM, GAS, FASM assembly languages
Fresh IDE, visual assembly language IDE with built-in FASM assembler
WinAsm Studio, a free IDE for developing 32-bit Windows and 16-bit DOS programs using the Assembler
Community and Ongoing Learning
The Art of Assembly Language (online edition) is one of the most popular books on assembly language, from always-readable No Starch Press; you might also be interested in these from the same author: Write Great Code: Volume 1: Understanding the Machine and Write Great Code, Volume 2: Thinking Low-Level, Writing High-Level
Should You Learn Assembly Language?
Whether you should learn assembly language depends on what your goals are. For most developers, the answer is "no."
There are two primary reasons to learn assembly language: because you want to use it directly, or because you want to understand computers at a fundamental level.
From a practical standpoint, only a relative handful of the world's engineers and computer scientists actually use assembly language.
The overwhelming majority of software development, including virtually all applications development of any kind, uses high level programming languages, and not assembly code. Some specific areas where assembly language gets used are:
Theoretical computer science
The other reason to learn assembly language is just to gain a better understanding of what is actually going on deep in the guts of a computer. (This is why virtually all Computer Science majors have to learn assembly language.)
Of course, if you're the kind of person who is really interested in that, you might want to think about a career working in low-level systems development.
Other Things to Learn
There are some languages where, if you know just a little, you can do a whole lot. Python and Ruby are like that — you can learn enough in a weekend to build something worthwhile. Assembly language is not like that.
Assembly language is never used in a vacuum. The type of engineer who needs to know assembly is likely to be working in area where there is a need a to know a handful of other skills to be effective. These likely include:
Legacy languages like Fortran and Cobol
Further Reading and Resources
We have lots more information on this kind of stuff, Programming: Languages, Timeline & Guides.
What Code Should You Learn?
Confused about what programming language you should learn to code in? Check out our infographic, What Code Should You Learn?
It not only discusses different aspects of the languages, it answers important questions such as, "How much money will I make programming Java for a living?"