Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
system prog new.docx
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
275.7 Кб
Скачать

4) Ways of addressing.

The method or addressing mode is called the procedure of finding the operand for the command being executed. If a team uses two operands, then for each of them should be given the addressing, and addressing modes of the first and second operand can either coincide or differ. Operand may be in different places: directly in the command code, in any case, in memory, in which case there are several options specifying its address.There are the following addressing modes:

Register addressing

mov ax, bx

Direct addressing

mov ax, 2

Immediate addressing

mov ax, es:0001 mov ax, es:word_var

Indirect addressing

mov ax, [bx]

Addressing on base with shift

mov ax, [bx+2] mov ax, [bp] + 2 mov ax, 2[bp] Indirect addressing with scaling mov ax, [esi*2] + 2

Register-addressing - most teams processor called with arguments that are nazyvayutsya assembler operands, the operands are placed in any general-purpose registers and segment registers.

2. Immediate Addressing - some codes allow you to specify one of the operators directly in the code: mov ax, 2

3. Direct addressing - if the operand is in memory address is known, it can be used. If the operand is a word in the segment pointed to by the ES register with an offset from the beginning of 0001 the segment, the command: mov ax, es, 0001 will put the word in register AX. If the segment specified in the register ES has been described word_var variable word size, we can write (1), then the assembler will replace the word itself word_var to the appropriate address.

4. Indirect addressing - on the same register addressing of operands with the same can not specify the address of the operands stored in any register ax, [bx] - moves the word in the AX register from memory, the segment selector are in the DS, and the shift in the BX /

5. Addressing on the basis of shift - mov ax, [bx 2] places the word in the AX register, which is a segment showing DS with an offset of 2 more than the number of BX.

5) Dynamic libraries. Principles of using dynamic libraries.

The source program in assembly language consists of a sequence of statements, which is also called the assembler lines or suggestions.

In an assembly line can be written assembler directives, commands or instructions of the processor, preprocessor commands, macros, and comments. Recording line in accordance with some formal rules set out below. Violation of these rules leads to a lot of mistakes, especially in the first stage of development of the assembler.

Assembler directives do not generate machine instructions and any action on a processor, they define the structure of the program, according to the compiler and linker information about what they need to do with the commands and data. Examples of directives:

end -defines the logical end of the program, all the recorded

after it will not be perceived by the translator,

seg -defines the beginning of a new section

db -allocates a constant.

Commands or instructions of the processor and generate machine instructions are executed in sequence while the processor. Examples of commands:

MOVE A, B

ADD B

org expression

Sets the value of the program counter. ORG directive with an operand 100h necessarily used when writing files such as COM, which are loaded into memory when the size of the parameter block 100h.

even

EVEN directive makes the current count is a multiple of two, inserting the command NOP, if it was odd. This increases the speed of the program, so as to access to a word that starts with an odd address, the processor must read two words of memory. If the description of the segment is not used by the alignment of the type BYTE, the counter at the beginning of the segment is always even.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]