merge mem.inc to dll.inc

place dll.inc in /programs
delete all the other dll.inc and mem.inc files
correct some programs to use common dll.inc


git-svn-id: svn://kolibrios.org@3014 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Ivan Baravy 2012-11-09 10:42:30 +00:00
parent 55f254a7ee
commit 0cc349060f
50 changed files with 170 additions and 2681 deletions

View File

@ -1,99 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -13,8 +13,7 @@ include '../../macros.inc'
include '../../proc32.inc' include '../../proc32.inc'
include '../../develop/libraries/box_lib/load_lib.mac' include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include 'mem.inc' include '../../dll.inc'
include 'dll.inc'
include 'lang.inc' include 'lang.inc'
include 'info_fun_float.inc' include 'info_fun_float.inc'

View File

@ -1,99 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -13,8 +13,7 @@ include '../../macros.inc'
include '../../proc32.inc' include '../../proc32.inc'
include '../../develop/libraries/box_lib/load_lib.mac' include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include 'mem.inc' include '../../dll.inc'
include 'dll.inc'
include 'strlen.inc' include 'strlen.inc'
include 'obj_codes.inc' include 'obj_codes.inc'

View File

@ -1,48 +0,0 @@
;-----------------------------------------------------------------------------
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[size]
;*** add ecx,4
mcall 68,12
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
;*** add ecx,4
@@: mov edx,[mptr]
or edx,edx
jz @f
;*** add edx,-4
@@: mcall 68,20
or eax,eax
jz @f
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
;*** add ecx,-4
@@: mcall 68,13
pop ecx ebx
ret
endp

View File

@ -1,99 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -10,8 +10,7 @@ use32
include '../../../../../macros.inc' include '../../../../../macros.inc'
include '../../../../../proc32.inc' include '../../../../../proc32.inc'
include '../../../../../develop/libraries/box_lib/load_lib.mac' include '../../../../../develop/libraries/box_lib/load_lib.mac'
include 'mem.inc' include '../../../../../dll.inc'
include 'dll.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load
@ -315,4 +314,4 @@ stacktop:
rb 4096 rb 4096
filename_area: filename_area:
rb 256 rb 256
mem: mem:

View File

@ -10,8 +10,7 @@ use32
include '../../../../../macros.inc' include '../../../../../macros.inc'
include '../../../../../proc32.inc' include '../../../../../proc32.inc'
include '../../../../../develop/libraries/box_lib/load_lib.mac' include '../../../../../develop/libraries/box_lib/load_lib.mac'
include 'mem.inc' include '../../../../../dll.inc'
include 'dll.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load
@ -315,4 +314,4 @@ stacktop:
rb 4096 rb 4096
filename_area: filename_area:
rb 256 rb 256
mem: mem:

View File

@ -1,48 +0,0 @@
;-----------------------------------------------------------------------------
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[size]
;*** add ecx,4
mcall 68,12
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
;*** add ecx,4
@@: mov edx,[mptr]
or edx,edx
jz @f
;*** add edx,-4
@@: mcall 68,20
or eax,eax
jz @f
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
;*** add ecx,-4
@@: mcall 68,13
pop ecx ebx
ret
endp

View File

@ -17,7 +17,7 @@ TRUE = 1
include '../../../../../proc32.inc' include '../../../../../proc32.inc'
include '../../../../../macros.inc' include '../../../../../macros.inc'
include '../../libio/libio.inc' include '../../libio/libio.inc'
include '../dll.inc' include '../../../../../dll.inc'
yy dd 20 yy dd 20
@ -275,70 +275,6 @@ draw_window:
_f_path db '/rd/1/lib',0 _f_path db '/rd/1/lib',0
_f_mask db '*ini*',0 _f_mask db '*ini*',0
;-----------------------------------------------------------------------------
proc mem.Alloc size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov eax,[size]
lea ecx,[eax+4+4095]
and ecx,not 4095
mcall 68,12
add ecx,-4
mov [eax],ecx
add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc mptr,size;///////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx esi edi eax
mov eax,[mptr]
mov ebx,[size]
or eax,eax
jz @f
lea ecx,[ebx+4+4095]
and ecx,not 4095
add ecx,-4
cmp ecx,[eax-4]
je .exit
@@: mov eax,ebx
call mem.Alloc
xchg eax,[esp]
or eax,eax
jz .exit
mov esi,eax
xchg eax,[esp]
mov edi,eax
mov ecx,[esi-4]
cmp ecx,[edi-4]
jbe @f
mov ecx,[edi-4]
@@: add ecx,3
shr ecx,2
cld
rep movsd
xchg eax,[esp]
call mem.Free
.exit:
pop eax edi esi ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov eax,[mptr]
or eax,eax
jz @f
push ebx ecx
lea ecx,[eax-4]
mcall 68,13
pop ecx ebx
@@: ret
endp
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;--- ÄÀÍÍÛÅ ÏÐÎÃÐÀÌÌÛ ---------------------------------------------- ;--- ÄÀÍÍÛÅ ÏÐÎÃÐÀÌÌÛ ----------------------------------------------
;--------------------------------------------------------------------- ;---------------------------------------------------------------------

View File

@ -11,7 +11,7 @@ TRUE = 1
include '../../../../../proc32.inc' include '../../../../../proc32.inc'
include '../../../../../macros.inc' include '../../../../../macros.inc'
include '../dll.inc' include '../../../../../dll.inc'
include '../../libio/libio.inc' include '../../libio/libio.inc'
include '../../libimg/libimg.inc' include '../../libimg/libimg.inc'
@ -137,55 +137,6 @@ draw_window:
invoke gfx.close, [ctx] invoke gfx.close, [ctx]
ret ret
;-----------------------------------------------------------------------------
proc mem.Alloc, size ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx, [size]
add ecx, 4
mcall 68, 12
add ecx, -4
mov [eax], ecx
add eax, 4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc, mptr, size ;////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx, [size]
or ecx, ecx
jz @f
add ecx, 4
@@: mov edx, [mptr]
or edx, edx
jz @f
add edx, -4
@@: mcall 68, 20
or eax, eax
jz @f
add ecx, -4
mov [eax], ecx
add eax, 4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free, mptr ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx, [mptr]
or ecx, ecx
jz @f
add ecx, -4
@@: mcall 68, 13
pop ecx ebx
ret
endp
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
s_header db 'Image Viewer (test app)', 0 s_header db 'Image Viewer (test app)', 0

View File

@ -8,7 +8,7 @@ dd 0x01, START, I_END, 0x1000, 0x1000, 0, 0
include '../../../../../proc32.inc' include '../../../../../proc32.inc'
include '../../../../../macros.inc' include '../../../../../macros.inc'
include '../dll.inc' include '../../../../../dll.inc'
include '../../libio/libio.inc' include '../../libio/libio.inc'
include '../../libimg/libimg.inc' include '../../libimg/libimg.inc'
@ -147,55 +147,6 @@ draw_window:
mcall 12, 2 mcall 12, 2
ret ret
;-----------------------------------------------------------------------------
proc mem.Alloc, size ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx, [size]
add ecx, 4
mcall 68, 12
add ecx, -4
mov [eax], ecx
add eax, 4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc, mptr, size ;////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx, [size]
or ecx, ecx
jz @f
add ecx, 4
@@: mov edx, [mptr]
or edx, edx
jz @f
add edx, -4
@@: mcall 68, 20
or eax, eax
jz @f
add ecx, -4
mov [eax], ecx
add eax, 4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free, mptr ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx, [mptr]
or ecx, ecx
jz @f
add ecx, -4
@@: mcall 68, 13
pop ecx ebx
ret
endp
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
window_title db 'libimg to_rgb2 & encode demo',0 window_title db 'libimg to_rgb2 & encode demo',0

View File

@ -1,99 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -1,124 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
; void* __stdcall mem.Alloc(unsigned size);
mem.Alloc:
push ebx ecx
mov ecx, [esp+12]
mcall 68, 12
pop ecx ebx
ret 4
; void* __stdcall mem.ReAlloc(void* mptr, unsigned size);
mem.ReAlloc:
push ebx ecx edx
mov edx, [esp+16]
mov ecx, [esp+20]
mcall 68, 20
pop edx ecx ebx
ret 8
; void __stdcall mem.Free(void* mptr);
mem.Free:
push ebx ecx
mov ecx, [esp+12]
mcall 68, 13
pop ecx ebx
ret 4
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -13,7 +13,7 @@ use32
include '../../../../macros.inc' include '../../../../macros.inc'
purge mov,add,sub purge mov,add,sub
include '../../../../proc32.inc' include '../../../../proc32.inc'
include 'dll.inc' include '../../../../dll.inc'
include '../network.inc' include '../network.inc'

View File

@ -1,93 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
stdcall dll.Init,[eax+4]
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -607,7 +607,7 @@ include 'tp-tabctl.asm'
include 'tp-editor.asm' include 'tp-editor.asm'
include 'tp-recode.asm' include 'tp-recode.asm'
include 'external/dll.inc' include '../../../dll.inc'
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
section @DATA ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: section @DATA ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

View File

@ -584,51 +584,3 @@ proc update_caption ;/////////////////////////////////////////////////////////
ret ret
endp endp
;-----------------------------------------------------------------------------
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[size]
;*** add ecx,4
mcall 68,12
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
;*** add ecx,4
@@: mov edx,[mptr]
or edx,edx
jz @f
;*** add edx,-4
@@: mcall 68,20
or eax,eax
jz @f
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
;*** add ecx,-4
@@: mcall 68,13
pop ecx ebx
ret
endp

144
programs/dll.inc Normal file
View File

@ -0,0 +1,144 @@
;-----------------------------------------------------------------------------
proc dll.Load, import_table:dword
mov esi, [import_table]
.next_lib:
mov edx, [esi]
or edx, edx
jz .exit
push esi
mov esi, [esi + 4]
mov edi, s_libdir.fname
@@:
lodsb
stosb
or al, al
jnz @b
mcall 68, 19, s_libdir
or eax, eax
jz .fail
stdcall dll.Link, eax, edx
stdcall dll.Init, [eax + 4]
pop esi
add esi, 8
jmp .next_lib
.exit:
xor eax, eax
ret
.fail:
add esp, 4
xor eax, eax
inc eax
ret
endp
;-----------------------------------------------------------------------------
proc dll.Link, exp:dword, imp:dword
push eax
mov esi, [imp]
test esi, esi
jz .done
.next:
lodsd
test eax, eax
jz .done
stdcall dll.GetProcAddress, [exp], eax
or eax, eax
jz @f
mov [esi - 4], eax
jmp .next
@@:
mov dword[esp], 0
.done:
pop eax
ret
endp
;-----------------------------------------------------------------------------
proc dll.Init, dllentry:dword
pushad
mov eax, mem.Alloc
mov ebx, mem.Free
mov ecx, mem.ReAlloc
mov edx, dll.Load
stdcall [dllentry]
popad
ret
endp
;-----------------------------------------------------------------------------
proc dll.GetProcAddress, exp:dword, sz_name:dword
mov edx, [exp]
xor eax, eax
.next:
or edx, edx
jz .end
cmp dword[edx], 0
jz .end
stdcall strcmp, [edx], [sz_name]
test eax, eax
jz .ok
add edx, 8
jmp .next
.ok:
mov eax, [edx + 4]
.end:
ret
endp
;-----------------------------------------------------------------------------
proc strcmp, str1:dword, str2:dword
push esi edi
mov esi, [str1]
mov edi, [str2]
xor eax, eax
@@:
lodsb
scasb
jne .fail
or al, al
jnz @b
jmp .ok
.fail:
or eax, -1
.ok:
pop edi esi
ret
endp
;-----------------------------------------------------------------------------
s_libdir:
db '/sys/lib/'
.fname rb 32
;-----------------------------------------------------------------------------
proc mem.Alloc, size
push ebx ecx
mov ecx, [size]
mcall 68, 12
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc, mptr, size
push ebx ecx edx
mov ecx, [size]
or ecx, ecx
jz @f
@@:
mov edx, [mptr]
or edx, edx
jz @f
@@:
mcall 68, 20
or eax, eax
jz @f
@@:
pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free, mptr
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
@@:
mcall 68, 13
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------

View File

@ -1,99 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -1,48 +0,0 @@
;-----------------------------------------------------------------------------
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[size]
;*** add ecx,4
mcall 68,12
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
;*** add ecx,4
@@: mov edx,[mptr]
or edx,edx
jz @f
;*** add edx,-4
@@: mcall 68,20
or eax,eax
jz @f
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
;*** add ecx,-4
@@: mcall 68,13
pop ecx ebx
ret
endp

View File

@ -13,8 +13,7 @@ include '../../../macros.inc'
include '../../../proc32.inc' include '../../../proc32.inc'
include '../../../develop/libraries/box_lib/load_lib.mac' include '../../../develop/libraries/box_lib/load_lib.mac'
include '../../../develop/libraries/box_lib/trunk/box_lib.mac' ;¬ ªà®áë ¤«ï § ¤ ­¨ï í«¥¬¥­â®¢ box_lib include '../../../develop/libraries/box_lib/trunk/box_lib.mac' ;¬ ªà®áë ¤«ï § ¤ ­¨ï í«¥¬¥­â®¢ box_lib
include 'mem.inc' include '../../../dll.inc'
include 'dll.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load
@ -1463,4 +1462,4 @@ stacktop:
rb 4096 rb 4096
filename_area: filename_area:
rb 256 rb 256
mem: mem:

View File

@ -1,99 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

File diff suppressed because one or more lines are too long

View File

@ -48,8 +48,7 @@ include '../../../macros.inc'
include '../../../proc32.inc' include '../../../proc32.inc'
include '../../../develop/libraries/box_lib/load_lib.mac' include '../../../develop/libraries/box_lib/load_lib.mac'
include '../../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
include 'mem.inc' include '../../../dll.inc'
include 'dll.inc'
include 'le_pole.inc' include 'le_pole.inc'
include 'le_signal.inc' include 'le_signal.inc'

View File

@ -1,48 +0,0 @@
;-----------------------------------------------------------------------------
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[size]
;*** add ecx,4
mcall 68,12
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
;*** add ecx,4
@@: mov edx,[mptr]
or edx,edx
jz @f
;*** add edx,-4
@@: mcall 68,20
or eax,eax
jz @f
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
;*** add ecx,-4
@@: mcall 68,13
pop ecx ebx
ret
endp

View File

@ -1,99 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -1,48 +0,0 @@
;-----------------------------------------------------------------------------
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[size]
;*** add ecx,4
mcall 68,12
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
;*** add ecx,4
@@: mov edx,[mptr]
or edx,edx
jz @f
;*** add edx,-4
@@: mcall 68,20
or eax,eax
jz @f
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
;*** add ecx,-4
@@: mcall 68,13
pop ecx ebx
ret
endp

View File

@ -12,8 +12,7 @@ use32
include '../../../../programs/macros.inc' include '../../../../programs/macros.inc'
include '../../../../programs/proc32.inc' include '../../../../programs/proc32.inc'
include '../../../../programs/develop/libraries/box_lib/load_lib.mac' include '../../../../programs/develop/libraries/box_lib/load_lib.mac'
include 'mem.inc' include '../../../dll.inc'
include 'dll.inc'
include 'vox_draw.inc' include 'vox_draw.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load

View File

@ -1,144 +0,0 @@
;-----------------------------------------------------------------------------
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib:
mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@:
lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
stdcall dll.Init,[eax+4]
pop esi
add esi,8
jmp .next_lib
.exit:
xor eax,eax
ret
.fail:
add esp,4
xor eax,eax
inc eax
ret
endp
;-----------------------------------------------------------------------------
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next:
lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@:
mov dword[esp],0
.done:
pop eax
ret
endp
;-----------------------------------------------------------------------------
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc ;libini_alloc
mov ebx,mem.Free ;libini_free
mov ecx,mem.ReAlloc ;libini_realloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
;-----------------------------------------------------------------------------
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next:
or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok:
mov eax,[edx+4]
.end:
ret
endp
;-----------------------------------------------------------------------------
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@:
lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail:
or eax,-1
.ok:
pop edi esi
ret
endp
;-----------------------------------------------------------------------------
s_libdir:
db '/sys/lib/'
.fname rb 32
;-----------------------------------------------------------------------------
proc mem.Alloc,size
push ebx ecx
mov ecx,[size]
mcall 68,12
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
@@:
mov edx,[mptr]
or edx,edx
jz @f
@@:
mcall 68,20
or eax,eax
jz @f
@@:
pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
@@:
mcall 68,13
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------

View File

@ -473,7 +473,7 @@ include 'win_bcgr.inc'
include 'win_sort.inc' include 'win_sort.inc'
include 'win_opti.inc' include 'win_opti.inc'
include 'libini.inc' include 'libini.inc'
include 'dll.inc' include '../../../dll.inc'
include 'data.inc' include 'data.inc'
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
IM_END: IM_END:

View File

@ -31,7 +31,7 @@ use32
include "../../../macros.inc" include "../../../macros.inc"
include "../../../proc32.inc" include "../../../proc32.inc"
include "../../../develop/libraries/network/network.inc" include "../../../develop/libraries/network/network.inc"
include "dll.inc" include "../../../dll.inc"
;include "fdo.inc" ;include "fdo.inc"
include "eth.inc" include "eth.inc"
include "lang.inc" include "lang.inc"

View File

@ -1,124 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
; void* __stdcall mem.Alloc(unsigned size);
mem.Alloc:
push ebx ecx
mov ecx, [esp+12]
mcall 68, 12
pop ecx ebx
ret 4
; void* __stdcall mem.ReAlloc(void* mptr, unsigned size);
mem.ReAlloc:
push ebx ecx edx
mov edx, [esp+16]
mov ecx, [esp+20]
mcall 68, 20
pop edx ecx ebx
ret 8
; void __stdcall mem.Free(void* mptr);
mem.Free:
push ebx ecx
mov ecx, [esp+12]
mcall 68, 13
pop ecx ebx
ret 4
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -1,124 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
; void* __stdcall mem.Alloc(unsigned size);
mem.Alloc:
push ebx ecx
mov ecx, [esp+12]
mcall 68, 12
pop ecx ebx
ret 4
; void* __stdcall mem.ReAlloc(void* mptr, unsigned size);
mem.ReAlloc:
push ebx ecx edx
mov edx, [esp+16]
mov ecx, [esp+20]
mcall 68, 20
pop edx ecx ebx
ret 8
; void __stdcall mem.Free(void* mptr);
mem.Free:
push ebx ecx
mov ecx, [esp+12]
mcall 68, 13
pop ecx ebx
ret 4
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -48,7 +48,7 @@ include '../../../macros.inc'
include '../../../proc32.inc' include '../../../proc32.inc'
include '../../../develop/libraries/box_lib/load_lib.mac' include '../../../develop/libraries/box_lib/load_lib.mac'
include '../../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
include 'dll.inc' include '../../../dll.inc'
include '../../../debug.inc' include '../../../debug.inc'
URLMAXLEN equ 256 ; maximum length of url string URLMAXLEN equ 256 ; maximum length of url string

View File

@ -1,157 +0,0 @@
;-----------------------------------------------------------------------------
proc mem.Alloc size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov eax,[size]
lea ecx,[eax+4+4095]
and ecx,not 4095
mcall 68,12
add ecx,-4
mov [eax],ecx
add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc mptr,size;///////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx esi edi eax
mov eax,[mptr]
mov ebx,[size]
or eax,eax
jz @f
lea ecx,[ebx+4+4095]
and ecx,not 4095
add ecx,-4
cmp ecx,[eax-4]
je .exit
@@: mov eax,ebx
call mem.Alloc
xchg eax,[esp]
or eax,eax
jz .exit
mov esi,eax
xchg eax,[esp]
mov edi,eax
mov ecx,[esi-4]
cmp ecx,[edi-4]
jbe @f
mov ecx,[edi-4]
@@: add ecx,3
shr ecx,2
cld
rep movsd
xchg eax,[esp]
call mem.Free
.exit:
pop eax edi esi ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov eax,[mptr]
or eax,eax
jz @f
push ebx ecx
lea ecx,[eax-4]
mcall 68,13
pop ecx ebx
@@: ret
endp
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
stdcall dll.Init,[eax+4]
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -46,7 +46,7 @@ include '../../../macros.inc'
include 'ETH.INC' include 'ETH.INC'
include 'debug-fdo.inc' include 'debug-fdo.inc'
include 'dhcp.inc' include 'dhcp.inc'
include 'dll.inc' include '../../../dll.inc'
START: ; start of execution START: ; start of execution
@ -489,4 +489,4 @@ I_END_2:
path rb 1024+5 path rb 1024+5
I_END: I_END:

View File

@ -1,99 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -1,48 +0,0 @@
;-----------------------------------------------------------------------------
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[size]
;*** add ecx,4
mcall 68,12
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
;*** add ecx,4
@@: mov edx,[mptr]
or edx,edx
jz @f
;*** add edx,-4
@@: mcall 68,20
or eax,eax
jz @f
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
;*** add ecx,-4
@@: mcall 68,13
pop ecx ebx
ret
endp

View File

@ -14,8 +14,7 @@ use32
include '../../proc32.inc' include '../../proc32.inc'
include '../../macros.inc' include '../../macros.inc'
include 'mem.inc' include '../../dll.inc'
include 'dll.inc'
include '../../develop/libraries/box_lib/load_lib.mac' include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../develop/libraries/box_lib/trunk/box_lib.mac'

View File

@ -1,99 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -1,48 +0,0 @@
;-----------------------------------------------------------------------------
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[size]
;*** add ecx,4
mcall 68,12
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
;*** add ecx,4
@@: mov edx,[mptr]
or edx,edx
jz @f
;*** add edx,-4
@@: mcall 68,20
or eax,eax
jz @f
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
;*** add ecx,-4
@@: mcall 68,13
pop ecx ebx
ret
endp

View File

@ -22,8 +22,7 @@ maxSyntaxFileSize equ 410000
include '../../proc32.inc' include '../../proc32.inc'
;include '../../config.inc' ;include '../../config.inc'
include '../../macros.inc' include '../../macros.inc'
include 'mem.inc' include '../../dll.inc'
include 'dll.inc'
include '../../develop/libraries/box_lib/load_lib.mac' include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../system/desktop/trunk/kglobals.inc' include '../../system/desktop/trunk/kglobals.inc'

View File

@ -24,7 +24,7 @@ include 'string.inc'
include 'macros.inc' include 'macros.inc'
include 'editbox_ex.mac' include 'editbox_ex.mac'
include 'load_lib.mac' include 'load_lib.mac'
include 'dll.inc' include '../../../dll.inc'
include 'debug.inc' include 'debug.inc'
DEBUG equ 0;1 DEBUG equ 0;1

View File

@ -1,157 +0,0 @@
;-----------------------------------------------------------------------------
proc mem.Alloc size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov eax,[size]
lea ecx,[eax+4+4095]
and ecx,not 4095
mcall 68,12
add ecx,-4
mov [eax],ecx
add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc mptr,size;///////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx esi edi eax
mov eax,[mptr]
mov ebx,[size]
or eax,eax
jz @f
lea ecx,[ebx+4+4095]
and ecx,not 4095
add ecx,-4
cmp ecx,[eax-4]
je .exit
@@: mov eax,ebx
call mem.Alloc
xchg eax,[esp]
or eax,eax
jz .exit
mov esi,eax
xchg eax,[esp]
mov edi,eax
mov ecx,[esi-4]
cmp ecx,[edi-4]
jbe @f
mov ecx,[edi-4]
@@: add ecx,3
shr ecx,2
cld
rep movsd
xchg eax,[esp]
call mem.Free
.exit:
pop eax edi esi ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov eax,[mptr]
or eax,eax
jz @f
push ebx ecx
lea ecx,[eax-4]
mcall 68,13
pop ecx ebx
@@: ret
endp
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
stdcall dll.Init,[eax+4]
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -1,93 +0,0 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
stdcall dll.Init,[eax+4]
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -46,8 +46,7 @@ define BUFF_SIZE 1024
include 'proc32.inc' include 'proc32.inc'
include 'macros.inc' include 'macros.inc'
include 'libio.inc' include 'libio.inc'
include 'mem.inc' include '../../../dll.inc'
include 'dll.inc'
purge mov purge mov

View File

@ -1,48 +0,0 @@
;-----------------------------------------------------------------------------
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[size]
;*** add ecx,4
mcall 68,12
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
;*** add ecx,4
@@: mov edx,[mptr]
or edx,edx
jz @f
;*** add edx,-4
@@: mcall 68,20
or eax,eax
jz @f
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
;*** add ecx,-4
@@: mcall 68,13
pop ecx ebx
ret
endp

View File

@ -1237,7 +1237,7 @@ no_full:
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
include 'libini.inc' include 'libini.inc'
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
include 'dll.inc' include '../../../dll.inc'
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
include 'drawappl.inc' include 'drawappl.inc'
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -1,144 +0,0 @@
;-----------------------------------------------------------------------------
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib:
mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@:
lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
stdcall dll.Init,[eax+4]
pop esi
add esi,8
jmp .next_lib
.exit:
xor eax,eax
ret
.fail:
add esp,4
xor eax,eax
inc eax
ret
endp
;-----------------------------------------------------------------------------
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next:
lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@:
mov dword[esp],0
.done:
pop eax
ret
endp
;-----------------------------------------------------------------------------
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc ;libini_alloc
mov ebx,mem.Free ;libini_free
mov ecx,mem.ReAlloc ;libini_realloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
;-----------------------------------------------------------------------------
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next:
or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok:
mov eax,[edx+4]
.end:
ret
endp
;-----------------------------------------------------------------------------
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@:
lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail:
or eax,-1
.ok:
pop edi esi
ret
endp
;-----------------------------------------------------------------------------
s_libdir:
db '/sys/lib/'
.fname rb 32
;-----------------------------------------------------------------------------
proc mem.Alloc,size
push ebx ecx
mov ecx,[size]
mcall 68,12
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
@@:
mov edx,[mptr]
or edx,edx
jz @f
@@:
mcall 68,20
or eax,eax
jz @f
@@:
pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
@@:
mcall 68,13
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------