feat: usage de bloc de mémoire pour loger la FAT.correction permettant le chargement des fichier a leur taille réelle et correction des buffers pour eviter le debordement de blocs mémoire.

This commit is contained in:
Nicolas Hordé 2004-11-10 12:00:08 +00:00
parent 2dc6857104
commit 537fa9d76d
1 changed files with 42 additions and 22 deletions

View File

@ -97,24 +97,30 @@ AdressDirectory dw 0 ;En cluster
firstsearch dw 1 ;Premiere requete ? firstsearch dw 1 ;Premiere requete ?
getfat: getfat:
push ax bx dx si push ax bx dx si ds gs
mov dx,cs
push cs
pop ds
mov si,offset datafat
mov ah,9
int 49h
mov ax,cx mov ax,cx
mov bx,ax mov bx,ax
and bx,0000000000000001b and bx,0000000000000001b
shr ax,1 shr ax,1
mov cx,3 mov cx,3
mul cx mul cx
mov si,offset bufferfat xor si,si
add si,ax add si,ax
cmp bx,0h cmp bx,0h
jnz evenfat jnz evenfat
oddfat: oddfat:
mov dx,cs:[si] mov dx,gs:[si]
and dx,0FFFh and dx,0FFFh
mov cx,dx mov cx,dx
jmp endfat jmp endfat
evenfat: evenfat:
mov dx,cs:[si+1] mov dx,gs:[si+1]
and dx,0FFF0h and dx,0FFF0h
shr dx,4 shr dx,4
mov cx,dx mov cx,dx
@ -122,11 +128,11 @@ endfat:
cmp dx,0FF0h cmp dx,0FF0h
jbe nocarry jbe nocarry
stc stc
pop si dx bx ax pop gs ds si dx bx ax
ret ret
nocarry: nocarry:
clc clc
pop si dx bx ax pop gs ds si dx bx ax
ret ret
;============loadfile (Fonction 4)=============== ;============loadfile (Fonction 4)===============
@ -229,11 +235,11 @@ projfile:
jc errorload2 jc errorload2
mov eax,cs:tempfit.FileSize mov eax,cs:tempfit.FileSize
mov ecx,eax mov ecx,eax
add ecx,19000 add ecx,100h
push ax push eax
mov ah,2 mov ah,2
int 49h int 49h
pop ax pop eax
jc errorload2 jc errorload2
push gs push gs
pop es pop es
@ -387,6 +393,7 @@ AdjustLast:
mov cx,dx mov cx,dx
push cs push cs
pop ds pop ds
cld
rep movsb rep movsb
zeroload: zeroload:
clc clc
@ -403,7 +410,7 @@ noway:
;<- Flag Carry si erreur ;<- Flag Carry si erreur
;===================================================== ;=====================================================
InitDrive: InitDrive:
push eax bx cx edx di ds es push eax bx cx edx di ds es gs
push cs push cs
pop ds pop ds
push cs push cs
@ -422,9 +429,9 @@ againtry:
dec di dec di
jnz againtry jnz againtry
oknoagaintry: oknoagaintry:
mov cs:lastseg,0 mov lastseg,0
mov cs:lastoff,0 mov lastoff,0
mov cs:LastRead,0 mov LastRead,0
mov ax,myboot.sectorsize mov ax,myboot.sectorsize
mov bl,myboot.SectorsPerCluster mov bl,myboot.SectorsPerCluster
xor bh,bh xor bh,bh
@ -465,9 +472,22 @@ oknoagaintry:
mov adressdirectory,0 mov adressdirectory,0
mov firstsearch,1 mov firstsearch,1
mov currentdirstr,0 mov currentdirstr,0
mov di,offset bufferfat xor eax,eax
mov ax,myboot.SectorsPerFat
mul myboot.SectorSize
shl edx,16
add edx,eax
mov ecx,edx
mov si,offset datafat
mov ah,2
int 49h
mov ah,3
int 49h
xor di,di
mov dx,myboot.SectorsPerFat mov dx,myboot.SectorsPerFat
mov cx,AdressFat mov cx,AdressFat
push gs
pop es
SeeFat: SeeFat:
call readsector call readsector
jc ErrorInit jc ErrorInit
@ -476,13 +496,15 @@ SeeFat:
dec dx dec dx
jnz seefat jnz seefat
clc clc
pop es ds di edx cx bx eax pop gs es ds di edx cx bx eax
ret ret
ErrorInit: ErrorInit:
stc stc
pop es ds di edx cx bx eax pop gs es ds di edx cx bx eax
ret ret
datafat db '/fat',0
;=============FindFirstFile (Fonction 7)============== ;=============FindFirstFile (Fonction 7)==============
;Renvois dans ES:DI un bloc d'info ;Renvois dans ES:DI un bloc d'info
;-> AH=7 ;-> AH=7
@ -1056,10 +1078,8 @@ getdir:
clc clc
ret ret
bufferread db 512 dup (0)
bufferread equ $ bufferwrite db 512 dup (0)
bufferwrite equ $+2048 bufferentry db 512 dup (0)
bufferentry equ $+2048+2048
bufferFat equ $+2048+2048+2048
end start end start