kolibrios/programs/system/rdsave/trunk/str.inc
heavyiron fa45c7e5db New versions of End and RDsave. See forum for detales.
git-svn-id: svn://kolibrios.org@4213 a494cfbc-eb01-0410-851d-a64ba20cac60
2013-11-11 22:49:12 +00:00

130 lines
3.6 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

; 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
push edi ecx
cld
mov edi,[lpStr]
xor ecx,ecx
dec ecx
xor eax,eax
repne scasb
not ecx
dec ecx
mov eax,ecx
pop ecx edi
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