unknowncheats uc-forum.com ucdownloads ucdownloads.com

Go Back   UC-Tutorials - Multiplayer Game Hacking and Cheat Tutorials > Programming > Assembly

- Sponsored Advertisement -
http://www.myfpscheats.com/


Reply
 
Thread Tools Display Modes
  #1  
Old 03-20-2010, 08:54 PM
learn_more learn_more is offline
Member
 
Join Date: Feb 2010
Posts: 59
Default String Functions

by Max_Power

Self explanatory, but I wrote these to avoid using the masm library and api.

Code:
	;These work just like their api counterparts
	
	strlen PROTO :DWORD			;Returns the length of the string minus the null terminator
	strcat PROTO :DWORD,:DWORD	;Appends string1 to string2 with result in string1
	strcpy PROTO :DWORD,:DWORD	;Copys source string to destination
	
	.code
	
	strlen proc USES esi lpSource:DWORD
		mov esi,lpSource
		xor eax,eax
		
		.REPEAT
			mov cl,[esi+eax]
			inc eax
		.UNTIL cl==0
		
		dec eax
		ret
	strlen endp
	
	strcat proc USES esi edi lpString1:DWORD,lpString2:DWORD
		mov esi,lpString1
		mov edi,lpString2
		invoke strlen,lpString1
		mov edx,eax
		xor eax,eax
		
		.REPEAT
			mov cl,[edi+eax]
			mov [esi+edx],cl
			inc eax
			inc edx
		.UNTIL cl==0

		mov eax,esi
		ret
	strcat endp
	
	strcpy proc USES esi edi lpDestination:DWORD,lpSource:DWORD
		mov esi,lpDestination
		mov edi,lpSource
		xor eax,eax
		
		.REPEAT
			mov cl,[edi+eax]
			mov [esi+eax],cl
			inc eax
		.UNTIL cl==0

		mov eax,esi
		ret
	strcpy endp

Last edited by learn_more; 03-20-2010 at 09:12 PM.
Reply With Quote
Reply

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit

Tags
functions, string

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 04:18 PM.