In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
What are the addressing methods for memory operands? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.
The addressing modes of memory operands are: direct addressing, register indirect addressing, register relative addressing, base addressing relative addressing, base addressing relative addressing.
Addressing mode of memory Operand
TIPS:
The object operated by the ♥ instruction is in memory in the form of []
The ♥ instruction gives the offset address of the Operand in a logical segment of memory: [offset address]
The base address of the ♥ logical segment is given by default or reset.
The word length of the ♥ memory Operand itself is uncertain, and its word length depends on another register Operand, or the word length is specified in other ways
1. Direct addressing
The offset instruction directly gives the offset address of the Operand.
Eg:MOV AX, [1200H]; store the content of segment 1200H in AL and the content of 1201H in AH
In the direct addressing mode, the Operand defaults to the data segment, but the segment reset is allowed, that is, the logical segment is given by instruction.
Eg:MOV AX,ES: [1200H]; store the content of the additional segment 1200H in AL and the content of 1201H in AH
"I personally understand:
Adding [] indicates that you need to look for an address outside the register. at this point, you should first consider which section of the memory you are in, and then directly find the location given in this section. Generally speaking, the default is in the data segment.
two。 Register indirect addressing
The arguments Operand is stored in memory, and the offset address of the data in memory is the contents of the general register in square brackets [].
Four general-purpose registers (also known as interaddress registers, BX, BP, SI, DI) are commonly used to store offset addresses of data. (the inter-address register is divided into base address register BX, BP and indexing register SI, DI)
General format of indirect addressing:
Eg:MOV BX,1200H; this is the immediate addressing, that is, the operands are sent directly to BX, and at this time BX=1200H
MOV AX, [BX]; here is [BX] = [1200H], so it is converted to direct addressing, but with the addition of BX as an intermediate proxy, the unit content with the offset address 1200H in the code segment is assigned to the content of the AL,1201H unit to the AH.
Indirect addressing is the offset address of the Operand indirectly given by the register.
The segment address of the duration Operand (which segment the Operand is in) depends on which interval register is selected (which segment can be reset)
By default, BX, SI and DI are in the data segment; BP is in the stack segment by default
"I personally understand:
We can find the corresponding segment through the selected interval register, and then find the physical location through the offset of the segment. When addressing indirectly, we can find the physical location of the source Operand.
Physical location = segment base address * 16 + offset address.
3. Register relative addressing
The offset address of the circle Operand adds a displacement to the contents of the register
Assign eg:MOV AX,2000H; address immediately, assign 2000H to AX
MOV DS,AX; DS gets the segment header address from AX
MOV BX,1200H; address immediately, assign 1200H to BX
MOV AL, [BX] 5; relative addressing, assigns the content at the segment base address 2000H and offset 1200H+5 to AL
Relative addressing is mainly used for one-dimensional array operations.
Displacement is often used as the header address, and the value of the inter-address register is used as the relative address in the table (there will be constants between use and inconvenience)
"I personally understand:
Relative addressing adds a displacement constant to indirect addressing, so the way to determine whether it is indirect addressing or relative addressing is to see if there is a constant before and after the address register, and the one with constant is relative addressing.
4. Base address change addressing
The offset address of the numbers Operand is:
The contents of a base address register (BX, BP) + the contents of an index register (SI, DI)
"where BX defaults to data segment BP defaults to stack segment
The segment address of the circle Operand is determined by the selected base address register
Operations, like relative addressing, are mainly used for one-dimensional array operations.
Assign eg:MOV SI,1100H; address immediately, assign 1100H to SI
MOV BX,SI; assign 1100H to BX
MOV AX, [SI+BX]; physical address of the source Operand = data segment base address * 16+1100H+1100H
"I personally understand:
Base address addressing is to find the first address of the segment where the base address register is located, and then add the offset of the base address register and the offset of the index register. Its characteristic is that [BX] [BP] must have one of the two, and [SI] [DI] must have one of the two.
5. Base address change of address relative addressing
The offset address of the numbers Operand is:
Base address register + index register + displacement
The segment address of the circle Operand is determined by the selected base address register
Base addressing relative addressing is mainly used for the operation of two-dimensional arrays
Assign eg:MOV DI,1100H; address immediately, assign 1100H to DI
MOV BP,DI; assign 1100H to BP
MOV AL, [BP] [DI] 5; BP indicates that the Operand is in the stack segment, and its physical address = the base address of the stack segment * 16+1100H+1100H+5
"I personally understand:
The base address change relative to addressing only adds a constant offset to the base address change, from which the physical address of the source Operand can be grasped.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.