8086 architecture from BIOS to Bootloader

8086 memory architecture distribution:
Insert picture description here
When the 8086 is powered on or reset, the first instruction issued is FFFF0, which is located in the first area and accesses the ROM chip.

Some programs are also solidified in the ROM for us to call when we write the operating system. It includes the program for the keyboard, the program for the mouse, and the input and output for the display. We can call these programs.

Continuing the above, we said that the first instruction jumps to FFFF0. In fact, this memory address stores a JUMP instruction, which is used to jump to the address. If written in assembly code, it is

JMP segment address: offset address (8086 architecture)

In the 8086 architecture, after power-on or reset, all registers except the CS segment register are initialized to 0
Insert picture description here
and then shifted to the left by 4 bits of CS to become FFFF0 and add the value of IP to form an address FFFF0. When the instruction is fetched and executed, the value of the CS register and the IP register is modified by describing the segment address and offset address when executing the JUMP instruction.

Therefore, if the instructions followed by the jumped FFFF0 are F000 and E05B as shown in the figure below, then the value of the corresponding CS segment register and the value of the instruction pointer register IP are F000 and E058, so you can get a new one Address FE05B, and then transfer this new memory address to the memory through 20 address lines to fetch new instructions.

Insert picture description here
This address still corresponds to the content of the ROM, which solidifies the procedures for power-on diagnosis, detection and initialization. Then continue from this position to the higher address.

The capacity of ROM is small, and the computer must be allowed to leave the ROM environment, so the ROM is also solidified to read the program from the hard disk or U disk, and then put it into the memory to continue execution. Usually the code of the operating system is placed in the U disk or hard disk.

In the final stage of ROM execution, a piece of code will be used to read the main boot sector of the hard disk to the position of 0x7C00. Insert picture description here
At this time, you can use JMP 0x0000:0x7c00 to jump to the memory, so that the memory jumps to the position of 0x7c00 to execute the code read from the hard disk. After this step, the master boot sector of the hard disk will continue to move the hard disk. The code of the operating system in the system is read into the memory until the operating system is run into the memory.

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45394002/article/details/114650679