Seven addressing modes (direct addressing mode)

Publisher:平凡梦想Latest update time:2017-01-22 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The operand required by the instruction is stored in the memory, and the effective address of the operand is given directly in the instruction. This addressing mode is called direct addressing mode.

In normal cases, operands are stored in the data segment, so their physical address will be directly formed by the data segment register DS and the effective address given in the instruction, but if the segment override prefix is ​​used, then the operands can be stored in other segments.

Example: Assume there is an instruction: MOV BX, [1234H]. When it is executed, (DS) = 2000H, and the value of memory unit 21234H is 5213H. What is the value of BX after the instruction is executed?

Answer: According to the addressing rules of direct addressing mode, the specific execution process of this instruction is represented by the figure below.

From the figure, we can see that the execution of this instruction is divided into three parts:
 
Since 1234H is a direct address, it follows the opcode of the instruction and is read out when the instruction is fetched;

The segment register for accessing the data segment is DS, so add the value of DS and the offset 1234H to get the physical address of the storage unit: 21234H;

Take the value 5213H of unit 21234H and store it in register BX according to the principle of "high high low low".

Therefore, after executing this instruction, the value of BX is 5213H.
 

Since the segment register of the data segment defaults to DS, if you want to specify access to data in other segments, you can write it explicitly in the instruction using a segment prefix.

The target operand of the following instruction is the direct addressing mode with a segment prefix.

MOV ES:[1000H], AX

Direct addressing mode is often used to process data in memory units. Its operand is the value of a memory variable. This addressing mode can be addressed within a 64K-byte segment.

Note: The writing formats of immediate addressing mode and direct addressing mode are different. The address of direct addressing should be written in brackets "[", "]". In the program, direct address is usually represented by memory variable name, such as: MOV BX, VARW, where VARW is a memory word variable.

Try to compare the addressing mode of the source operand in the following instructions (VARW is a memory word variable):
  MOV AX, 1234H MOV AX, [1234H]; the former is immediate addressing, and the latter is direct addressing 
  MOV AX, VARW MOV AX, [VARW]; the two are equivalent, both are direct addressing.


Reference address:Seven addressing modes (direct addressing mode)

Previous article:Seven addressing modes (register indirect addressing mode)
Next article:Seven addressing modes (immediate addressing, register addressing)

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号