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:
mov ax, bx
mov ax, 2
mov ax, es:0001 mov ax, es:word_var
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.
Date: 2015-01-29; view: 107