Fundamentals 18 min read

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 first steps, how memory‑mapping works, how the CPU’s PC register is forced to 0xFFFF0, how the boot sector is loaded to 0x7C00, and what the initial assembly code actually does.

Liangxu Linux
Liangxu Linux
Liangxu Linux
What Really Happens When You Press the Power Button? A Deep Dive into the BIOS Boot Process

When you press the power button, the CPU immediately starts executing code, but most people only find vague textbook explanations. This article breaks down the exact sequence of events that occur from power‑on to the moment the operating system takes over.

Prerequisite Knowledge

Understanding the boot process requires three basic facts:

Memory stores data at addressable locations.

The CPU repeatedly fetches instructions from memory and executes them.

The address from which the CPU fetches the next instruction is held in a register (the PC) that increments automatically or is changed by jump instructions.

Why BIOS Leads the Process

After power‑on, the BIOS runs first because the CPU begins execution at a fixed physical address that is mapped to BIOS code. This is possible thanks to memory‑mapping , where certain address ranges are reserved for firmware and peripheral devices.

Memory‑Mapping Explained

The width of the CPU’s address bus determines the total addressable memory space (e.g., a 64‑bit CPU can address 2^64 bytes). However, not all of that space is used for RAM; portions are allocated to devices such as video memory and the hard‑disk controller. These device regions are mapped into the address space, allowing the CPU to read or write them as if they were ordinary memory.

Real‑Mode Memory Layout

In real mode, the first 1 MiB of address space is divided among RAM, BIOS, and other firmware. BIOS occupies the high region 0xC0000‑0xFFFFF, with the actual BIOS program residing at 0xF0000‑0xFFFFF. The interrupt vector table also lives at the very start of memory.

How the CPU Starts Executing BIOS

At the instant the power button is pressed, the CPU’s PC register is forced to the physical address 0xFFFF0. Internally, the segment register CS is set to 0xF000 and the offset IP to 0xFFF0, which together compute the address 0xFFFF0. The first instruction at this location is a far jump: jmp far f000:e05b This jump transfers control to the main BIOS code at physical address 0xFE05B, where hardware initialization and the final boot‑sector loading take place.

Loading the Boot Sector (0x7C00)

BIOS reads the first sector (512 bytes) of the selected boot device (floppy, HDD, USB, etc.)—specifically cylinder 0, head 0, sector 1. If the last two bytes of this sector are 0x55 and 0xAA, BIOS treats it as a valid boot sector and copies the entire 512‑byte block to memory address 0x7C00, then jumps the PC to that address.

Example Boot‑Sector Code

The following assembly snippet, taken from a “30‑day OS” tutorial, shows a minimal boot sector that prints "hello‑os" and then halts:

; hello‑os
; ORG 0x7c00   ; load address

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
  JE fin
  MOV AH,0x0e
  MOV BX,15
  INT 0x10
  JMP putloop
fin:
  HLT
  JMP fin
msg:
  DB 0x0a,0x0a
  DB "hello‑os"
  DB 0x0a
  DB 0
  RESB 0x7dfe-$
  DB 0x55,0xaa

The directive ORG 0x7c00 tells the assembler that the code will be loaded at 0x7C00, matching the address where BIOS places the boot sector.

Why 0x7C00?

The value originates from the original IBM PC design. The BIOS team assumed the first operating system (DOS 1.0) needed a minimum of 32 KB of RAM. Placing the boot sector near the top of that 32 KB (at 0x7C00) kept it safe from being overwritten while leaving room for a small stack.

From BIOS to Operating‑System Kernel

Summarizing the chain of events:

The CPU starts at 0xFFFF0, executing BIOS entry code.

The BIOS jumps to its main routine at 0xFE05B.

After hardware checks, BIOS loads the boot sector into 0x7C00 and jumps there.

The boot sector code loads the OS kernel and transfers control to it.

Beyond this point, the operating system takes over, handling segmentation, paging, interrupt tables, device drivers, memory management, process scheduling, file systems, and user‑mode interfaces.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AssemblyBIOSBoot Processmemory mappingreal mode
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.