Home x86 Assembly <<< Previous Next >>>

Boot Sectors!

As you know, computers needs to be booted up using a BOOTABLE DISK. A typical computer disk is divided into portions known as tracks and sectors. It so happens that when the computer starts up, it reads the first sector of the disk into memory, and executes it. This first sector is known as a boot-sector. A boot-sector can be written in assembly language. Here is how:
.model tiny
.code

entry: ; we enter the program
jmp start ; required jump statement
nop ; nop required to follow the jmp
start:

;Add anything--put your code here

org 510
dw 0aa55h ; ; add signature of BOOT SECTOR
end entry
If you compile this in MASM, you'd get a 512 bytes long file.
You can write this file to the first sector of the disk using some utilities like John Fine's Partcopy. Then you can boot the computer using the disk

Remember, this is a Rough Guide!
You can easily add the 'Hello World' program given before to this boot-sector. You'd now have a boot-disk that says 'hello world' when it starts up! You might need more info to do other neat little things. For more on what the memory looks like, click here
Examples of other boot sectors:


MS-DOS 6.2 Boot Sector

The Boot Sector of the Windows 95 operating system

Disassembly of OS/2 boot sector

Boot Sector of Linux 2.0

Boot-Sector of an Individual operating system


I found the stuff above while surfing through the web. Though everything looks real, I have tested only the last example--and found it works.

Home x86 Assembly <<< Previous Next >>>