Assembler - commands for beginners low-level programmers

All commands can only be executed using machine language. Assembler commands are a symbolic representation of this language. With it, they write small, but very fast programs. But, despite their size, the writing process is very time-consuming.

Assembler commands




Therefore, assembler commands are used to work with the hardware component, or when there is critically insufficient memory for program execution. Therefore, assembler code is executed in the form of subprograms and integrates with high-level code. Since the assembler can vary greatly depending on the type of architecture, you should consider it for a specific case, in this article it is the Win architecture. But the description of assembler commands, as a rule, does not change much, and they can be used both in microcontrollers and in other electronic devices for which assembler is used.
assembler team








,

, , 4 . , , , , , . . , . :

  • ;
  • ;
  • ;
  • .

, . , . :

ADD <1/1>, <2/ 2>

, «1». : . , . , , .

description of assembler commands




, . , , , . , , , .





, . :

SUB <Cell1 / Register1>, <Cell2 / Register2>

assembler arithmetic instructions




The principle of calculation is as follows: value No. 2 is subtracted from No. 1, and recorded in place No. 1. The conditions for passing the operation are exactly the same as the conditions for passing the addition operation.

Multiplication

If the same commands were used for division and addition, both for unsigned and for signed numbers, then when multiplying and division, there are different algorithms for them. So, to multiply unsigned numbers, use the following command:

MUL <operand>

assembler command list




The operand specified in the command is one of the factors. The place of the second factor and the place of the result of the operation are fixed in advance, depending on the size of the MUL in bytes. Their location is the topic of a separate article. For sign multiplication, use the command:

IMUL <operand№1>, <operand№2>

, . , №1. №1 , №2 – . :

IMUL<№1>

IMUL<№1>>, <№2>, < >

IMUL<№1>, < >

MUL , . – , . , . , , .

, . :

DIV <>

:

IDIV <>

, -, . , . .

, : , .

" " NEG </>. , . , , .

Useful and incrementing and decrementing operations (increase or decrease the operand by one). To increment an operand, you need to register the following command:

INC <operand>

For decrement should be prescribed:

DEC <operand>

An operand can be a memory cell or register. The exceptional benefit of these operations is that they take up less space for themselves than similar assembler commands offered by addition or subtraction.




All Articles