The computer BIOS reads the data from the first sector of the hard disk to the memory 0x7c00 location, gives control to the active partition table of the master boot Record (MBR), the MBR re-search system, and loads the first sector of the active partition table to a fixed address. The MBR then gives control to PBR,PBR to parse the FAT or NTFS format file system, locate the boot kernel file ntldr, and load the file into 0x20000. Finally, control is given to NTLDR for kernel boot.
The original source code is a compilation process, the path of the assembler is probably in the "\boot\freeldr\bootsect\dosmbr.asm".
I refer to the source code is not the original ReactOS, the reference source is derived from the "Windows kernel design thought" author Chen Shubao rewrite the lite version of the BMR boot source. I looked at the original DOSMBR code and its code was closer to the startup logic of Windows XP. The Chen Shubao version is much easier to understand. The following is a code snippet for Chen Shubao:
Start:
CLI, off interrupt, zero interrupt flag in flag Register, disable interrupt,
xor ax, ax, heterogeneous or operation, two operands identical, i.e. clear 0 operation;
mov SS, ax ; Set stack segment register, segment register clear 0;
mov sp, 7c00h ; set stack top, stack top is 0x7c00; STI; interrupt, the interrupt flag position in the Flag Register 1, open interrupt;
push 07c0h
pop ds
mov ax, 07c0h ; Set data segment Register
mov ds, ax
; load NTLDR
push DWORD 80000h/512-8 ; Total number of COUNT-NTLDR sectors, 80000h/512-8 = 0x3f8
push DWORD 8 ; src-start reading of the sector area code
push DWORD 20000h ; DES-the destination address for storing data call loadsector ; loading sector
; Ntfsboot jmp 0x2000:0000,fatboot jmp 0x2000:0003
Push word 2000h
push word 0000h
o16 retf
Not to be continued ...