The lost art of Assembly Programming

Assembly is a low-level programming language for a computer or any other programmable device, which has a very strong (generally one-to-one) correspondence with the machine language instructions (basically, the programmer speaks with the device by using the device’s language).

Each assembly language is specific to a particular computer architecture, in contrast to most high-level programming languages, which are generally portable across multiple architectures.

Programming in Assembly

Writing code in assembly is way harder than in any other programming language, it takes way more time to write and it’s not “forgiving” at all, any mistake will have a great impact on the code’s execution. Take a peek below, where you’ll see the Hello World! program written in Assembly, and the same program written in the Java language. It’s obvious which of the two is the more complicated one, right?!

class HelloWorldApp {
	public static void main(String[] args) {
		System.out.println("Hello World!");


section    .text
global 	   _start			;must be declared for linker (ld)

_start:				        ;tell linker entry point

    mov	  edx,len			;message length
    mov   ecx,msg			;message to write
    mov	  ebx,1				;file descriptor (stdout)
    mov	  eax,4				;system call number (sys_write)
    int	  0x80				;call kernel
    mov   eax,1				;system call number (sys_exit)
    int   0x80				;call kernel
section	  .data

msg   db 'Hello, world!',0xa            ;our dear string
len   equ $ - msg			;length of our dear string

The term “Assembly” seems very high-tech and scary, but don’t be fearful, in reality the assembly language is more complicated than the term suggests :). But knowing this programming language is a must for compiler writers, and a good feat for all programmers who want to be skillful debuggers, or who are especially interested in code performance and efficiency.

Anyone who works with compiler design, binary arithmetic, memory allocation or character set encoding (and wants to go more in depth with this) has to take into consideration the assembly language, because it offers insight on how a computer works at hardware level. Also, this programming language will increase the programmer’s knowledge about the inner workings of computers (things such as how the CPU/CPU registers work with memory addresses).

Where is the Assembly language being used?

Some may ask: why use assembly when we’ve got… Java (fast execution and easy programming) for example? I agree with easy programming, but I must disagree with fast execution. In this regard, no programming language can beat assembly, except coding by using 0 and 1, but good luck with that!

These are only a few areas were the assembly language is still being used:

  • A stand-alone executable that will execute without recourse to the run-time components, used in: automobile fuel and ignition systems, firmware for telephones, security systems, air-conditioning control systems
  • Code used in direct interaction with the hardware (device drivers or interrupt handlers)
  • Software that requires extreme optimization (an inner loop in a processor-intensive algorithm). In this category I’d like to mention game programming, which greatly benefits from assembly programming (if done well, of course!). Another area is the one of scientific simulation, which really needs highly optimized algorithms
  • Software which needs precise timing, software such as simulations, flight navigation systems, and medical equipment
  • Computer viruses, boot loaders, device drivers and items close to the low-level operating system or hardware
  • etc.

Considering that there are so many areas which are in need of this programming language, asking how long it is going to stick with us is like asking “how much time are computers going to be around?”… but we all know the answer to this. As long as there are device drivers and firmware to develop, software which needs precise timing or other high-performance software, programmers who know assembly will always find something to work on.

Scroll to Top