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 


what do this assembly code do.(control flow)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
happyreadygo
Advanced Cheater
Reputation: 1

Joined: 14 Sep 2011
Posts: 87

PostPosted: Thu Jan 12, 2012 9:24 pm    Post subject: what do this assembly code do.(control flow) Reply with quote

I have basic assembly knowleage , only cmp x,y and mov x,y but idon't know that control flow.

here is the whole function.

mov eax,[esp+04]
test eax,eax
jnge 004df49d
cmp eax,09
jnl 004df49d
mov edx,[esp+08]
lea eax,[eax+eax*2] // this line had edited
mov [ecx+eax*4+44],edx
xor eax,eax
ret 0008
mov eax,fffffffd
ret 0008

can anybody explain what the code is doing in term of higher language.
what i want is to force always "mov [ecx+eax*4+44],edx"
are there any tutorial of assembly control flow.


Last edited by happyreadygo on Thu Jan 12, 2012 10:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Jan 12, 2012 9:58 pm    Post subject: Reply with quote

lea eax,[eax+eax+eax*2] , are you sure?
maybe: lea eax,[eax+eax*2]



Code:

test eax,eax                      =  cmp eax,0
JNGE  (not 'greater or equal')    =  JL (less)
JNL     (not less)                =  JGE (greater or equal)
lea eax,[eax+eax*2]           =  multiply eax by 3




So it would be (more or less) (pascal pseudo code):
Code:

index := arg1;              ([esp+04])
value := arg2;              ([esp+08])
start := ECX                 (where array/structure starts)

if index >= 0 and index <= 8 then
begin

  index := index * 3;
  array(start + index * 4 + 44) := value

  // above two lines could be replaced with this:
  // array(start + index * 12 + 44) := value

  return 0;
end
else return -3;

_________________


Last edited by mgr.inz.Player on Thu Jan 12, 2012 10:57 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
happyreadygo
Advanced Cheater
Reputation: 1

Joined: 14 Sep 2011
Posts: 87

PostPosted: Thu Jan 12, 2012 10:44 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
lea eax,[eax+eax+eax*2] , are you sure?
maybe: lea eax,[eax+eax*2]


I made a mistake.Embarassed

I am really thank you. Very Happy I ll try to understand and learn from your post.
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 Gamehacking 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