2007-03-14 12:07:54 +01:00
|
|
|
|
model tiny,stdcall
|
|
|
|
|
p486
|
|
|
|
|
locals
|
|
|
|
|
jumps
|
|
|
|
|
codeseg
|
|
|
|
|
option procalign:byte
|
|
|
|
|
|
|
|
|
|
include "..\include\mem.h"
|
|
|
|
|
include "..\include\fat.h"
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2004-11-19 18:14:57 +01:00
|
|
|
|
org 0h
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
header exe <"CE",1,0,0,offset exports,offset imports,,>
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
exporting
|
|
|
|
|
declare readsector
|
|
|
|
|
declare writesector
|
|
|
|
|
declare verifysector
|
|
|
|
|
declare initdrive
|
|
|
|
|
declare loadfile
|
|
|
|
|
declare compressrle
|
|
|
|
|
declare decompressrle
|
|
|
|
|
declare findfirstfile
|
|
|
|
|
declare findnextfile
|
|
|
|
|
declare getfreespace
|
|
|
|
|
declare searchfile
|
|
|
|
|
declare getname
|
|
|
|
|
declare getserial
|
|
|
|
|
declare changedir
|
|
|
|
|
declare readcluster
|
|
|
|
|
declare writecluster
|
|
|
|
|
declare getdir
|
|
|
|
|
declare projfile
|
|
|
|
|
declare execfile
|
|
|
|
|
ende
|
|
|
|
|
|
|
|
|
|
importing
|
|
|
|
|
use SYSTEME,biosprinth
|
|
|
|
|
use SYSTEME,mbfindsb
|
|
|
|
|
use SYSTEME,mbfree
|
|
|
|
|
use SYSTEME,mbcreate
|
|
|
|
|
use SYSTEME,mbresident
|
|
|
|
|
use SYSTEME,mbfind
|
|
|
|
|
use SYSTEME,mbchown
|
|
|
|
|
use SYSTEME,mbloadfuncs
|
2007-03-18 21:39:24 +01:00
|
|
|
|
use SYSTEME,mbloadsection
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endi
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;DPT disquette
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mydpt dpt <>
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
;Secteur de boot
|
2007-03-14 12:07:54 +01:00
|
|
|
|
myboot bootinfo <>
|
|
|
|
|
|
|
|
|
|
;Parametres
|
|
|
|
|
support db 0
|
|
|
|
|
nbbuffer db 0
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
;Donn<6E>es Calcul<75>e
|
|
|
|
|
clustersize dw 0
|
2007-03-14 12:07:54 +01:00
|
|
|
|
tracksperhead dw 0
|
|
|
|
|
drivesize dd 0
|
|
|
|
|
adressboot dw 0
|
|
|
|
|
adressfat dw 0
|
|
|
|
|
adressparent dw 0
|
|
|
|
|
adressdirectory dw 0
|
|
|
|
|
adressdata dw 0
|
|
|
|
|
addingvalue dw 0
|
|
|
|
|
currentdir dw 0 ;En cluster
|
|
|
|
|
currentdirstr db 128 dup (0)
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
PROC getfat near
|
|
|
|
|
uses ax,bx,dx,si,ds,es
|
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
|
|
|
|
|
push cs
|
|
|
|
|
pop es
|
2007-03-23 17:42:51 +01:00
|
|
|
|
call [cs:mbfindsb],offset datafat,cs
|
|
|
|
|
mov es,ax
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov ax,cx
|
|
|
|
|
mov bx,ax
|
|
|
|
|
and bx,0000000000000001b
|
|
|
|
|
shr ax,1
|
|
|
|
|
mov cx,3
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mul cx
|
2007-03-23 17:42:51 +01:00
|
|
|
|
;mov si,offset fatter
|
|
|
|
|
xor si,si
|
2004-06-12 23:34:04 +02:00
|
|
|
|
add si,ax
|
|
|
|
|
cmp bx,0h
|
|
|
|
|
jnz evenfat
|
|
|
|
|
oddfat:
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov ax,[es:si]
|
|
|
|
|
and ax,0FFFh
|
|
|
|
|
mov cx,ax
|
2004-06-12 23:34:04 +02:00
|
|
|
|
jmp endfat
|
|
|
|
|
evenfat:
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov ax,[es:si+1]
|
|
|
|
|
and ax,0FFF0h
|
|
|
|
|
shr ax,4
|
|
|
|
|
mov cx,ax
|
2004-06-12 23:34:04 +02:00
|
|
|
|
endfat:
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cmp ax,0FF0h
|
2004-06-12 23:34:04 +02:00
|
|
|
|
jbe nocarry
|
|
|
|
|
stc
|
|
|
|
|
ret
|
|
|
|
|
nocarry:
|
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp getfat
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;============loadfile===============
|
|
|
|
|
;Charge le fichier ds:%0 en ds:%1 ->ax taille
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;-> AH=4
|
|
|
|
|
;<- Flag Carry si erreur
|
|
|
|
|
;=====================================================
|
2007-03-14 12:07:54 +01:00
|
|
|
|
PROC loadfile FAR
|
2007-03-23 17:42:51 +01:00
|
|
|
|
ARG @name:word,@pointer:word
|
|
|
|
|
LOCAL @@temp:word:48
|
|
|
|
|
USES cx,si,di,ds,es
|
|
|
|
|
push ss
|
|
|
|
|
pop es
|
|
|
|
|
lea di,[@@temp]
|
|
|
|
|
push ds di
|
|
|
|
|
mov si,[@name]
|
|
|
|
|
mov cx,48/4
|
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
|
|
|
|
push ss
|
|
|
|
|
pop ds
|
|
|
|
|
pop di es
|
|
|
|
|
call searchfile,di
|
2004-06-12 23:34:04 +02:00
|
|
|
|
jne errorload
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jc errorload
|
2007-03-23 17:42:51 +01:00
|
|
|
|
mov cx,[(find di).result.filegroup]
|
|
|
|
|
mov eax,[(find di).result.filesize]
|
|
|
|
|
push es
|
|
|
|
|
pop ds
|
2007-03-14 12:07:54 +01:00
|
|
|
|
call loadway,cx,eax,[@pointer]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
jc errorload
|
|
|
|
|
clc
|
|
|
|
|
ret
|
|
|
|
|
errorload:
|
|
|
|
|
stc
|
2007-03-14 12:07:54 +01:00
|
|
|
|
xor eax,eax
|
2004-06-12 23:34:04 +02:00
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp loadfile
|
2004-10-30 21:55:45 +02:00
|
|
|
|
|
|
|
|
|
;============execfile (Fonction 18)===============
|
|
|
|
|
;Execute le fichier ds:si
|
|
|
|
|
;-> AH=18
|
|
|
|
|
;<- Flag Carry si erreur
|
|
|
|
|
;=====================================================
|
2007-03-14 12:07:54 +01:00
|
|
|
|
PROC execfile FAR
|
2007-03-23 17:42:51 +01:00
|
|
|
|
ARG @file:word
|
|
|
|
|
pushad
|
2004-10-30 22:36:00 +02:00
|
|
|
|
push ds es fs gs
|
2007-03-28 23:28:44 +02:00
|
|
|
|
mov di,[@file]
|
|
|
|
|
call uppercase,di
|
|
|
|
|
call projfile,di
|
|
|
|
|
;jc @@reallyerrornoblock
|
|
|
|
|
call [cs:mbfind],di
|
2007-03-18 21:39:24 +01:00
|
|
|
|
jc @@reallyerror
|
2007-03-28 23:28:44 +02:00
|
|
|
|
call [cs:mbchown],ax,[word ptr ss:bp+4]
|
2007-03-18 21:39:24 +01:00
|
|
|
|
jc @@reallyerror
|
|
|
|
|
push ax
|
|
|
|
|
pop ds
|
2007-03-28 23:28:44 +02:00
|
|
|
|
cmp [ds:0x0],'EC'
|
|
|
|
|
jne @@reallyerror
|
|
|
|
|
push ax
|
2007-03-18 21:39:24 +01:00
|
|
|
|
push cs
|
|
|
|
|
push offset @@arrive
|
|
|
|
|
push ds
|
|
|
|
|
push [word ptr (exe).starting]
|
|
|
|
|
push ds
|
|
|
|
|
push ds
|
|
|
|
|
push ds
|
2007-03-23 17:42:51 +01:00
|
|
|
|
pop es
|
2004-10-30 21:55:45 +02:00
|
|
|
|
pop fs
|
|
|
|
|
pop gs
|
|
|
|
|
push 7202h
|
2007-03-23 17:42:51 +01:00
|
|
|
|
xor eax,eax
|
|
|
|
|
xor ebx,ebx
|
|
|
|
|
xor ecx,ecx
|
|
|
|
|
xor edx,edx
|
|
|
|
|
xor esi,esi
|
|
|
|
|
xor edi,edi
|
|
|
|
|
xor ebp,ebp
|
2004-10-30 21:55:45 +02:00
|
|
|
|
popf
|
|
|
|
|
sti
|
|
|
|
|
db 0CBh
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@arrive:
|
2007-03-28 23:28:44 +02:00
|
|
|
|
;cli
|
|
|
|
|
;pop ax
|
|
|
|
|
;call [cs:mbfree],ax
|
|
|
|
|
call [cs:mbfree]
|
2004-10-30 21:55:45 +02:00
|
|
|
|
pop gs fs es ds
|
2007-03-18 21:39:24 +01:00
|
|
|
|
popad
|
2007-03-23 17:42:51 +01:00
|
|
|
|
clc
|
2007-03-18 21:39:24 +01:00
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@reallyerror:
|
2007-03-23 17:42:51 +01:00
|
|
|
|
call [cs:mbfree],ax
|
|
|
|
|
@@reallyerrornoblock:
|
2004-10-30 21:55:45 +02:00
|
|
|
|
pop gs fs es ds
|
2007-03-18 21:39:24 +01:00
|
|
|
|
popad
|
|
|
|
|
stc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp execfile
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2004-10-30 21:25:45 +02:00
|
|
|
|
;============projfile (Fonction 17)===============
|
2007-03-28 23:28:44 +02:00
|
|
|
|
;Charge le fichier ds:%0 sur un bloc m<>moire -> eax taille
|
|
|
|
|
;-> eax taille fichier
|
2004-10-30 21:25:45 +02:00
|
|
|
|
;<- Flag Carry si erreur
|
|
|
|
|
;=====================================================
|
2007-03-14 12:07:54 +01:00
|
|
|
|
PROC projfile FAR
|
|
|
|
|
ARG @pointer:word
|
2007-03-23 17:42:51 +01:00
|
|
|
|
LOCAL @@temp:word:64
|
2007-03-14 12:07:54 +01:00
|
|
|
|
USES cx,si,di,ds,es
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push ss
|
2007-03-14 12:07:54 +01:00
|
|
|
|
pop es
|
2007-03-23 17:42:51 +01:00
|
|
|
|
lea di,[@@temp]
|
|
|
|
|
push di
|
|
|
|
|
mov si,[@pointer]
|
|
|
|
|
mov cx,64/4
|
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
|
|
|
|
push ss
|
|
|
|
|
pop ds
|
|
|
|
|
pop di
|
|
|
|
|
call uppercase,di
|
|
|
|
|
call [cs:mbfind],di
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jnc @@errorload
|
2007-03-23 17:42:51 +01:00
|
|
|
|
call searchfile,di
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jne @@errorload
|
|
|
|
|
jc @@errorload
|
2007-03-23 17:42:51 +01:00
|
|
|
|
mov eax,[es:(find di).result.filesize]
|
|
|
|
|
call [cs:mbcreate],di,ax
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jc @@errorload
|
2007-03-28 23:28:44 +02:00
|
|
|
|
call [cs:mbchown],ax,[word ptr ss:bp+4]
|
|
|
|
|
jc @@errorload
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov ds,ax
|
2007-03-23 17:42:51 +01:00
|
|
|
|
mov cx,[es:(find di).result.filegroup]
|
|
|
|
|
mov eax,[es:(find di).result.filesize]
|
2007-03-14 12:07:54 +01:00
|
|
|
|
call loadway,cx,eax,0
|
|
|
|
|
jc @@errorload
|
2007-03-28 23:28:44 +02:00
|
|
|
|
cmp [ds:0x0],'EC'
|
|
|
|
|
jne @@notace
|
|
|
|
|
call [cs:mbloadfuncs],ds
|
|
|
|
|
jc @@errorload
|
|
|
|
|
call [cs:mbloadsection],ds
|
|
|
|
|
jc @@errorload
|
|
|
|
|
@@notace:
|
2004-10-30 21:25:45 +02:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@errorload:
|
|
|
|
|
xor eax,eax
|
2007-03-23 17:42:51 +01:00
|
|
|
|
stc
|
2004-10-30 21:25:45 +02:00
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp projfile
|
2004-10-30 21:25:45 +02:00
|
|
|
|
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============SearchFile===============
|
|
|
|
|
;Renvois dans ds:%0 et non equal si pas existant
|
|
|
|
|
;->
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;<- Flag Carry si erreur
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;======================================
|
|
|
|
|
PROC searchfile FAR
|
|
|
|
|
ARG @pointer:word
|
|
|
|
|
USES bx,cx,si,di,ds,es
|
|
|
|
|
mov si,[@pointer]
|
|
|
|
|
lea bx,[es:(find si).result]
|
|
|
|
|
call uppercase,si
|
|
|
|
|
call findfirstfile,si
|
|
|
|
|
jc @@errorsearch
|
|
|
|
|
jmp @@founded
|
|
|
|
|
@@nextsearch:
|
|
|
|
|
call findnextfile,si
|
|
|
|
|
jc @@errorsearch
|
|
|
|
|
@@founded:
|
|
|
|
|
cmp [byte ptr bx],0
|
|
|
|
|
je @@notgood
|
|
|
|
|
cmp [byte ptr bx+entries.fileattr],0Fh
|
|
|
|
|
je @@nextsearch
|
|
|
|
|
call cmpnames,si,bx
|
|
|
|
|
jc @@nextsearch
|
|
|
|
|
@@okfound:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@notgood:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cmp si,0FF5h
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@errorsearch:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp searchfile
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;Transforme la chaine ds:%0 en maj
|
2007-03-23 17:42:51 +01:00
|
|
|
|
PROC uppercase FAR
|
2007-03-14 12:07:54 +01:00
|
|
|
|
ARG @strs:word
|
|
|
|
|
USES si,ax
|
|
|
|
|
mov si,[@strs]
|
|
|
|
|
@@uppercaser:
|
|
|
|
|
mov al,[si]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cmp al,0
|
2007-03-14 12:07:54 +01:00
|
|
|
|
je @@enduppercase
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cmp al,'a'
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jb @@nonmaj
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cmp al,'z'
|
2007-03-14 12:07:54 +01:00
|
|
|
|
ja @@nonmaj
|
2004-06-12 23:34:04 +02:00
|
|
|
|
sub al,'a'-'A'
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [si],al
|
|
|
|
|
@@nonmaj:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
inc si
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jmp @@uppercaser
|
|
|
|
|
@@enduppercase:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp uppercase
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;Compare le nom ds:%0 '.' avec ds:%1
|
|
|
|
|
PROC cmpnames FAR
|
|
|
|
|
ARG @off1:word,@off2:word
|
|
|
|
|
USES ax,cx,si,di,es
|
|
|
|
|
mov si,[@off1]
|
|
|
|
|
mov di,[@off2]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
cmp [byte ptr si],"."
|
|
|
|
|
jne @@notaredir
|
|
|
|
|
cmp [word ptr si],".."
|
|
|
|
|
jne @@onlyonedir
|
|
|
|
|
cmp [word ptr di],".."
|
|
|
|
|
je @@itok
|
|
|
|
|
jmp @@notequal
|
|
|
|
|
@@onlyonedir:
|
|
|
|
|
cmp [word ptr di]," ."
|
|
|
|
|
je @@itok
|
|
|
|
|
@@notaredir:
|
2007-03-14 12:07:54 +01:00
|
|
|
|
push ds
|
2007-03-23 17:42:51 +01:00
|
|
|
|
pop es
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov cx,8
|
|
|
|
|
repe cmpsb
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jne @@nequal
|
2004-06-12 23:34:04 +02:00
|
|
|
|
inc si
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jmp @@equal
|
|
|
|
|
@@nequal:
|
|
|
|
|
cmp [byte ptr es:di-1],' '
|
|
|
|
|
jne @@notequal
|
|
|
|
|
@@equal:
|
|
|
|
|
cmp [byte ptr si-1],'.'
|
|
|
|
|
jne @@trynoext
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov al,' '
|
|
|
|
|
rep scasb
|
|
|
|
|
mov cx,3
|
|
|
|
|
rep cmpsb
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jne @@nequal2
|
2004-11-19 19:57:45 +01:00
|
|
|
|
inc si
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jmp @@equal2
|
|
|
|
|
@@nequal2:
|
|
|
|
|
cmp [byte ptr es:di-1],' '
|
|
|
|
|
jne @@notequal
|
|
|
|
|
@@equal2:
|
|
|
|
|
cmp [byte ptr si-1],0
|
|
|
|
|
jne @@notequal
|
|
|
|
|
@@itok:
|
|
|
|
|
clc
|
2004-06-12 23:34:04 +02:00
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@notequal:
|
2004-11-19 19:57:45 +01:00
|
|
|
|
stc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@trynoext:
|
|
|
|
|
cmp [byte ptr si-1],0
|
|
|
|
|
jne @@notequal
|
|
|
|
|
jmp @@itok
|
|
|
|
|
endp cmpnames
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-28 23:28:44 +02:00
|
|
|
|
;charge le fichier de de groupe %0 et de taille %1
|
2007-03-14 12:07:54 +01:00
|
|
|
|
PROC loadway NEAR
|
|
|
|
|
ARG @sector:word,@size:dword,@offset:word
|
|
|
|
|
USES eax,bx,cx,dx,si,di,ds,es
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
mov eax,[@size]
|
|
|
|
|
cmp eax,0
|
|
|
|
|
je @@zeroload
|
|
|
|
|
rol eax,16
|
|
|
|
|
mov dx,ax
|
|
|
|
|
ror eax,16
|
|
|
|
|
div [cs:clustersize]
|
|
|
|
|
mov bx,ax
|
|
|
|
|
mov cx,[@sector]
|
|
|
|
|
mov di,[@offset]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
cmp bx,1
|
|
|
|
|
jb @@adjustlast
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@loadfat:
|
|
|
|
|
call readcluster,cx,di
|
|
|
|
|
jc @@noway
|
|
|
|
|
add di,[cs:clustersize]
|
|
|
|
|
call getfat
|
|
|
|
|
dec bx
|
|
|
|
|
jnz @@loadfat
|
|
|
|
|
@@adjustlast:
|
|
|
|
|
cmp dx,0
|
|
|
|
|
je @@zeroload
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push cs
|
2007-03-14 12:07:54 +01:00
|
|
|
|
pop ds
|
|
|
|
|
mov si,offset bufferread
|
|
|
|
|
call readcluster,cx,si
|
|
|
|
|
jc @@noway
|
|
|
|
|
mov cx,dx
|
2004-11-10 13:00:08 +01:00
|
|
|
|
cld
|
2004-06-12 23:34:04 +02:00
|
|
|
|
rep movsb
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@zeroload:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@noway:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp loadway
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============INITDRIVE===============
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;Initialise le lecteur pour une utilisation ult<6C>rieure
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;->
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;<- Flag Carry si erreur
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=====================================
|
|
|
|
|
PROC initdrive FAR
|
|
|
|
|
USES eax,bx,cx,edx,si,di,ds,es
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
push cs
|
|
|
|
|
pop es
|
|
|
|
|
mov di,3
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@againtry:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xor ax,ax
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov dl,[support]
|
|
|
|
|
xor dh,dh
|
2004-06-12 23:34:04 +02:00
|
|
|
|
int 13h
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov bx,offset bufferread
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov ax,0201h
|
|
|
|
|
mov cx,0001h
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov dl,[support]
|
|
|
|
|
xor dh,dh
|
2004-06-12 23:34:04 +02:00
|
|
|
|
int 13h
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jnc @@oknoagaintry
|
2004-06-12 23:34:04 +02:00
|
|
|
|
dec di
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jnz @@againtry
|
|
|
|
|
@@oknoagaintry:
|
|
|
|
|
mov si,offset bufferread+3
|
|
|
|
|
mov di,offset myboot
|
|
|
|
|
mov cx,size myboot
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov ax,[myboot.sectorsize]
|
|
|
|
|
mov bl,[myboot.sectorspercluster]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xor bh,bh
|
|
|
|
|
mul bx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [clustersize],ax
|
|
|
|
|
mov bx,[myboot.hiddensectorsl]
|
|
|
|
|
adc bx,[myboot.hiddensectorsh]
|
|
|
|
|
mov [adressboot],bx
|
|
|
|
|
add bx,[myboot.reservedsectors]
|
|
|
|
|
mov [adressfat],bx
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xor ax,ax
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov al,[myboot.fatsperdrive]
|
|
|
|
|
mul [myboot.sectorsperfat]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
add bx,ax
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [adressparent],bx
|
|
|
|
|
mov [adressdirectory],bx
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov ax,32
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mul [myboot.directorysize]
|
|
|
|
|
div [myboot.sectorsize]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
add bx,ax
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [adressdata],bx
|
2004-06-12 23:34:04 +02:00
|
|
|
|
sub bx,2
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [addingvalue],bx
|
|
|
|
|
mov ax,[myboot.sectorsperdrive]
|
|
|
|
|
div [myboot.sectorspertrack]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xor dx,dx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
div [myboot.headsperdrive]
|
|
|
|
|
mov [tracksperhead],ax
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xor eax,eax
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov ax,[myboot.sectorsperdrive]
|
|
|
|
|
sub ax,[adressdata]
|
|
|
|
|
mul [myboot.sectorsize]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
shl edx,16
|
|
|
|
|
add edx,eax
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [drivesize],edx
|
|
|
|
|
mov [currentdir],0
|
|
|
|
|
mov [adressdirectory],0
|
|
|
|
|
mov [currentdirstr],0
|
2004-11-10 13:00:08 +01:00
|
|
|
|
xor eax,eax
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov ax,[myboot.sectorsperfat]
|
|
|
|
|
mul [myboot.sectorsize]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
call [cs:mbfindsb],offset datafat,cs
|
|
|
|
|
jnc @@hadafatbloc
|
|
|
|
|
call [cs:mbcreate],offset datafat,ax
|
|
|
|
|
jc @@errorinit
|
|
|
|
|
call [cs:mbresident],ax
|
|
|
|
|
jc @@errorinit
|
|
|
|
|
call [cs:mbchown],ax,cs
|
|
|
|
|
jc @@errorinit
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@hadafatbloc:
|
|
|
|
|
mov dx,[myboot.sectorsperfat]
|
|
|
|
|
mov cx,[adressfat]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
xor di,di
|
|
|
|
|
;mov di,offset fatter
|
|
|
|
|
mov ds,ax
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@seefat:
|
|
|
|
|
call readsector,cx,di
|
|
|
|
|
jc @@errorinit
|
|
|
|
|
add di,[cs:myboot.sectorsize]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
inc cx
|
|
|
|
|
dec dx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jnz @@seefat
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@errorinit:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp initdrive
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
datafat db '/fat',0
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============FindFirstFile==============
|
|
|
|
|
;Renvois dans DS:%1 un bloc d'info
|
|
|
|
|
;->
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;<- Flag Carry si erreur
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;========================================
|
|
|
|
|
PROC findfirstfile FAR
|
|
|
|
|
ARG @pointer:word
|
|
|
|
|
USES cx,si
|
|
|
|
|
mov si,[@pointer]
|
|
|
|
|
mov cx,[cs:currentdir]
|
|
|
|
|
mov [(find si).adressdirectory],cx
|
|
|
|
|
xor cx,cx
|
|
|
|
|
mov [(find si).entryplace],cx
|
|
|
|
|
mov [(find si).firstsearch],1
|
|
|
|
|
call findnextfile,[@pointer]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp findfirstfile
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============FindnextFile==============
|
|
|
|
|
;Renvois dans DS:%0 un bloc d'info
|
|
|
|
|
;->
|
|
|
|
|
;<- Flag Carry si erreur
|
|
|
|
|
;=======================================
|
|
|
|
|
PROC findnextfile FAR
|
|
|
|
|
ARG @pointer:word
|
|
|
|
|
USES ax,bx,cx,di,si,ds,es
|
|
|
|
|
push cs
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
pop ds
|
|
|
|
|
mov si,[@pointer]
|
|
|
|
|
mov cx,[es:(find si).adressdirectory]
|
|
|
|
|
mov bx,[es:(find si).entryplace]
|
|
|
|
|
@@findnextfileagain:
|
|
|
|
|
cmp [es:(find si).firstsearch],1
|
|
|
|
|
je @@first
|
|
|
|
|
add bx,size entries
|
|
|
|
|
cmp bx,[cs:clustersize]
|
|
|
|
|
jb @@nopop
|
|
|
|
|
@@first:
|
|
|
|
|
mov di,offset bufferentry
|
|
|
|
|
mov bx,0
|
|
|
|
|
cmp [cs:currentdir],0
|
|
|
|
|
jne @@notrootdir
|
|
|
|
|
cmp [es:(find si).firstsearch],1
|
|
|
|
|
je @@noaddfirst1
|
2004-06-12 23:34:04 +02:00
|
|
|
|
inc cx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@noaddfirst1:
|
|
|
|
|
add cx,[cs:adressparent]
|
|
|
|
|
mov al,[cs:myboot.sectorspercluster]
|
|
|
|
|
@@readroot:
|
|
|
|
|
call readsector,cx,di
|
|
|
|
|
jc @@notwell
|
|
|
|
|
add di,[cs:myboot.sectorsize]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
dec al
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jnz @@readroot
|
|
|
|
|
sub cx,[cs:adressparent]
|
|
|
|
|
jmp @@nopop
|
|
|
|
|
@@notrootdir:
|
|
|
|
|
cmp [es:(find si).firstsearch],1
|
|
|
|
|
je @@noaddfirst2
|
2004-06-12 23:34:04 +02:00
|
|
|
|
call getfat
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@noaddfirst2:
|
|
|
|
|
jc @@notwell
|
|
|
|
|
call readcluster,cx,di
|
|
|
|
|
jc @@notwell
|
|
|
|
|
@@nopop:
|
|
|
|
|
mov [es:(find si).firstsearch],0
|
|
|
|
|
mov di,offset bufferentry
|
|
|
|
|
add di,bx
|
|
|
|
|
cmp [byte ptr di],0
|
|
|
|
|
je @@notwell
|
|
|
|
|
mov [es:(find si).entryplace],bx
|
|
|
|
|
mov [es:(find si).adressdirectory],cx
|
|
|
|
|
cmp [byte ptr di],0E5h
|
|
|
|
|
je @@findnextfileagain
|
|
|
|
|
cmp [byte ptr di+entries.fileattr],28h
|
|
|
|
|
je @@findnextfileagain
|
|
|
|
|
cmp [byte ptr di+entries.fileattr],0Fh
|
|
|
|
|
je @@findnextfileagain
|
|
|
|
|
mov si,di
|
|
|
|
|
mov di,[@pointer]
|
|
|
|
|
lea di,[es:(find di).result]
|
|
|
|
|
mov cx,size entries
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@notwell:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp findnextfile
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============GetFreeSpace===============
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;Renvoie en EDX l'espace disque libre du volume
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;->
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;<- Flag Carry si erreur
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;========================================
|
|
|
|
|
PROC getfreespace FAR
|
|
|
|
|
USES eax,bx
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xor eax,eax
|
|
|
|
|
call getsector
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mul [cs:myboot.sectorsize]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
shl edx,16
|
|
|
|
|
add edx,eax
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp getfreespace
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
;ax=d<>fectueux bx=libre
|
2007-03-14 12:07:54 +01:00
|
|
|
|
getsector:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push cx dx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov dx,[cs:myboot.sectorsperdrive]
|
|
|
|
|
sub dx,[cs:addingvalue]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xor ax,ax
|
|
|
|
|
xor bx,bx
|
|
|
|
|
mov cx,0
|
|
|
|
|
goget:
|
|
|
|
|
push cx
|
|
|
|
|
call getfat
|
|
|
|
|
cmp cx,0FF7h
|
|
|
|
|
jne notdefect
|
|
|
|
|
inc bx
|
|
|
|
|
notdefect:
|
|
|
|
|
cmp cx,0
|
|
|
|
|
jne notfree
|
|
|
|
|
inc ax
|
|
|
|
|
notfree:
|
|
|
|
|
pop cx
|
|
|
|
|
inc cx
|
|
|
|
|
dec dx
|
|
|
|
|
jnz goget
|
|
|
|
|
pop dx cx
|
|
|
|
|
ret
|
|
|
|
|
errorfree:
|
|
|
|
|
stc
|
|
|
|
|
pop dx cx
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============READCLUSTER===============
|
|
|
|
|
;Lit le secteur %0 et le met en ds:%1
|
|
|
|
|
;->
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;<- Flag Carry si erreur
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=======================================
|
|
|
|
|
PROC readcluster FAR
|
|
|
|
|
ARG @sector:word,@pointer:word
|
|
|
|
|
USES ax,bx,dx,si
|
2007-03-23 17:42:51 +01:00
|
|
|
|
mov al,[cs:myboot.sectorspercluster]
|
|
|
|
|
xor ah,ah
|
|
|
|
|
mov bx,ax
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mul [@sector]
|
|
|
|
|
add ax,[cs:addingvalue]
|
|
|
|
|
mov si,[@pointer]
|
|
|
|
|
@@readsectors:
|
|
|
|
|
call readsector,ax,si
|
|
|
|
|
jc @@errorreadincluster
|
|
|
|
|
add si,[cs:myboot.sectorsize]
|
|
|
|
|
inc ax
|
|
|
|
|
dec bx
|
|
|
|
|
jnz @@readsectors
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@errorreadincluster:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp readcluster
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============WRITECLUSTER===============
|
|
|
|
|
;Ecrit le cluster %0 et le met en ds:%1
|
|
|
|
|
;->
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;<- Flag Carry si erreur
|
|
|
|
|
;=====================================================
|
2007-03-14 12:07:54 +01:00
|
|
|
|
PROC writecluster FAR
|
|
|
|
|
ARG @sector:word,@pointer:word
|
|
|
|
|
USES ax,bx,dx,si
|
2007-03-23 17:42:51 +01:00
|
|
|
|
mov al,[cs:myboot.sectorspercluster]
|
|
|
|
|
xor ah,ah
|
|
|
|
|
mov bx,ax
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mul [@sector]
|
|
|
|
|
add ax,[cs:addingvalue]
|
|
|
|
|
mov si,[@pointer]
|
|
|
|
|
@@writesectors:
|
|
|
|
|
call writesector,ax,si
|
|
|
|
|
jc @@errorwriteincluster
|
|
|
|
|
add si,[cs:myboot.sectorsize]
|
|
|
|
|
inc ax
|
2004-06-12 23:34:04 +02:00
|
|
|
|
dec bx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jnz @@writesectors
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@errorwriteincluster:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp writecluster
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============READSECTOR===============
|
|
|
|
|
;Lit le secteur %0 et le met en ds:%1
|
|
|
|
|
;->
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;<- Flag Carry si erreur
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;======================================
|
|
|
|
|
PROC readsector FAR
|
|
|
|
|
ARG @sector:word,@pointer:word
|
|
|
|
|
USES ax,bx,cx,dx,si,es
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
mov ax,[@sector]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xor dx,dx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
div [cs:myboot.sectorspertrack]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
inc dl
|
|
|
|
|
mov bl,dl
|
|
|
|
|
xor dx,dx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
div [cs:myboot.headsperdrive]
|
|
|
|
|
mov dh,[cs:support]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xchg dl,dh
|
|
|
|
|
mov cx,ax
|
|
|
|
|
xchg cl,ch
|
|
|
|
|
shl cl,6
|
|
|
|
|
or cl,bl
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov bx,[@pointer]
|
|
|
|
|
mov si,4
|
|
|
|
|
mov al,1
|
|
|
|
|
@@tryagain:
|
|
|
|
|
mov ah, 2
|
2004-06-12 23:34:04 +02:00
|
|
|
|
int 13h
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jnc @@done
|
|
|
|
|
dec si
|
|
|
|
|
jnz @@tryagain
|
|
|
|
|
@@done:
|
|
|
|
|
ret
|
|
|
|
|
endp readsector
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============WRITESECTOR============
|
|
|
|
|
;Ecrit le secteur %0 point<6E> par ds:%0
|
|
|
|
|
;->
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;<- Flag Carry si erreur
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;====================================
|
|
|
|
|
PROC writesector FAR
|
|
|
|
|
ARG @sector:word,@pointer:word
|
|
|
|
|
USES ax,bx,cx,dx,si,es
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
mov ax,[@sector]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xor dx,dx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
div [cs:myboot.sectorspertrack]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
inc dl
|
|
|
|
|
mov bl,dl
|
|
|
|
|
xor dx,dx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
div [cs:myboot.headsperdrive]
|
|
|
|
|
mov dh,[cs:support]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xchg dl,dh
|
|
|
|
|
mov cx,ax
|
|
|
|
|
xchg cl,ch
|
|
|
|
|
shl cl,6
|
|
|
|
|
or cl, bl
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov bx,[@pointer]
|
|
|
|
|
mov si,4
|
|
|
|
|
mov al,1
|
|
|
|
|
@@tryagain:
|
|
|
|
|
mov ah, 3
|
2004-06-12 23:34:04 +02:00
|
|
|
|
int 13h
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jnc @@done
|
|
|
|
|
dec si
|
|
|
|
|
jnz @@tryagain
|
|
|
|
|
@@done:
|
|
|
|
|
ret
|
|
|
|
|
endp writesector
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============Getname==============
|
|
|
|
|
;Renvoie le nom en DS:%0
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;-> AH=11
|
|
|
|
|
;<- Flag Carry si erreur
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;==================================
|
|
|
|
|
PROC getname FAR
|
|
|
|
|
ARG @pointer:word
|
|
|
|
|
USES ax,cx,si,di,ds,es
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
push cs
|
2004-06-12 23:34:04 +02:00
|
|
|
|
pop ds
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov di,[@pointer]
|
|
|
|
|
mov si,offset myboot.drivename
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov cx,11
|
|
|
|
|
rep movsb
|
|
|
|
|
mov al,' '
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov di,[@pointer]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov cx,11
|
|
|
|
|
repne scasb
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [byte ptr es:di],0
|
2004-06-12 23:34:04 +02:00
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp getname
|
|
|
|
|
;=============Getserial==============
|
|
|
|
|
;Renvoie le num<75>ro de serie en EAX
|
|
|
|
|
;->
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;<- Flag Carry si erreur
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;====================================
|
|
|
|
|
PROC getserial FAR
|
|
|
|
|
mov eax,[cs:myboot.serialnumber]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp getserial
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============VERIFYSECTOR==============
|
|
|
|
|
;V<>rifie le secteur %0
|
|
|
|
|
;->
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;<- Flag Carry si erreur, Flag Equal si secteurs <20>gaux
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=======================================
|
|
|
|
|
PROC verifysector FAR
|
2007-03-25 01:13:54 +01:00
|
|
|
|
ARG @sector:word
|
2007-03-14 12:07:54 +01:00
|
|
|
|
USES ecx,si,di,ds,es
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push cs
|
|
|
|
|
pop es
|
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
2004-11-05 01:57:03 +01:00
|
|
|
|
mov si,offset bufferread
|
2007-03-14 12:07:54 +01:00
|
|
|
|
call readsector,cx,si
|
2007-03-25 01:13:54 +01:00
|
|
|
|
call inverse
|
2007-03-14 12:07:54 +01:00
|
|
|
|
call writesector,cx,si
|
|
|
|
|
jc @@errorverify
|
2004-11-05 01:57:03 +01:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov si,offset bufferwrite
|
|
|
|
|
call readsector,cx,si
|
2007-03-25 01:13:54 +01:00
|
|
|
|
call inverse
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jc @@errorverify
|
2004-11-05 01:57:03 +01:00
|
|
|
|
|
|
|
|
|
mov si,offset bufferread
|
2007-03-25 01:13:54 +01:00
|
|
|
|
call inverse
|
2007-03-14 12:07:54 +01:00
|
|
|
|
call writesector,cx,si
|
|
|
|
|
jc @@errorverify
|
2004-11-05 01:57:03 +01:00
|
|
|
|
|
|
|
|
|
xor ecx,ecx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov cx,[cs:myboot.sectorsize]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
shr cx,2
|
|
|
|
|
mov si,offset bufferread
|
|
|
|
|
mov di,offset bufferwrite
|
|
|
|
|
cld
|
|
|
|
|
rep cmpsd
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@errorverify:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
ret
|
|
|
|
|
|
2007-03-25 01:13:54 +01:00
|
|
|
|
endp verifysector
|
|
|
|
|
|
|
|
|
|
inverse:
|
|
|
|
|
push si cx
|
2004-11-05 01:57:03 +01:00
|
|
|
|
xor cx,cx
|
2007-03-25 01:13:54 +01:00
|
|
|
|
invert:
|
2007-03-14 12:07:54 +01:00
|
|
|
|
not [dword ptr si]
|
2004-11-05 01:57:03 +01:00
|
|
|
|
add si,4
|
|
|
|
|
add cx,4
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cmp cx,[cs:myboot.sectorsize]
|
2007-03-25 01:13:54 +01:00
|
|
|
|
jb invert
|
2004-11-05 01:57:03 +01:00
|
|
|
|
pop cx si
|
2004-06-12 23:34:04 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;=============DecompressRle (Fonction 05H)==============
|
|
|
|
|
;decompress ds:si en es:di taille bp d<>compress<73> cx compress<73>
|
|
|
|
|
;-> AH=5
|
|
|
|
|
;<- Flag Carry si erreur, Flag Equal si secteurs <20>gaux
|
|
|
|
|
;=====================================================
|
2007-03-28 17:53:26 +02:00
|
|
|
|
PROC decompressrle FAR
|
|
|
|
|
ARG @seg1:word,@off1:word,@seg2:word,@off2:word,@size:word
|
2007-03-28 23:28:44 +02:00
|
|
|
|
USES ecx,dx,si,di,ds,es
|
2007-03-28 17:53:26 +02:00
|
|
|
|
mov ds,[@seg1]
|
|
|
|
|
mov es,[@seg2]
|
|
|
|
|
mov si,[@off1]
|
|
|
|
|
mov di,[@off2]
|
|
|
|
|
mov dx,[@size]
|
|
|
|
|
@@decompression:
|
|
|
|
|
mov eax,[ds:si]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cmp al,'/'
|
2007-03-28 17:53:26 +02:00
|
|
|
|
jne @@nocomp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cmp si,07FFFh-6
|
2007-03-28 17:53:26 +02:00
|
|
|
|
jae @@thenen
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov ecx,eax
|
|
|
|
|
ror ecx,16
|
|
|
|
|
cmp cl,'*'
|
2007-03-28 17:53:26 +02:00
|
|
|
|
jne @@nocomp
|
|
|
|
|
cmp [byte ptr ds:si+4],'/'
|
|
|
|
|
jne @@nocomp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov al,ch
|
|
|
|
|
mov cl,ah
|
|
|
|
|
xor ah,ah
|
|
|
|
|
xor ch,ch
|
2004-11-05 01:57:03 +01:00
|
|
|
|
cld
|
2004-06-12 23:34:04 +02:00
|
|
|
|
rep stosb
|
|
|
|
|
add si,5
|
|
|
|
|
sub dx,5
|
2007-03-28 17:53:26 +02:00
|
|
|
|
jnz @@decompression
|
|
|
|
|
jmp @@thenen
|
|
|
|
|
@@nocomp:
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [es:di],al
|
2004-06-12 23:34:04 +02:00
|
|
|
|
inc si
|
|
|
|
|
inc di
|
|
|
|
|
dec dx
|
2007-03-28 17:53:26 +02:00
|
|
|
|
jnz @@decompression
|
|
|
|
|
@@thenen:
|
2007-03-28 23:28:44 +02:00
|
|
|
|
xor eax,eax
|
2007-03-28 17:53:26 +02:00
|
|
|
|
mov ax,di
|
|
|
|
|
sub ax,[@off2]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-28 17:53:26 +02:00
|
|
|
|
endp decompressrle
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
;=============CompressRle (Fonction 06H)==============
|
|
|
|
|
;compress ds:si en es:di taille cx d<>compress<73> BP compress<73>
|
|
|
|
|
;-> AH=6
|
|
|
|
|
;<- Flag Carry si erreur, Flag Equal si secteurs <20>gaux
|
|
|
|
|
;=====================================================
|
2007-03-28 17:53:26 +02:00
|
|
|
|
PROC compressrle FAR
|
|
|
|
|
ARG @seg1:word,@off1:word,@seg2:word,@off2:word,@size:word
|
|
|
|
|
USES ax,bx,cx,dx,si,di,ds,es
|
|
|
|
|
mov es,[@seg1]
|
|
|
|
|
mov ds,[@seg2]
|
|
|
|
|
mov di,[@off1]
|
|
|
|
|
mov si,[@off2]
|
|
|
|
|
mov dx,[@size]
|
|
|
|
|
@@againcomp:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov bx,di
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov al,[es:di]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov cx,dx
|
|
|
|
|
cmp ch,0
|
2007-03-28 17:53:26 +02:00
|
|
|
|
je @@poo
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov cl,0ffh
|
|
|
|
|
;mov cx,bp
|
|
|
|
|
;sub cx,di
|
|
|
|
|
;mov ah,cl
|
2007-03-28 17:53:26 +02:00
|
|
|
|
@@poo:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov ah,cl
|
|
|
|
|
inc di
|
|
|
|
|
xor ch,ch
|
|
|
|
|
repe scasb
|
|
|
|
|
sub cl,ah
|
|
|
|
|
neg cl
|
|
|
|
|
cmp cl,6
|
2007-03-28 17:53:26 +02:00
|
|
|
|
jbe @@nocomp2
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [dword ptr si],' * /'
|
|
|
|
|
mov [byte ptr si+4],'/'
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov [si+1],cl
|
|
|
|
|
mov [si+3],al
|
|
|
|
|
add si,5
|
|
|
|
|
dec di
|
|
|
|
|
xor ch,ch
|
|
|
|
|
sub dx,cx
|
2007-03-28 17:53:26 +02:00
|
|
|
|
jnz @@againcomp
|
|
|
|
|
jmp @@fini
|
|
|
|
|
@@nocomp2:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov [si],al
|
|
|
|
|
inc si
|
|
|
|
|
inc bx
|
|
|
|
|
mov di,bx
|
|
|
|
|
dec dx
|
2007-03-28 17:53:26 +02:00
|
|
|
|
jnz @@againcomp
|
|
|
|
|
@@fini:
|
|
|
|
|
mov ax,si
|
|
|
|
|
sub ax,[@off2]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-28 17:53:26 +02:00
|
|
|
|
endp compressrle
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
;=============Changedir (Fonction 13)==============
|
|
|
|
|
;Change le repertoire courant a DS:SI
|
|
|
|
|
;-> AH=13
|
|
|
|
|
;<- Flag Carry si erreur, Flag Equal si secteurs <20>gaux
|
|
|
|
|
;=====================================================
|
2007-03-14 12:07:54 +01:00
|
|
|
|
PROC changedir FAR
|
2007-03-23 17:42:51 +01:00
|
|
|
|
ARG @pointer:word
|
|
|
|
|
LOCAL @@temp:word:64
|
|
|
|
|
USES cx,si,di,ds,es
|
|
|
|
|
push ss
|
|
|
|
|
pop es
|
|
|
|
|
lea di,[@@temp]
|
|
|
|
|
push di
|
|
|
|
|
mov si,[@pointer]
|
|
|
|
|
mov cx,64/4
|
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
|
|
|
|
push ss
|
|
|
|
|
pop ds
|
|
|
|
|
pop di
|
|
|
|
|
call searchfile,di
|
|
|
|
|
jne @@noch
|
|
|
|
|
jc @@noch
|
|
|
|
|
;cmp [si],005Ch ;'/',0 (root dir)
|
|
|
|
|
mov cx,[es:(find di).result.filegroup]
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [cs:currentdir],cx
|
|
|
|
|
mov [cs:adressdirectory],cx
|
2007-03-23 17:42:51 +01:00
|
|
|
|
cmp [dword ptr es:(find di).result.filename],' .'
|
2007-03-14 12:07:54 +01:00
|
|
|
|
je @@theend
|
2007-03-23 17:42:51 +01:00
|
|
|
|
cmp [dword ptr es:(find di).result.filename],' ..'
|
|
|
|
|
jne @@notback
|
|
|
|
|
push cs
|
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
pop es
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov di,offset currentdirstr
|
|
|
|
|
mov cx,128
|
|
|
|
|
mov al,0
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cld
|
2004-06-12 23:34:04 +02:00
|
|
|
|
repne scasb
|
2007-03-23 17:42:51 +01:00
|
|
|
|
mov al,'/'
|
2004-06-12 23:34:04 +02:00
|
|
|
|
std
|
|
|
|
|
repne scasb
|
|
|
|
|
inc di
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [byte ptr es:di],0
|
|
|
|
|
jmp @@theend
|
|
|
|
|
@@notback:
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push cs
|
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
pop es
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov di,offset currentdirstr
|
|
|
|
|
mov cx,128
|
|
|
|
|
mov al,0
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cld
|
2004-06-12 23:34:04 +02:00
|
|
|
|
repne scasb
|
|
|
|
|
dec di
|
2007-03-23 17:42:51 +01:00
|
|
|
|
mov al,'/'
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cld
|
|
|
|
|
stosb
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov dx,di
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push ss
|
2004-06-12 23:34:04 +02:00
|
|
|
|
pop es
|
2007-03-23 17:42:51 +01:00
|
|
|
|
lea di,[@@temp]
|
|
|
|
|
mov si,di
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov cx,128
|
|
|
|
|
mov al,0
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cld
|
|
|
|
|
repne scasb
|
2004-06-12 23:34:04 +02:00
|
|
|
|
sub cx,128
|
|
|
|
|
neg cx
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push ss
|
|
|
|
|
pop ds
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push cs
|
|
|
|
|
pop es
|
|
|
|
|
mov di,dx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
@@theend:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@noch:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp changedir
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============getdir==============
|
|
|
|
|
;Recupere le repertoire courant a DS:%0
|
|
|
|
|
;->
|
2004-06-12 23:34:04 +02:00
|
|
|
|
;<- Flag Carry si erreur
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=================================
|
|
|
|
|
PROC getdir FAR
|
|
|
|
|
ARG @pointer:word
|
|
|
|
|
USES ax,cx,si,di,ds,es
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push cs
|
|
|
|
|
pop es
|
|
|
|
|
mov di,offset currentdirstr
|
|
|
|
|
mov cx,128
|
|
|
|
|
mov al,0
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cld
|
2004-06-12 23:34:04 +02:00
|
|
|
|
repne scasb
|
|
|
|
|
sub cx,128
|
|
|
|
|
neg cx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
mov si,offset currentdirstr
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov di,[@pointer]
|
|
|
|
|
cld
|
2004-06-12 23:34:04 +02:00
|
|
|
|
rep movsb
|
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp getdir
|
2004-11-10 13:00:08 +01:00
|
|
|
|
|
|
|
|
|
bufferread db 512 dup (0)
|
|
|
|
|
bufferwrite db 512 dup (0)
|
|
|
|
|
bufferentry db 512 dup (0)
|
2007-03-23 17:42:51 +01:00
|
|
|
|
;fatter db 9*512 dup (0)
|