What Really Happens When You Press the Power Button? A Deep Dive into the BIOS Boot Process
This article demystifies the computer startup sequence by explaining why BIOS controls the initial steps, how memory‑mapping works, what the 0x7c00 boot sector is, and how the BIOS loads and transfers control to the operating system kernel.
When you press the power button, the CPU’s PC register is forced to 0xFFFF0, the entry point of the BIOS program. The BIOS then runs its own code, performs hardware self‑tests, and prepares to hand control to the first bootable storage device.
Why BIOS Leads the Boot Process
The BIOS is stored in ROM and is the only code the CPU can execute before any RAM is initialized. Because the CPU fetches instructions from memory addresses defined by the PC register, the BIOS must be mapped into a known memory region (0xF0000‑0xFFFFF) so the CPU can start executing it.
Memory‑Mapping Basics
CPU address‑bus width determines the addressable memory space (e.g., 32‑bit bus → 4 GB). Parts of this address space are reserved for peripherals by mapping them into specific address ranges, a technique called memory‑mapping. The BIOS itself is memory‑mapped into the high memory area.
Real‑Mode Memory Layout
In real mode the first 1 MB of memory is accessible. The BIOS occupies 0xC0000‑0xFFFFF, with the interrupt vector table at the very start of memory. The BIOS code and data are placed in these high addresses.
How the BIOS Starts Executing Code
At power‑on the CPU’s PC register is set to 0xFFFF0. The segment register CS is loaded with 0xF000 and the offset IP with 0xFFF0, forming the physical address 0xFFFF0. The instruction at this address is a far jump: jmp far f000:e05b This jump transfers execution to address 0xFE05B where the BIOS performs hardware detection, builds the interrupt vector table, and finally loads the boot sector.
What the Boot Sector Is (0x7C00)
The BIOS reads the first sector (512 bytes) of the first bootable device (the “boot sector”) located at cylinder 0, head 0, sector 1. If the last two bytes of this sector are 0x55 0xAA, the BIOS treats it as bootable and copies it to memory address 0x7C00, then jumps the PC register to that address.
Boot Sector Example
A typical boot sector written in assembly looks like this:
; hello‑os
; TAB=4
ORG 0x7c00 ; program loads at 0x7c00
entry:
MOV AX,0 ; clear registers
MOV SS,AX
MOV SP,0x7c00
MOV DS,AX
MOV ES,AX
MOV SI,msg
putloop:
MOV AL,[SI]
ADD SI,1
CMP AL,0 ; zero‑terminated string
JE fin
MOV AH,0x0e ; BIOS teletype output
MOV BX,15 ; colour
INT 0x10
JMP putloop
fin:
HLT
JMP fin
msg:
DB 0x0a,0x0a ; newlines
DB "hello‑os"
DB 0x0a
DB 0 ; terminator
RESB 0x7dfe-$ ; pad to 512 bytes
DB 0x55, 0xaa ; boot signatureThe ORG 0x7c00 directive tells the assembler that the code will be loaded at 0x7C00, matching the address where the BIOS places the boot sector. The final two bytes (0x55 0xAA) are the required boot signature.
Why 0x7C00 Was Chosen
The original IBM PC BIOS assumed a minimum of 32 KB of RAM and wanted the boot sector to reside near the top of that space without overwriting other data. 0x8000 − 0x400 = 0x7C00, which fits this constraint.
From Boot Sector to OS Kernel
After the boot sector runs, it typically loads the operating system kernel from further sectors on the disk into memory and jumps to it. From that point onward the OS takes over, handling segmentation, paging, interrupt handling, device drivers, memory management, process scheduling, file systems, and user‑mode interfaces.
In summary, the boot sequence consists of four main jumps: power‑on → BIOS entry (0xFFFF0), BIOS jump to 0xFE05B, BIOS loading the boot sector to 0x7C00, and the boot sector loading the OS kernel.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
