Understanding Assembly Language and Benefits and Examples

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 called 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 the  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 the computer .

Meanwhile, in high-level languages ​​one command is able to 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 a 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

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

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. Below we will describe what are the benefits of learning assembly language.

You need to understand that the computer only knows 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 the actual language is 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 be able to display the same task or purpose. In addition, all programs in whatever language they use will be translated into machine language when they want to be executed. This is because that is the only language that can be understood by the processor.

No less important is because 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 the same between one processor with another processor.

But keep in mind that Intel is a company that controls the market share for processors and becomes the ruler. This is what makes all other manufacturers inevitably have to use the same language or instruction set that is used by Intel processors.

Example Assembly Language

Below we have prepared examples of programming languages ​​that use assembly language.

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

Actually to be able to print the letter A and other letters and display it to 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 have to save it with a.asm.

 

; progam untuk mencetak huruf A ke layar

 

; by [email protected]

 

.model small

 

.code

 

org 100h

 

mulai” mov ah,02

 

mov dl,65

 

int 21h

 

int 20 h

 

end mulai

After that you have to save your program and when it’s 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:

  • small model : is a description of the program that works for the mode of an existing program. Some examples such as small, tiny, and others.
  • . org 100h code: is the information used to determine the offset address of the program you want to use. You need to know that specifically the com program will always start with an offset of 100h.
  • start:this description 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 or (jmp) command.
  • mov ah, 02: shows you filled in the ah register  using service  2 , which is identical to  ah = 2. This means that this information is a service for printing characters.
  • mov dl, 65 : shows you filled in the dl register  using ascii 65  characters  maupu
  • int 21h: interrupt number 21 which he will work on based on the value of the services provided.
  • int 20 h: indicates interruption 20 which is used to restore 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 high level language and the second is called low level language.

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

While for low-level languages, the focus is 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’s the discussion about understanding assembly language and its functions and examples. Hopefully useful and easy to understand!

 

by Abdullah Sam
I’m a teacher, researcher and writer. I write about study subjects to improve the learning of college and university students. I write top Quality study notes Mostly, Tech, Games, Education, And Solutions/Tips and Tricks. I am a person who helps students to acquire knowledge, competence or virtue.

Leave a Comment