ComputersProgramming

Programming: Assembler language. Basics of Assembler Language

In order for the machine to be able to execute human commands at the hardware level, it is necessary to specify a certain sequence of actions in the language of "zeros and units". Assembler will become an assistant in this matter. It is a utility that works with the translation of commands into the machine language. However, writing a program is a very time-consuming and difficult process. This language is not intended to create easy and simple actions. At the moment, any programming language used (Assembler works fine) allows you to write special effective tasks that greatly affect the operation of the hardware. The main purpose is to create micro-commands and small codes. This language provides more opportunities than, for example, Pascal or C.

Brief description of Assembler languages

All programming languages are divided into levels: low and high. Any of the syntactic system of the "family" Assembler differs in that it combines at once some advantages of the most common and modern languages. With others, they are related by the fact that you can fully use the computer system.

A distinctive feature of the compiler is its ease of use. This is different from those that work only with high levels. If you take into account any such programming language, the assembler functions twice as fast and better. To write an easy program in it, it will not take too much time.

Briefly on the structure of the language

If we talk in general about the work and structure of the functioning of the language, we can say for sure that its commands fully correspond to the instructions of the processor. That is, Assembler uses mnemocodes, the most convenient for a person to record.

Unlike other programming languages, Assembler uses specific labels instead of addresses for writing memory locations. They are translated into the so-called directives with the code execution process. These are relative addresses that do not affect the operation of the processor (not translated into the machine language), but are necessary for recognition by the programming environment itself.

For each line of the processor there is a system of commands. In this scenario, any process, including the translated machine code, will be correct.

The assembler language has several syntaxes that will be discussed in the article.

Pros of the language

The most important and convenient adaptation of the Assembler language will be that it can write any program for the processor, which will be very compact. If the code turns out to be huge, then some processes redirect the programming environment to the main memory. At the same time, they all perform quickly and without interruption, unless, of course, they are run by a qualified programmer.

Drivers, operating systems, BIOS, compilers, interpreters, etc. - this is all the program in the language of Assembler.

When you use a disassembler that makes a translation from machine to computer language, you can easily understand how this or that system task works, even if there is no explanation for it. However, this is possible only if the programs are easy. Unfortunately, in nontrivial codes it is rather difficult to understand.

Lows of language

Unfortunately, novice programmers (and often professionals) find it difficult to understand the language. Assembler requires a detailed description of the required command. Because of the need to use machine commands, the likelihood of erroneous actions and the complexity of execution increase.

In order to write even the most simple program, the programmer must be qualified, and his level of knowledge is high enough. The average specialist, unfortunately, often writes bad codes.

If the platform for which the program is being created is updated, then all commands must be rewritten manually - this is required by the language itself. Assembler does not support the function of automatic control of the health of processes and the replacement of any elements.

Language commands

As already mentioned above, each processor has its own set of commands. The simplest elements that are recognized by any type are the following codes:

  • Data transfer is carried out with the help of mov, etc.
  • Commands related to arithmetic: sub, imul, etc.
  • Bitwise and logical functions can be implemented with the help of or, and etc. It is these fundamentals of the Assembler language that allow it to be similar to others.
  • In order to implement the transition from one command to another, it is necessary to write such operators: djnz, cfsneq, cjne. An inexperienced programmer might think that this is just a set of letters, but this is not true.
  • In and out are used if there is a need to enter or leave the port.
  • Control commands are int. Thanks to him, you can stop the execution of any processes in favor of the main action.

Using Directives

Programming the microcontrollers in the language (Assembler allows it and does a great job), the lowest level in most cases ends well. It is best to use processors with a limited resource. For 32-bit technology, this language is excellent. Often in the codes you can see the directives. What is this? And for what is it used?

To begin with, it is necessary to emphasize that directives are not translated into machine language. They control the performance of the compiler. Unlike commands, these parameters, having different functions, differ not due to different processors, but due to another translator. Among the main directives can be identified the following:

  • All known macros.
  • There are also directives that have a higher language. The assembler perfectly "reads" them and executes them.
  • Functions of monitoring and controlling the modes of the compiler.
  • Recognition of constants and variables.
  • Control the operation of programs that are in RAM.

origin of name

Due to what was called the language - "Assembler"? It's about the translator and the compiler, which make the data encrypted. From English Assembler means nothing more than an assembler. The program was not collected manually, the automatic structure was used. Moreover, at the moment users and professionals have already lost the difference between the terms. Programming languages are often called Assembler, although this is just a utility.

Because of the common collective name, some people have an erroneous decision that there is a single low-level language (or standard norms for it). In order for the programmer to understand what structure is involved, it is necessary to specify for which platform one or another Assembler language is used.

Macromedia

The Assembler languages, which are relatively new, have macro-means. They facilitate both writing and executing the program. Due to their presence, the translator performs the written code many times faster. When creating a conditional choice, you can write a huge block of commands, and it's easier to use macros. They will allow you to quickly switch between actions, if the condition is met or not.

When using macro-language directives, the programmer gets Assembler macros. Sometimes it can be widely used, and sometimes its functional features are reduced to one team. Their presence in the code makes it easier to work with it, makes it more understandable and intuitive. However, you should still be careful - in some cases, macros, on the contrary, worsen the situation.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.unansea.com. Theme powered by WordPress.