A text to understand the difference between effective address and offset address in assembly language

Comprehension of offset address in assembly

The offset address is also called the offset. Since the ALU inside the 8086/8088 CPU can only perform 16-bit (4x4 in hexadecimal, with 4 bits, 0x0000-0xFFFF), 8086/8088 has 20 (16 times System 4X5, with 5, 0x00000-0xFFFFF) address lines. In order to facilitate the 8086/8088CPU which can only perform 16 operations, then we will change 5 bits into two 4 bits, that is to divide the physical address into a segment address and an offset address, as shown in the following figure:

A text to understand the difference between effective address and offset address in assembly language

So how to get the physical address through segment address and offset address?

Physical address = segment address *16 (decimal) + offset address. (Binary, that is, the segment address "4|offset address").

Effective address understanding

The effective address EA is a 16-bit unsigned number, indicating the distance from the cell where the operand is located to the beginning of the segment, ie the offset address of the logical address. When the operand is stored in memory, the physical address of the memory cell has two parts. One is the offset address; the other is the segment address. In the various addressing methods of the 8086/8088, the offset address required for finding the memory cell can be composed of various components, which are called effective addresses and are expressed by EA. You can get a valid address through memory addressing.

The effective address can consist of several parts: the contents of the base register, the contents of the index register, the scale factor, and the amount of displacement.

How to get a physical address from a valid address

The physical address refers to the 20-bit address used by the CPU to address the main memory, which determines the memory location of a physical location. (2 points) The memory unit physical address can be determined from the segment address and offset within the segment. The offset of a memory location within a segment is called the effective address (EA).

Physical address = segment address × 16 + offset within the segment.

A text to understand the difference between effective address and offset address in assembly language

Effective address addressing

The process of determining the operand address based on the contents of the instruction is called addressing. Perfect addressing methods provide users with easy organization and use of data.

1 Direct Addressing: The instruction address field indicates the address of the operand.

2 Indirect Addressing: In the instruction address field, the address represented by the operand address, that is, the memory cell corresponding to the instruction address code is given by the address A, and the operation data is stored in the main memory unit indicated by the address A. Some computer instructions can be indirectly addressed multiple times. If the main memory unit indicated by A stores another address B, and the operation data is stored in the main memory unit indicated by B, it is called multiple indirect addressing.

3 Immediate Addressing: The instruction address field indicates the operand itself.

4 Indexed addressing: The instruction address field represents the index register number i and the displacement value D. The specified index register E is added to the shift value D, and the sum E+D is the operand address. Many computers have a double-index function that adds the contents of the two index registers to the displacement value, resulting in an operand address. Indexed addressing facilitates array operations and program sharing. At the same time, the length of the displacement value can be shorter than the length of the address, so the length of the instruction can be shortened.

5 Relative addressing: The instruction address field represents the displacement value D. The contents of the program counter (namely the address of this instruction) K and the displacement value D are added to obtain the operand address K+D. When the program is floating in main memory, relative addressing can maintain the original program function. In addition, there are addressing methods such as self-increment addressing, self-reducing addressing, and combination addressing. The addressing mode can be determined by the operation code, or a flag can be set in the address field to indicate the addressing mode.

The difference between effective address and offset address in assembly language

On the machine of the 8086, the effective address = segment address is shifted left by 4 bits + offset address, and the offset address is the same as the effective address. However, as far as ibm's hardware is concerned, their addressing modes are also divided into two types: one is real address addressing, and the other is virtual address addressing. The two addressing modes are very different. On the 8086, the effective address = segment address is shifted left by 4 bits + offset address because it only has the real address addressing mode, and after 286, there is the virtual address addressing mode. This involves related paragraphs as well as descriptors, descriptor tables, and other questions. Please refer to the book about the interface yourself.

Stage Follow Lights

Stage Follow Lights ,Follow Spot Lighting,Follow Me Lighting,Lights Follow

Guangzhou Cheng Wen Photoelectric Technology Co., Ltd. , https://www.cwledwall.com