2004-10-29 18:32:48 +02:00
|
|
|
|
|
2007-03-13 21:56:55 +01:00
|
|
|
|
;Affiche le nombre hexa dans %0[dword]
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc biosprinth uses ax bx cx edx si di, num:dword
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov edx,[num]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov ah,09h
|
|
|
|
|
mov di,8
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.hexaize:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
rol edx,4
|
|
|
|
|
mov si,dx
|
|
|
|
|
and si,1111b
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov al,[cs:si+.tab]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov cx,1
|
|
|
|
|
cmp al,32
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jb .control
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov bx,7
|
|
|
|
|
mov ah,09h
|
|
|
|
|
int 10h
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.control:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov ah,0Eh
|
|
|
|
|
int 10h
|
|
|
|
|
dec di
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jnz .hexaize
|
|
|
|
|
retf
|
|
|
|
|
.tab db '0123456789ABCDEF'
|
|
|
|
|
endp
|
2004-10-29 18:32:48 +02:00
|
|
|
|
|
2007-03-13 21:56:55 +01:00
|
|
|
|
;Affiche le texte ASCIIZ point<6E> par %0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc biosprint uses ax bx cx si, pointer:word
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov si,[pointer]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov cx,1
|
|
|
|
|
mov bx,7
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.again:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
lodsb
|
|
|
|
|
or al,al
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jz .fin
|
2007-03-13 21:56:55 +01:00
|
|
|
|
cmp al,32
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jb .control
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov ah,09h
|
|
|
|
|
int 10h
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.control:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov ah,0Eh
|
|
|
|
|
int 10h
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .again
|
|
|
|
|
.fin:
|
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-10-29 18:32:48 +02:00
|
|
|
|
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc enablea20 uses ax
|
2007-03-14 12:18:58 +01:00
|
|
|
|
mov al,0d1h
|
|
|
|
|
out 64h,al
|
|
|
|
|
call a20wait
|
|
|
|
|
mov al,0dfh
|
|
|
|
|
out 60h,al
|
|
|
|
|
call a20wait
|
|
|
|
|
;mov al,0ffh
|
|
|
|
|
;out 64h,al
|
|
|
|
|
;call a20wait
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-14 12:18:58 +01:00
|
|
|
|
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc disablea20 uses ax
|
2007-03-14 12:18:58 +01:00
|
|
|
|
mov al,0d1h
|
|
|
|
|
out 64h,al
|
|
|
|
|
call a20wait
|
|
|
|
|
mov al,0DDh
|
|
|
|
|
out 60h,al
|
|
|
|
|
call a20wait
|
|
|
|
|
;mov al,0ffh
|
|
|
|
|
;out 64h,al
|
|
|
|
|
;call a20wait
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-14 12:18:58 +01:00
|
|
|
|
|
|
|
|
|
a20wait:
|
|
|
|
|
in al,64h
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .suite
|
|
|
|
|
.suite:
|
2007-03-14 12:18:58 +01:00
|
|
|
|
and al,2
|
|
|
|
|
jnz a20wait
|
|
|
|
|
ret
|
|
|
|
|
;par le system control port A
|
|
|
|
|
;in al,92h
|
|
|
|
|
;or al,2
|
|
|
|
|
;out 92h,al
|
|
|
|
|
|
|
|
|
|
;par le system control port A
|
|
|
|
|
;in al,92h
|
|
|
|
|
;and al,not 2
|
|
|
|
|
;out 92h,al
|
|
|
|
|
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc flatmode uses eax bx ds
|
2007-03-14 12:18:58 +01:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
; first, calculate the linear address of GDT
|
|
|
|
|
xor eax,eax
|
|
|
|
|
mov ax,ds
|
|
|
|
|
shl eax,4
|
2019-07-06 10:52:53 +02:00
|
|
|
|
add dword [.gdt+2],eax ; store as GDT linear base addr
|
2007-03-14 12:18:58 +01:00
|
|
|
|
; now load the GDT into the GDTR
|
2019-07-06 10:52:53 +02:00
|
|
|
|
lgdt fword [.gdt] ; load GDT base
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.descriptor descriptor
|
|
|
|
|
end virtual
|
|
|
|
|
mov bx,1 * .descriptor.sizeof ; point to first descriptor
|
2007-03-14 12:18:58 +01:00
|
|
|
|
cli ; turn off interrupts
|
|
|
|
|
mov eax,cr0 ; prepare to enter protected mode
|
|
|
|
|
or al,1 ; flip the PE bit
|
|
|
|
|
mov cr0,eax ; we're now in protected mode
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .suite
|
|
|
|
|
.suite:
|
2007-03-14 12:18:58 +01:00
|
|
|
|
mov fs,bx ; load the FS segment register
|
|
|
|
|
and al,0FEh ; clear the PE bit again
|
|
|
|
|
mov cr0,eax ; back to real mode
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .suite2
|
|
|
|
|
.suite2:
|
2007-03-14 12:18:58 +01:00
|
|
|
|
sti ; resume handling interrupts
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf ;
|
2007-03-13 21:56:55 +01:00
|
|
|
|
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.gdt:
|
|
|
|
|
gdtitse descriptor .gdtend - .gdt - 1, .gdt, 0, 0, 0, 0 ; the GDT itself
|
|
|
|
|
gdtdata descriptor 0ffffh, 0, 0, 091h, 0cfh, 0 ; 4G data segment
|
|
|
|
|
.gdtend:
|
|
|
|
|
endp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-13 21:56:55 +01:00
|
|
|
|
;Attend l'appuie sur une touche
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc bioswaitkey uses ax
|
2007-03-13 21:56:55 +01:00
|
|
|
|
xor ax,ax
|
|
|
|
|
int 16h
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-13 21:56:55 +01:00
|
|
|
|
|
|
|
|
|
firstmb dw 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Charge les sections du block %0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbloadsection uses ax bx cx si di ds es, blocks:word
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov ax,[blocks]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov es,ax
|
|
|
|
|
mov ds,ax
|
2019-07-06 10:52:53 +02:00
|
|
|
|
cmp word [0],"EC"
|
|
|
|
|
jne .notace
|
|
|
|
|
lea si,[.toresov]
|
|
|
|
|
mov word [ss:si],0FFFFh
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.exe exe
|
|
|
|
|
end virtual
|
|
|
|
|
mov bx,[ds:.exe.sections]
|
2007-03-18 21:44:40 +01:00
|
|
|
|
cmp bx,0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .finishloading
|
|
|
|
|
.loading:
|
|
|
|
|
cmp dword [bx],0
|
|
|
|
|
je .finishloading
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov ax,bx
|
|
|
|
|
add ax,4
|
2007-03-14 12:18:58 +01:00
|
|
|
|
pushad
|
2019-07-06 10:52:53 +02:00
|
|
|
|
stdcall biosprint,ax
|
2007-03-14 12:18:58 +01:00
|
|
|
|
popad
|
2019-07-06 10:52:53 +02:00
|
|
|
|
stdcall mbcreate,ax,word [bx+2]
|
|
|
|
|
jc .error
|
2004-11-19 18:19:05 +01:00
|
|
|
|
inc si
|
|
|
|
|
inc si
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov [ss:si],ax
|
|
|
|
|
push si
|
|
|
|
|
mov si,[bx]
|
|
|
|
|
xor di,di
|
|
|
|
|
mov es,ax
|
|
|
|
|
mov cx,[bx+2]
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
pop si
|
|
|
|
|
add bx,4
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.gonext:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
inc bx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
cmp byte [bx],0
|
|
|
|
|
jne .gonext
|
2007-03-13 21:56:55 +01:00
|
|
|
|
inc bx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .loading
|
|
|
|
|
.finishloading:
|
|
|
|
|
cmp word [ss:si],0FFFFh
|
|
|
|
|
je .finishdepands
|
|
|
|
|
stdcall mbloadfuncs,word [ss:si]
|
|
|
|
|
jc .depandserror
|
2007-03-13 21:56:55 +01:00
|
|
|
|
dec si
|
|
|
|
|
dec si
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .finishloading
|
|
|
|
|
.finishdepands:
|
|
|
|
|
retf
|
|
|
|
|
.notace:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.error:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.depandserror:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.toresov dw 60 dup (0)
|
|
|
|
|
endp
|
2007-03-13 21:56:55 +01:00
|
|
|
|
|
2004-11-19 18:19:05 +01:00
|
|
|
|
|
2007-03-13 21:56:55 +01:00
|
|
|
|
;Initialise les blocs de m<>moire en prenant memorystart pour segment de base
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbinit uses ax cx si di ds es
|
2007-03-13 21:56:55 +01:00
|
|
|
|
cmp [cs:firstmb],0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .alreadyok
|
2007-03-13 21:56:55 +01:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
mov [cs:firstmb],memorystart
|
|
|
|
|
mov ax,memorystart-2
|
|
|
|
|
mov es,ax
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov si,afree
|
2007-03-13 21:56:55 +01:00
|
|
|
|
xor di,di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.mb mb
|
|
|
|
|
end virtual
|
|
|
|
|
mov cx,.mb.sizeof
|
2007-03-13 21:56:55 +01:00
|
|
|
|
rep movsb
|
|
|
|
|
clc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.alreadyok:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-11-19 18:19:05 +01:00
|
|
|
|
|
2019-07-06 10:52:53 +02:00
|
|
|
|
afree mb "HN",0,0,0,0A000h-memorystart,"Libre"
|
2007-03-13 21:56:55 +01:00
|
|
|
|
db 0
|
|
|
|
|
|
|
|
|
|
;Cre<72>r un bloc de nom %0 de taille %1 (octets) -> n<>segment dans AX
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbcreate uses bx cx dx si di ds es, blocks:word, size:word
|
2007-03-13 21:56:55 +01:00
|
|
|
|
push gs
|
2007-03-27 12:22:47 +02:00
|
|
|
|
mov ax,[ss:bp+4]
|
|
|
|
|
mov dx,ax
|
|
|
|
|
dec dx
|
|
|
|
|
dec dx
|
|
|
|
|
mov gs,dx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
cmp word [gs:0x0],'NH'
|
|
|
|
|
je .oktoset
|
2007-03-27 12:22:47 +02:00
|
|
|
|
mov ax,memorystart
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.oktoset:
|
2007-03-27 12:22:47 +02:00
|
|
|
|
mov gs,ax
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov cx,[size]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
shr cx,4
|
|
|
|
|
inc cx
|
|
|
|
|
mov bx,[cs:firstmb]
|
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
mov dl,true
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.searchfree:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
cmp dl,false
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .notenougtmem
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov es,bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.mb mb
|
|
|
|
|
end virtual
|
|
|
|
|
cmp word [es:.mb.check],"NH"
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .memoryerror
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp [es:.mb.isnotlast],true
|
2007-03-14 12:18:58 +01:00
|
|
|
|
sete dl
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp [es:.mb.reference],free
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .notsogood
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov ax,[es:.mb.sizes]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
cmp cx,ax
|
2019-07-06 10:52:53 +02:00
|
|
|
|
ja .notsogood
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov word [es:.mb.check],"NH"
|
|
|
|
|
mov [es:.mb.isnotlast],true
|
|
|
|
|
mov [es:.mb.reference],gs
|
|
|
|
|
mov [es:.mb.isresident],false
|
|
|
|
|
lea di,[es:.mb.names]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
push cx
|
|
|
|
|
mov cx,24/4
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov si,[blocks]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
|
|
|
|
pop cx
|
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
|
|
|
|
sub ax,cx
|
|
|
|
|
cmp ax,0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .nofree
|
2007-03-13 21:56:55 +01:00
|
|
|
|
dec ax
|
|
|
|
|
dec ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov [es:.mb.sizes],cx
|
2007-03-13 21:56:55 +01:00
|
|
|
|
add cx,bx
|
|
|
|
|
mov es,cx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov si,afree
|
2007-03-13 21:56:55 +01:00
|
|
|
|
xor di,di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov cx,.mb.sizeof
|
2007-03-14 12:18:58 +01:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
2007-03-13 21:56:55 +01:00
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov [es:.mb.isnotlast],dl
|
|
|
|
|
mov [es:.mb.sizes],ax
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.nofree:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov ax,bx
|
|
|
|
|
pop gs
|
2007-03-14 12:18:58 +01:00
|
|
|
|
clc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.notsogood:
|
2004-11-19 18:19:05 +01:00
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
add bx,[es:.mb.sizes]
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .searchfree
|
|
|
|
|
.memoryerror:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
pop gs
|
2007-03-14 12:18:58 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.notenougtmem:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
pop gs
|
2004-11-19 18:19:05 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-11-19 18:19:05 +01:00
|
|
|
|
|
2007-03-13 21:56:55 +01:00
|
|
|
|
;Lib<69>re le bloc de m<>moire %0 et ses sous blocs
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbfree uses ax bx cx si di ds es, blocks:word
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov bx,[blocks]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov ax,bx
|
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
mov es,bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.mb mb
|
|
|
|
|
end virtual
|
|
|
|
|
cmp word [es:.mb.check],"NH"
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .memoryerror
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp [es:.mb.reference],free
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .wasfree
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp [es:.mb.isresident],true
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .wasresident
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov [es:.mb.reference],free
|
2007-03-13 21:56:55 +01:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov si,.isfree
|
2019-07-09 18:30:00 +02:00
|
|
|
|
lea di,[es:.mb.names]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov cx,6
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov bx,[cs:firstmb]
|
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.searchtofree:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov es,bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp word [es:.mb.check],"NH"
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .memoryerror
|
2007-03-13 21:56:55 +01:00
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
add bx,[es:.mb.sizes]
|
|
|
|
|
cmp [es:.mb.sizes],0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .nottofree
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp ax,[es:.mb.reference]
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .nottofree
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov [es:.mb.isresident],false
|
|
|
|
|
mov [es:.mb.reference],free
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov si,.isfree
|
2019-07-09 18:30:00 +02:00
|
|
|
|
lea di,[es:.mb.names]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov cx,6
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.nottofree:
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp [es:.mb.isnotlast],true
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .searchtofree
|
|
|
|
|
stdcall mbclean
|
|
|
|
|
retf
|
|
|
|
|
.memoryerror:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.wasfree:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.wasresident:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
2007-03-13 21:56:55 +01:00
|
|
|
|
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.isfree db "libre",0
|
|
|
|
|
endp
|
2004-11-19 18:19:05 +01:00
|
|
|
|
|
2004-11-03 01:32:19 +01:00
|
|
|
|
;Mise a nivo de la m<>moire (jonction de blocs libre)
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbclean uses ax bx dx es gs
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov bx,[cs:firstmb]
|
2004-11-03 01:32:19 +01:00
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
xor ax,ax
|
|
|
|
|
xor dx,dx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.searchfree:
|
2004-11-03 01:32:19 +01:00
|
|
|
|
mov gs,bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.mb mb
|
|
|
|
|
end virtual
|
|
|
|
|
cmp word [gs:.mb.check],"NH"
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .memoryerror
|
2004-11-03 01:32:19 +01:00
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
add bx,[gs:.mb.sizes]
|
|
|
|
|
cmp word [gs:.mb.sizes],0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .notenougtmem
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp [gs:.mb.reference],free
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .notfree
|
2004-11-03 01:32:19 +01:00
|
|
|
|
cmp ax,0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .notmeetfree
|
2019-07-09 18:30:00 +02:00
|
|
|
|
add dx,[gs:.mb.sizes]
|
|
|
|
|
mov word [gs:.mb.check],0
|
|
|
|
|
mov dword [gs:.mb.names],0
|
2004-11-03 01:32:19 +01:00
|
|
|
|
inc dx
|
|
|
|
|
inc dx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .nottrigered
|
|
|
|
|
.notmeetfree:
|
2004-11-03 01:32:19 +01:00
|
|
|
|
xor dx,dx
|
|
|
|
|
mov ax,gs
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .nottrigered
|
|
|
|
|
.notfree:
|
2004-11-03 01:32:19 +01:00
|
|
|
|
cmp ax,0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .nottrigered
|
2004-11-03 01:32:19 +01:00
|
|
|
|
mov es,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
add [es:.mb.sizes],dx
|
2004-11-03 01:32:19 +01:00
|
|
|
|
xor ax,ax
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.nottrigered:
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp [gs:.mb.isnotlast],true
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .searchfree
|
2004-11-03 01:32:19 +01:00
|
|
|
|
cmp ax,0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .reallyfinish
|
2004-11-03 01:32:19 +01:00
|
|
|
|
mov es,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
add [es:.mb.sizes],dx
|
|
|
|
|
mov [es:.mb.isnotlast],false
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.reallyfinish:
|
2004-11-03 01:32:19 +01:00
|
|
|
|
clc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.notenougtmem:
|
2004-11-03 01:32:19 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.memoryerror:
|
2004-06-12 23:34:04 +02:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-13 21:56:55 +01:00
|
|
|
|
;Rend le segment %0 r<>sident
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbresident uses bx es, blocks:word
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov bx,[blocks]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
dec bx
|
2004-10-29 18:32:48 +02:00
|
|
|
|
dec bx
|
2004-06-12 23:34:04 +02:00
|
|
|
|
mov es,bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.mb mb
|
|
|
|
|
end virtual
|
|
|
|
|
cmp word [es:.mb.check],"NH"
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .memoryerror
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov [es:.mb.isresident],true
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.memoryerror:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-10-31 12:45:46 +01:00
|
|
|
|
|
2007-03-13 21:56:55 +01:00
|
|
|
|
;Rend le segment %0 non r<>sident
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbnonresident uses bx es, blocks:word
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov bx,[blocks]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
mov es,bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.mb mb
|
|
|
|
|
end virtual
|
|
|
|
|
cmp word [es:.mb.check],"NH"
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .memoryerror
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov [es:.mb.isresident],false
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.memoryerror:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-13 21:56:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Change le proprietaire de %0 a %1
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbchown uses bx dx es,blocks:word, owner:word
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov bx,[blocks]
|
2004-10-31 12:45:46 +01:00
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
mov es,bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.mb mb
|
|
|
|
|
end virtual
|
|
|
|
|
cmp word [es:.mb.check],"NH"
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .memoryerror
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp [es:.mb.reference],free
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .wasfree
|
|
|
|
|
mov dx,[owner]
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov [es:.mb.reference],dx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.memoryerror:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.wasfree:
|
2004-10-31 12:45:46 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-10-31 12:45:46 +01:00
|
|
|
|
|
2007-03-13 21:56:55 +01:00
|
|
|
|
;Alloue un bloc /data de CX caractere pour le process appelant -> ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mballoc uses si ds, size:word
|
2004-11-02 22:54:19 +01:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
2019-07-06 10:52:53 +02:00
|
|
|
|
stdcall mbcreate,.data,[size]
|
|
|
|
|
stdcall mbchown,ax,word [ss:bp+4]
|
|
|
|
|
retf
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.data db '/data',0
|
|
|
|
|
endp
|
2007-03-13 21:56:55 +01:00
|
|
|
|
|
|
|
|
|
;Renvoie en AX le MB n<> %0 carry quand termin<69>
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbget uses bx dx es, num:word
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov bx,[cs:firstmb]
|
2004-10-29 20:22:55 +02:00
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
|
|
|
|
xor dx,dx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.searchfree:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov es,bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.mb mb
|
|
|
|
|
end virtual
|
|
|
|
|
cmp word [es:.mb.check],"NH"
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .memoryerror
|
2004-10-29 20:22:55 +02:00
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
add bx,[es:.mb.sizes]
|
|
|
|
|
cmp [es:.mb.sizes],0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .memoryerror
|
|
|
|
|
cmp dx,[num]
|
|
|
|
|
je .foundmcb
|
|
|
|
|
ja .notfound
|
2004-10-29 20:22:55 +02:00
|
|
|
|
inc dx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp [es:.mb.isnotlast],true
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .searchfree
|
|
|
|
|
.memoryerror:
|
2004-10-29 20:22:55 +02:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.foundmcb:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov ax,es
|
|
|
|
|
inc ax
|
|
|
|
|
inc ax
|
2004-10-29 20:22:55 +02:00
|
|
|
|
clc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.notfound:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-10-31 10:31:20 +01:00
|
|
|
|
|
2007-03-13 21:56:55 +01:00
|
|
|
|
;Renvoie en AX le MCB qui correspond a ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbfind uses bx si di es, blocks:word
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov bx,[cs:firstmb]
|
2004-10-31 10:31:20 +01:00
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov si,[blocks]
|
|
|
|
|
.search:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov es,bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.mb mb
|
|
|
|
|
end virtual
|
|
|
|
|
lea di,[es:.mb.names]
|
|
|
|
|
cmp word [es:.mb.check],"NH"
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .memoryerror
|
2004-10-31 10:31:20 +01:00
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
add bx,[es:.mb.sizes]
|
|
|
|
|
cmp [es:.mb.sizes],0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .memoryerror
|
2004-10-31 10:31:20 +01:00
|
|
|
|
push si di
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.cmpnames:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov al,[es:di]
|
|
|
|
|
cmp al,[ds:si]
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .ok
|
2004-10-31 10:31:20 +01:00
|
|
|
|
cmp al,0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .ok
|
2004-10-31 10:31:20 +01:00
|
|
|
|
inc si
|
|
|
|
|
inc di
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .cmpnames
|
|
|
|
|
.ok:
|
2004-10-31 10:31:20 +01:00
|
|
|
|
pop di si
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .foundmcb
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp [es:.mb.isnotlast],true
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .search
|
|
|
|
|
.notfound:
|
2004-10-31 10:31:20 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.memoryerror:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.foundmcb:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov ax,es
|
|
|
|
|
inc ax
|
|
|
|
|
inc ax
|
2004-10-31 10:31:20 +01:00
|
|
|
|
clc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-13 21:56:55 +01:00
|
|
|
|
|
2004-10-31 10:31:20 +01:00
|
|
|
|
|
2007-03-13 21:56:55 +01:00
|
|
|
|
;Renvoie en AX le sous mcb qui correspond a %0 et qui appartien a %1
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbfindsb uses bx dx si di es, blocks:word, owner:word
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov bx,[cs:firstmb]
|
2004-11-03 23:30:09 +01:00
|
|
|
|
dec bx
|
|
|
|
|
dec bx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov si,[blocks]
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.mb mb
|
|
|
|
|
end virtual
|
|
|
|
|
lea di,[es:.mb.names]
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov dx,[owner]
|
|
|
|
|
.search:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov es,bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp word [es:.mb.check],"NH"
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .memoryerror
|
2004-11-03 23:30:09 +01:00
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
add bx,[es:.mb.sizes]
|
|
|
|
|
cmp [es:.mb.sizes],0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .memoryerror
|
2004-11-03 23:30:09 +01:00
|
|
|
|
push si di
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.cmpnames:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov al,[es:di]
|
|
|
|
|
cmp al,[ds:si]
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .ok
|
2004-11-03 23:30:09 +01:00
|
|
|
|
cmp al,0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .ok
|
2004-11-03 23:30:09 +01:00
|
|
|
|
inc si
|
|
|
|
|
inc di
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .cmpnames
|
|
|
|
|
.ok:
|
2004-11-03 23:30:09 +01:00
|
|
|
|
pop di si
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .notfoundmcb
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp [es:.mb.reference],dx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .foundmcb
|
|
|
|
|
.notfoundmcb:
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp [es:.mb.isnotlast],true
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .search
|
|
|
|
|
.notfound:
|
2004-11-03 23:30:09 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.foundmcb:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov ax,es
|
|
|
|
|
inc ax
|
|
|
|
|
inc ax
|
2004-06-12 23:34:04 +02:00
|
|
|
|
clc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.memoryerror:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-13 21:56:55 +01:00
|
|
|
|
|
|
|
|
|
;Resouds les d<>pendances du bloc de m<>moire %0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbloadfuncs uses ax bx cx dx si ds, blocks:word
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov ds,[blocks]
|
|
|
|
|
cmp word [0],"EC"
|
|
|
|
|
jne .notace
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.exe exe
|
|
|
|
|
end virtual
|
|
|
|
|
mov si,[ds:.exe.imports]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
cmp si,0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .endofloading
|
|
|
|
|
.loadfuncs:
|
|
|
|
|
cmp word [si],0
|
|
|
|
|
je .endofloading
|
|
|
|
|
stdcall mbsearchfunc,si
|
|
|
|
|
jnc .toendoftext
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov bx,si
|
2007-03-31 13:18:56 +02:00
|
|
|
|
;pushad
|
2019-07-06 10:52:53 +02:00
|
|
|
|
;stdcall biosprint,si
|
2007-03-31 13:18:56 +02:00
|
|
|
|
;popad
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.findend:
|
2004-10-29 18:32:48 +02:00
|
|
|
|
inc bx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
cmp byte [bx], ':'
|
|
|
|
|
jne .findend
|
|
|
|
|
mov byte [bx],0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
invoke projfile,si
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov byte [bx],':'
|
|
|
|
|
jc .erroronload
|
2007-03-31 13:18:56 +02:00
|
|
|
|
;pushad
|
2019-07-06 10:52:53 +02:00
|
|
|
|
;stdcall biosprint,si
|
2007-03-31 13:18:56 +02:00
|
|
|
|
;popad
|
2019-07-06 10:52:53 +02:00
|
|
|
|
stdcall mbsearchfunc,si
|
|
|
|
|
jc .libnotexist
|
|
|
|
|
.toendoftext:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov cl,[si]
|
|
|
|
|
cmp cl,0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .oktonext
|
2007-03-13 21:56:55 +01:00
|
|
|
|
inc si
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .toendoftext
|
|
|
|
|
.oktonext:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
inc si
|
|
|
|
|
mov [si],ax
|
|
|
|
|
mov [si+2],dx
|
|
|
|
|
add si,4
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .loadfuncs
|
|
|
|
|
.endofloading:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
clc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.notace:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.libnotexist:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.erroronload:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
2007-03-13 21:56:55 +01:00
|
|
|
|
|
2007-03-23 17:46:35 +01:00
|
|
|
|
;Recherche une fonction point<6E> par DS:%0 en m<>moire et renvoie son adresse en DX:AX
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc mbsearchfunc uses bx si di es, func:word
|
2019-07-06 10:52:53 +02:00
|
|
|
|
mov bx,[func]
|
2007-03-23 17:46:35 +01:00
|
|
|
|
mov si,bx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.findend:
|
2019-07-09 18:30:00 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.exe exe
|
|
|
|
|
end virtual
|
2007-03-13 21:56:55 +01:00
|
|
|
|
inc bx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
cmp byte [bx], ':'
|
|
|
|
|
jne .findend
|
|
|
|
|
mov byte [bx],0
|
|
|
|
|
stdcall mbfind,si
|
|
|
|
|
mov byte [bx],':'
|
|
|
|
|
jc .notfoundattallthesb
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov es,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp word [es:.exe.checks],"EC"
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .notfoundattallthesb
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov di,[es:.exe.exports]
|
2007-03-13 21:56:55 +01:00
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.functions:
|
|
|
|
|
cmp word [es:di],0
|
|
|
|
|
je .notfoundattallthesb
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov si,bx
|
2019-07-06 10:52:53 +02:00
|
|
|
|
.cmpnamesfunc:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov al,[es:di]
|
|
|
|
|
cmp al,[ds:si]
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jne .notfoundthesb
|
2007-03-13 21:56:55 +01:00
|
|
|
|
cmp al,0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .seemsok
|
2007-03-13 21:56:55 +01:00
|
|
|
|
inc si
|
|
|
|
|
inc di
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .cmpnamesfunc
|
|
|
|
|
.notfoundthesb:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov al,[es:di]
|
|
|
|
|
cmp al,0
|
2019-07-06 10:52:53 +02:00
|
|
|
|
je .oktonext
|
2007-03-13 21:56:55 +01:00
|
|
|
|
inc di
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .notfoundthesb
|
|
|
|
|
.oktonext:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
inc di
|
|
|
|
|
inc di
|
|
|
|
|
inc di
|
2019-07-06 10:52:53 +02:00
|
|
|
|
jmp .functions
|
|
|
|
|
.seemsok:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov dx,es
|
|
|
|
|
mov ax,[es:di+1]
|
|
|
|
|
clc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
.notfoundattallthesb:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
stc
|
2019-07-06 10:52:53 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|