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
|
|
|
|
|
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
|
|
|
|
|
;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
|
|
|
|
|
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
|
|
|
|
|
ARG @name:word,@pointer:word
|
|
|
|
|
USES cx,si,di
|
|
|
|
|
mov si,[@name]
|
|
|
|
|
call searchfile,si
|
2004-06-12 23:34:04 +02:00
|
|
|
|
jne errorload
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jc errorload
|
|
|
|
|
mov cx,[(find si).result.filegroup]
|
|
|
|
|
mov eax,[(find si).result.filesize]
|
|
|
|
|
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
|
2004-10-30 21:55:45 +02:00
|
|
|
|
pushf
|
2004-10-31 12:44:57 +01:00
|
|
|
|
push bp dx
|
|
|
|
|
mov bp,sp
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov dx,[ss:bp+10]
|
2004-10-31 12:44:57 +01:00
|
|
|
|
pushad
|
2004-10-30 22:36:00 +02:00
|
|
|
|
push ds es fs gs
|
|
|
|
|
call projfile
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jc @@reallyerror
|
2004-10-31 12:44:57 +01:00
|
|
|
|
push es
|
|
|
|
|
pop gs
|
|
|
|
|
mov ah,6
|
|
|
|
|
int 49h
|
2004-11-19 20:57:43 +01:00
|
|
|
|
mov ah,12
|
|
|
|
|
int 49h
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jc @@reallyerror
|
2004-10-31 10:30:14 +01:00
|
|
|
|
push es
|
2004-10-30 21:55:45 +02:00
|
|
|
|
push cs
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov ax,offset @@arrive
|
2004-10-30 21:55:45 +02:00
|
|
|
|
push ax
|
|
|
|
|
push es
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cmp [word ptr gs:0h],'EC'
|
|
|
|
|
jne @@noce
|
2004-11-19 20:57:43 +01:00
|
|
|
|
push size exe
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jmp @@wasce
|
|
|
|
|
@@noce:
|
2004-11-19 18:14:57 +01:00
|
|
|
|
push 0000h
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@wasce:
|
2004-10-30 21:55:45 +02:00
|
|
|
|
push es
|
|
|
|
|
push es
|
|
|
|
|
push es
|
|
|
|
|
pop ds
|
|
|
|
|
pop fs
|
|
|
|
|
pop gs
|
|
|
|
|
push 7202h
|
|
|
|
|
popf
|
|
|
|
|
sti
|
|
|
|
|
db 0CBh
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@arrive:
|
2004-10-30 21:55:45 +02:00
|
|
|
|
cli
|
2004-10-31 10:30:14 +01:00
|
|
|
|
pop gs
|
|
|
|
|
mov ah,01
|
|
|
|
|
int 49h
|
2004-10-30 21:55:45 +02:00
|
|
|
|
pop gs fs es ds
|
|
|
|
|
popad
|
2004-10-31 12:44:57 +01:00
|
|
|
|
pop dx bp
|
|
|
|
|
popf
|
2004-10-30 21:55:45 +02:00
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@reallyerror:
|
2004-10-30 21:55:45 +02:00
|
|
|
|
pop gs fs es ds
|
|
|
|
|
popad
|
2004-10-31 12:44:57 +01:00
|
|
|
|
pop dx bp
|
|
|
|
|
popf
|
2004-10-30 22:36:00 +02:00
|
|
|
|
stc
|
2004-10-30 21:55:45 +02:00
|
|
|
|
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-14 12:07:54 +01:00
|
|
|
|
;Charge le fichier ds:%0 sur un bloc m<>moire -> eax taille -> es bloc
|
|
|
|
|
;->
|
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
|
|
|
|
|
USES cx,si,di,ds,es
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
mov si,[@pointer]
|
|
|
|
|
call uppercase,si
|
|
|
|
|
call [cs:mbfind],si
|
|
|
|
|
jnc @@errorload
|
|
|
|
|
call searchfile,si
|
|
|
|
|
jne @@errorload
|
|
|
|
|
jc @@errorload
|
|
|
|
|
mov eax,[es:(find si).result.filesize]
|
|
|
|
|
call [cs:mbcreate],si,ax
|
|
|
|
|
jc @@errorload
|
|
|
|
|
mov ds,ax
|
|
|
|
|
mov cx,[es:(find si).result.filegroup]
|
|
|
|
|
mov eax,[es:(find si).result.filesize]
|
|
|
|
|
call loadway,cx,eax,0
|
|
|
|
|
jc @@errorload
|
2004-10-30 21:25:45 +02:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@errorload:
|
2004-10-30 21:25:45 +02:00
|
|
|
|
stc
|
2007-03-14 12:07:54 +01:00
|
|
|
|
xor eax,eax
|
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
|
|
|
|
|
PROC uppercase far
|
|
|
|
|
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]
|
|
|
|
|
push ds
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
;charge le fichier de de groupe CX et de taille eax
|
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
|
|
|
|
|
cmp bx,1
|
|
|
|
|
jb @@adjustlast
|
|
|
|
|
mov cx,[@sector]
|
|
|
|
|
mov di,[@offset]
|
|
|
|
|
@@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]
|
|
|
|
|
;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
|
|
|
|
|
@@hadafatbloc:
|
|
|
|
|
mov dx,[myboot.sectorsperfat]
|
|
|
|
|
mov cx,[adressfat]
|
|
|
|
|
;xor di,di
|
|
|
|
|
mov di,offset fatter
|
|
|
|
|
;mov ds,ax
|
|
|
|
|
@@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
|
|
|
|
|
mov bl,[cs:myboot.sectorspercluster]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xor bh,bh
|
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
|
|
|
|
|
mov bl,[cs:myboot.sectorspercluster]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xor bh,bh
|
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
|
|
|
|
|
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
|
|
|
|
|
call @@inverse
|
|
|
|
|
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
|
|
|
|
|
call @@inverse
|
|
|
|
|
jc @@errorverify
|
2004-11-05 01:57:03 +01:00
|
|
|
|
|
|
|
|
|
mov si,offset bufferread
|
2007-03-14 12:07:54 +01:00
|
|
|
|
call @@inverse
|
|
|
|
|
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-14 12:07:54 +01:00
|
|
|
|
@@inverse:
|
2004-11-05 01:57:03 +01:00
|
|
|
|
push si cx
|
|
|
|
|
xor cx,cx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
@@invert:
|
|
|
|
|
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]
|
|
|
|
|
jb @@invert
|
2004-11-05 01:57:03 +01:00
|
|
|
|
pop cx si
|
2004-06-12 23:34:04 +02:00
|
|
|
|
ret
|
2007-03-14 12:07:54 +01:00
|
|
|
|
endp verifysector
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
;=============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-14 12:07:54 +01:00
|
|
|
|
decompressrle:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push cx dx si di
|
|
|
|
|
mov dx,cx
|
|
|
|
|
mov bp,di
|
|
|
|
|
decompression:
|
|
|
|
|
mov eax,[si]
|
|
|
|
|
cmp al,'/'
|
|
|
|
|
jne nocomp
|
|
|
|
|
cmp si,07FFFh-6
|
|
|
|
|
jae thenen
|
|
|
|
|
mov ecx,eax
|
|
|
|
|
ror ecx,16
|
|
|
|
|
cmp cl,'*'
|
|
|
|
|
jne nocomp
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cmp [byte ptr si+4],'/'
|
2004-06-12 23:34:04 +02:00
|
|
|
|
jne nocomp
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
jnz decompression
|
|
|
|
|
thenen:
|
|
|
|
|
mov ax,dx
|
|
|
|
|
sub bp,di
|
|
|
|
|
neg bp
|
|
|
|
|
clc
|
|
|
|
|
pop di si dx cx
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;=============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-14 12:07:54 +01:00
|
|
|
|
compressrle:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push ax bx cx dx si di ds es
|
|
|
|
|
mov bp,di
|
|
|
|
|
xchg si,di
|
|
|
|
|
push es
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
pop ds
|
|
|
|
|
mov dx,cx
|
|
|
|
|
;mov bp,cx
|
|
|
|
|
againcomp:
|
|
|
|
|
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
|
|
|
|
|
je poo
|
|
|
|
|
mov cl,0ffh
|
|
|
|
|
;mov cx,bp
|
|
|
|
|
;sub cx,di
|
|
|
|
|
;mov ah,cl
|
|
|
|
|
poo:
|
|
|
|
|
mov ah,cl
|
|
|
|
|
inc di
|
|
|
|
|
xor ch,ch
|
|
|
|
|
repe scasb
|
|
|
|
|
sub cl,ah
|
|
|
|
|
neg cl
|
|
|
|
|
cmp cl,6
|
|
|
|
|
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
|
|
|
|
|
jnz againcomp
|
|
|
|
|
jmp fini
|
|
|
|
|
nocomp2:
|
|
|
|
|
mov [si],al
|
|
|
|
|
inc si
|
|
|
|
|
inc bx
|
|
|
|
|
mov di,bx
|
|
|
|
|
dec dx
|
|
|
|
|
jnz againcomp
|
|
|
|
|
fini:
|
|
|
|
|
sub bp,si
|
|
|
|
|
neg bp
|
|
|
|
|
clc
|
|
|
|
|
pop es ds di si dx cx bx ax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;=============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
|
|
|
|
|
USES ax,cx,dx,si,di,ds,es
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push cs
|
|
|
|
|
pop es
|
|
|
|
|
;cmp [si],005Ch ;'\',0 (root dir)
|
|
|
|
|
mov di,offset tempdir
|
|
|
|
|
call searchfile
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jc @@noch
|
|
|
|
|
mov cx,[cs:tempdir.filegroup]
|
|
|
|
|
mov [cs:currentdir],cx
|
|
|
|
|
mov [cs:adressdirectory],cx
|
|
|
|
|
cmp [dword ptr cs:di],' ..'
|
|
|
|
|
jne @@notback
|
|
|
|
|
cmp [dword ptr cs:di],' .'
|
|
|
|
|
je @@theend
|
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
|
|
|
|
|
mov al,'\'
|
|
|
|
|
std
|
|
|
|
|
repne scasb
|
|
|
|
|
inc di
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [byte ptr es:di],0
|
|
|
|
|
jmp @@theend
|
|
|
|
|
@@notback:
|
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
|
|
|
|
|
mov al,'\'
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cld
|
|
|
|
|
stosb
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov dx,di
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
mov di,si
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
tempdir entries <>
|
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-14 12:07:54 +01:00
|
|
|
|
fatter db 9*512 dup (0)
|