2007-03-14 12:07:54 +01:00
|
|
|
|
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
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
header exe 1
|
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
|
2007-04-11 21:03:37 +02:00
|
|
|
|
declare getbuffer
|
|
|
|
|
declare setbuffer
|
2007-03-14 12:07:54 +01:00
|
|
|
|
ende
|
|
|
|
|
|
|
|
|
|
importing
|
2007-04-11 21:03:37 +02:00
|
|
|
|
use SYSTEME,biosprint
|
2007-03-14 12:07:54 +01:00
|
|
|
|
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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mydpt dpt
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
;Secteur de boot
|
2019-07-09 10:33:10 +02:00
|
|
|
|
myboot bootinfo
|
2007-03-14 12:07:54 +01:00
|
|
|
|
|
|
|
|
|
;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
|
|
|
|
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc getfat uses ax bx dx si ds es
|
2007-03-14 12:07:54 +01:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
push cs
|
|
|
|
|
pop es
|
2019-07-09 10:33:10 +02:00
|
|
|
|
invoke mbfindsb,datafat,cs
|
2007-03-23 17:42:51 +01:00
|
|
|
|
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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
2004-06-12 23:34:04 +02:00
|
|
|
|
nocarry:
|
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
|
|
|
|
;=====================================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc loadfile uses cx si di ds es, name:word,pointer:word
|
|
|
|
|
local temp[48]:WORD
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push ss
|
|
|
|
|
pop es
|
2019-07-09 10:33:10 +02:00
|
|
|
|
lea di,[temp]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push ds di
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,[name]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
mov cx,48/4
|
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
|
|
|
|
push ss
|
|
|
|
|
pop ds
|
|
|
|
|
pop di es
|
2019-07-09 10:33:10 +02:00
|
|
|
|
stdcall searchfile,di
|
2004-06-12 23:34:04 +02:00
|
|
|
|
jne errorload
|
2007-03-14 12:07:54 +01:00
|
|
|
|
jc errorload
|
2019-07-09 10:33:10 +02:00
|
|
|
|
virtual at di
|
|
|
|
|
.find find
|
|
|
|
|
end virtual
|
|
|
|
|
mov cx,[.find.result.filegroup]
|
|
|
|
|
mov eax,[.find.result.filesize]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push es
|
|
|
|
|
pop ds
|
2019-07-09 10:33:10 +02:00
|
|
|
|
stdcall loadway,cx,eax,[pointer]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
jc errorload
|
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
2004-06-12 23:34:04 +02:00
|
|
|
|
errorload:
|
|
|
|
|
stc
|
2007-03-14 12:07:54 +01:00
|
|
|
|
xor eax,eax
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-10-30 21:55:45 +02:00
|
|
|
|
|
|
|
|
|
;============execfile (Fonction 18)===============
|
|
|
|
|
;Execute le fichier ds:si
|
|
|
|
|
;-> AH=18
|
|
|
|
|
;<- Flag Carry si erreur
|
|
|
|
|
;=====================================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc execfile, file:word
|
2007-03-23 17:42:51 +01:00
|
|
|
|
pushad
|
2004-10-30 22:36:00 +02:00
|
|
|
|
push ds es fs gs
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,[file]
|
|
|
|
|
stdcall uppercase,di
|
|
|
|
|
stdcall projfile,di
|
|
|
|
|
jc .reallyerrornoblock
|
|
|
|
|
invoke mbfind,di
|
|
|
|
|
jc .reallyerror
|
|
|
|
|
invoke mbchown,ax,word [ss:bp+4]
|
|
|
|
|
jc .reallyerror
|
2007-03-18 21:39:24 +01:00
|
|
|
|
push ax
|
|
|
|
|
pop ds
|
2019-07-09 10:33:10 +02:00
|
|
|
|
cmp word [ds:0x0],'EC'
|
|
|
|
|
jne .reallyerror
|
2007-03-28 23:28:44 +02:00
|
|
|
|
push ax
|
2007-03-18 21:39:24 +01:00
|
|
|
|
push cs
|
2019-07-09 10:33:10 +02:00
|
|
|
|
push .arrive
|
2007-03-18 21:39:24 +01:00
|
|
|
|
push ds
|
2019-07-09 10:33:10 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.exe exe
|
|
|
|
|
end virtual
|
|
|
|
|
push word [.exe.starting]
|
2007-03-18 21:39:24 +01:00
|
|
|
|
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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.arrive:
|
2007-03-28 23:28:44 +02:00
|
|
|
|
;cli
|
|
|
|
|
;pop ax
|
2019-07-09 10:33:10 +02:00
|
|
|
|
;invoke mbfree,ax
|
|
|
|
|
invoke 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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.reallyerror:
|
|
|
|
|
invoke 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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
|
|
|
|
;=====================================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc projfile uses cx si di ds es, pointer:word
|
|
|
|
|
local temp[64]:WORD
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push ss
|
2007-03-14 12:07:54 +01:00
|
|
|
|
pop es
|
2019-07-09 10:33:10 +02:00
|
|
|
|
lea di,[temp]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push di
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,[pointer]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
mov cx,64/4
|
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
|
|
|
|
push ss
|
|
|
|
|
pop ds
|
|
|
|
|
pop di
|
2007-04-11 21:03:37 +02:00
|
|
|
|
pushad
|
2019-07-09 10:33:10 +02:00
|
|
|
|
invoke biosprint,di
|
2007-04-11 21:03:37 +02:00
|
|
|
|
popad
|
2019-07-09 10:33:10 +02:00
|
|
|
|
stdcall uppercase,di
|
|
|
|
|
invoke mbfind,di
|
|
|
|
|
jnc .notace
|
|
|
|
|
stdcall searchfile,di
|
|
|
|
|
jne .errorload
|
|
|
|
|
jc .errorload
|
|
|
|
|
virtual at di
|
|
|
|
|
.find find
|
|
|
|
|
end virtual
|
|
|
|
|
mov eax,[es:.find.result.filesize]
|
|
|
|
|
invoke mbcreate,di,ax
|
|
|
|
|
jc .errorload
|
|
|
|
|
invoke mbchown,ax,word [ss:bp+4]
|
|
|
|
|
jc .errorload
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov ds,ax
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov cx,[es:.find.result.filegroup]
|
|
|
|
|
mov eax,[es:.find.result.filesize]
|
|
|
|
|
stdcall loadway,cx,eax,0
|
|
|
|
|
jc .errorload
|
|
|
|
|
cmp word [ds:0x0],'EC'
|
|
|
|
|
jne .notace
|
|
|
|
|
invoke mbloadfuncs,ds
|
|
|
|
|
jc .errorload
|
|
|
|
|
invoke mbloadsection,ds
|
|
|
|
|
jc .errorload
|
|
|
|
|
.notace:
|
2004-10-30 21:25:45 +02:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.errorload:
|
2007-03-14 12:07:54 +01:00
|
|
|
|
xor eax,eax
|
2007-03-23 17:42:51 +01:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
|
|
|
;======================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc searchfile uses bx cx si di ds es, pointer:word
|
|
|
|
|
mov si,[pointer]
|
|
|
|
|
virtual at si
|
|
|
|
|
.find find
|
|
|
|
|
end virtual
|
|
|
|
|
lea bx,[es:.find.result]
|
|
|
|
|
stdcall uppercase,si
|
|
|
|
|
stdcall findfirstfile,si
|
|
|
|
|
jc .errorsearch
|
|
|
|
|
jmp .founded
|
|
|
|
|
.nextsearch:
|
|
|
|
|
stdcall findnextfile,si
|
|
|
|
|
jc .errorsearch
|
|
|
|
|
.founded:
|
|
|
|
|
cmp byte [bx],0
|
|
|
|
|
je .notgood
|
|
|
|
|
virtual at bx
|
|
|
|
|
.entries entries
|
|
|
|
|
end virtual
|
|
|
|
|
cmp byte [.entries.fileattr],0Fh
|
|
|
|
|
je .nextsearch
|
|
|
|
|
stdcall cmpnames,si,bx
|
|
|
|
|
jc .nextsearch
|
|
|
|
|
.okfound:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.notgood:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cmp si,0FF5h
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.errorsearch:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;Transforme la chaine ds:%0 en maj
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc uppercase uses si ax, strs:word
|
|
|
|
|
mov si,[strs]
|
|
|
|
|
.uppercaser:
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov al,[si]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cmp al,0
|
2019-07-09 10:33:10 +02:00
|
|
|
|
je .enduppercase
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cmp al,'a'
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jb .nonmaj
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cmp al,'z'
|
2019-07-09 10:33:10 +02: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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.nonmaj:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
inc si
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jmp .uppercaser
|
|
|
|
|
.enduppercase:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;Compare le nom ds:%0 '.' avec ds:%1
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc cmpnames uses ax cx si di es, off1:word,off2:word
|
|
|
|
|
mov si,[off1]
|
|
|
|
|
mov di,[off2]
|
|
|
|
|
cmp byte [si],"."
|
|
|
|
|
jne .notaredir
|
|
|
|
|
cmp word [si],".."
|
|
|
|
|
jne .onlyonedir
|
|
|
|
|
cmp word [di],".."
|
|
|
|
|
je .itok
|
|
|
|
|
jmp .notequal
|
|
|
|
|
.onlyonedir:
|
|
|
|
|
cmp word [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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .nequal
|
2004-06-12 23:34:04 +02:00
|
|
|
|
inc si
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jmp .equal
|
|
|
|
|
.nequal:
|
|
|
|
|
cmp byte [es:di-1],' '
|
|
|
|
|
jne .notequal
|
|
|
|
|
.equal:
|
|
|
|
|
cmp byte [si-1],'.'
|
|
|
|
|
jne .trynoext
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov al,' '
|
|
|
|
|
rep scasb
|
|
|
|
|
mov cx,3
|
|
|
|
|
rep cmpsb
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .nequal2
|
2004-11-19 19:57:45 +01:00
|
|
|
|
inc si
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jmp .equal2
|
|
|
|
|
.nequal2:
|
|
|
|
|
cmp byte [es:di-1],' '
|
|
|
|
|
jne .notequal
|
|
|
|
|
.equal2:
|
|
|
|
|
cmp byte [si-1],0
|
|
|
|
|
jne .notequal
|
|
|
|
|
.itok:
|
2007-03-14 12:07:54 +01:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.notequal:
|
2004-11-19 19:57:45 +01:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.trynoext:
|
|
|
|
|
cmp byte [si-1],0
|
|
|
|
|
jne .notequal
|
|
|
|
|
jmp .itok
|
|
|
|
|
endp
|
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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc loadway uses eax bx cx dx si di ds es, sector:word,size:dword,offset:word
|
2007-03-14 12:07:54 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov eax,[size]
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cmp eax,0
|
2019-07-09 10:33:10 +02:00
|
|
|
|
je .zeroload
|
2007-03-14 12:07:54 +01:00
|
|
|
|
rol eax,16
|
|
|
|
|
mov dx,ax
|
|
|
|
|
ror eax,16
|
|
|
|
|
div [cs:clustersize]
|
|
|
|
|
mov bx,ax
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov cx,[sector]
|
|
|
|
|
mov di,[offset]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
cmp bx,1
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jb .adjustlast
|
|
|
|
|
.loadfat:
|
|
|
|
|
stdcall readcluster,cx,di
|
|
|
|
|
jc .noway
|
2007-03-14 12:07:54 +01:00
|
|
|
|
add di,[cs:clustersize]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
stdcall getfat
|
2007-03-14 12:07:54 +01:00
|
|
|
|
dec bx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnz .loadfat
|
|
|
|
|
.adjustlast:
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cmp dx,0
|
2019-07-09 10:33:10 +02:00
|
|
|
|
je .zeroload
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push cs
|
2007-03-14 12:07:54 +01:00
|
|
|
|
pop ds
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,bufferread
|
|
|
|
|
stdcall readcluster,cx,si
|
|
|
|
|
jc .noway
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov cx,dx
|
2004-11-10 13:00:08 +01:00
|
|
|
|
cld
|
2004-06-12 23:34:04 +02:00
|
|
|
|
rep movsb
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.zeroload:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.noway:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
|
|
|
;=====================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc initdrive 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
|
2019-07-09 10:33:10 +02: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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov bx,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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnc .oknoagaintry
|
2004-06-12 23:34:04 +02:00
|
|
|
|
dec di
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnz .againtry
|
|
|
|
|
.oknoagaintry:
|
|
|
|
|
mov si,bufferread+3
|
|
|
|
|
mov di,myboot
|
|
|
|
|
mov cx,myboot.sizeof
|
2007-03-14 12:07:54 +01:00
|
|
|
|
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
|
2007-04-11 21:03:37 +02:00
|
|
|
|
xor eax,eax
|
|
|
|
|
mov ax,[buffer.size]
|
|
|
|
|
mul [myboot.sectorsize]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
invoke mbfindsb,databuffer,cs
|
|
|
|
|
jnc .hadabufferblock
|
|
|
|
|
invoke mbcreate,databuffer,ax
|
|
|
|
|
jc .errorinit
|
|
|
|
|
invoke mbresident,ax
|
|
|
|
|
jc .errorinit
|
|
|
|
|
invoke mbchown,ax,cs
|
|
|
|
|
jc .errorinit
|
|
|
|
|
.hadabufferblock:
|
2007-04-11 21:03:37 +02:00
|
|
|
|
mov [buffer.current],0FFFFh
|
|
|
|
|
mov ax,0FFFFh
|
|
|
|
|
mov cx,[buffer.size]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,buffer.chain
|
2007-04-11 21:03:37 +02:00
|
|
|
|
cld
|
|
|
|
|
rep stosw
|
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]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
invoke mbfindsb,datafat,cs
|
|
|
|
|
jnc .hadafatbloc
|
|
|
|
|
invoke mbcreate,datafat,ax
|
|
|
|
|
jc .errorinit
|
|
|
|
|
invoke mbresident,ax
|
|
|
|
|
jc .errorinit
|
|
|
|
|
invoke mbchown,ax,cs
|
|
|
|
|
jc .errorinit
|
|
|
|
|
.hadafatbloc:
|
2007-03-14 12:07:54 +01:00
|
|
|
|
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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.seefat:
|
|
|
|
|
stdcall readsector,cx,di
|
|
|
|
|
jc .errorinit
|
2007-03-14 12:07:54 +01:00
|
|
|
|
add di,[cs:myboot.sectorsize]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
inc cx
|
|
|
|
|
dec dx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnz .seefat
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.errorinit:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
datafat db '/fat',0
|
2007-04-11 21:03:37 +02:00
|
|
|
|
databuffer db '/buffer',0
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
buffer diskbuffer
|
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
|
|
|
|
;========================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc findfirstfile uses cx si, pointer:word
|
|
|
|
|
mov si,[pointer]
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov cx,[cs:currentdir]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
virtual at si
|
|
|
|
|
.find find
|
|
|
|
|
end virtual
|
|
|
|
|
mov [.find.adressdirectory],cx
|
2007-03-14 12:07:54 +01:00
|
|
|
|
xor cx,cx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov [.find.entryplace],cx
|
|
|
|
|
mov [.find.firstsearch],1
|
|
|
|
|
stdcall findnextfile,[pointer]
|
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
|
|
|
|
;=======================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc findnextfile uses ax bx cx di si ds es, pointer:word
|
2007-03-14 12:07:54 +01:00
|
|
|
|
push cs
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
pop ds
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,[pointer]
|
|
|
|
|
virtual at si
|
|
|
|
|
.find find
|
|
|
|
|
end virtual
|
|
|
|
|
mov cx,[es:.find.adressdirectory]
|
|
|
|
|
mov bx,[es:.find.entryplace]
|
|
|
|
|
.findnextfileagain:
|
|
|
|
|
cmp [es:.find.firstsearch],1
|
|
|
|
|
je .first
|
|
|
|
|
virtual at 0
|
|
|
|
|
.entries2 entries
|
|
|
|
|
end virtual
|
|
|
|
|
add bx,.entries2.sizeof
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cmp bx,[cs:clustersize]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jb .nopop
|
|
|
|
|
.first:
|
|
|
|
|
mov di,bufferentry
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov bx,0
|
|
|
|
|
cmp [cs:currentdir],0
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .notrootdir
|
|
|
|
|
cmp [es:.find.firstsearch],1
|
|
|
|
|
je .noaddfirst1
|
2004-06-12 23:34:04 +02:00
|
|
|
|
inc cx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.noaddfirst1:
|
2007-03-14 12:07:54 +01:00
|
|
|
|
add cx,[cs:adressparent]
|
|
|
|
|
mov al,[cs:myboot.sectorspercluster]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.readroot:
|
|
|
|
|
stdcall readsector,cx,di
|
|
|
|
|
jc .notwell
|
2007-03-14 12:07:54 +01:00
|
|
|
|
add di,[cs:myboot.sectorsize]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
dec al
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnz .readroot
|
2007-03-14 12:07:54 +01:00
|
|
|
|
sub cx,[cs:adressparent]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jmp .nopop
|
|
|
|
|
.notrootdir:
|
|
|
|
|
cmp [es:.find.firstsearch],1
|
|
|
|
|
je .noaddfirst2
|
|
|
|
|
stdcall getfat
|
|
|
|
|
.noaddfirst2:
|
|
|
|
|
jc .notwell
|
|
|
|
|
stdcall readcluster,cx,di
|
|
|
|
|
jc .notwell
|
|
|
|
|
.nopop:
|
|
|
|
|
mov [es:.find.firstsearch],0
|
|
|
|
|
mov di,bufferentry
|
2007-03-14 12:07:54 +01:00
|
|
|
|
add di,bx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
cmp byte [di],0
|
|
|
|
|
je .notwell
|
|
|
|
|
mov [es:.find.entryplace],bx
|
|
|
|
|
mov [es:.find.adressdirectory],cx
|
|
|
|
|
cmp byte [di],0E5h
|
|
|
|
|
je .findnextfileagain
|
|
|
|
|
virtual at di
|
|
|
|
|
.entries entries
|
|
|
|
|
end virtual
|
|
|
|
|
cmp byte [.entries.fileattr],28h
|
|
|
|
|
je .findnextfileagain
|
|
|
|
|
cmp byte [.entries.fileattr],0Fh
|
|
|
|
|
je .findnextfileagain
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov si,di
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,[pointer]
|
|
|
|
|
virtual at di
|
|
|
|
|
.find2 find
|
|
|
|
|
end virtual
|
|
|
|
|
lea di,[es:.find2.result]
|
|
|
|
|
mov cx,.entries2.sizeof
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.notwell:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
|
|
|
;========================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc getfreespace uses eax bx
|
2004-06-12 23:34:04 +02:00
|
|
|
|
xor eax,eax
|
2019-07-09 10:33:10 +02:00
|
|
|
|
stdcall 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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
stdcall getfat
|
2004-06-12 23:34:04 +02:00
|
|
|
|
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
|
|
|
|
;=======================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc readcluster uses ax bx dx si, sector:word,pointer:word
|
2007-03-23 17:42:51 +01:00
|
|
|
|
mov al,[cs:myboot.sectorspercluster]
|
|
|
|
|
xor ah,ah
|
|
|
|
|
mov bx,ax
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mul [sector]
|
2007-03-14 12:07:54 +01:00
|
|
|
|
add ax,[cs:addingvalue]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,[pointer]
|
|
|
|
|
.readsectors:
|
|
|
|
|
stdcall readsector,ax,si
|
|
|
|
|
jc .errorreadincluster
|
2007-03-14 12:07:54 +01:00
|
|
|
|
add si,[cs:myboot.sectorsize]
|
|
|
|
|
inc ax
|
|
|
|
|
dec bx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnz .readsectors
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.errorreadincluster:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
|
|
|
|
;=====================================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc writecluster uses ax bx dx si, sector:word,pointer:word
|
2007-03-23 17:42:51 +01:00
|
|
|
|
mov al,[cs:myboot.sectorspercluster]
|
|
|
|
|
xor ah,ah
|
|
|
|
|
mov bx,ax
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mul [sector]
|
2007-03-14 12:07:54 +01:00
|
|
|
|
add ax,[cs:addingvalue]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,[pointer]
|
|
|
|
|
.writesectors:
|
|
|
|
|
stdcall writesector,ax,si
|
|
|
|
|
jc .errorwriteincluster
|
2007-03-14 12:07:54 +01:00
|
|
|
|
add si,[cs:myboot.sectorsize]
|
|
|
|
|
inc ax
|
2004-06-12 23:34:04 +02:00
|
|
|
|
dec bx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnz .writesectors
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.errorwriteincluster:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-04-11 21:03:37 +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
|
|
|
|
;======================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc readsector uses ax bx cx dx si di ds es, sector:word,pointer:word
|
|
|
|
|
local tempsec:WORD
|
2007-04-11 21:03:37 +02:00
|
|
|
|
push ds
|
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
2019-07-09 10:33:10 +02:00
|
|
|
|
invoke mbfindsb,databuffer,cs
|
2007-04-11 21:03:37 +02:00
|
|
|
|
pop ds
|
|
|
|
|
mov es,ax
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jc .error
|
|
|
|
|
mov si,buffer.chain
|
2007-04-11 21:03:37 +02:00
|
|
|
|
xor cx,cx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov ax,[sector]
|
2007-04-11 21:03:37 +02:00
|
|
|
|
mov bx,0FFFFh
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.searchbuffer:
|
2007-04-11 21:03:37 +02:00
|
|
|
|
cmp [cs:si],ax
|
2019-07-09 10:33:10 +02:00
|
|
|
|
je .preprepcopy
|
|
|
|
|
cmp word [cs:si],0FFFEh
|
|
|
|
|
jne .notfree
|
2007-04-11 21:03:37 +02:00
|
|
|
|
mov bx,cx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.notfree:
|
|
|
|
|
cmp word [cs:si],0FFFFh
|
|
|
|
|
je .theend
|
2007-04-11 21:03:37 +02:00
|
|
|
|
inc si
|
|
|
|
|
inc si
|
|
|
|
|
inc cx
|
|
|
|
|
cmp cx,[cs:buffer.size]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jb .searchbuffer
|
|
|
|
|
.theend:
|
2007-04-11 21:03:37 +02:00
|
|
|
|
cmp bx,0FFFFh
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnz .prepread
|
2007-04-11 21:03:37 +02:00
|
|
|
|
cmp cx,[cs:buffer.size]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jb .read
|
2007-04-11 21:03:37 +02:00
|
|
|
|
mov cx,[cs:buffer.current]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.searchnext:
|
2007-04-11 21:03:37 +02:00
|
|
|
|
inc cx
|
|
|
|
|
cmp cx,[cs:buffer.size]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jb .read
|
2007-04-11 21:03:37 +02:00
|
|
|
|
xor cx,cx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jmp .read
|
|
|
|
|
.prepread:
|
2007-04-11 21:03:37 +02:00
|
|
|
|
mov cx,bx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.read:
|
2007-04-11 21:03:37 +02:00
|
|
|
|
mov [cs:buffer.current],cx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov [tempsec],cx
|
2007-04-11 21:03:37 +02:00
|
|
|
|
mov ax,[cs:myboot.sectorsize]
|
|
|
|
|
mul cx
|
|
|
|
|
mov di,ax
|
2019-07-09 10:33:10 +02:00
|
|
|
|
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
|
2007-04-11 21:03:37 +02:00
|
|
|
|
or cl,bl
|
|
|
|
|
mov bx,di
|
|
|
|
|
mov si,3
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.tryagain:
|
2007-03-31 13:17:07 +02:00
|
|
|
|
mov ax,0201h
|
2004-06-12 23:34:04 +02:00
|
|
|
|
int 13h
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnc .prepcopy
|
2007-03-14 12:07:54 +01:00
|
|
|
|
dec si
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnz .tryagain
|
|
|
|
|
mov bx,[tempsec]
|
2007-04-11 21:03:37 +02:00
|
|
|
|
shl bx,1
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov word [bx+buffer.chain],0FFFEh
|
|
|
|
|
.error:
|
2007-04-11 21:03:37 +02:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.preprepcopy:
|
|
|
|
|
mov [tempsec],cx
|
|
|
|
|
.prepcopy:
|
|
|
|
|
mov bx,[tempsec]
|
|
|
|
|
mov ax,[tempsec]
|
|
|
|
|
mov cx,[sector]
|
2007-04-11 21:03:37 +02:00
|
|
|
|
shl bx,1
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov [cs:bx+buffer.chain],cx
|
2007-04-11 21:03:37 +02:00
|
|
|
|
mov cx,[cs:myboot.sectorsize]
|
|
|
|
|
mul cx
|
|
|
|
|
mov di,ax
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.copy:
|
2007-04-11 21:03:37 +02:00
|
|
|
|
push ds
|
|
|
|
|
push es
|
|
|
|
|
pop ds
|
|
|
|
|
pop es
|
|
|
|
|
mov si,di
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,[pointer]
|
2007-04-11 21:03:37 +02:00
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.done:
|
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-04-11 21:03:37 +02:00
|
|
|
|
|
|
|
|
|
;=============SETBUFFER============
|
|
|
|
|
;change la taille des buffers a %0
|
|
|
|
|
;->
|
|
|
|
|
;<- Flag Carry si erreur
|
|
|
|
|
;====================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc setbuffer uses ax cx di ds es, size:word
|
2007-04-11 21:03:37 +02:00
|
|
|
|
push cs
|
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
pop es
|
2019-07-09 10:33:10 +02:00
|
|
|
|
invoke mbfindsb,databuffer,cs
|
|
|
|
|
jc .nodatabuffer
|
|
|
|
|
invoke mbfree,ax
|
|
|
|
|
.nodatabuffer:
|
|
|
|
|
mov ax,[size]
|
2007-04-11 21:03:37 +02:00
|
|
|
|
mov cx,ax
|
|
|
|
|
mov [buffer.size],ax
|
|
|
|
|
mul [myboot.sectorsize]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
invoke mbcreate,databuffer,ax
|
|
|
|
|
jc .errorinit
|
|
|
|
|
invoke mbresident,ax
|
|
|
|
|
jc .errorinit
|
|
|
|
|
invoke mbchown,ax,cs
|
|
|
|
|
jc .errorinit
|
2007-04-11 21:03:37 +02:00
|
|
|
|
mov [buffer.current],0FFFFh
|
|
|
|
|
mov ax,0FFFFh
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,buffer.chain
|
2007-04-11 21:03:37 +02:00
|
|
|
|
cld
|
|
|
|
|
rep stosw
|
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.errorinit:
|
2007-04-11 21:03:37 +02:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-04-11 21:03:37 +02:00
|
|
|
|
|
|
|
|
|
;=============GETBUFFER============
|
|
|
|
|
;renvoie la structure de buffer en %0
|
|
|
|
|
;->
|
|
|
|
|
;<- Flag Carry si erreur
|
|
|
|
|
;====================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc getbuffer uses ax cx di ds es, pointer:word
|
2007-04-11 21:03:37 +02:00
|
|
|
|
push cs
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
pop ds
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,buffer
|
|
|
|
|
mov di,[pointer]
|
|
|
|
|
mov cx,buffer.sizeof
|
2007-04-11 21:03:37 +02:00
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============WRITESECTOR============
|
2007-04-11 21:03:37 +02:00
|
|
|
|
;Ecrit le secteur %0 point<6E> par ds:%1
|
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
|
|
|
|
;====================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc writesector uses ax bx cx dx si es, sector:word,pointer:word
|
2007-03-14 12:07:54 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 10:33:10 +02:00
|
|
|
|
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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov bx,[pointer]
|
2007-04-11 21:03:37 +02:00
|
|
|
|
mov si,3
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.tryagain:
|
2007-03-31 13:17:07 +02:00
|
|
|
|
mov ax,0301h
|
2004-06-12 23:34:04 +02:00
|
|
|
|
int 13h
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnc .done
|
2007-03-14 12:07:54 +01:00
|
|
|
|
dec si
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnz .tryagain
|
|
|
|
|
.done:
|
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
|
|
|
;==================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc getname uses ax cx si di ds es, pointer:word
|
2007-03-14 12:07:54 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
push cs
|
2004-06-12 23:34:04 +02:00
|
|
|
|
pop ds
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,[pointer]
|
|
|
|
|
mov si,myboot.drivename
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov cx,11
|
|
|
|
|
rep movsb
|
|
|
|
|
mov al,' '
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,[pointer]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov cx,11
|
|
|
|
|
repne scasb
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov byte [es:di],0
|
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-14 12:07:54 +01:00
|
|
|
|
;=============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
|
|
|
|
;====================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc getserial FAR
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov eax,[cs:myboot.serialnumber]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
|
|
|
;=======================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc verifysector uses ecx si di ds es, sector:word
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push cs
|
|
|
|
|
pop es
|
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,bufferread
|
|
|
|
|
stdcall readsector,cx,si
|
|
|
|
|
stdcall inverse
|
|
|
|
|
stdcall writesector,cx,si
|
|
|
|
|
jc .errorverify
|
2004-11-05 01:57:03 +01:00
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,bufferwrite
|
|
|
|
|
stdcall readsector,cx,si
|
|
|
|
|
stdcall inverse
|
|
|
|
|
jc .errorverify
|
2004-11-05 01:57:03 +01:00
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,bufferread
|
|
|
|
|
stdcall inverse
|
|
|
|
|
stdcall 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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,bufferread
|
|
|
|
|
mov di,bufferwrite
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cld
|
|
|
|
|
rep cmpsd
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.errorverify:
|
|
|
|
|
retf
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
endp
|
2007-03-25 01:13:54 +01:00
|
|
|
|
|
|
|
|
|
inverse:
|
|
|
|
|
push si cx
|
2004-11-05 01:57:03 +01:00
|
|
|
|
xor cx,cx
|
2007-03-25 01:13:54 +01:00
|
|
|
|
invert:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
not dword [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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
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
|
|
|
|
|
;=====================================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc decompressrle uses ecx dx si di ds es,seg1:word,off1:word,seg2:word,off2:word,size:word
|
|
|
|
|
mov ds,[seg1]
|
|
|
|
|
mov es,[seg2]
|
|
|
|
|
mov si,[off1]
|
|
|
|
|
mov di,[off2]
|
|
|
|
|
mov dx,[size]
|
|
|
|
|
.decompression:
|
2007-03-28 17:53:26 +02:00
|
|
|
|
mov eax,[ds:si]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cmp al,'/'
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .nocomp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
cmp si,07FFFh-6
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jae .thenen
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov ecx,eax
|
|
|
|
|
ror ecx,16
|
|
|
|
|
cmp cl,'*'
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .nocomp
|
|
|
|
|
cmp byte [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
|
2019-07-09 10:33:10 +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
|
2019-07-09 10:33:10 +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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
sub ax,[off2]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
|
|
|
|
;=====================================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc compressrle uses ax bx cx dx si di ds es, seg1:word,off1:word,seg2:word,off2:word,size:word
|
|
|
|
|
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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
je .poo
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov cl,0ffh
|
|
|
|
|
;mov cx,bp
|
|
|
|
|
;sub cx,di
|
|
|
|
|
;mov ah,cl
|
2019-07-09 10:33:10 +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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jbe .nocomp2
|
|
|
|
|
mov dword [si],' * /'
|
|
|
|
|
mov byte [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
|
2019-07-09 10:33:10 +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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jnz .againcomp
|
|
|
|
|
.fini:
|
2007-03-28 17:53:26 +02:00
|
|
|
|
mov ax,si
|
2019-07-09 10:33:10 +02:00
|
|
|
|
sub ax,[off2]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
|
|
|
|
;=====================================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc changedir uses cx si di ds es, pointer:word
|
|
|
|
|
local temp[64]:WORD
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push ss
|
|
|
|
|
pop es
|
2019-07-09 10:33:10 +02:00
|
|
|
|
lea di,[temp]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push di
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,[pointer]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
mov cx,64/4
|
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
|
|
|
|
push ss
|
|
|
|
|
pop ds
|
|
|
|
|
pop di
|
2019-07-09 10:33:10 +02:00
|
|
|
|
stdcall searchfile,di
|
|
|
|
|
jne .noch
|
|
|
|
|
jc .noch
|
2007-03-23 17:42:51 +01:00
|
|
|
|
;cmp [si],005Ch ;'/',0 (root dir)
|
2019-07-09 10:33:10 +02:00
|
|
|
|
virtual at di
|
|
|
|
|
.find find
|
|
|
|
|
end virtual
|
|
|
|
|
mov cx,[es:.find.result.filegroup]
|
2007-03-14 12:07:54 +01:00
|
|
|
|
mov [cs:currentdir],cx
|
|
|
|
|
mov [cs:adressdirectory],cx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
cmp dword [es:.find.result.filename],' .'
|
|
|
|
|
je .theend
|
|
|
|
|
cmp dword [es:.find.result.filename],' ..'
|
|
|
|
|
jne .notback
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push cs
|
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
pop es
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,currentdirstr
|
2004-06-12 23:34:04 +02:00
|
|
|
|
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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov byte [es:di],0
|
|
|
|
|
jmp .theend
|
|
|
|
|
.notback:
|
2007-03-23 17:42:51 +01:00
|
|
|
|
push cs
|
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
pop es
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,currentdirstr
|
2004-06-12 23:34:04 +02:00
|
|
|
|
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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
lea di,[temp]
|
2007-03-23 17:42:51 +01:00
|
|
|
|
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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.theend:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.noch:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
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
|
|
|
|
;=================================
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc getdir uses ax cx si di ds es, pointer:word
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push cs
|
|
|
|
|
pop es
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,currentdirstr
|
2004-06-12 23:34:04 +02:00
|
|
|
|
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
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov si,currentdirstr
|
|
|
|
|
mov di,[pointer]
|
2007-03-14 12:07:54 +01:00
|
|
|
|
cld
|
2004-06-12 23:34:04 +02:00
|
|
|
|
rep movsb
|
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
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)
|