LBA Harddisk在引导加载程序中使用int 13h ah = 42h读取

时间:2022-01-21 03:12:33

I am trying to load Root directory of fat 16 partition using Int 13h Function ah = 42h! All parameters are correctly set to the best of my knowledge. Here is the code:`

我试图使用Int 13h函数啊= 42h加载胖16分区的根目录!所有参数都是根据我的知识正确设置的。这是代码:`

    mov byte[DAP.sz],0x10
    mov byte[DAP.res],0
    mov cx,word[TotalRootDirSecs]
    mov word[DAP.count],cx
    mov word[DAP.offset],0x0500
    mov word[DAP.seg],0x0
    mov eax,dword[IstRootDirSec]
    add eax,dword[BPB_HiddSec]
    mov dword[DAP.baseLo],eax
    mov dword[DAP.baseHi],0x0
    mov di,5
    pusha
.loop:
    dec di
    cmp di,0
    jz .failed  
    mov si,0x0
    mov ds,si
    mov si,DAP
    mov dl,0x80
    mov ah,0x42
    int 0x13
    jc .loop
    popa
    mov si,RootLoaded
    call Print16
    cli
    hlt
.failed:
    mov al,ah
    add al,48
    mov ah,0eh
    int 0x10
    popa
    cli
    hlt`

Error code returned into ah is 1 that is Incorrect parameter( LBA out of range) but I dumped the registers and all values are correct. Please anyone can tell where the mistake lies. Thanks in advance.

返回到ah的错误代码是1是不正确的参数(LBA超出范围)但是我转储了寄存器并且所有值都是正确的。请任何人都能分辨出错误所在。提前致谢。

1 个解决方案

#1


The mistake was I was using IstRootDirSec Variable as DWORD but it was a word and i have to convert it to DWORD.

错误是我使用IstRootDirSec变量作为DWORD,但它是一个单词,我必须将其转换为DWORD。

xor eax,eax
mov ax,word[IstRootDirSec]
add eax,dword[BPB_HiddSec]

#1


The mistake was I was using IstRootDirSec Variable as DWORD but it was a word and i have to convert it to DWORD.

错误是我使用IstRootDirSec变量作为DWORD,但它是一个单词,我必须将其转换为DWORD。

xor eax,eax
mov ax,word[IstRootDirSec]
add eax,dword[BPB_HiddSec]