mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-14 02:47:07 +03:00
0d88e2ca63
git-svn-id: svn://kolibrios.org@4319 a494cfbc-eb01-0410-851d-a64ba20cac60
121 lines
3.5 KiB
PHP
121 lines
3.5 KiB
PHP
; by ManHunter / PCL
|
||
; http://www.manhunter.ru
|
||
;-----------------------------------------------------
|
||
; ”ãªæ¨ï ¯®«ãç¥¨ï ¤«¨ë áâப¨ (Fast)
|
||
;-----------------------------------------------------
|
||
; lpStr - 㪠§ ⥫ì áâபã ASCIIZ
|
||
; <EFBFBD> ¢ë室¥: EAX - ¤«¨ áâப¨ ¡¥§ ãç¥â § ¢¥àè î饣®
|
||
; ã«¥¢®£® ¡ ©â
|
||
;-----------------------------------------------------
|
||
;proc _lstrlen lpStr:DWORD
|
||
; mov eax, [lpStr]
|
||
; sub eax, 4
|
||
;@@:
|
||
; add eax, 4
|
||
; cmp byte [eax], 0
|
||
; je .szlen_lb1
|
||
; cmp byte [eax+1], 0
|
||
; je .szlen_lb2
|
||
; cmp byte [eax+2], 0
|
||
; je .szlen_lb3
|
||
; cmp byte [eax+3], 0
|
||
; jne @b
|
||
; sub eax, [lpStr]
|
||
; add eax, 3
|
||
; ret
|
||
;.szlen_lb3:
|
||
; sub eax, [lpStr]
|
||
; add eax, 2
|
||
; ret
|
||
;.szlen_lb2:
|
||
; sub eax, [lpStr]
|
||
; add eax, 1
|
||
; ret
|
||
;.szlen_lb1:
|
||
; sub eax, [lpStr]
|
||
; ret
|
||
;endp
|
||
|
||
;-----------------------------------------------------
|
||
; ”ãªæ¨ï ¯®«ãç¥¨ï ¤«¨ë áâப¨
|
||
;-----------------------------------------------------
|
||
; lpStr - 㪠§ ⥫ì áâபã ASCIIZ
|
||
; <EFBFBD> ¢ë室¥: EAX - ¤«¨ áâப¨ ¡¥§ ãç¥â § ¢¥àè î饣®
|
||
; ã«¥¢®£® ¡ ©â
|
||
;-----------------------------------------------------
|
||
proc _lstrlen lpStr:DWORD
|
||
mov eax, [lpStr]
|
||
@@: inc eax
|
||
cmp byte [eax], 0
|
||
jne @b
|
||
sub eax, [lpStr]
|
||
ret
|
||
endp
|
||
;-----------------------------------------------------
|
||
; ”ãªæ¨ï ¡ëáâண® ᫨ï¨ï ¤¢ãå áâப
|
||
; ¨á¯®«ì§ãîâáï äãªæ¨¨ _lstrlen, _lstrcpy
|
||
;-----------------------------------------------------
|
||
; lpDst - 㪠§ â¥«ì ¨á室ãî áâபã ASCIIZ
|
||
; lpSrc - 㪠§ â¥«ì ¤®¡ ¢«ï¥¬ãî áâபã ASCIIZ
|
||
;-----------------------------------------------------
|
||
proc _lstrcat lpDst:DWORD, lpSrc:DWORD
|
||
pusha
|
||
|
||
stdcall _lstrlen,[lpDst]
|
||
add eax,[lpDst]
|
||
|
||
stdcall _lstrcpy,eax,[lpSrc]
|
||
|
||
popa
|
||
ret
|
||
endp
|
||
|
||
;-----------------------------------------------------
|
||
; ”ãªæ¨ï ¡ëáâண® ª®¯¨à®¢ ¨ï áâப¨
|
||
; ¨á¯®«ì§ãîâáï äãªæ¨¨ _lstrlen, _memcopy
|
||
;-----------------------------------------------------
|
||
; lpDst - 㪠§ â¥«ì ¯à¨¥¬¨ª
|
||
; lpSrc - 㪠§ ⥫ì áâபã ASCIIZ
|
||
;-----------------------------------------------------
|
||
proc _lstrcpy lpDst:DWORD, lpSrc:DWORD
|
||
pusha
|
||
|
||
stdcall _lstrlen,[lpSrc]
|
||
inc eax
|
||
stdcall _memcopy,[lpDst],[lpSrc],eax
|
||
|
||
popa
|
||
ret
|
||
endp
|
||
|
||
;-----------------------------------------------------
|
||
; ”ãªæ¨ï ¡ëáâண® ª®¯¨à®¢ ¨ï ãç á⪠¯ ¬ïâ¨
|
||
;-----------------------------------------------------
|
||
; lpDst - 㪠§ â¥«ì ¯à¨¥¬¨ª
|
||
; lpSrc - 㪠§ â¥«ì ¨áâ®ç¨ª
|
||
; dSize - à §¬¥à ª®¯¨à㥬®£® ¡«®ª
|
||
;-----------------------------------------------------
|
||
proc _memcopy lpDst:DWORD, lpSrc:DWORD, dSize:DWORD
|
||
pusha
|
||
|
||
; “áâ ®¢¨âì 㪠§ ⥫¨ ¨áâ®ç¨ª ¨ ¯à¨¥¬¨ª
|
||
cld
|
||
mov edi,[lpDst]
|
||
mov esi,[lpSrc]
|
||
|
||
mov ecx,[dSize]
|
||
push ecx
|
||
; <EFBFBD> §¤¥«¨âì 4 ¨ ¯®«ãç¨âì ¤«¨ã ¢ DWORD
|
||
shr ecx,2
|
||
; ‘ª®¯¨à®¢ âì ®á®¢ãî ç áâì áâப¨ DWORD' ¬¨
|
||
rep movsd
|
||
pop ecx
|
||
; <EFBFBD>®«ãç¨âì ®áâ ⮪ ®â ¤¥«¥¨ï 4
|
||
and ecx,3
|
||
; ‘ª®¯¨à®¢ âì ®áâ ⮪ áâப¨ ¡ ©â ¬¨
|
||
rep movsb
|
||
|
||
popa
|
||
ret
|
||
endp
|