/ Programming: Assembler language. Basics of the Assembler Language

Programming: Assembler language. Basics of the Assembler Language

In order for the machine to execute commandsperson at the hardware level, it is necessary to specify a certain sequence of actions in the language of "ticks and units". Assembler will become an assistant in this matter. This is a utility that works with the translation of commands into the machine language. However, writing a program is a very time-consuming and complicated process. This language is not intended to create easy and simple actions. At the moment, any programming language used (Assembler works perfectly) 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.

assembly language

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 iseasy to use. This is different from those that work only with high levels. If you take into account any such programming language, Assembler functions twice as fast and better. In order 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 structurethe functioning of the language, you can say for sure that its commands fully correspond to the commands of the processor. That is, Assembler uses mnemocodes, the most convenient for a person to record.

Unlike other programming languages,The assembler uses certain labels instead of addresses for writing memory cells. 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.

Assembler's language has several syntaxes, which will be discussed in the article.

assembly language

Pros of the language

The most important and convenient adaptation of the languageAssembler 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 fast enough and without failures, unless, of course, they are run by a qualified programmer.

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

When using a disassembler, whichmakes 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 light. Unfortunately, in non-trivial codes it is rather difficult to understand.

Lows of language

Unfortunately, novice programmers (and oftenprofessionals) it is difficult to disassemble 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 created,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.

assembly language program

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 using or, and, and so on. It is these basics of the Assembler language that allow it to be similar to others.
  • In order to make the transition from onecommands to another, it is necessary to register 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 applied in the event that there is a need to enter (or output from the port).
  • Control commands are int. Thanks to him, you can stop the execution of any processes in favor of the main action.
    programming of microcontrollers in assembly language

Using Directives

Programming microcontrollers in the language(Assembler allows it and does an excellent job), the lowest level in most cases ends successfully. 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 thatdirectives are not translated into the 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. 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.
    machine code assembly language

origin of name

Due to what was called the language -Assembler? It is a question of the translator and the compiler, which make the data encryption. From English Assembler means nothing more than an assembler. The program was not collected manually, an automatic structure was used. Moreover, at the moment users and specialists 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 atSome 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.

The Basics of Assembly Language

Macromedia

Assembler languages ​​that are created with respect torecently, have a 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 programmergets Assembler macros. Sometimes it can be widely used, and sometimes its functional features are reduced to one command. 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.

Liked:
0
Popular Posts
Spiritual development
Food
yup