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).

Introduction

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:

10110000 01100001

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.

Of course 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.

Example

For example, if 10110 means “move the value,” then we could abbreviate it with the MOV command.

We could also give the 000 register a easier to remember name (in this case, the register is named AL).

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

Online Resources

Tutorials and Basic Guides

Video Tutorials

Reference

Tools

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

  • Visual MASM.

Community and Ongoing Learning

Books

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:

  • Operating systems

  • Firmware

  • Device drivers

  • Language design

  • Compiler design

  • Embedded systems

  • Hardware design

  • Advanced cryptography

  • 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:

  • Hardware languages, like VHDL and Verilog, along with a good understanding of microprocessors and electrical engineering

  • Low-level operating system languages like C and its derivatives: C++, C#, and D

  • Legacy languages like Fortran and Cobol

  • Platform languages like Java and Objective-C

  • Algorithms

  • Compiler, interpreter, and language design.


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?”

Adam Michael Wood

About Adam Michael Wood

Adam specializes in developer documentation and tutorials. In addition to his writing here, he has authored engineering guides and other long-form technical manuals. Outside of work, Adam composes and performs liturgical music. He lives with his wife and children in California.

Comments

Thanks for your comment. It will show here once it has been approved.

Your email address will not be published. Required fields are marked *

avatar

debasish

July 18, 2019

Is the processor used While translating the higher level language into machine code.If yes then we also need a machine code for translating that HLL.

avatar

Alex

August 23, 2019

Thank Adam, You’ve absolutely done a great job.

avatar

KENNETH W COOK

September 7, 2019

what does this mean in assembly IF CROMEMCO*(LARGEDS+SMALLDS)
I came across this and i don’t understand I don’t know how to use a * or a + with a if statement