2004-10-29 18:32:48 +02:00
|
|
|
|
.model tiny
|
|
|
|
|
.486
|
|
|
|
|
smart
|
|
|
|
|
.code
|
|
|
|
|
|
2004-11-19 18:19:05 +01:00
|
|
|
|
org 0h
|
2004-10-29 18:32:48 +02:00
|
|
|
|
|
|
|
|
|
include ..\include\mem.h
|
|
|
|
|
include ..\include\divers.h
|
|
|
|
|
|
|
|
|
|
start:
|
2004-11-19 18:19:05 +01:00
|
|
|
|
maxfunc equ 13
|
2004-10-29 18:32:48 +02:00
|
|
|
|
|
|
|
|
|
jmp tsr ;Saute <20> la routine r<>sidente
|
|
|
|
|
nameed db 'MB' ;Nom drivers
|
|
|
|
|
id dw 1234h ;Identifiant drivers
|
|
|
|
|
Tsr:
|
|
|
|
|
cli ;D<>sactive interruptions logiciellement
|
|
|
|
|
cmp ax,cs:ID ;Compare si test de chargement
|
|
|
|
|
jne nomore ;Si pas test alors on continu
|
|
|
|
|
rol ax,3*4 ;Rotation de 3 chiffre de l'ID pour montrer que le drivers est charg<72>
|
|
|
|
|
jmp itsok ;On termine l'int avec notre code d'ID preuve du bon chargement de VIDEO
|
|
|
|
|
nomore:
|
|
|
|
|
cmp ah,maxfunc
|
|
|
|
|
jbe noerrorint
|
|
|
|
|
stc
|
|
|
|
|
jmp itsok
|
|
|
|
|
noerrorint:
|
|
|
|
|
clc
|
|
|
|
|
push bx
|
|
|
|
|
mov bl,ah ;On calcule d'apr<70>s le n<> de fonction
|
|
|
|
|
xor bh,bh ;quel sera l'entr<74>e dans la table index<65>e
|
|
|
|
|
shl bx,1 ;des adresses fonctions.
|
|
|
|
|
mov bx,cs:[bx+tables] ;On r<>cup<75>re cette adresse depuis la table
|
|
|
|
|
mov cs:current,bx ;On la stocke temporairement pour obtenir les registres d'origine
|
|
|
|
|
pop bx
|
|
|
|
|
clc
|
|
|
|
|
call cs:current ;Puis on execute la fonction
|
|
|
|
|
itsok:
|
|
|
|
|
push bp
|
|
|
|
|
mov bp,sp ;On prend sp dans bp pour adresser la pile
|
|
|
|
|
jnc noerror ;La fonction appel<65>e a renvoyer une erreur : Flag CARRY ?
|
|
|
|
|
or byte ptr [bp+6],1b;Si oui on le retranscrit sur le registre FLAG qui sera d<>pil<69> lors du IRET
|
|
|
|
|
;xor eax,eax
|
|
|
|
|
;mov ax,cs ;On r<>cup<75>re le segment et l'offset puis en renvoie l'adresse physique
|
|
|
|
|
;shl eax,4 ;de l'erreur.
|
|
|
|
|
;add ax,cs:current
|
2004-10-29 20:22:55 +02:00
|
|
|
|
jmp endofint ;on termine l'int
|
2004-10-29 18:32:48 +02:00
|
|
|
|
noerror:
|
|
|
|
|
and byte ptr [bp+6],0FEh;Si pas d'erreur on efface le Bit CARRY du FLAG qui sera d<>pil<69> lors du IRET
|
|
|
|
|
endofint:
|
|
|
|
|
pop bp
|
|
|
|
|
sti ;On r<>active les interruptions logiciellement
|
|
|
|
|
iret ;Puis on retourne au programme appelant.
|
|
|
|
|
|
|
|
|
|
current dw 0 ;Mot temporaire qui contient l'adresse de la fonction appel<65>e
|
|
|
|
|
tables dw MBinit ;Table qui contient les adresses de toutes les fonctions de VIDEO (WORD)
|
|
|
|
|
dw MBFree
|
|
|
|
|
dw MBCreate
|
|
|
|
|
dw MBresident
|
2004-10-29 20:22:55 +02:00
|
|
|
|
dw MBGet
|
2004-10-31 10:31:20 +01:00
|
|
|
|
dw MBFind
|
2004-10-31 12:45:46 +01:00
|
|
|
|
dw MBChown
|
2004-11-02 22:54:19 +01:00
|
|
|
|
dw MBAlloc
|
2004-11-03 01:32:19 +01:00
|
|
|
|
dw MBclean
|
2004-11-03 23:30:09 +01:00
|
|
|
|
dw MBfindsb
|
2004-11-19 18:19:05 +01:00
|
|
|
|
dw MBnonresident
|
|
|
|
|
dw MBSearchfunc
|
|
|
|
|
dw MBLoadfuncs
|
|
|
|
|
;dw MBdefrag
|
|
|
|
|
;dw MBcopy
|
|
|
|
|
;dw MBchname
|
2004-10-29 20:22:55 +02:00
|
|
|
|
|
2004-06-12 23:34:04 +02:00
|
|
|
|
FirstMB dw 0
|
|
|
|
|
|
2004-11-19 18:19:05 +01:00
|
|
|
|
;Resouds les d<>pendances du bloc de m<>moire GS
|
|
|
|
|
MBloadfuncs:
|
|
|
|
|
push ax bx ecx dx si di ds es gs
|
|
|
|
|
push gs
|
|
|
|
|
pop ds
|
2004-11-19 20:57:06 +01:00
|
|
|
|
cmp word ptr ds:[0],"EC"
|
|
|
|
|
;jne notloaded
|
|
|
|
|
jne endofloading
|
2004-11-19 19:58:30 +01:00
|
|
|
|
mov si,ds:[exe.import]
|
2004-11-19 18:19:05 +01:00
|
|
|
|
loadfuncs:
|
|
|
|
|
cmp word ptr [si],0
|
|
|
|
|
je endofloading
|
|
|
|
|
call MBSearchfunc
|
|
|
|
|
jnc toendoftext
|
|
|
|
|
mov bx,si
|
|
|
|
|
findend2:
|
|
|
|
|
inc bx
|
|
|
|
|
cmp byte ptr [bx], ':'
|
|
|
|
|
jne findend2
|
|
|
|
|
mov byte ptr [bx],0
|
|
|
|
|
mov ah,17
|
|
|
|
|
int 48h
|
|
|
|
|
jc notloaded
|
|
|
|
|
mov byte ptr [bx],':'
|
|
|
|
|
call MBSearchfunc
|
|
|
|
|
jc notloaded
|
|
|
|
|
toendoftext:
|
|
|
|
|
mov al,[si]
|
|
|
|
|
cmp al,0
|
|
|
|
|
je oktonext2
|
|
|
|
|
inc si
|
|
|
|
|
jmp toendoftext
|
|
|
|
|
oktonext2:
|
|
|
|
|
inc si
|
|
|
|
|
mov [si],dx
|
|
|
|
|
mov [si+2],gs
|
|
|
|
|
add si,4
|
|
|
|
|
jmp loadfuncs
|
|
|
|
|
endofloading:
|
|
|
|
|
clc
|
|
|
|
|
pop gs es ds di si dx ecx bx ax
|
|
|
|
|
ret
|
|
|
|
|
notloaded:
|
|
|
|
|
stc
|
|
|
|
|
pop gs es ds di si dx ecx bx ax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Recherche une fonction point<6E> par DS:SI en m<>moire et renvoie son adresse en GS:DX
|
|
|
|
|
MBSearchfunc:
|
|
|
|
|
push bx si di
|
|
|
|
|
mov bx,si
|
|
|
|
|
findend:
|
|
|
|
|
inc bx
|
|
|
|
|
cmp byte ptr [bx], ':'
|
|
|
|
|
jne findend
|
|
|
|
|
mov byte ptr [bx],0
|
|
|
|
|
call MBfind
|
|
|
|
|
mov byte ptr [bx],':'
|
|
|
|
|
jc notfoundattallthesb
|
2004-11-19 19:58:30 +01:00
|
|
|
|
cmp word ptr gs:[exe.checks],"EC"
|
2004-11-19 18:19:05 +01:00
|
|
|
|
jne notfoundattallthesb
|
2004-11-19 19:58:30 +01:00
|
|
|
|
mov di,gs:[exe.export]
|
2004-11-19 18:19:05 +01:00
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
|
|
|
|
functions:
|
|
|
|
|
cmp word ptr gs:[di],0
|
|
|
|
|
je notfoundattallthesb
|
|
|
|
|
mov si,bx
|
|
|
|
|
cmpnamesfunc:
|
|
|
|
|
mov al,gs:[di]
|
|
|
|
|
cmp al,ds:[si]
|
|
|
|
|
jne notfoundthesb
|
|
|
|
|
cmp al,0
|
|
|
|
|
je seemsok
|
|
|
|
|
inc si
|
|
|
|
|
inc di
|
|
|
|
|
jmp cmpnamesfunc
|
|
|
|
|
notfoundthesb:
|
|
|
|
|
mov al,gs:[di]
|
|
|
|
|
cmp al,0
|
|
|
|
|
je oktonext
|
|
|
|
|
inc di
|
|
|
|
|
jmp notfoundthesb
|
|
|
|
|
oktonext:
|
|
|
|
|
inc di
|
|
|
|
|
inc di
|
|
|
|
|
inc di
|
|
|
|
|
jmp functions
|
|
|
|
|
seemsok:
|
|
|
|
|
mov dx,gs:[di+1]
|
|
|
|
|
clc
|
|
|
|
|
pop di si bx
|
|
|
|
|
ret
|
|
|
|
|
notfoundattallthesb:
|
|
|
|
|
stc
|
|
|
|
|
pop di si bx
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
2004-11-03 01:32:19 +01:00
|
|
|
|
;Mise a nivo de la m<>moire (jonction de blocs libre)
|
|
|
|
|
MBclean:
|
|
|
|
|
push ax bx dx es gs
|
|
|
|
|
mov bx,cs:firstmb
|
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
xor ax,ax
|
|
|
|
|
xor dx,dx
|
|
|
|
|
searchfree3:
|
|
|
|
|
mov gs,bx
|
|
|
|
|
cmp gs:[MB.Check],'NH'
|
|
|
|
|
jne erroronsearch
|
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
|
|
|
|
add bx,gs:[MB.Sizes]
|
|
|
|
|
cmp word ptr gs:[MB.Sizes],0
|
|
|
|
|
je erroronsearch
|
|
|
|
|
cmp gs:[MB.Reference],Free
|
|
|
|
|
jne notfreeatall
|
|
|
|
|
cmp ax,0
|
|
|
|
|
je notmeetafree
|
|
|
|
|
add dx,gs:[MB.Sizes]
|
|
|
|
|
mov word ptr gs:[MB.Check],0
|
|
|
|
|
mov dword ptr gs:[MB.Names],0
|
|
|
|
|
mov dword ptr gs:[MB.Names+4],0
|
|
|
|
|
inc dx
|
|
|
|
|
inc dx
|
|
|
|
|
jmp nottrigered
|
|
|
|
|
notmeetafree:
|
|
|
|
|
xor dx,dx
|
|
|
|
|
mov ax,gs
|
|
|
|
|
jmp nottrigered
|
|
|
|
|
notfreeatall:
|
|
|
|
|
cmp ax,0
|
|
|
|
|
je nottrigered
|
|
|
|
|
mov es,ax
|
|
|
|
|
add es:[MB.Sizes],dx
|
|
|
|
|
xor ax,ax
|
|
|
|
|
nottrigered:
|
|
|
|
|
cmp gs:[MB.IsNotLast],true
|
|
|
|
|
je searchfree3
|
|
|
|
|
cmp ax,0
|
|
|
|
|
je reallyfinish
|
|
|
|
|
mov es,ax
|
|
|
|
|
add es:[MB.Sizes],dx
|
|
|
|
|
mov es:[MB.IsNotLast],False
|
|
|
|
|
reallyfinish:
|
|
|
|
|
clc
|
|
|
|
|
pop gs es dx bx ax
|
|
|
|
|
ret
|
|
|
|
|
erroronsearch:
|
|
|
|
|
stc
|
|
|
|
|
pop gs es dx bx ax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
2004-10-29 18:32:48 +02:00
|
|
|
|
;Initialise les blocs de m<>moire en prenant memorystart pour segment de base
|
2004-06-12 23:34:04 +02:00
|
|
|
|
MBinit:
|
|
|
|
|
push ax cx es
|
2004-10-29 20:22:55 +02:00
|
|
|
|
cmp cs:FirstMB,0
|
|
|
|
|
jne notforfree
|
2004-10-29 18:32:48 +02:00
|
|
|
|
mov ax,memorystart
|
|
|
|
|
mov cs:Firstmb,ax
|
|
|
|
|
mov cx,0A000h
|
|
|
|
|
sub cx,ax
|
|
|
|
|
dec ax
|
2004-06-12 23:34:04 +02:00
|
|
|
|
dec ax
|
|
|
|
|
mov es,ax
|
2004-10-29 20:22:55 +02:00
|
|
|
|
cmp es:[MB.Check],'NH'
|
|
|
|
|
je notforfree
|
2004-10-29 18:32:48 +02:00
|
|
|
|
mov es:[MB.Reference],Free
|
|
|
|
|
mov es:[MB.Sizes],cx
|
|
|
|
|
mov es:[MB.Check],'NH'
|
|
|
|
|
mov dword ptr es:[MB.Names],'eerF'
|
|
|
|
|
mov dword ptr es:[MB.Names+4],0
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov es:[MB.IsNotLast],False
|
|
|
|
|
clc
|
|
|
|
|
pop es cx ax
|
|
|
|
|
ret
|
|
|
|
|
notforfree:
|
|
|
|
|
stc
|
|
|
|
|
pop es cx ax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;Lib<69>re le bloc de m<>moire GS
|
|
|
|
|
MBFree:
|
2004-11-03 01:32:19 +01:00
|
|
|
|
push ax bx es
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov bx,gs
|
2004-11-02 22:54:19 +01:00
|
|
|
|
mov ax,bx
|
2004-10-29 18:32:48 +02:00
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov es,bx
|
2004-10-29 20:22:55 +02:00
|
|
|
|
cmp es:[MB.Reference],Free
|
|
|
|
|
je wasfree
|
|
|
|
|
cmp es:[MB.IsResident],true
|
|
|
|
|
je wasfree
|
|
|
|
|
mov es:[MB.IsResident],false
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov es:[MB.Reference],Free
|
|
|
|
|
mov dword ptr es:[MB.Names],'eerF'
|
|
|
|
|
mov dword ptr es:[MB.Names+4],0
|
2004-11-02 22:54:19 +01:00
|
|
|
|
mov bx,cs:firstmb
|
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
searchtofree:
|
|
|
|
|
mov gs,bx
|
|
|
|
|
cmp gs:[MB.Check],'NH'
|
|
|
|
|
jne wasfree
|
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
|
|
|
|
add bx,gs:[MB.Sizes]
|
|
|
|
|
cmp word ptr gs:[MB.Sizes],0
|
|
|
|
|
je wasfree
|
|
|
|
|
cmp ax,gs:[MB.Reference]
|
|
|
|
|
jne nottofree
|
|
|
|
|
mov gs:[MB.IsResident],false
|
|
|
|
|
mov gs:[MB.Reference],Free
|
|
|
|
|
mov dword ptr gs:[MB.Names],'eerF'
|
|
|
|
|
mov dword ptr gs:[MB.Names+4],0
|
|
|
|
|
nottofree:
|
|
|
|
|
cmp gs:[MB.IsNotLast],true
|
2004-11-03 01:32:19 +01:00
|
|
|
|
je searchtofree
|
|
|
|
|
call MBclean
|
|
|
|
|
pop es bx ax
|
2004-10-29 18:32:48 +02:00
|
|
|
|
ret
|
2004-10-29 20:22:55 +02:00
|
|
|
|
wasfree:
|
|
|
|
|
stc
|
2004-11-03 01:32:19 +01:00
|
|
|
|
pop es bx ax
|
2004-10-29 20:22:55 +02:00
|
|
|
|
ret
|
2004-10-31 12:45:46 +01:00
|
|
|
|
|
|
|
|
|
;Change le proprietaire de GS a dx
|
|
|
|
|
MBChown:
|
|
|
|
|
push bx es
|
|
|
|
|
mov bx,gs
|
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
mov es,bx
|
|
|
|
|
cmp es:[MB.Reference],Free
|
|
|
|
|
je wasfree2
|
|
|
|
|
mov es:[MB.Reference],dx
|
|
|
|
|
pop es bx
|
|
|
|
|
ret
|
|
|
|
|
wasfree2:
|
|
|
|
|
stc
|
|
|
|
|
pop es bx
|
|
|
|
|
ret
|
|
|
|
|
|
2004-11-02 22:54:19 +01:00
|
|
|
|
;Alloue un bloc de CX caractere pour le process vis<69> -> GS
|
|
|
|
|
MBAlloc:
|
|
|
|
|
push dx si bp ds
|
|
|
|
|
mov bp,sp
|
|
|
|
|
mov dx,ss:[bp+12]
|
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
mov si,offset data
|
|
|
|
|
call MBCreate
|
|
|
|
|
call MBChown
|
|
|
|
|
pop ds bp si dx
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
data db '/Data',0
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2004-10-29 20:22:55 +02:00
|
|
|
|
;Renvoie en GS le MB n<> cx carry quand termin<69>
|
2004-10-29 18:32:48 +02:00
|
|
|
|
MBGet:
|
2004-10-29 20:22:55 +02:00
|
|
|
|
push bx dx
|
|
|
|
|
mov bx,cs:firstmb
|
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
xor dx,dx
|
|
|
|
|
searchfree2:
|
|
|
|
|
mov gs,bx
|
|
|
|
|
cmp gs:[MB.Check],'NH'
|
|
|
|
|
jne itsend
|
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
|
|
|
|
add bx,gs:[MB.Sizes]
|
|
|
|
|
cmp word ptr gs:[MB.Sizes],0
|
|
|
|
|
je itsend
|
|
|
|
|
cmp dx,cx
|
|
|
|
|
je foundmcb
|
|
|
|
|
ja itsend
|
|
|
|
|
inc dx
|
|
|
|
|
cmp gs:[MB.IsNotLast],true
|
|
|
|
|
je searchfree2
|
|
|
|
|
itsend:
|
|
|
|
|
stc
|
|
|
|
|
pop dx bx
|
|
|
|
|
ret
|
|
|
|
|
foundmcb:
|
|
|
|
|
clc
|
|
|
|
|
pop dx bx
|
2004-11-10 13:00:49 +01:00
|
|
|
|
ret
|
2004-10-31 10:31:20 +01:00
|
|
|
|
|
|
|
|
|
;Renvoie en GS le MCB qui correspond a ds:si
|
|
|
|
|
MBFind:
|
|
|
|
|
push ax bx si di
|
|
|
|
|
mov bx,cs:firstmb
|
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
mov di,MB.Names
|
|
|
|
|
search:
|
|
|
|
|
mov gs,bx
|
|
|
|
|
cmp gs:[MB.Check],'NH'
|
|
|
|
|
jne itsend2
|
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
|
|
|
|
add bx,gs:[MB.Sizes]
|
|
|
|
|
cmp word ptr gs:[MB.Sizes],0
|
|
|
|
|
je itsend2
|
|
|
|
|
push si di
|
|
|
|
|
cmpnames:
|
|
|
|
|
mov al,gs:[di]
|
|
|
|
|
cmp al,ds:[si]
|
|
|
|
|
jne ok
|
|
|
|
|
cmp al,0
|
|
|
|
|
je ok
|
|
|
|
|
inc si
|
|
|
|
|
inc di
|
|
|
|
|
jmp cmpnames
|
|
|
|
|
ok:
|
|
|
|
|
pop di si
|
|
|
|
|
je foundmcb2
|
|
|
|
|
cmp gs:[MB.IsNotLast],true
|
|
|
|
|
je search
|
|
|
|
|
itsend2:
|
|
|
|
|
stc
|
|
|
|
|
pop di si bx ax
|
|
|
|
|
ret
|
|
|
|
|
foundmcb2:
|
2004-11-03 23:30:09 +01:00
|
|
|
|
mov bx,gs
|
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
|
|
|
|
mov gs,bx
|
2004-10-31 10:31:20 +01:00
|
|
|
|
clc
|
|
|
|
|
pop di si bx ax
|
|
|
|
|
ret
|
|
|
|
|
|
2004-11-03 23:30:09 +01:00
|
|
|
|
;Renvoie en GS le sous mcb qui correspond a ds:si et qui appartien a dx
|
|
|
|
|
MBFindsb:
|
|
|
|
|
push ax bx si di
|
|
|
|
|
mov bx,cs:firstmb
|
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
mov di,MB.Names
|
|
|
|
|
search2:
|
|
|
|
|
mov gs,bx
|
|
|
|
|
cmp gs:[MB.Check],'NH'
|
|
|
|
|
jne itsend3
|
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
|
|
|
|
add bx,gs:[MB.Sizes]
|
|
|
|
|
cmp word ptr gs:[MB.Sizes],0
|
|
|
|
|
je itsend3
|
|
|
|
|
push si di
|
|
|
|
|
cmpnames2:
|
|
|
|
|
mov al,gs:[di]
|
|
|
|
|
cmp al,ds:[si]
|
|
|
|
|
jne ok2
|
|
|
|
|
cmp al,0
|
|
|
|
|
je ok2
|
|
|
|
|
inc si
|
|
|
|
|
inc di
|
|
|
|
|
jmp cmpnames2
|
|
|
|
|
ok2:
|
|
|
|
|
pop di si
|
|
|
|
|
jne notfoundmcb2
|
|
|
|
|
cmp gs:[MB.Reference],dx
|
|
|
|
|
je foundmcb3
|
|
|
|
|
notfoundmcb2:
|
|
|
|
|
cmp gs:[MB.IsNotLast],true
|
|
|
|
|
je search2
|
|
|
|
|
itsend3:
|
|
|
|
|
stc
|
|
|
|
|
pop di si bx ax
|
|
|
|
|
ret
|
|
|
|
|
foundmcb3:
|
|
|
|
|
mov bx,gs
|
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
|
|
|
|
mov gs,bx
|
|
|
|
|
clc
|
|
|
|
|
pop di si bx ax
|
|
|
|
|
ret
|
|
|
|
|
|
2004-10-29 18:32:48 +02:00
|
|
|
|
;Cre<72>r un bloc de nom ds:si de taille cx (octets) -> n<>segment dans GS
|
2004-06-12 23:34:04 +02:00
|
|
|
|
MBCreate:
|
2004-10-31 12:45:46 +01:00
|
|
|
|
push bp
|
|
|
|
|
mov bp,sp
|
|
|
|
|
mov gs,ss:[bp+6]
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push ax bx cx dx si di es
|
|
|
|
|
shr cx,4
|
|
|
|
|
inc cx
|
|
|
|
|
mov bx,cs:firstmb
|
|
|
|
|
dec bx
|
2004-10-29 18:32:48 +02:00
|
|
|
|
dec bx
|
|
|
|
|
mov dl,1
|
2004-06-12 23:34:04 +02:00
|
|
|
|
searchfree:
|
2004-10-29 18:32:48 +02:00
|
|
|
|
cmp dl,False
|
|
|
|
|
je wasntgood
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov es,bx
|
|
|
|
|
cmp es:[MB.Check],'NH'
|
|
|
|
|
jne wasntgood
|
|
|
|
|
cmp es:[MB.IsNotLast],True
|
|
|
|
|
sete dl
|
|
|
|
|
cmp es:[MB.Reference],Free
|
2004-10-29 18:32:48 +02:00
|
|
|
|
jne notsogood
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov ax,es:[MB.Sizes]
|
|
|
|
|
cmp cx,ax
|
|
|
|
|
ja notsogood
|
2004-10-29 18:32:48 +02:00
|
|
|
|
mov word ptr es:[MB.Check],'NH'
|
|
|
|
|
mov es:[MB.IsNotLast],True
|
2004-10-31 12:45:46 +01:00
|
|
|
|
mov es:[MB.Reference],gs
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov es:[MB.IsResident],False
|
2004-10-29 18:32:48 +02:00
|
|
|
|
mov di,MB.Names
|
2004-06-12 23:34:04 +02:00
|
|
|
|
push ax cx
|
2004-10-29 18:32:48 +02:00
|
|
|
|
mov cx,32
|
2004-06-12 23:34:04 +02:00
|
|
|
|
loops:
|
|
|
|
|
mov dh,[si]
|
|
|
|
|
inc si
|
|
|
|
|
dec cx
|
|
|
|
|
jz endofloops
|
|
|
|
|
cmp dh,0
|
|
|
|
|
je endofloops
|
|
|
|
|
mov es:[di],dh
|
|
|
|
|
inc di
|
|
|
|
|
jmp loops
|
|
|
|
|
endofloops:
|
|
|
|
|
inc cx
|
|
|
|
|
mov al,0
|
|
|
|
|
rep stosb
|
|
|
|
|
pop cx ax
|
2004-10-31 10:31:20 +01:00
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
|
|
|
|
sub ax,cx
|
|
|
|
|
cmp ax,0
|
|
|
|
|
je nofree
|
2004-11-19 18:19:05 +01:00
|
|
|
|
dec ax
|
|
|
|
|
dec ax
|
2004-10-31 10:31:20 +01:00
|
|
|
|
mov es:[MB.Sizes],cx
|
|
|
|
|
add cx,bx
|
|
|
|
|
mov es,cx
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov es:[MB.IsNotLast],dl
|
|
|
|
|
mov es:[MB.IsResident],False
|
|
|
|
|
mov es:[MB.Reference],Free
|
|
|
|
|
mov es:[MB.Sizes],ax
|
|
|
|
|
mov dword ptr es:[MB.Names],'eerF'
|
|
|
|
|
mov dword ptr es:[MB.Names+4],0
|
|
|
|
|
mov es:[MB.Check],'NH'
|
|
|
|
|
nofree:
|
2004-10-31 10:31:20 +01:00
|
|
|
|
mov gs,bx
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
|
|
|
|
pop es di si dx cx bx ax
|
2004-10-31 12:45:46 +01:00
|
|
|
|
pop bp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
ret
|
|
|
|
|
wasntgood:
|
|
|
|
|
stc
|
|
|
|
|
pop es di si dx cx bx ax
|
2004-10-31 12:45:46 +01:00
|
|
|
|
pop bp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
ret
|
2004-10-29 18:32:48 +02:00
|
|
|
|
notsogood:
|
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
|
|
|
|
add bx,es:[MB.Sizes]
|
|
|
|
|
jmp searchfree
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
;Rend le segment GS r<>sident
|
|
|
|
|
MBresident:
|
|
|
|
|
push bx es
|
|
|
|
|
mov bx,gs
|
|
|
|
|
dec bx
|
2004-11-10 13:26:45 +01:00
|
|
|
|
dec bx
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov es,bx
|
|
|
|
|
mov es:[MB.IsResident],True
|
|
|
|
|
pop es bx
|
|
|
|
|
ret
|
2004-10-29 18:32:48 +02:00
|
|
|
|
|
2004-11-19 18:19:05 +01:00
|
|
|
|
;Rend le segment GS r<>sident
|
|
|
|
|
MBnonresident:
|
|
|
|
|
push bx es
|
|
|
|
|
mov bx,gs
|
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
mov es,bx
|
|
|
|
|
mov es:[MB.IsResident],False
|
|
|
|
|
pop es bx
|
|
|
|
|
ret
|
|
|
|
|
|
2004-10-29 18:32:48 +02:00
|
|
|
|
end start
|