X-Git-Url: http://git.dujemihanovic.xyz/projects?a=blobdiff_plain;f=boot%2Fx86%2Fvbr-fat32.s;h=b4c71489e5bf9d421ded07e145550c13e37cb716;hb=2a70d72730b91905543e5d5e850bc00cf43bc5e6;hp=061ca527afc3d585558c43b495c72a68536c6476;hpb=dad65146188909b9568ed39b3b3fbc5e88e158c3;p=nameless-os.git diff --git a/boot/x86/vbr-fat32.s b/boot/x86/vbr-fat32.s index 061ca52..b4c7148 100644 --- a/boot/x86/vbr-fat32.s +++ b/boot/x86/vbr-fat32.s @@ -24,7 +24,6 @@ real_start: ; we expect the boot drive to be in DL and our partition table entry in DS:SI mov [BOOT_DRIVE], dl - mov [part_table_entry], si ; calculate the 1st sector of the data area call get_1st_data_sec @@ -37,7 +36,9 @@ real_start: mov eax, BPB_RootClus call read_cluster_chain + push cx mov cx, 11 + push si .find_stage_3: mov si, STAGE3_NAME cmp byte [es:di], 0 ; we have no more entries to look at @@ -53,11 +54,14 @@ real_start: add bx, 0x1000 mov es, bx .stage3_found: - sub di, 0xb ; "repe cmpsb" incremented this + pop si + pop cx + add di, 9 ; knowing that cmpsb incremented this by 11, we can also increment it by 9 + ; right here so we can use 1 less offset below ; stage 3 has been found and ES:DI points to its directory entry - mov ax, [es:di+dir_entry.firstclushi] ; load high half of the 1st cluster + mov ax, [es:di] ; load high half of the 1st cluster shl eax, 16 - mov ax, [es:di+dir_entry.firstcluslo] ; load low half of the 1st cluster + mov ax, [es:di+(dir_entry.firstcluslo-dir_entry.firstclushi)] ; load low half of the 1st cluster mov bx, STAGE3_SEGMENT mov es, bx mov di, STAGE3_OFFSET @@ -70,7 +74,6 @@ real_start: mov si, stage3_missing call print .halt: - cli hlt jmp short $-1