Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Assembly Int to String?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
iam_clint
How do I cheat?
Reputation: 0

Joined: 14 Dec 2007
Posts: 0

PostPosted: Fri Dec 14, 2007 6:42 pm    Post subject: Assembly Int to String? Reply with quote

need help to convert an int to a string in assembly
example provided
---
Code:

push eax
mov eax,[10232F2] //This value for example could be 22
mov [10332D],eax //[10332D] is a text for example A Goat
pop eax

--
when I run this code I get a hex value in the text field so say it was 22 being pushed into that text it would show 0x16 if i swap the text to a byte field in CE but when its in text view it shows a random symbol/letter
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Fri Dec 14, 2007 7:24 pm    Post subject: Reply with quote

Check m32lib's version of ITOA.
_________________
Back to top
View user's profile Send private message
Uzeil
Moderator
Reputation: 6

Joined: 21 Oct 2006
Posts: 2411

PostPosted: Fri Dec 14, 2007 7:55 pm    Post subject: Reply with quote

Code:
invoke crt__itoa, <number>, <pointer to string buffer>, <radix>


Example:
Code:
.DATA
  somestring db 50 dUP(00)
  magicalnumber dd 13371337h

.CODE
start:
  mov eax,magicalnumber
  invoke crt__itoa, eax, offset somestring, 10h


or

Code:
.DATA
  somestring db 50 dUP(00)
  magicalnumber dd 13371337h

.CODE
start:
  push 16
  push offset somestring
  push magicalnumber
  call crt__itoa
  add esp,0ch
They do the same thing. Make sure you import msvcrt though...


For string to int I just use StrToInt... if the string is, say "10" it'll return 10 in eax(0x0a), and if the string is, say "$10", it'll return 16 in eax(0x10). The $ sign simply means 'hexidecimal', You can use crt__atoi as well, but if the result is the same, I'm fine with being a slut for simplicity- in which StrToInt takes the cake.

_________________


Mini Engine v3.0
Mipla v1.0

Reposted old threads out of the MS section.
Back to top
View user's profile Send private message
iam_clint
How do I cheat?
Reputation: 0

Joined: 14 Dec 2007
Posts: 0

PostPosted: Fri Dec 14, 2007 8:36 pm    Post subject: Reply with quote

Uzeil wrote:
Code:
invoke crt__itoa, <number>, <pointer to string buffer>, <radix>


Example:
Code:
.DATA
  somestring db 50 dUP(00)
  magicalnumber dd 13371337h

.CODE
start:
  mov eax,magicalnumber
  invoke crt__itoa, eax, offset somestring, 10h


or

Code:
.DATA
  somestring db 50 dUP(00)
  magicalnumber dd 13371337h

.CODE
start:
  push 16
  push offset somestring
  push magicalnumber
  call crt__itoa
  add esp,0ch
They do the same thing. Make sure you import msvcrt though...


For string to int I just use StrToInt... if the string is, say "10" it'll return 10 in eax(0x0a), and if the string is, say "$10", it'll return 16 in eax(0x10). The $ sign simply means 'hexidecimal', You can use crt__atoi as well, but if the result is the same, I'm fine with being a slut for simplicity- in which StrToInt takes the cake.


Thanks
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sat Dec 15, 2007 12:51 am    Post subject: Reply with quote

The source code for the Microsoft Visual C++ runtime library comes with visual studio, for compilation purposes, not sure on their copying stance though.
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites