Home Common Problem If bp addressing is used when accessing memory, what is the default segment register?

If bp addressing is used when accessing memory, what is the default segment register?

Oct 19, 2020 am 11:49 AM
memory

If you use bp addressing when accessing memory, the default segment register is "SS", which is the stack segment. The SS stack segment usually refers to a memory area that works in stack mode; in an architecture that uses segmented memory management for program memory allocation, the stack segment is used to store local variables and function return addresses.

If bp addressing is used when accessing memory, what is the default segment register?

#The segment register is set for segmented management of memory. Computers need to segment memory to allocate it to different programs (similar to hard disk paging). When describing memory segmentation, the following segment information is required: 1. Size of the segment; 2. Starting address of the segment; 3. Management attributes of the segment (writing prohibited/execution prohibited/system exclusive, etc.). It is necessary to use 8 bytes (64 bits) to store this information, but the segment register only has 16 bits, so only the segment number (segment selector, also translated as "segment selector") can be stored in the segment register, and then the segment number is mapped to the existence GDT (global (segment) descriptor table, global segment number record table) in memory reads segment information.

8086CPU has 20 address lines, and the maximum addressable memory space is 1MB. The 8086 registers are only 16 bits, and the instruction pointer (IP) and index register (SI, DI) are also 16 bits. It is impossible to address 1MB of space with a 16-bit address. Therefore, the memory must be segmented, that is, the 1MB space is divided into 2^4, that is, 16 segments, each segment does not exceed 64KB (2^16, 16-bit data lines can be addressed). Four 16-bit segment registers are set up in the 8086 to manage four types of segments: CS is the code segment, DS is the data segment, SS is the stack segment, and ES is the additional segment. After the memory is segmented, each segment has a segment base address. The segment register stores the high-order 16 bits of the segment base address. This 16-bit address can be formed by shifting the 16-bit address to the left by four bits (adding 4 zeros after it). 20-bit segment base address.

The segment register CS points to the memory segment where the program is stored. IP is used to store the offset of the next instruction to be executed in the segment. Putting them together can fetch the next time in the memory segment. The instruction to execute.

The segment register SS points to the memory segment used for the stack, and SP is used to point to the top of the stack. Putting them together can access the top unit of the stack. In addition, when the offset uses the pointer register BP, its default segment register is also SS, and BP can be used to access the entire stack, not just the top of the stack.

The segment register DS points to the data segment, and ES points to the additional segment. When accessing the operand, one of the two is combined with an offset to obtain the physical address of the storage unit. The offset can be one of a specific numerical value, a symbolic address, the value of a pointer register, etc. The specific situation will be determined by the addressing mode of the instruction.

Usually, the default data segment register is DS, with one exception: when performing string operations, the segment register of the destination address is specified as ES. Of course, in general instructions, we can also change the segment register of the operand by changing the "segment replacement" field in the prefix.

"Optional segment registers" are segment addresses that can be used to force the values ​​of these segment registers as their operand addresses.

The above is the detailed content of If bp addressing is used when accessing memory, what is the default segment register?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Which memory has the fastest access speed? Which memory has the fastest access speed? Jul 26, 2022 am 10:54 AM

The fastest access memory is "internal memory"; the memory in the computer adopts a hierarchical structure, arranged in order of speed, including internal memory, cache memory, the computer's main memory, and large-capacity disks. The memory is generally divided into RAM Random Access Memory and ROM Read Only Memory.

Can the CPU directly access data in the internal memory? Can the CPU directly access data in the internal memory? Nov 25, 2022 pm 02:02 PM

Can be accessed directly. Internal memory, also called memory, is the bridge between external memory and the CPU. All programs in the computer run in memory. The function of memory is to temporarily store calculation data in the CPU and data exchanged with external memories such as hard disks. As long as the computer is running, the operating system will transfer the data that needs to be calculated from the memory to the CPU for calculation; when the calculation is completed, the CPU will transmit the results. The operation of the memory also determines the stable operation of the computer.

What is the basis for computers to have strong memory capabilities? What is the basis for computers to have strong memory capabilities? Jul 09, 2021 pm 03:59 PM

The basis for a computer to have a strong memory capability is a storage device with sufficient capacity. Memory can be divided into internal memory and external memory. They enable computers to have powerful memory functions and can store large amounts of information. This information includes not only various types of data information, but also programs for processing these data.

What is the memory system in a computer system? What is the memory system in a computer system? Jul 22, 2022 pm 02:23 PM

The memory system refers to a system in a computer consisting of various storage devices that store programs and data, control components, and devices (hardware) and algorithms (software) that manage information scheduling. The storage system provides the ability to write and read information (programs and data) required for computer work, and realizes the computer's information memory function. The hierarchical structure of the storage system can be divided into five levels: register group, cache cache, main memory, virtual memory and external memory.

Which country invented the USB flash drive? Which country invented the USB flash drive? Oct 09, 2022 pm 02:26 PM

The USB flash drive was invented in China, and Netac is the global inventor of the USB flash drive. In July 2002, Netac's "Fast Lightning External Storage Method and Device for Data Processing Systems" was officially authorized by the State Intellectual Property Office. This patent filled the 20-year gap in invention patents in the field of computer storage in China; 2004 On December 7, 2019, Netac received the basic invention patent for flash disks officially authorized by the U.S. National Patent Office.

What is cache? What is cache? Nov 25, 2022 am 11:48 AM

Cache is called cache memory. It is a high-speed small-capacity memory between the central processing unit and the main memory. It is generally composed of high-speed SRAM. This kind of local memory is oriented to the CPU. It is introduced to reduce or eliminate the gap between the CPU and the memory. The impact of the speed difference between them on system performance. Cache capacity is small but fast, memory speed is low but capacity is large. By optimizing the scheduling algorithm, the performance of the system will be greatly improved.

What is memory? What are the essential differences between internal memory and external memory? What is memory? What are the essential differences between internal memory and external memory? Aug 25, 2022 pm 04:02 PM

Memory is a memory device used to store programs and data, as well as intermediate results and final results of operations. The difference between internal memory and external memory: 1. The memory is a temporary storage area when executing the program, and all data will be lost after a power failure; the external memory is used to store original data and operation results, and the data will not be lost after a power failure; 2. Memory is characterized by fast access speed, but small capacity and expensive price, while external memory is characterized by large capacity, low price, but slow access speed; 3. Memory is used to store programs and data that the computer needs to use immediately. Memory is used to store programs and data that are not in use temporarily.

What are the characteristics of rom memory What are the characteristics of rom memory Nov 29, 2022 am 11:29 AM

The characteristic of ROM memory is that it can only read data from the memory, but cannot write information into it. The data will still exist after the computer is powered off. ROM read-only memory can only read information but cannot write information. Usually a basic input/output system is solidified in the ROM of the computer motherboard, called BIOS (Basic Input Output System); its main function is to complete the automatic power-on of the system. Inspection, initialization of each functional module in the system, basic input/output driver of the system and booting the operating system.