Home / Computer / What is Assembly Language? Understanding Assembly Language & Its Functions

What is Assembly Language? Understanding Assembly Language & Its Functions

Definition of Assembly Language

What do you know about assembly language? You need to know that assembly language is a type of programming language that exists in the second generation. This assembly language is also named as assembly language which is the language used for computers, but this language is included in the category as a low level language or low level language . This language is a notation for machines so that it can later be read by humans.

Unlike high level language or high level language, this assembly language has a 1-1 relationship with machine instructions. For example, for each nickname or mnemonic that will later be written using assembly language, then later it will also be directly translated with exactly one operating code so that it can be directly understood by a computer .

Meanwhile, at a high level language one command can be translated into various operating codes in the machine language. The process of changing language from assembly language to machine language is carried out by the assembler. While the feedback process is the task of the disassembler. But keep in mind that each computer is equipped with machine language that tends to be not the same, resulting in the resulting assembly language is also potentially not the same.

Benefits of Learning Assembly Language

 Understanding Assembly Language and Examples

#include int main () {printf (A); return 0; } Assembly (with DEBUG): mov ah, 02. mov dl, 41. int 21. int 20. Machine language: ??? How do you compare the program size and ease?

What are the benefits of learning assembly language? Studying one type of computer language on this one is very important because it can provide knowledge about what functions the assembly language has. We will explain below what are the benefits of learning assembly language.

You need to understand that computers only recognize two commands, namely 1 and 0. The higher the language used, the more humane the way you give commands. For example, if a programmer wants to display text to a computer screen, then in C language it is actually only enough to write printf ("Hello World").

However, for the use of assembly language which incidentally is a low-level language, then there are at least 5 steps that must be met in order to display the same task or purpose. In addition, all programs with whatever language is used will be translated into machine language at the time of execution. This is because that is the only language that can be understood by the processor.

Equally important is that assembly language is also a mnemonic or abbreviation when trying to give commands to machine language. So it is not surprising that assembly language has close links with its processors. Each processor is also equipped with an instruction set that has the possibility of not being the same between one processor with another processor.

However, it should be remembered that Intel is a company that controls the market share for processors and becomes the ruler. This makes all other manufacturers inevitably have to use the same language or instruction set as used by Intel processors.

Example of Assembly Language

 Understanding Assembly Language Is ]

Below we have prepared an example in the form of a programming language that uses assembly language.

How to print the letter A and display it to the screen

Actually to be able to print the letter A or other letters and display it on the screen, you can use any editor. All you need to do is to type the following command or script in notepad and then you must save it with a.asm.


; program to print the letter A to the screen

; by [email protected]

 .model small

.code

org 100h

start "mov ah, 02

mov dl, 65

int 21h

int 20 h

end start

After that you must save your program and when it is finished, you can then exit the editor. Later you will get a program description in the form of: (semicolon). That is, after there is a sign; then the program will automatically immediately ignore any commands made or existing.

For other program information we will explain as below:

  • .model small : is a description of the program that functions for the mode of existing program. Some examples such as small, tiny, etc.
  • . Org 100h code: is the information used to determine the offset address of the program to be used. You need to know that special com programs will always start with an offset of 100h.
  • starting: this statement shows the name of a label. When starting to use an assembly program, you should start with a label. Later it will be used as a program jump by using the jump command or (jmp).
  • mov ah, 02: shows you fill in the register ah using the service 2 which is identical to ah = 2. This means that this information is a service for printing characters.
  • mov dl, 65 : indicates that you filled in register dl using ascii characters 65 maupu A.
  • int 21h: interruption number 21 which he will work on based on the value of the service provided.
  • int 20 h: indicates interruption 20 which is used to return control to DOS.
  • end start : is the end of the program

Difference between Low and High Level Languages ​​

As we mentioned earlier that the language used by computers is divided into two. The first is called a high level language and the second is called a low level language.

For high level languages, this language is more focused on humans where the way it works is so that all statements contained in the program can be written easily so that it is easy understood by humans.

As for the type of low-level language focuses more on machine language. That is, how so that the computer can directly interpret statements that come from the program. This is the basic difference between the two types of languages ​​that are often used by computers in carrying out their duties.

That is a discussion of the notion of assembly language and its functions and examples. Hopefully useful and easy to understand!

Loading...

Check Also

Bernie Sanders’ internet plan would break up providers

Today, Democratic presidential candidate and Vermont Senator Bernie Sanders announced a new plan focused on …