From 418e448f5922c0b6f16ca31001f4f1b7f956e0e6 Mon Sep 17 00:00:00 2001 From: CleverMouse Date: Wed, 27 Nov 2013 10:41:18 +0000 Subject: [PATCH] get partition start from MBR if available git-svn-id: svn://kolibrios.org@4299 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/hd_load/usb_boot/BOOT_F32.ASM | 24 +++++++++++++++--------- programs/hd_load/usb_boot/mtldr.asm | 8 ++++---- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/programs/hd_load/usb_boot/BOOT_F32.ASM b/programs/hd_load/usb_boot/BOOT_F32.ASM index 275b3b9ca0..ecf2ae9411 100644 --- a/programs/hd_load/usb_boot/BOOT_F32.ASM +++ b/programs/hd_load/usb_boot/BOOT_F32.ASM @@ -9,34 +9,40 @@ nop times 57h db 0 ; file 'bt2.dat':3,57h +@@: + cmp byte [si], 80h + jnz @f + mov eax, [si+8] + mov [cs:7C1Ch], eax @@: xor eax, eax mov ds, ax mov ss, ax mov sp, 7C00h + mov bp, sp mov [boot_drive], dl cld sti push 800h pop es - movzx ebx, word [7C0Eh] ; reserved_sect + movzx ebx, word [bp+0Eh] ; reserved_sect mov [fat_start], ebx - mov al, byte [7C10h] ; num_fats - mul dword [7C24h] ; sect_fat + mov al, byte [bp+10h] ; num_fats + mul dword [bp+24h] ; sect_fat add eax, ebx ; cluster 2 begins from sector eax - movzx ebx, byte [7C0Dh] ; sects_per_clust + movzx ebx, byte [bp+0Dh] ; sects_per_clust add bx, bx sub eax, ebx mov [data_start], eax - mov eax, [7C2Ch] ; root_cluster + mov eax, [bp+2Ch] ; root_cluster and eax, 0FFFFFFFh fat32_parse_dir: xor bx, bx mov di, bx push eax call read_cluster - movzx cx, byte [7C0Dh] ; sects_per_clust + movzx cx, byte [bp+0Dh] ; sects_per_clust shl cx, 4 ; *0x200/0x20 scan_cluster: cmp byte [es:di], 0 @@ -65,7 +71,7 @@ file_found: push eax call read_cluster mov ax, es - movzx cx, byte [7C0Dh] + movzx cx, byte [bp+0Dh] shl cx, 5 add ax, cx mov es, ax @@ -82,7 +88,7 @@ sayerr: read_cluster: ; in: eax = cluster, bx->buffer - movzx ecx, byte [7C0Dh] + movzx ecx, byte [bp+0Dh] mul ecx add eax, [data_start] @@ -91,7 +97,7 @@ read_cluster: ; cx = number of sectors ; es:bx -> buffer read: - add eax, [7C1Ch] ; hidden sectors + add eax, [bp+1Ch] ; hidden sectors push es read_loop: pushad diff --git a/programs/hd_load/usb_boot/mtldr.asm b/programs/hd_load/usb_boot/mtldr.asm index 427d410971..f0b92d09ac 100644 --- a/programs/hd_load/usb_boot/mtldr.asm +++ b/programs/hd_load/usb_boot/mtldr.asm @@ -5,10 +5,10 @@ format binary use16 -out_string = 0x7DA2 -read_cluster = 0x7D0A -relative_read = 0x7D18 -next_cluster = 0x7D5C +out_string = 0x7DAB +read_cluster = 0x7D15 +relative_read = 0x7D22 +next_cluster = 0x7D65 org 0x8000 start: