In 32-bit microcomputer systems, in addition to supporting the previous seven addressing modes, a more flexible, convenient, but also more complex memory addressing mode is provided, thereby further expanding the addressing range of the memory address.
When using 16-bit registers to access storage units, only the base address register (BX and BP) and the index register (SI and DI) can be used as part of the address offset, but when using 32-bit registers for addressing, there is no such restriction. All 32-bit registers (EAX, EBX, ECX, EDX, ESI, EDI, EBP and ESP) can be a part of the address offset.
When addressing with a 32-bit address offset, the offset of the memory address can be divided into three parts: a 32-bit base address register, a 32-bit index register that can be multiplied by 1, 2, 4 or 8, and an 8-bit/32-bit offset constant, and these three parts can be combined arbitrarily, omitting one or two of them.
The 32-bit base registers are: EAX, EBX, ECX, EDX, ESI, EDI, EBP and ESP; The
32-bit index registers are: EAX, EBX, ECX, EDX, ESI, EDI and EBP (except ESP).
Here are some 32-bit address instructions:
MOV AX, [123456H]
MOV EAX, [EBX]
MOV EBX, [ECX*2]
MOV EBX, [EAX+100H]
MOV EDX, [EAX*4+200H]
MOV EBX, [EAX+EDX*2]
MOV EBX, [EAX+EDX*2+300H]
MOV AX, [ESP]
The effective address calculation formula for addressing with a 32-bit address offset is summarized as shown in the formula.
Since the 32-bit addressing mode can use all general registers, there are new regulations for the segment registers combined with the effective address. The specific regulations are as follows:
1. The writing order of the registers in the address determines whether the register is a base register or an index register;
For example, EBX in [EBX+EBP] is the base register and EBP is the index register, while EBP in [EBP+EBX] is the base register and EBX is the index register;
2. The selection of the default segment register depends on the base register;
3. When the base register is EBP or ESP, the default segment register is SS, otherwise, the default segment register is DS;
4. In the instruction, if the segment prefix is used, the explicit segment register takes precedence.
The following lists several 32-bit addressing instructions and their memory operand segment registers.
Example of instruction | Segment registers used to access memory locations |
MOV AX, [123456H] | ;Default segment register DS |
MOV EAX, [EBX+EBP] | ;Default segment register DS |
MOV EBX, [EBP+EBX] | ;Default segment register SS |
MOV EBX, [EAX+100H] | ;Default segment register DS |
MOV EDX, ES:[EAX*4+200H] | ;Explicit segment register ES |
MOV [ESP+EDX*2], AX | ;Default segment register SS |
MOV EBX, GS:[EAX+EDX*2+300H] | ;Explicit segment register GS |
MOV AX, [ESP] | ;Default segment register SS |
Previous article:Some pitfalls in 8-bit microcontroller programming
Next article:Seven addressing modes (relative base address plus indexed addressing mode)
- Popular Resources
- Popular amplifiers
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
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
- 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
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- ZTE Hardware Written Test
- 5G OTA testing is too complicated? - Try using simulation tools to help
- Made a power module with LM317
- STM32MP157A-DK1 Evaluation (7) M4 Core Program Test
- Yiyuantong 2020 summer recruitment season is recruiting hot positions!
- Use Xun to create an Android emulator for the itop4418 development board
- [Qinheng RISC-V core CH582] 3 unboxing experience
- UPS-IPGuard Pro P1902 front panel device wiring diagram:
- The DC-DC circuit of Lingte LT3780 is shown in the figure. Who can analyze the specific working principle?
- Clock source design of msp430