| View previous topic :: View next topic |
| Author |
Message |
Dr.Disrespect Grandmaster Cheater
Reputation: 3
Joined: 17 Feb 2016 Posts: 526
|
Posted: Tue Mar 15, 2016 12:36 pm Post subject: Array and Loop in ASM. |
|
|
| How to create a one-dimensional array and loop through it? Thanks a lot.
|
|
| Back to top |
|
 |
akumakuja28 Master Cheater
Reputation: 16
Joined: 28 Jun 2015 Posts: 432
|
Posted: Tue Mar 15, 2016 1:17 pm Post subject: |
|
|
Yeah explain what exactly you want to accomplish.
_________________
|
|
| Back to top |
|
 |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Tue Mar 15, 2016 1:18 pm Post subject: |
|
|
What kind of array do you mean?
Basically all the instructions like
| Code: | | mov eax,[eax+ecx*4] |
are loops through array, the multiplier and the offset of course depends on the type with which you want to fill your array ...
|
|
| Back to top |
|
 |
Dr.Disrespect Grandmaster Cheater
Reputation: 3
Joined: 17 Feb 2016 Posts: 526
|
Posted: Tue Mar 15, 2016 6:30 pm Post subject: |
|
|
Thanks for the replies. I want to create a global array that can hold the ID of multiple AI players. When an AI player dies, its ID will be taken off from the array. And when a new AI player is created, I want:
Option one:
The ID of the new AI player will be places in the position in the array where the last dead AI player was.
Option two:
The ID of the new AI player will be places in sequence of the array and do not take the position of the dead AI player in the array, which means there will be empty slot in the array.
I want to know how to implement both of these options.
I hope I explain it well. Sorry for my English.
Thanks a lot.
|
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Tue Mar 15, 2016 7:24 pm Post subject: |
|
|
Lets assume EBX holds the ID of the new AI and you backup whatever registers the game requires. Sample injection:
| Code: | newmem:
mov eax,myarray
xor ecx,ecx
begin:
cmp [eax+ecx*4],0
je save
inc ecx
cmp ecx,#10 //max size of array
jl begin
jmp code
save:
mov [eax+ecx*4],ebx
code:
//original code |
|
|
| Back to top |
|
 |
Dr.Disrespect Grandmaster Cheater
Reputation: 3
Joined: 17 Feb 2016 Posts: 526
|
Posted: Fri Mar 18, 2016 1:55 am Post subject: |
|
|
| Zanzer wrote: | Lets assume EBX holds the ID of the new AI and you backup whatever registers the game requires. Sample injection:
| Code: | newmem:
mov eax,myarray
xor ecx,ecx
begin:
cmp [eax+ecx*4],0
je save
inc ecx
cmp ecx,#10 //max size of array
jl begin
jmp code
save:
mov [eax+ecx*4],ebx
code:
//original code |
|
Thanks a lot.
|
|
| Back to top |
|
 |
|