This commit is contained in:
ridethepig 2022-09-21 22:15:05 +08:00
parent a0dacc4b9e
commit 274d517426
2 changed files with 6 additions and 6 deletions

Binary file not shown.

View File

@ -222,23 +222,23 @@ FuncFindFile:
mov word [RootDirSectorNow], SectorNoOfRootDirectory mov word [RootDirSectorNow], SectorNoOfRootDirectory
mov word [LeftRootDirSectors], RootDirSectors mov word [LeftRootDirSectors], RootDirSectors
.FindLoaderInRootDir: .FindLoaderInRootDir:
mov ax, [RootDirSectorNow]; ax <- 现在正在搜索的扇区号 mov ax, [RootDirSectorNow] ; ax <- 现在正在搜索的扇区号
mov bx, OffsetOfSectorBuf ; es:bx = BaseOfSectorBuf:OffsetOfSectorBuf mov bx, OffsetOfSectorBuf ; es:bx = BaseOfSectorBuf:OffsetOfSectorBuf
mov cx, 1 mov cx, 1
call ReadSector call ReadSector
mov si, [bp + 4] ; ds:si -> "LOADER BIN" mov si, [bp + 4] ; ds:si
mov di, OffsetOfSectorBuf ; es:di -> BaseOfSectorBuf:400h = BaseOfSectorBuf*10h+400h mov di, OffsetOfSectorBuf ; es:di -> BaseOfSectorBuf:400h = BaseOfSectorBuf*10h+400h
mov dx, 10h ; 32(目录项大小) * 16(dx) = 512(BPB_BytsPerSec) mov dx, 10h ; 32(目录项大小) * 16(dx) = 512(BPB_BytsPerSec)
.CompareFilename: .CompareFilename:
call StringCmp call StringCmp
cmp ax, 1 cmp ax, 1
jz .LoaderFound ; ax == 1 -> 比对成了 jz .LoaderFound ; ax == 1 -> 比对成了
dec dx dec dx
cmp dx, 0 cmp dx, 0
jz .GotoNextRootDirSector ; 该扇区的所有目录项都探索完了,去探索下一个扇区 jz .GotoNextRootDirSector ; 该扇区的所有目录项都探索完了,去探索下一个扇区
add di, 20h ; 32 -> 目录项大小 add di, 20h ; 32 -> 目录项大小
jmp .CompareFilename jmp .CompareFilename
.GotoNextRootDirSector: .GotoNextRootDirSector: