The assembly language


Did you know that the only language that microcontrollers are capable of understanding is the so-called “machine code”? This language is formed by the zeros and ones of the binary system.

This of course makes it very difficult, or rather impossible, the task of programming these processors. This is why  assembly languages ​​exist.

Through this type of language, the programmer can do his homework thanks to the fact that it is a language with which he can express himself more naturally. However, it can be “understood” without problems by the microprocessor that is being programmed.

What you will find here: Everything about assembly languages, including their basic elements, the types that exist and their main applications, among many other interesting things.

Assembly  languages  ​​have been with us for a long time. Although high-level programming languages ​​exist today  ,  assembly language is still used for programming devices, hardware drivers, and much more.

That is why in this article you will  learn everything about assembly languages,  from their beginnings to their current applications.

Of course, as always in a clear and precise way to be understood by everyone, regardless of their level of knowledge on these issues.

But before you dive into the topic of  assembly languages , one of the best ideas you can have is to refresh your memory about the basics of programming languages.

It is also not a bad idea to learn a little more about some other areas related to this subject.

What is a programming language?

In a clear simple way, it could be said that  a programming language is a set of symbols, keywords, codes and semantic rules.

These are used to create a sequence or series of algorithmic instructions, which will be used to create a program that can control both the physical and logical behavior of a computer. This is with the aim of obtaining a certain result.

It could be defined in very few words that  the programming language  is a structured system of communication. This allows the link between the programmer and the device being programmed.

At this point, it is essential to know  how a programming language works. This is because all electronic devices today need to be programmed through a programming language in order to carry out their task. From a Smart TV to a washing machine.

The programming language in these cases, and in many more, is used so that  the programmer can communicate with the hardware or software of the equipment.

In this way it is possible to provide him with the basic and advanced aspects of his behavior.

Examples of these are what data it should operate with, how that data should be stored, transmitted or processed.

Finally, you must also have the action that the software or hardware must take with this data depending on the different variables that have been imposed.

Programming language features

What types of programming language are there?

As we have established,  the programming language is the key element of all modern technology.

The programming language allows the programmer to bring to life the programs and operating systems and software of multiple devices.

These programming languages ​​are currently classified into two well-differentiated types,  low-level and high-level languages,  however, there are others that complement or expand the capabilities of those mentioned.

It should be noted at this point that all programs must be programmed using algorithms, being one of the main tools to help us with this  Pseint issue , which is discussed in much more depth in this article .

Machine language

The so-called  “machine language”  is one of the oldest languages ​​that exist; It is formed by combining  “1”  and  “0”,  that is, it is a language that only uses the binary system. This is so because this is the only system that devices and computers are capable of interpreting.

Low-level programming language

The basic function of this programming language is to  act as an interface between the hardware and the software  of a given device.

Assembly language

The language on which this article deepens. Assembly language, or Assembly Language in English was the first attempt in the search for an easier substitute to communicate directly with the hardware of a device.

It should be noted at this point that the IEV number of the assembler type programs given by the International Electrotechnical Commission is 171-05-17, and is registered in the category “Digital technology – Fundamental concepts / Software”.

These types of languages ​​act as converters, since the devices use the binary language, and the programmer uses a  more flexible and easy-to-use programming language. This is called a high-level language.

Assembly language view

High-level programming language

The main goal  of the high-level language is to make things easier for the programmer.

This is because the instructions that you can use to create the programs are presented in a much more understandable way.

If you want to know more about  programming tools  such as pseudo code or pseudo instructions, the best thing you can do is click on this link . Here you will find excellent information on the subject, as well as some good examples of how it is used.

History and present of assembly language

Assembly language and assembly programs have been part of the history of computing since the beginning of it.

It could be taken as the first interaction in the year 1949, when EDSAC was developed , acronym in English for  “Electronic Delay Storage Automatic Calculator”,  whose translation is  “Automatic Storage Calculator with Electronic Delay”,

This was the first computer to incorporate internal commands. As color data we can say that OXO, the first video game in history, was developed specifically to be able to be executed on this computer.

Among the most outstanding characteristics of  EDSAC , it can be mentioned that it  had the first assembler in the world,  a very primitive one. This took advantage of the mnemonic design of the computer.

The first of many exercises carried out by this early assembly code was a square number program. This development by Beatrice Worsley was executed on EDSAC on May 6, 1949, and used mnemonics and complex arithmetic operations.

Automatic Electronic Delay Storage Calculator

The second big step in the history of assemblers took place when Stan Poley developed SOAP in 1954, an acronym for English that means  “Symbolic Optimal Assembly Program”. This in Spanish can be translated as  “Symbolic Optimal Assembly Program”.

This assembler was developed at IBM’s Thomas J. Watson Research Center facility specifically for the  IBM 650 Magnetic Drum Data-Processing Machine computer.

SOAP was a multi-pass assembler , meaning that it is capable of processing the program more than once to generate the object program.

After the implementation of these  first assembly languages , its success grew exponentially, since it offered many advantages, especially to the programming technicians of the time.

With this new technology they could get rid of certain tasks such as remembering long sequences of numbers and codes. Another of the frequent problems that this inclusion could solve were those related to the data in memory.

They also offered a minimum data definition size. This aspect was fundamental in those times of the first commercial computers, high speed, and above all, proven and effective reliability.

Although this success may also be due to the  lack of high-level language compilers  specifically designed to be used on this type of microcomputer.

IBM 650 Magnetic Drum Data-Processing Machine

From this, many commercial applications began to be developed  using assembly languages. With this, many microcomputers depended inseparably on assembly languages ​​to be able to operate these programs with their hardware.

Examples of this are IBM PC DOS or Lotus 1-2-3, or even much more modern apps like some games in the 1990s.

In this sense, most of the computers developed between the 1980s and 1990s, such as the Atari and the MSX,  were tied to the use of an assembly language.

However, all this was going to change severely with the appearance of the so-called  high-level languages. Thanks to this type of language and its wide range of options and features, they managed to drastically reduce the use of assembly languages ​​by the 1980s.

Although its use has been reduced, the truth is that today,  assembly language is still widely used in countless implementations.

This is due to its characteristics, since it allows you to communicate directly with the hardware, with which you can carry out tasks with devices that would otherwise be impossible.

Examples of this would be the creation of boot codes, reverse engineering, manipulation and programming of hardware and much more.

This means that even today,  a programmer can generate significant income thanks to compiler languages,  and it is one of the least explored fields of computer science. This motivates that there are few professionals with whom we can compete here.

Current assembly language processing

If you want to learn more about  modern assembly language implementations, we have much more  on that later in this article.

What is assembly language?

Basically,  an assembly language is a low-level programming language  used to manipulate the internal instructions of a device.

This language can be used in this way fundamentally because the assembly language always offers a one-to-one correspondence between itself and the raw machine code instructions of the device being programmed.

This means that each line of written assembly language code is perfectly equivalent to one instruction of the device being programmed. This means that it does not have to be interpreted or compiled for the hardware to “understand”.

In a slightly more technical explanation, the assembly language,  “Assembly”  or  “ASM”  by its name in English, is a series of mnemonics that are designed to represent basic instructions in electronics.

This is useful for programming microprocessors, microcontrollers, and other programmable integrated circuits.

It should be noted that this type of IC is present in every computer with its processors, televisions, audio devices, smartphones and much other hardware.

These  mnemonics  are basically a  symbolic representation of binary machine codes,  constants, and other programming elements.

That is, all the elements you need to carry out the task of making a certain processor or microprocessor perform a certain action.

Symbolic representation of the codes

In this sense, it should be noted  that a specific assembly language is necessary for each processor architecture. Generally this is always defined by the hardware manufacturer.

This is so because device developments are based on a set of instructions, data types, registers, memory locations, and other characteristics of a particular  assembly language .

If you were to try to program a device with an assembly language that does not correspond to its type, it will be impossible.

This means that  an assembly language is specific to a particular computer architecture,  unlike today’s modern high-level programming languages.

You can use high-level languages ​​regardless of the architecture on which the device was developed, as explained below.

Assembly language features

Just as human beings need a language to be able to communicate, hardware also requires a way that allows us to “talk” to its processors and make them carry out what we want.

The hardware is unable to understand what we propose to it,  since it only uses a combination of ones and zeros,  called machine language. So it is necessary to have a language that acts as an intermediary.

This is the  basic function of an assembly language.

Combination of 1 and 0 in assembly language

However, the task is not so simple, since there are many types of hardware,  with processors and microprocessors designed around very different architectures.

This gives the task a fairly high degree of difficulty. But assembly languages ​​share certain types of characteristics, which we will mention from this point on.

As we mentioned earlier in this article, one of the main characteristics of assembly language is that it does not allow porting to other architectures.

This means that a code that has been written for a certain microprocessor or processor will not work for another model or manufacturer, unless you carry out a very important redesign.

In this sense, the  best known and most used processor architectures  are the Intel x86 and Intel x64, the AMD architectures and the ARM architecture. This latest architecture is used in most modern smartphones, tablets and laptops.

The fact that  each assembly language is specific to a particular architecture, whether it be a physical computer or a virtual computer, prevents truly cross-platform developments from being created.

You can develop this in high-level programming languages ​​such as JAVA or C.

Another outstanding feature of  apps developed directly in an assembly language  is that they are much more efficient in terms of system resources, and much faster too.

A program developed in assembly language can be considerably more efficient than a program developed in a high-level language.

However, thanks to  today’s high-level programming language compilers,  this feature is less and less required.

This is due to the fact that by means of these languages ​​it is now possible to create very efficient programs in terms of speed and stability.

Also  through assembly language,  developers can have much more effective control of the processes to be carried out by the processor that is being programmed.

This is thanks to the fact that this language, as we mentioned, offers the particularity of being able to communicate directly with the hardware. This is a feature that is not available in high-level languages , and it allows you to design very specific code.

It should be noted that the source code resulting from this assembly language development has the  “asm” extension. From this file the machine code is created, which usually has a  “Hex” file extension.

assembler types

Currently  there are multiple types of assembly language, as well as categories of assemblers  that, although they perform the same final function, vary according to the type of scenario in which it is used.

  • Cross Assembler:  The first type of assembler allows the support of physical media such as input and output peripherals. It is mainly used in the development of programming for specific systems.
  • Resident Assembler:  This type of assemblers remain in the memory of the computer, and are only loaded to  allow the execution of the object program  produced . This type of assembler is the most used for the engineering of smaller control systems.
  • Macro Assemblers:  This specific type of assembler allows the use of macro instructions. They are applications, often large, that have the particularity of not remaining in memory once the object code has been generated.
  • Microassemblers:  This type of assemblers provides the interpreter with precise instructions on  how the CPU should carry out a certain task.

Arduino Microcontroller

  • One-phase  assemblers: One-phase assemblers have the distinction of reading a source program line, translating it directly, and  producing one  machine language instruction at a time.  This type of assemblers are easy to use, and also offer the benefit of occupying little space in memory.
  • Two-phase assemblers:  It is the most used type of assembler today. Its name is due to the fact that  the entire translation and execution process is carried out in two stages.  In the first one, the assembler analyzes the source code and builds it into a symbol table. In the second stage, the source code of the program is analyzed again to translate it.

What is an assembly language program like?

Basically,  a program made in assembly language  will be made up of a sequence of statements. Each of these statements occupies a single line and can be seen as follows:

[label] [operation] [operand] [ comments]

All four fields in the statement are optional. In the event that any of them is not completed, there will be an empty sentence.

  • Instructions:  These statements represent orders to the processor and after the compilation process, they are capable of generating executable code.
  • Directives:  These statements direct the process of compiling or building the executable program, but they are not capable of generating executable code. They are usually used to increase the readability of the source code.
  • (Model) Data segment:  Contains the address where the variable declaration begins. The variable is written.
  • (Stack) Code segment:  Contains the starting address where the program instructions are located. All the code of the program to be developed is written.
  • (Data) Stack segment:  Contains the address where the stack is located.
  • (Code) Extra Segment:  Contains the address where we can store extra data.

Basic elements of assembly language

For many years, there has been a significant dispersion among the different assembly language developers when it comes to naming and categorizing the different parts of their language.

However, the truth is that you can be sure that they correspond to a more standard nomenclature.

It could be said that the basic elements of assembly language are:

  • Tags: Basically, a tag is a word used to designate some line or section of the program. This can be used to jump between different parts of the code to that tag. Note that these tags must always start with a letter or an underscore “_”. The maximum size of a label can be up to 32 characters long.
  • Instructions: The instructions are nothing more than the operations to be carried out by the microcontroller. These instructions that each microcontroller can carry out are already defined in its data sheet.
  • Operands: Operands are the basic elements used in the instruction that is currently being executed. Generally, the operands are all registers, variables, or constants.
  • Directives: Directives perform a function similar to instructions. However there is a difference. The directives are typical of the assembly language, but they are independent of the microcontroller chip used in the project. Directives represent certain features of assembly language, and are used to specify the processor used as well as its configuration. They are also used for the purpose of allocating memory locations, among many other tasks.
  • Comments: Comments are nothing more than any sentence that you can write in the code itself to make it clearer for those who read it, or for yourself. It should be noted that these comments can be placed anywhere in your code, as long as they start with a semicolon “;”.

Do you want to learn more? Programming languages

Assembly language programs

There are currently quite a few offers available to start making your own assembly language programs.

DOSBox Screen

Some of the most used and popular alternatives among developers are the following:

  • Assembler RosAsm: RosAsm or “ReactOS ASseMbler” is basically a 32-bit x86 assembly language for Win32 offered under the terms of the GNU license.
  • Flat Assembler: Flat Assembler, also known as “FASM”, is a free, multi-pass assembler for IA-32.2 and x86-64 architectures.
  • Microsoft Macro Assembler: Microsoft Macro Assembler, also known as “MASM” is an assembler for the x86 family of microprocessors, developed by Microsoft.
  • Turbo Assembler: Turbo Assembler, also known as “TASM” is basically an assembly package developed by Borland specifically for the IBM PC platform and x86 microprocessors.
  • GNU Toolchain: GNU Toolchain is a package containing the development tools for the GNU platform. An assembler is also included.
  • GNU Assembler: GNU Assembler, also known as “GAS”, is the assembler of the GNU project, used to compile Linux and other GNU operating systems.
  • a86 Assemblers: This commercial assembler was developed for use with the Intel x86 family of processors.
  • a86 and a386: A86 is a compact commercial assembler developed for the Intel X86 family of processors by Eric Isaacson. The assembler is capable of producing Windows/DOS compatible .COM or .OBJ files from a source code text file. The a86/d86 are targeted at the 16-bit x86 platform, unlike the a386 and d386, which were developed for 32-bit platforms.

Free IDEs for assembly languages

Many times the IDEs are as important as the programming language itself, since they are an important aid in the work of the programmer.

If you don’t know what an IDE is, we’ll tell you that it’s basically an integrated development environment.

This comes from the English words “Integrated Development Environment”. In a few words, it is a computer program developed in order to make programming easier.

For this, it has a number of very interesting tools, such as a source code editor, debugger, compiler and interpreter, as well as other automatic construction options.

From here we will show you the IDEs that you can use in your projects with assembly language.

  • Fresh IDE: In this case, it is a very visual IDE developed for assembly language with an integrated Flat Assembler (FASM) compiler. It was written in the Fresh IDE and is a compileable standalone application. Among its most notable features we can mention that it is compatible with FASM, but it also allows the code to be compiled in all versions of FASM. Fresh IDE is only available for Windows, but Linux users can use it without problems through Wine. If you wish, you can download this assembly language IDE for free at this link.

Free Assembly Language IDE

  • WinAsm Studio: This app is a completely free integrated development environment for developing programs for Windows 32-bit and DOS 16-bit platforms. Languages ​​such as Microsoft Macro Assembler MASM and FASM can be used for this. For the latter, the plugin for FASM should be used. If you want, you can have this free Assembler IDE by clicking on this link.

Free Assembler IDE

  • Visual Studio Code: The most interesting thing about this source code editing app is that it has been developed by Microsoft. Important features of this program include support for debugging, code refactoring, syntax highlighting, Git embedding control, intelligent code completion, and many other configuration options. If you want to download Visual Studio Code for free, you can do so by clicking on this link.

Visual Studio Code

  • Assembler IDE: This development environment for assembly code was created with the purpose of automating the assembly process as much as possible. To do this, it integrates various tools such as a code editor, a debugger and a disassembler. This IDE is capable of working with assembly languages ​​such as NASM, TASM/MASM, and FASM, with which you can perform actions such as code debugging, code editing, disassembly, and compilation. It should be noted that it is an online assembler. You can find it at this link.

Free Online Assembler

  • Easy Code: This IDE for development in assembly language was developed with the aim of generating applications for the Windows platform in 32 bits. Among the most notable features of this IDE for assembly language are a comfortable interface, which reminds us of Visual Basic, and the possibility of developing apps in assembly in a simple and fast way, thanks to the multiple tools it offers. If you want to get hold of this IDE for Assembly completely free of charge, all you have to do is click on this link.

Free Assembly IDE

  • RadASM: Lastly, you have RadASM. This is a completely free IDE for 32-bit assemblers for Windows. Among its most important features we can mention its compatibility and support for MASM, TASM, FASM, NASM, GoASM and HLA. If you want to download this IDE for assembler for free, you can do so by clicking on this link.

RadASM Screen

Assembly language books

As you know, the term assembler is used to name one of the most important processes in computer programming. And this is usually a quite complicated task if you do not have the basic notions on these topics.

For this reason, if you are interested in starting a career in programming, the best thing you can do is start building a good library.

In this sense, there are some publishers that specialize in computing issues, such as Addison Wesley and Prentice Hall, two benchmarks in the sector.

Unfortunately, most of his books are in the English language.

In the event that you do not master this last language, you can also start studying it, and taking into account the importance of this language in computing, it would not be bad at all to do it as soon as possible.

Assembly Language Examples

The following is an example of a program developed in assembly language for the x86 processor architecture.

.model small



String1 DB ‘Hello World.$’



mov ax, @data

mov ds, ax

mov dx, offset Cadena1

mov ah, 9

int 21h

int 20h

end program

We can notice here the frequent use of the MOV instruction, which is one of the most important instructions in an assembly language, since its purpose is the transfer of data between registers of the processor or register and memory.

Also with the MOV instruction it is possible to use absolute data, such as moving any number to a processor register.

What is MOV instruction

Assembler Applications

In the early days of computing, and therefore of programming,  applications were developed in whole or in part in one of the assembly languages.

This was so since the existing resources to process information were rather scarce, and the assembly language was a more than viable solution to achieve an efficient application.

That is to say that it worked well with the little memory and processor power available in the computers of that time.

Over the years, the capacity of memories and processors multiplied several times in terms of power and speed. This resulted in programs becoming increasingly complex, taking advantage of the virtues of these new processors and memories.

At this point, the assembly languages, so necessary in other times, were replaced in programming tasks by high-level languages  ​​such as C, FORTRAN and COBOL.

They were also replaced with object-oriented languages, which are capable of millions of lines of code and create code as efficient as assembly language.

In this sense,  object-oriented programming languages  ​​have made it possible to create enormous software developments, which would be impossible to carry out using an assembly language.

This is mainly due to the fact that there are millions of lines of code.

Remember that each order of the assembly language is equivalent to an instruction in a processor, which is why it could take years to write complex and huge software like the current ones.

However,  assembly language is still used today in modern development to gain access to hardware.

However, it is also used to program small devices, since it is ideal, due to the little space that programs developed in assembly language occupy, for this type of task.

Here are some examples of  how assembly language is used today.

Assembly language in video game consoles

A video game console needs the  software and hardware  that controls it to be perfectly optimized so that it can run as efficiently and quickly as possible.

For this reason, the developers of this type of device use the  assembly language to write the necessary code  that takes advantage of every last bit of the existing hardware.

Videogame console

The use of  assembly language  allows designers to gain direct access to the hardware of the consoles and therefore make the necessary manual adjustments to obtain the full power of the different components of the console.

In this sense, application programmers  also use assembly language for their development instead of using high-level languages ​​that are easier to implement.

This technique basically allows them to have high efficiency values, since the software interacts directly with the hardware.

Assembly language in embedded systems

Embedded  systems  are those programs that control the functions of various specific devices.

Examples of these types of devices are video cards, hard drives, security systems, modems, cell phones, air conditioning control systems, data acquisition instruments, and many others.

These types of devices are programmed using an assembly language because they are small and can be  easily stored in the ROM of these devices.

By fulfilling a single function, its development is not so complicated.

Today,  the programming of embedded system microcontrollers is the most common use of an assembly language.

Any of the functions that a device offers us, be it a refrigerator or a car computer, is controlled by a processor of this type, which must be programmed in advance to carry out that specific function.

Assembly language in household appliances

Assembly language in hardware device drivers

A device driver is basically a computer program that allows the operating system to interact directly with a peripheral.

The objective of this is that the user can use it without having to know how it works, just click on a button to obtain a result. Without a device driver it would be impossible to use hardware.

Due to this condition,  the programming of a device driver  is carried out through an assembly language, since the hardware can be directly accessed so that it does what the designer wants, and present it to the user in the simplest and most user-friendly way possible. clear possible.