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.
Previous article:Seven addressing modes (register indirect addressing mode)
Next article:Seven addressing modes (immediate addressing, register addressing)
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Purgatory Legend-RAM War
- ATX-100 Series Cable Harness Tester Revealed! (Demo + Features)
- Who can give me the control circuit of the car main driver's door glass lifting switch group
- Reasons why the automatic function of a digital oscilloscope cannot be triggered when measuring low-frequency signals
- Running helloworld-porting on iTOP-4418 development board
- Capacitor selection and installation considerations
- Millimeter wave sensor technology for detecting passengers in moving vehicles
- How to detect whether a POE switch is a single-chip microcomputer
- Two small questions about the C5509A debugging process
- TMS320C6678 external memory DDR3 hardware design and software debugging