Boot Record of a Floppy
First we are going to write a boot program to a floppy disk.
see this picture the round inside the discs are called as Track. Cross lines in the disks are called as sectors.
The first track in first sector is a Boot sector of a floppy.
Every track in the disk has number. our first sector (Boot sector) has a number 0, 0, 1. It means 0 th drive (floppy) 0 th sector , 1st Track.
In that first sector should holds the boot program. or otherwise the system consider that is not a bootable disk and displayed the message “Non-System disk or disk error” “Replace and press any key when ready”.
Ok the boot record How it should be
the first instruction is load this program into 0x07c0 (see in memory map in previous chapter. In that chapter boot program was loaded in this memory location)
all the bytes are 00 and last two bytes should be 55 and AA.
Simple Booting Assembly program:
; boot.asm
mov ax, 0x07c0
mov ds, ax
times 510-($-$$) db 0
db 0x55
db 0xAA
How you will execute this program please click the link and see the video:
There you can understand how to make assembly program using NASM assembler and run that booting program .
(If the command is not showing in video I Will explain here)
nasm -f bin -o booting.img booting.asm
Ok in the same program we will add one small code to display one character how it will be
Booting program with print a character
; boot.asm
mov ax, 0x07c0
mov ds, ax
mov ah, 0x0E ; This is function of 0x10 interrupt to print a character and move next
mov al, ‘a’ ; This is character to print
int 0x10 ; This is Interrupt to print a character
times 510-($-$$) db 0
db 0x55
db 0xAA
Compile same before and add it in Virtual box to boot Now the character ‘a’ will be displayed after booting.
See the below video
so you are asking now What is ah, al ? what is int? in next chapter we are going to explain about 16 bit registers in that chapters all you can understand.