Joined: 31 Jan 2020 Posts: 29 Location: 192.168.0.1
Posted: Tue Jun 02, 2020 5:00 am Post subject: ASM Loop Through
Here is some addresses access instruction how can i loop through it and compare each value on it with what i need, if yes jump to another label if not continue looping to second value ...etc
and thanks
Sorry for my bad english
I assume you you want to compare unique values and assign each case a different procedure/action.
Code:
{$ASM}
//32bit
alloc(yourHook,2048)
yourHook:
// let's say esi+4 holds the address
push eax
mov eax,[esi+4]
cmp eax,#38240
jne @F
// you can, do here the mov[esi+10],#100 and jmp afterwards to @hookCleanup...
call firstEntity
@@:
cmp eax,#38304
jne @F
call secondEntity
@@:
cmp eax 39776
jne @F
call thirdEntity
test eax,eax
jne @hookCleanup
call nullEntity
@hookCleanup:
pop eax
jmp someAddressReturn
firstEntity:
mov [esi+10], #100 // let's say health
ret
secondEntity:
cmp [esi+8],1 // another unique id for example
jne @F
mov [esi+10],0
@@:
ret
thirdEntity:
mov [esi+3c],(float)0 // let's say speed
ret
nullEntity:
// eh, you may remove from array if you're saving entities to be able access from lua and such...
ret
someAddress:
jmp yourHook
someAddressReturn:
_________________
I'm rusty and getting older, help me re-learn lua.
They're labels. @@ is an anonymous label (no actual name), @f refers to the closest next label, and @b refers to the closest previous label. _________________
I don't know where I'm going, but I'll figure it out when I get there.
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