Ruan Yifeng: Why is the memory address of the master boot record 0x7C00?

Ruan Yifeng: Why is the memory address of the master boot record 0x7C00?

The "Computer Principles" textbook says that during startup, the master boot record will be stored in the memory address 0x7C00.

The textbook does not explain how this strange address comes from. I have always wondered why it is not stored in the head, tail, or other locations of the memory, but in this place that is 1024 bytes smaller than 32KB?

Yesterday, I read an article that finally solved the mystery.

First of all, if you don't know what the master boot record (abbreviated as MBR) is, you can read "How does a computer start?" first.

Simply put, computer startup is such a process.

  1. power ups
  2. Read the BIOS in ROM to check the hardware
  3. Hardware check passed
  4. BIOS checks the first sector of the boot device (i.e., the master boot record) according to the specified order and loads it at memory address 0x7C00
  5. The master boot record gives the operating system control

Therefore, the master boot record is a small program that guides the "operating system" into the memory, and its size does not exceed 1 sector (512 bytes).

The address 0x7C00 comes from Intel's first-generation personal computer chip 8088. In order to maintain compatibility, subsequent CPUs have always used this address.

In August 1981, IBM's first personal computer, the IBM PC 5150, was launched, using this chip.

At that time, the operating system was 86-DOS. This operating system required at least 32KB of memory. We know that the memory address starts at 0x0000, and 32KB of memory is 0x0000~0x7FFF.

The 8088 chip itself needs to occupy 0x0000 to 0x03FF to store the storage locations of various interrupt handlers. (The master boot record itself is the handler for the interrupt signal INT 19h.) Therefore, only 0x0400 to 0x7FFF is available for use.

In order to leave as much continuous memory as possible for the operating system, the master boot record is placed at the end of the memory address. Since a sector is 512 bytes, the master boot record itself will also generate data, and another 512 bytes need to be reserved for storage. Therefore, its reserved position becomes:

  1. 0x7FFF - 512 - 512 = 0x7C00   

This is how 0x7C00 came about.

After the computer starts, the usage of 32KB of memory is as follows.

  1. +--------------------- 0x0  
  2. | Interrupts vectors
  3. +--------------------- 0x400  
  4. | BIOS data area
  5. +--------------------- 0x5 ??
  6. | OS load area
  7. +--------------------- 0x7C00  
  8. | Boot sector
  9. +--------------------- 0x7E00  
  10. | Boot data/stack
  11. +--------------------- 0x7FFF  
  12. | (not used)
  13. +--------------------- (...)

(over)

<<:  80% of U.S. mobile users spend 3 apps on their mobile devices

>>:  In-depth study of JavaScript objects

Recommend

Get ready! China's mountain snow map

Near the beginning of winter Heavy Snow They have...

The color of your quilt really affects your sleep quality! Change it now!

Can the color of the quilt affect your sleep? ——R...

Developers' Notes: Three OS and Embracing Open Source Swift

In just half a month, the world's two greates...

A complete guide to online promotion methods!

1. External promotion As the name suggests, exter...

The most comprehensive network operation solution analysis!

1. Competitive product analysis 1. Choose competi...

Do you believe that Android users can use Apple Maps?

Since its launch, Apple Maps has been criticized ...

How to write an attractive activity proposal?

Years ago, I planned and organized a community ev...

iOS 17.0.1 battery life test results are out, and it crashes again!

A few days after the official release of iOS 17, ...

The "Quiet Night Thoughts" you recited was never seen by Li Bai

Recently, the movie "30,000 Miles from Chang...

Hands-on experience of ROCK smart business card case, a business and social tool

Every time I attend a meeting or a party, I alway...

Unexpectedly, "burping and farting" can also affect carbon emissions

What are bull farts and why should we collect the...

The 5 most easily overlooked points and solutions for short video operations

What is the happiest thing about short video oper...