View previous topic :: View next topic |
Author |
Message |
Fresco Grandmaster Cheater
Reputation: 4
Joined: 07 Nov 2010 Posts: 600
|
Posted: Fri Feb 17, 2012 10:28 am Post subject: How to compare a value that is about to be written ? |
|
|
eax is the address of my value that should never be 1 but that can be every other value that ebx writes in it
Code: | lea eax,[my pointer address]
lea ebx,[whatever address]
// and now i have to compare the value of the address in ebx with 1 how do i do that ?
cmp 1,[ebx] //?? is that correct ?
je donothing // if the value of the address held by ebx is equal to 1 then jump to code that does nothing else do not jump
originalcode:
// original code
jmp after code ... //return
donothing:
nop // code that does nothing
jmp after code ... //return |
how to use cmp ?
_________________
... Fresco |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25796 Location: The netherlands
|
Posted: Fri Feb 17, 2012 4:37 pm Post subject: |
|
|
it's cmp [ebx],1
alternatively:
mov ebx,[whatever address]
cmp ebx,1
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
Fresco Grandmaster Cheater
Reputation: 4
Joined: 07 Nov 2010 Posts: 600
|
Posted: Sat Feb 18, 2012 6:40 am Post subject: |
|
|
Thank you, I got it
in other words if eax = 000ABC00
eax <- without [ ] means use "000ABC00" like a number (703488 {dec})
if address "000ABC00" = FF (value) 255 {dec}
[eax] <- with [ ] means use the value stored in address "000ABC00" and [eax] would be FF {255}
Isn't that correct ?
_________________
... Fresco |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25796 Location: The netherlands
|
Posted: Sun Feb 19, 2012 12:18 pm Post subject: |
|
|
yes. A register like eax is just a value. If you want to read an address use [value]
so you can do either [00401234] or [eax] or even [eax+1234] to read the contents of that address that the value represents
also, since you seem to be limiting yourself to 255, I assume you want to work with bytes specifically
then use the "byte ptr [address]" notation
e.g:
cmp byte ptr [ebx],1
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
|