Here’s a line-by-line disassembly of your 512-byte boot‐sector routine (loaded at 0x0000:7C00), annotated with what each instruction does:
org 0x7C00 ; the BIOS loads this sector here
;––– Stage 1: initialize segments & stack –––––––––––––––––––––––––––––––––
0000:FA cli ; disable interrupts
0001:B8 00 10 mov ax,0x1000
0004:8E D0 mov ss,ax ; SS ← 0x1000
0006:BC 00 B0 mov sp,0xB000 ; SP ← 0xB000 (stack grows down from 0x1B000)
0009:B8 00 00 mov ax,0x0000
000C:8E D8 mov ds,ax ; DS ← 0
000E:8E C0 mov es,ax ; ES ← 0
0010:FB sti ; re-enable interrupts
;––– Stage 2: relocate this 512-byte sector to 0000:0600 ––––––––––––––––––
0011:BE 00 7C mov si,0x7C00 ; source = where BIOS put us
0014:BF 00 06 mov di,0x0600 ; dest = 0000:0600
0017:B9 00 02 mov cx,0x0200 ; count = 512 bytes
001A:F3 A4 rep movsb ; ES:DI ← DS:SI, 512 bytes
;––– Stage 3: jump into relocated copy at 0x0000:0621 –––––––––––––––––––
001C:EA 21 06 00 00 jmp 0x0000:0x0621
;––– Stage 4: (at 0000:0621) scan for the 55AA signature in the 2nd half –––––
0621:BE BE 07 mov si,0x07BE ; SI ← start of signature area (7BEh)
0624:38 04 cmp byte [si], al; compare byte at DS:SI to AL (AL=0)
0626:75 0B jne 0x0633 ; if not zero, skip ahead
0628:83 C6 10 add si,0x10 ; else step forward 16 bytes
062B:81 FE FE 07 cmp si,0x07FE ; have we reached 0x07FE?
062F:75 F3 jne 0x0624 ; if not, keep scanning
0631:EB 16 jmp 0x0649 ; found it?––jump to loader
;––– Stage 5: use INT 13h to load the partition’s first track –––––––––––––––
0633:B4 02 mov ah,0x02 ; AH=02h → BIOS READ SECTOR
0635:B0 01 mov al,0x01 ; AL=1 → read 1 sector
0637:BB 00 7C mov bx,0x7C00 ; ES:BX = buffer (back to 7C00h)
063A:B2 80 mov dl,0x80 ; DL = drive number (first hard disk)
063C:8A 74 01 mov dh,[bx+1] ; DH = head number from MBR
063F:8B 4C 02 mov cx,[bx+2] ; CX = sector+track info
0642:CD 13 int 0x13 ; BIOS disk service
0644:EA 00 7C 00 00 jmp 0x0000:0x7C00 ; jump to newly loaded volume-boot record
064A:EB FE jmp 0x064A ; (infinite loop if we ever fall through)
;––– padding to 512 bytes, last two bytes should be 0x55 0xAA –––––––––––––
… ; (zeros, then)
(offs 0x1FE) 55 AA ; boot signature
What this does, end-to-end:
- Setup. Disables interrupts, sets up SS:SP high in memory, clears DS/ES to 0x0000.
- Relocate. Copies itself (512 B) from 0000:7C00 → 0000:0600 so that the original 7C00 area is free.
- Scan. Looks for the 0x55AA signature (boot sector magic) in the relocated copy.
- Load. Uses INT 13h to read the first sector of the active partition into 0x7C00.
- Jump. Transfers control to that partition-boot record (i.e. a second-stage bootstrap).
- Halt loop. If anything goes wrong, it ends in an infinite jump at 0x064A.
This is a classic PC‐BIOS Master Boot Record.