diff --git a/programs/develop/info3ds/dll.inc b/programs/develop/info3ds/dll.inc deleted file mode 100644 index 5f13fbbc16..0000000000 --- a/programs/develop/info3ds/dll.inc +++ /dev/null @@ -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 diff --git a/programs/develop/info3ds/info3ds.asm b/programs/develop/info3ds/info3ds.asm index 063f3af9c2..40ebebccf6 100644 --- a/programs/develop/info3ds/info3ds.asm +++ b/programs/develop/info3ds/info3ds.asm @@ -13,8 +13,7 @@ include '../../macros.inc' include '../../proc32.inc' include '../../develop/libraries/box_lib/load_lib.mac' include '../../develop/libraries/box_lib/trunk/box_lib.mac' -include 'mem.inc' -include 'dll.inc' +include '../../dll.inc' include 'lang.inc' include 'info_fun_float.inc' diff --git a/programs/develop/kol_f_edit/dll.inc b/programs/develop/kol_f_edit/dll.inc deleted file mode 100644 index 5f13fbbc16..0000000000 --- a/programs/develop/kol_f_edit/dll.inc +++ /dev/null @@ -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 diff --git a/programs/develop/kol_f_edit/kol_f_edit.asm b/programs/develop/kol_f_edit/kol_f_edit.asm index 84e08f46e6..4cd81f393c 100644 --- a/programs/develop/kol_f_edit/kol_f_edit.asm +++ b/programs/develop/kol_f_edit/kol_f_edit.asm @@ -13,8 +13,7 @@ include '../../macros.inc' include '../../proc32.inc' include '../../develop/libraries/box_lib/load_lib.mac' include '../../develop/libraries/box_lib/trunk/box_lib.mac' -include 'mem.inc' -include 'dll.inc' +include '../../dll.inc' include 'strlen.inc' include 'obj_codes.inc' diff --git a/programs/develop/kol_f_edit/mem.inc b/programs/develop/kol_f_edit/mem.inc deleted file mode 100644 index ec78fbf7f6..0000000000 --- a/programs/develop/kol_f_edit/mem.inc +++ /dev/null @@ -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 diff --git a/programs/develop/libraries/buf2d/trunk/examples/dll.inc b/programs/develop/libraries/buf2d/trunk/examples/dll.inc deleted file mode 100644 index 5f13fbbc16..0000000000 --- a/programs/develop/libraries/buf2d/trunk/examples/dll.inc +++ /dev/null @@ -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 diff --git a/programs/develop/libraries/buf2d/trunk/examples/e2_images.asm b/programs/develop/libraries/buf2d/trunk/examples/e2_images.asm index 661d3011e5..58bf8ce906 100644 --- a/programs/develop/libraries/buf2d/trunk/examples/e2_images.asm +++ b/programs/develop/libraries/buf2d/trunk/examples/e2_images.asm @@ -10,8 +10,7 @@ use32 include '../../../../../macros.inc' include '../../../../../proc32.inc' 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 @@ -315,4 +314,4 @@ stacktop: rb 4096 filename_area: rb 256 -mem: \ No newline at end of file +mem: diff --git a/programs/develop/libraries/buf2d/trunk/examples/e3_text.asm b/programs/develop/libraries/buf2d/trunk/examples/e3_text.asm index dc5fa8b313..cbfa6fa0a7 100644 --- a/programs/develop/libraries/buf2d/trunk/examples/e3_text.asm +++ b/programs/develop/libraries/buf2d/trunk/examples/e3_text.asm @@ -10,8 +10,7 @@ use32 include '../../../../../macros.inc' include '../../../../../proc32.inc' 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 @@ -315,4 +314,4 @@ stacktop: rb 4096 filename_area: rb 256 -mem: \ No newline at end of file +mem: diff --git a/programs/develop/libraries/buf2d/trunk/examples/mem.inc b/programs/develop/libraries/buf2d/trunk/examples/mem.inc deleted file mode 100644 index ec78fbf7f6..0000000000 --- a/programs/develop/libraries/buf2d/trunk/examples/mem.inc +++ /dev/null @@ -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 diff --git a/programs/develop/libraries/libs-dev/.test/001/test001.asm b/programs/develop/libraries/libs-dev/.test/001/test001.asm index 7090a683c4..b6a83e0c6e 100644 --- a/programs/develop/libraries/libs-dev/.test/001/test001.asm +++ b/programs/develop/libraries/libs-dev/.test/001/test001.asm @@ -17,7 +17,7 @@ TRUE = 1 include '../../../../../proc32.inc' include '../../../../../macros.inc' include '../../libio/libio.inc' -include '../dll.inc' +include '../../../../../dll.inc' yy dd 20 @@ -275,70 +275,6 @@ draw_window: _f_path db '/rd/1/lib',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 - ;--------------------------------------------------------------------- ;--- ─└══█┼ ╧╨╬├╨└╠╠█ ---------------------------------------------- ;--------------------------------------------------------------------- diff --git a/programs/develop/libraries/libs-dev/.test/002/test002.asm b/programs/develop/libraries/libs-dev/.test/002/test002.asm index 58b20cb63f..7235d6523c 100644 --- a/programs/develop/libraries/libs-dev/.test/002/test002.asm +++ b/programs/develop/libraries/libs-dev/.test/002/test002.asm @@ -11,7 +11,7 @@ TRUE = 1 include '../../../../../proc32.inc' include '../../../../../macros.inc' -include '../dll.inc' +include '../../../../../dll.inc' include '../../libio/libio.inc' include '../../libimg/libimg.inc' @@ -137,55 +137,6 @@ draw_window: invoke gfx.close, [ctx] 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 diff --git a/programs/develop/libraries/libs-dev/.test/003/test003.asm b/programs/develop/libraries/libs-dev/.test/003/test003.asm index 84c4de11bb..13af263b48 100644 --- a/programs/develop/libraries/libs-dev/.test/003/test003.asm +++ b/programs/develop/libraries/libs-dev/.test/003/test003.asm @@ -8,7 +8,7 @@ dd 0x01, START, I_END, 0x1000, 0x1000, 0, 0 include '../../../../../proc32.inc' include '../../../../../macros.inc' -include '../dll.inc' +include '../../../../../dll.inc' include '../../libio/libio.inc' include '../../libimg/libimg.inc' @@ -147,55 +147,6 @@ draw_window: mcall 12, 2 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 diff --git a/programs/develop/libraries/libs-dev/.test/dll.inc b/programs/develop/libraries/libs-dev/.test/dll.inc deleted file mode 100644 index 5f13fbbc16..0000000000 --- a/programs/develop/libraries/libs-dev/.test/dll.inc +++ /dev/null @@ -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 diff --git a/programs/develop/libraries/network/examples/dll.inc b/programs/develop/libraries/network/examples/dll.inc deleted file mode 100644 index d29b04c964..0000000000 --- a/programs/develop/libraries/network/examples/dll.inc +++ /dev/null @@ -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 diff --git a/programs/develop/libraries/network/examples/nslookup.asm b/programs/develop/libraries/network/examples/nslookup.asm index e490c2a4a8..304527aeb0 100644 --- a/programs/develop/libraries/network/examples/nslookup.asm +++ b/programs/develop/libraries/network/examples/nslookup.asm @@ -13,7 +13,7 @@ use32 include '../../../../macros.inc' purge mov,add,sub include '../../../../proc32.inc' -include 'dll.inc' +include '../../../../dll.inc' include '../network.inc' diff --git a/programs/develop/tinypad/trunk/external/dll.inc b/programs/develop/tinypad/trunk/external/dll.inc deleted file mode 100644 index e1cb98d178..0000000000 --- a/programs/develop/tinypad/trunk/external/dll.inc +++ /dev/null @@ -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 diff --git a/programs/develop/tinypad/trunk/tinypad.asm b/programs/develop/tinypad/trunk/tinypad.asm index cb86f56b14..f860f8d691 100644 --- a/programs/develop/tinypad/trunk/tinypad.asm +++ b/programs/develop/tinypad/trunk/tinypad.asm @@ -607,7 +607,7 @@ include 'tp-tabctl.asm' include 'tp-editor.asm' include 'tp-recode.asm' -include 'external/dll.inc' +include '../../../dll.inc' ;----------------------------------------------------------------------------- section @DATA ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: diff --git a/programs/develop/tinypad/trunk/tp-common.asm b/programs/develop/tinypad/trunk/tp-common.asm index b207743af9..ed17bb0fa0 100644 --- a/programs/develop/tinypad/trunk/tp-common.asm +++ b/programs/develop/tinypad/trunk/tp-common.asm @@ -584,51 +584,3 @@ proc update_caption ;///////////////////////////////////////////////////////// ret 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 diff --git a/programs/dll.inc b/programs/dll.inc new file mode 100644 index 0000000000..2c8f170f4f --- /dev/null +++ b/programs/dll.inc @@ -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 +;----------------------------------------------------------------------------- diff --git a/programs/games/nu_pogodi/trunk/dll.inc b/programs/games/nu_pogodi/trunk/dll.inc deleted file mode 100644 index 5f13fbbc16..0000000000 --- a/programs/games/nu_pogodi/trunk/dll.inc +++ /dev/null @@ -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 diff --git a/programs/games/nu_pogodi/trunk/mem.inc b/programs/games/nu_pogodi/trunk/mem.inc deleted file mode 100644 index ec78fbf7f6..0000000000 --- a/programs/games/nu_pogodi/trunk/mem.inc +++ /dev/null @@ -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 diff --git a/programs/games/nu_pogodi/trunk/nu_pogod.asm b/programs/games/nu_pogodi/trunk/nu_pogod.asm index e59dcf09a6..a3634a05b1 100644 --- a/programs/games/nu_pogodi/trunk/nu_pogod.asm +++ b/programs/games/nu_pogodi/trunk/nu_pogod.asm @@ -13,8 +13,7 @@ include '../../../macros.inc' include '../../../proc32.inc' include '../../../develop/libraries/box_lib/load_lib.mac' 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 @@ -1463,4 +1462,4 @@ stacktop: rb 4096 filename_area: rb 256 -mem: \ No newline at end of file +mem: diff --git a/programs/media/log_el/trunk/dll.inc b/programs/media/log_el/trunk/dll.inc deleted file mode 100644 index 5f13fbbc16..0000000000 --- a/programs/media/log_el/trunk/dll.inc +++ /dev/null @@ -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 diff --git a/programs/media/log_el/trunk/le_libs.inc b/programs/media/log_el/trunk/le_libs.inc index 55318444c9..37b1aa57cd 100644 --- a/programs/media/log_el/trunk/le_libs.inc +++ b/programs/media/log_el/trunk/le_libs.inc @@ -1 +1 @@ -;include 'load_lib.mac' ;include 'mem.inc' ;include 'dll.inc' ;@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load head_f_i: head_f_l db 'Системная ошибка',0 system_dir_0 db '/sys/lib/' lib_name_0 db 'proc_lib.obj',0 err_message_found_lib_0 db 'Не найдена библиотека ',39,'proc_lib.obj',39,0 err_message_import_0 db 'Ошибка при импорте библиотеки ',39,'proc_lib.obj',39,0 system_dir_1 db '/sys/lib/' lib_name_1 db 'libimg.obj',0 err_message_found_lib_1 db 'Не найдена библиотека ',39,'libimg.obj',39,0 err_message_import_1 db 'Ошибка при импорте библиотеки ',39,'libimg.obj',39,0 system_dir_2 db '/sys/lib/' lib_name_2 db 'box_lib.obj',0 err_message_found_lib_2 db 'Не найдена библиотека ',39,'box_lib.obj',39,0 err_message_import_2 db 'Ошибка при импорте библиотеки ',39,'box_lib.obj',39,0 system_dir_3 db '/sys/lib/' lib_name_3 db 'libini.obj',0 err_message_found_lib_3 db 'Не найдена библиотека ',39,'libini.obj',39,0 err_message_import_3 db 'Ошибка при импорте библиотеки ',39,'libini.obj',39,0 system_dir_7 db '/sys/lib/' lib_name_7 db 'buf2d.obj',0 err_msg_found_lib_7 db 'Не найдена библиотека ',39,'buf2d.obj',39,0 err_msg_import_7 db 'Ошибка при импорте библиотеки ',39,'buf2d',39,0 l_libs_start: lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\ err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\ err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i lib2 l_libs lib_name_2, sys_path, file_name, system_dir_2,\ err_message_found_lib_2, head_f_l, import_box_lib, err_message_import_2, head_f_i lib3 l_libs lib_name_3, sys_path, file_name, system_dir_3,\ err_message_found_lib_3, head_f_l, import_libini, err_message_import_3, head_f_i lib_7 l_libs lib_name_7, sys_path, library_path, system_dir_7,\ err_msg_found_lib_7,head_f_l,import_buf2d,err_msg_import_7,head_f_i l_libs_end: align 4 proclib_import: ;описание экспортируемых функций OpenDialog_Init dd aOpenDialog_Init OpenDialog_Start dd aOpenDialog_Start dd 0,0 aOpenDialog_Init db 'OpenDialog_init',0 aOpenDialog_Start db 'OpenDialog_start',0 align 4 import_libimg: dd alib_init1 img_is_img dd aimg_is_img img_info dd aimg_info img_from_file dd aimg_from_file img_to_file dd aimg_to_file img_from_rgb dd aimg_from_rgb img_to_rgb dd aimg_to_rgb img_to_rgb2 dd aimg_to_rgb2 img_decode dd aimg_decode img_encode dd aimg_encode img_create dd aimg_create img_destroy dd aimg_destroy img_destroy_layer dd aimg_destroy_layer img_count dd aimg_count img_lock_bits dd aimg_lock_bits img_unlock_bits dd aimg_unlock_bits img_flip dd aimg_flip img_flip_layer dd aimg_flip_layer img_rotate dd aimg_rotate img_rotate_layer dd aimg_rotate_layer img_draw dd aimg_draw dd 0,0 alib_init1 db 'lib_init',0 aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение aimg_info db 'img_info',0 aimg_from_file db 'img_from_file',0 aimg_to_file db 'img_to_file',0 aimg_from_rgb db 'img_from_rgb',0 aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB aimg_to_rgb2 db 'img_to_rgb2',0 aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных aimg_encode db 'img_encode',0 aimg_create db 'img_create',0 aimg_destroy db 'img_destroy',0 aimg_destroy_layer db 'img_destroy_layer',0 aimg_count db 'img_count',0 aimg_lock_bits db 'img_lock_bits',0 aimg_unlock_bits db 'img_unlock_bits',0 aimg_flip db 'img_flip',0 aimg_flip_layer db 'img_flip_layer',0 aimg_rotate db 'img_rotate',0 aimg_rotate_layer db 'img_rotate_layer',0 aimg_draw db 'img_draw',0 align 4 import_box_lib: dd alib_init2 ;функция запускается макросом 1 раз при подключении бибилиотеки, потому в программе метка на нее не нужна edit_box_draw dd aEdit_box_draw edit_box_key dd aEdit_box_key edit_box_mouse dd aEdit_box_mouse ; version_ed dd aVersion_ed check_box_draw dd aCheck_box_draw check_box_mouse dd aCheck_box_mouse ; version_ch dd aVersion_ch ; option_box_draw dd aOption_box_draw ; option_box_mouse dd aOption_box_mouse ; version_op dd aVersion_op scrollbar_ver_draw dd aScrollbar_ver_draw ; scrollbar_ver_mouse dd aScrollbar_ver_mouse scrollbar_hor_draw dd aScrollbar_hor_draw ; scrollbar_hor_mouse dd aScrollbar_hor_mouse ; version_scrollbar dd aVersion_scrollbar tl_data_init dd sz_tl_data_init tl_data_clear dd sz_tl_data_clear tl_info_clear dd sz_tl_info_clear tl_key dd sz_tl_key tl_mouse dd sz_tl_mouse tl_draw dd sz_tl_draw tl_info_undo dd sz_tl_info_undo tl_info_redo dd sz_tl_info_redo tl_node_add dd sz_tl_node_add tl_node_set_data dd sz_tl_node_set_data tl_node_get_data dd sz_tl_node_get_data tl_node_delete dd sz_tl_node_delete tl_cur_beg dd sz_tl_cur_beg tl_cur_next dd sz_tl_cur_next tl_cur_perv dd sz_tl_cur_perv tl_node_close_open dd sz_tl_node_close_open tl_node_lev_inc dd sz_tl_node_lev_inc tl_node_lev_dec dd sz_tl_node_lev_dec tl_node_move_up dd sz_tl_node_move_up tl_node_move_down dd sz_tl_node_move_down tl_save_mem dd sz_tl_save_mem tl_load_mem dd sz_tl_load_mem tl_get_mem_size dd sz_tl_get_mem_size tl_node_poi_get_info dd sz_tl_node_poi_get_info tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info tl_node_poi_get_data dd sz_tl_node_poi_get_data dd 0,0 alib_init2 db 'lib_init',0 aEdit_box_draw db 'edit_box',0 aEdit_box_key db 'edit_box_key',0 aEdit_box_mouse db 'edit_box_mouse',0 ; aVersion_ed db 'version_ed',0 aCheck_box_draw db 'check_box_draw',0 aCheck_box_mouse db 'check_box_mouse',0 ; aVersion_ch db 'version_ch',0 ; aOption_box_draw db 'option_box_draw',0 ; aOption_box_mouse db 'option_box_mouse',0 ; aVersion_op db 'version_op',0 aScrollbar_ver_draw db 'scrollbar_v_draw',0 ; aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 aScrollbar_hor_draw db 'scrollbar_h_draw',0 ; aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 ; aVersion_scrollbar db 'version_scrollbar',0 sz_tl_data_init db 'tl_data_init',0 sz_tl_data_clear db 'tl_data_clear',0 sz_tl_info_clear db 'tl_info_clear',0 sz_tl_key db 'tl_key',0 sz_tl_mouse db 'tl_mouse',0 sz_tl_draw db 'tl_draw',0 sz_tl_info_undo db 'tl_info_undo',0 sz_tl_info_redo db 'tl_info_redo',0 sz_tl_node_add db 'tl_node_add',0 sz_tl_node_set_data db 'tl_node_set_data',0 sz_tl_node_get_data db 'tl_node_get_data',0 sz_tl_node_delete db 'tl_node_delete',0 sz_tl_cur_beg db 'tl_cur_beg',0 sz_tl_cur_next db 'tl_cur_next',0 sz_tl_cur_perv db 'tl_cur_perv',0 sz_tl_node_close_open db 'tl_node_close_open',0 sz_tl_node_lev_inc db 'tl_node_lev_inc',0 sz_tl_node_lev_dec db 'tl_node_lev_dec',0 sz_tl_node_move_up db 'tl_node_move_up',0 sz_tl_node_move_down db 'tl_node_move_down',0 sz_tl_save_mem db 'tl_save_mem',0 sz_tl_load_mem db 'tl_load_mem',0 sz_tl_get_mem_size db 'tl_get_mem_size',0 sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0 sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0 sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 align 4 import_libini: dd alib_init0 ini_get_str dd aini_get_str ini_get_int dd aini_get_int ini_get_color dd aini_get_color dd 0,0 alib_init0 db 'lib_init',0 aini_get_str db 'ini_get_str',0 aini_get_int db 'ini_get_int',0 aini_get_color db 'ini_get_color',0 align 4 import_buf2d: init dd sz_init buf2d_create dd sz_buf2d_create buf2d_create_f_img dd sz_buf2d_create_f_img buf2d_clear dd sz_buf2d_clear buf2d_draw dd sz_buf2d_draw buf2d_delete dd sz_buf2d_delete buf2d_line dd sz_buf2d_line buf2d_rect_by_size dd sz_buf2d_rect_by_size buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size buf2d_circle dd sz_buf2d_circle buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 buf2d_bit_blt dd sz_buf2d_bit_blt buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha buf2d_curve_bezier dd sz_buf2d_curve_bezier buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix buf2d_draw_text dd sz_buf2d_draw_text buf2d_crop_color dd sz_buf2d_crop_color buf2d_offset_h dd sz_buf2d_offset_h buf2d_flood_fill dd sz_buf2d_flood_fill buf2d_set_pixel dd sz_buf2d_set_pixel dd 0,0 sz_init db 'lib_init',0 sz_buf2d_create db 'buf2d_create',0 sz_buf2d_create_f_img db 'buf2d_create_f_img',0 sz_buf2d_clear db 'buf2d_clear',0 sz_buf2d_draw db 'buf2d_draw',0 sz_buf2d_delete db 'buf2d_delete',0 sz_buf2d_line db 'buf2d_line',0 sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 sz_buf2d_circle db 'buf2d_circle',0 sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 sz_buf2d_bit_blt db 'buf2d_bit_blt',0 sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 sz_buf2d_draw_text db 'buf2d_draw_text',0 sz_buf2d_crop_color db 'buf2d_crop_color',0 sz_buf2d_offset_h db 'buf2d_offset_h',0 sz_buf2d_flood_fill db 'buf2d_flood_fill',0 sz_buf2d_set_pixel db 'buf2d_set_pixel',0 \ No newline at end of file +;include 'load_lib.mac' ;include 'mem.inc' ;include '../../../dll.inc' ;@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load head_f_i: head_f_l db 'Системная ошибка',0 system_dir_0 db '/sys/lib/' lib_name_0 db 'proc_lib.obj',0 err_message_found_lib_0 db 'Не найдена библиотека ',39,'proc_lib.obj',39,0 err_message_import_0 db 'Ошибка при импорте библиотеки ',39,'proc_lib.obj',39,0 system_dir_1 db '/sys/lib/' lib_name_1 db 'libimg.obj',0 err_message_found_lib_1 db 'Не найдена библиотека ',39,'libimg.obj',39,0 err_message_import_1 db 'Ошибка при импорте библиотеки ',39,'libimg.obj',39,0 system_dir_2 db '/sys/lib/' lib_name_2 db 'box_lib.obj',0 err_message_found_lib_2 db 'Не найдена библиотека ',39,'box_lib.obj',39,0 err_message_import_2 db 'Ошибка при импорте библиотеки ',39,'box_lib.obj',39,0 system_dir_3 db '/sys/lib/' lib_name_3 db 'libini.obj',0 err_message_found_lib_3 db 'Не найдена библиотека ',39,'libini.obj',39,0 err_message_import_3 db 'Ошибка при импорте библиотеки ',39,'libini.obj',39,0 system_dir_7 db '/sys/lib/' lib_name_7 db 'buf2d.obj',0 err_msg_found_lib_7 db 'Не найдена библиотека ',39,'buf2d.obj',39,0 err_msg_import_7 db 'Ошибка при импорте библиотеки ',39,'buf2d',39,0 l_libs_start: lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\ err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\ err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i lib2 l_libs lib_name_2, sys_path, file_name, system_dir_2,\ err_message_found_lib_2, head_f_l, import_box_lib, err_message_import_2, head_f_i lib3 l_libs lib_name_3, sys_path, file_name, system_dir_3,\ err_message_found_lib_3, head_f_l, import_libini, err_message_import_3, head_f_i lib_7 l_libs lib_name_7, sys_path, library_path, system_dir_7,\ err_msg_found_lib_7,head_f_l,import_buf2d,err_msg_import_7,head_f_i l_libs_end: align 4 proclib_import: ;описание экспортируемых функций OpenDialog_Init dd aOpenDialog_Init OpenDialog_Start dd aOpenDialog_Start dd 0,0 aOpenDialog_Init db 'OpenDialog_init',0 aOpenDialog_Start db 'OpenDialog_start',0 align 4 import_libimg: dd alib_init1 img_is_img dd aimg_is_img img_info dd aimg_info img_from_file dd aimg_from_file img_to_file dd aimg_to_file img_from_rgb dd aimg_from_rgb img_to_rgb dd aimg_to_rgb img_to_rgb2 dd aimg_to_rgb2 img_decode dd aimg_decode img_encode dd aimg_encode img_create dd aimg_create img_destroy dd aimg_destroy img_destroy_layer dd aimg_destroy_layer img_count dd aimg_count img_lock_bits dd aimg_lock_bits img_unlock_bits dd aimg_unlock_bits img_flip dd aimg_flip img_flip_layer dd aimg_flip_layer img_rotate dd aimg_rotate img_rotate_layer dd aimg_rotate_layer img_draw dd aimg_draw dd 0,0 alib_init1 db 'lib_init',0 aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение aimg_info db 'img_info',0 aimg_from_file db 'img_from_file',0 aimg_to_file db 'img_to_file',0 aimg_from_rgb db 'img_from_rgb',0 aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB aimg_to_rgb2 db 'img_to_rgb2',0 aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных aimg_encode db 'img_encode',0 aimg_create db 'img_create',0 aimg_destroy db 'img_destroy',0 aimg_destroy_layer db 'img_destroy_layer',0 aimg_count db 'img_count',0 aimg_lock_bits db 'img_lock_bits',0 aimg_unlock_bits db 'img_unlock_bits',0 aimg_flip db 'img_flip',0 aimg_flip_layer db 'img_flip_layer',0 aimg_rotate db 'img_rotate',0 aimg_rotate_layer db 'img_rotate_layer',0 aimg_draw db 'img_draw',0 align 4 import_box_lib: dd alib_init2 ;функция запускается макросом 1 раз при подключении бибилиотеки, потому в программе метка на нее не нужна edit_box_draw dd aEdit_box_draw edit_box_key dd aEdit_box_key edit_box_mouse dd aEdit_box_mouse ; version_ed dd aVersion_ed check_box_draw dd aCheck_box_draw check_box_mouse dd aCheck_box_mouse ; version_ch dd aVersion_ch ; option_box_draw dd aOption_box_draw ; option_box_mouse dd aOption_box_mouse ; version_op dd aVersion_op scrollbar_ver_draw dd aScrollbar_ver_draw ; scrollbar_ver_mouse dd aScrollbar_ver_mouse scrollbar_hor_draw dd aScrollbar_hor_draw ; scrollbar_hor_mouse dd aScrollbar_hor_mouse ; version_scrollbar dd aVersion_scrollbar tl_data_init dd sz_tl_data_init tl_data_clear dd sz_tl_data_clear tl_info_clear dd sz_tl_info_clear tl_key dd sz_tl_key tl_mouse dd sz_tl_mouse tl_draw dd sz_tl_draw tl_info_undo dd sz_tl_info_undo tl_info_redo dd sz_tl_info_redo tl_node_add dd sz_tl_node_add tl_node_set_data dd sz_tl_node_set_data tl_node_get_data dd sz_tl_node_get_data tl_node_delete dd sz_tl_node_delete tl_cur_beg dd sz_tl_cur_beg tl_cur_next dd sz_tl_cur_next tl_cur_perv dd sz_tl_cur_perv tl_node_close_open dd sz_tl_node_close_open tl_node_lev_inc dd sz_tl_node_lev_inc tl_node_lev_dec dd sz_tl_node_lev_dec tl_node_move_up dd sz_tl_node_move_up tl_node_move_down dd sz_tl_node_move_down tl_save_mem dd sz_tl_save_mem tl_load_mem dd sz_tl_load_mem tl_get_mem_size dd sz_tl_get_mem_size tl_node_poi_get_info dd sz_tl_node_poi_get_info tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info tl_node_poi_get_data dd sz_tl_node_poi_get_data dd 0,0 alib_init2 db 'lib_init',0 aEdit_box_draw db 'edit_box',0 aEdit_box_key db 'edit_box_key',0 aEdit_box_mouse db 'edit_box_mouse',0 ; aVersion_ed db 'version_ed',0 aCheck_box_draw db 'check_box_draw',0 aCheck_box_mouse db 'check_box_mouse',0 ; aVersion_ch db 'version_ch',0 ; aOption_box_draw db 'option_box_draw',0 ; aOption_box_mouse db 'option_box_mouse',0 ; aVersion_op db 'version_op',0 aScrollbar_ver_draw db 'scrollbar_v_draw',0 ; aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 aScrollbar_hor_draw db 'scrollbar_h_draw',0 ; aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 ; aVersion_scrollbar db 'version_scrollbar',0 sz_tl_data_init db 'tl_data_init',0 sz_tl_data_clear db 'tl_data_clear',0 sz_tl_info_clear db 'tl_info_clear',0 sz_tl_key db 'tl_key',0 sz_tl_mouse db 'tl_mouse',0 sz_tl_draw db 'tl_draw',0 sz_tl_info_undo db 'tl_info_undo',0 sz_tl_info_redo db 'tl_info_redo',0 sz_tl_node_add db 'tl_node_add',0 sz_tl_node_set_data db 'tl_node_set_data',0 sz_tl_node_get_data db 'tl_node_get_data',0 sz_tl_node_delete db 'tl_node_delete',0 sz_tl_cur_beg db 'tl_cur_beg',0 sz_tl_cur_next db 'tl_cur_next',0 sz_tl_cur_perv db 'tl_cur_perv',0 sz_tl_node_close_open db 'tl_node_close_open',0 sz_tl_node_lev_inc db 'tl_node_lev_inc',0 sz_tl_node_lev_dec db 'tl_node_lev_dec',0 sz_tl_node_move_up db 'tl_node_move_up',0 sz_tl_node_move_down db 'tl_node_move_down',0 sz_tl_save_mem db 'tl_save_mem',0 sz_tl_load_mem db 'tl_load_mem',0 sz_tl_get_mem_size db 'tl_get_mem_size',0 sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0 sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0 sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 align 4 import_libini: dd alib_init0 ini_get_str dd aini_get_str ini_get_int dd aini_get_int ini_get_color dd aini_get_color dd 0,0 alib_init0 db 'lib_init',0 aini_get_str db 'ini_get_str',0 aini_get_int db 'ini_get_int',0 aini_get_color db 'ini_get_color',0 align 4 import_buf2d: init dd sz_init buf2d_create dd sz_buf2d_create buf2d_create_f_img dd sz_buf2d_create_f_img buf2d_clear dd sz_buf2d_clear buf2d_draw dd sz_buf2d_draw buf2d_delete dd sz_buf2d_delete buf2d_line dd sz_buf2d_line buf2d_rect_by_size dd sz_buf2d_rect_by_size buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size buf2d_circle dd sz_buf2d_circle buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 buf2d_bit_blt dd sz_buf2d_bit_blt buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha buf2d_curve_bezier dd sz_buf2d_curve_bezier buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix buf2d_draw_text dd sz_buf2d_draw_text buf2d_crop_color dd sz_buf2d_crop_color buf2d_offset_h dd sz_buf2d_offset_h buf2d_flood_fill dd sz_buf2d_flood_fill buf2d_set_pixel dd sz_buf2d_set_pixel dd 0,0 sz_init db 'lib_init',0 sz_buf2d_create db 'buf2d_create',0 sz_buf2d_create_f_img db 'buf2d_create_f_img',0 sz_buf2d_clear db 'buf2d_clear',0 sz_buf2d_draw db 'buf2d_draw',0 sz_buf2d_delete db 'buf2d_delete',0 sz_buf2d_line db 'buf2d_line',0 sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 sz_buf2d_circle db 'buf2d_circle',0 sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 sz_buf2d_bit_blt db 'buf2d_bit_blt',0 sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 sz_buf2d_draw_text db 'buf2d_draw_text',0 sz_buf2d_crop_color db 'buf2d_crop_color',0 sz_buf2d_offset_h db 'buf2d_offset_h',0 sz_buf2d_flood_fill db 'buf2d_flood_fill',0 sz_buf2d_set_pixel db 'buf2d_set_pixel',0 diff --git a/programs/media/log_el/trunk/log_el.asm b/programs/media/log_el/trunk/log_el.asm index 172d16fc24..613b81aeaa 100644 --- a/programs/media/log_el/trunk/log_el.asm +++ b/programs/media/log_el/trunk/log_el.asm @@ -48,8 +48,7 @@ include '../../../macros.inc' include '../../../proc32.inc' include '../../../develop/libraries/box_lib/load_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_signal.inc' diff --git a/programs/media/log_el/trunk/mem.inc b/programs/media/log_el/trunk/mem.inc deleted file mode 100644 index ec78fbf7f6..0000000000 --- a/programs/media/log_el/trunk/mem.inc +++ /dev/null @@ -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 diff --git a/programs/media/voxel_editor/trunk/dll.inc b/programs/media/voxel_editor/trunk/dll.inc deleted file mode 100644 index 5f13fbbc16..0000000000 --- a/programs/media/voxel_editor/trunk/dll.inc +++ /dev/null @@ -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 diff --git a/programs/media/voxel_editor/trunk/mem.inc b/programs/media/voxel_editor/trunk/mem.inc deleted file mode 100644 index ec78fbf7f6..0000000000 --- a/programs/media/voxel_editor/trunk/mem.inc +++ /dev/null @@ -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 diff --git a/programs/media/voxel_editor/trunk/voxel_editor.asm b/programs/media/voxel_editor/trunk/voxel_editor.asm index e092bd8f01..fcc9254d94 100644 --- a/programs/media/voxel_editor/trunk/voxel_editor.asm +++ b/programs/media/voxel_editor/trunk/voxel_editor.asm @@ -12,8 +12,7 @@ use32 include '../../../../programs/macros.inc' include '../../../../programs/proc32.inc' include '../../../../programs/develop/libraries/box_lib/load_lib.mac' -include 'mem.inc' -include 'dll.inc' +include '../../../dll.inc' include 'vox_draw.inc' @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load diff --git a/programs/media/zsea/dll.inc b/programs/media/zsea/dll.inc deleted file mode 100644 index aceef7ac97..0000000000 --- a/programs/media/zsea/dll.inc +++ /dev/null @@ -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 -;----------------------------------------------------------------------------- \ No newline at end of file diff --git a/programs/media/zsea/zSea.asm b/programs/media/zsea/zSea.asm index 0658e38cf5..147b65313a 100644 --- a/programs/media/zsea/zSea.asm +++ b/programs/media/zsea/zSea.asm @@ -473,7 +473,7 @@ include 'win_bcgr.inc' include 'win_sort.inc' include 'win_opti.inc' include 'libini.inc' -include 'dll.inc' +include '../../../dll.inc' include 'data.inc' ;--------------------------------------------------------------------- IM_END: diff --git a/programs/network/airc/trunk/airc.asm b/programs/network/airc/trunk/airc.asm index 980691bd7f..91b4f519c1 100644 --- a/programs/network/airc/trunk/airc.asm +++ b/programs/network/airc/trunk/airc.asm @@ -31,7 +31,7 @@ use32 include "../../../macros.inc" include "../../../proc32.inc" include "../../../develop/libraries/network/network.inc" -include "dll.inc" +include "../../../dll.inc" ;include "fdo.inc" include "eth.inc" include "lang.inc" diff --git a/programs/network/airc/trunk/dll.inc b/programs/network/airc/trunk/dll.inc deleted file mode 100644 index d29b04c964..0000000000 --- a/programs/network/airc/trunk/dll.inc +++ /dev/null @@ -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 diff --git a/programs/network/downloader/trunk/dll.inc b/programs/network/downloader/trunk/dll.inc deleted file mode 100644 index d29b04c964..0000000000 --- a/programs/network/downloader/trunk/dll.inc +++ /dev/null @@ -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 diff --git a/programs/network/downloader/trunk/downloader.asm b/programs/network/downloader/trunk/downloader.asm index 0e5f4cb112..3140932776 100644 --- a/programs/network/downloader/trunk/downloader.asm +++ b/programs/network/downloader/trunk/downloader.asm @@ -48,7 +48,7 @@ include '../../../macros.inc' include '../../../proc32.inc' include '../../../develop/libraries/box_lib/load_lib.mac' include '../../../develop/libraries/box_lib/trunk/box_lib.mac' -include 'dll.inc' +include '../../../dll.inc' include '../../../debug.inc' URLMAXLEN equ 256 ; maximum length of url string diff --git a/programs/network/zeroconf/trunk/dll.inc b/programs/network/zeroconf/trunk/dll.inc deleted file mode 100644 index 6ceb2d514d..0000000000 --- a/programs/network/zeroconf/trunk/dll.inc +++ /dev/null @@ -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 diff --git a/programs/network/zeroconf/trunk/zeroconf.asm b/programs/network/zeroconf/trunk/zeroconf.asm index b78aa5c094..8403ad3d98 100644 --- a/programs/network/zeroconf/trunk/zeroconf.asm +++ b/programs/network/zeroconf/trunk/zeroconf.asm @@ -46,7 +46,7 @@ include '../../../macros.inc' include 'ETH.INC' include 'debug-fdo.inc' include 'dhcp.inc' -include 'dll.inc' +include '../../../dll.inc' START: ; start of execution @@ -489,4 +489,4 @@ I_END_2: path rb 1024+5 -I_END: \ No newline at end of file +I_END: diff --git a/programs/other/planet_v/dll.inc b/programs/other/planet_v/dll.inc deleted file mode 100644 index 5f13fbbc16..0000000000 --- a/programs/other/planet_v/dll.inc +++ /dev/null @@ -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 diff --git a/programs/other/planet_v/mem.inc b/programs/other/planet_v/mem.inc deleted file mode 100644 index ec78fbf7f6..0000000000 --- a/programs/other/planet_v/mem.inc +++ /dev/null @@ -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 diff --git a/programs/other/planet_v/planet_v.asm b/programs/other/planet_v/planet_v.asm index b5ef354bfe..c73f3abe1b 100644 --- a/programs/other/planet_v/planet_v.asm +++ b/programs/other/planet_v/planet_v.asm @@ -14,8 +14,7 @@ use32 include '../../proc32.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/trunk/box_lib.mac' diff --git a/programs/other/t_edit/dll.inc b/programs/other/t_edit/dll.inc deleted file mode 100644 index 5f13fbbc16..0000000000 --- a/programs/other/t_edit/dll.inc +++ /dev/null @@ -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 diff --git a/programs/other/t_edit/mem.inc b/programs/other/t_edit/mem.inc deleted file mode 100644 index ec78fbf7f6..0000000000 --- a/programs/other/t_edit/mem.inc +++ /dev/null @@ -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 diff --git a/programs/other/t_edit/t_edit.asm b/programs/other/t_edit/t_edit.asm index 1deb652022..8e4015032d 100644 --- a/programs/other/t_edit/t_edit.asm +++ b/programs/other/t_edit/t_edit.asm @@ -22,8 +22,7 @@ maxSyntaxFileSize equ 410000 include '../../proc32.inc' ;include '../../config.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/trunk/box_lib.mac' include '../../system/desktop/trunk/kglobals.inc' diff --git a/programs/system/MyKey/trunk/MyKey.asm b/programs/system/MyKey/trunk/MyKey.asm index 5cab76a408..c413a78fb4 100644 --- a/programs/system/MyKey/trunk/MyKey.asm +++ b/programs/system/MyKey/trunk/MyKey.asm @@ -24,7 +24,7 @@ include 'string.inc' include 'macros.inc' include 'editbox_ex.mac' include 'load_lib.mac' -include 'dll.inc' +include '../../../dll.inc' include 'debug.inc' DEBUG equ 0;1 diff --git a/programs/system/MyKey/trunk/dll.inc b/programs/system/MyKey/trunk/dll.inc deleted file mode 100644 index 6ceb2d514d..0000000000 --- a/programs/system/MyKey/trunk/dll.inc +++ /dev/null @@ -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 diff --git a/programs/system/launch/trunk/dll.inc b/programs/system/launch/trunk/dll.inc deleted file mode 100755 index e1cb98d178..0000000000 --- a/programs/system/launch/trunk/dll.inc +++ /dev/null @@ -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 diff --git a/programs/system/launch/trunk/launch.asm b/programs/system/launch/trunk/launch.asm index c5eef42e4f..114490eb50 100755 --- a/programs/system/launch/trunk/launch.asm +++ b/programs/system/launch/trunk/launch.asm @@ -46,8 +46,7 @@ define BUFF_SIZE 1024 include 'proc32.inc' include 'macros.inc' include 'libio.inc' -include 'mem.inc' -include 'dll.inc' +include '../../../dll.inc' purge mov diff --git a/programs/system/launch/trunk/mem.inc b/programs/system/launch/trunk/mem.inc deleted file mode 100755 index ec78fbf7f6..0000000000 --- a/programs/system/launch/trunk/mem.inc +++ /dev/null @@ -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 diff --git a/programs/system/panel/trunk/@PANEL.ASM b/programs/system/panel/trunk/@PANEL.ASM index 68c1994dc0..b765465c99 100644 --- a/programs/system/panel/trunk/@PANEL.ASM +++ b/programs/system/panel/trunk/@PANEL.ASM @@ -1237,7 +1237,7 @@ no_full: ;------------------------------------------------------------------------------ include 'libini.inc' ;------------------------------------------------------------------------------ -include 'dll.inc' +include '../../../dll.inc' ;------------------------------------------------------------------------------ include 'drawappl.inc' ;------------------------------------------------------------------------------ diff --git a/programs/system/panel/trunk/dll.inc b/programs/system/panel/trunk/dll.inc deleted file mode 100644 index aceef7ac97..0000000000 --- a/programs/system/panel/trunk/dll.inc +++ /dev/null @@ -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 -;----------------------------------------------------------------------------- \ No newline at end of file