|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Uzeil Moderator Reputation: 6
Joined: 21 Oct 2006 Posts: 2411
|
Posted: Sun Mar 18, 2007 4:37 am Post subject: [Assembly] AND Bitwise Operator |
|
|
The 'and' bitwise operator. You may be familiar with this when working with booleans if you are a programmer (and for those who aren't: boolean is true/false)
Now. What is does is say 'only if these are both true, allow the return value to be true'. In other words, this is a bit-wise operator (you know binary? the 0's and 1's? well 0 = false and 1 = true.)
So lets do an example.
Now. We convert to binary. (in binary, you set up hexadecimal digits as 8-4-2-1. So like A (which is 10) would be 1010 because the 8 slot and 2 slot are filled. add them together and you ahve 10. every hexadecimal digit is 4 bits of binary)
so. AND
Code: | 0101 0010 <- 5 2 (4+1 filled, and second one with the 2 slot filled)
0110 0001 <- 6 1. (see, first is 4+2 slots filled. second is only the 1 slot filled)
__________
So only the ones that line up are going to still be true in the result. Therefore: the result is
0100 0000 <- the 4 slot in the first, and nothing in the second. The answer is 40 :) |
If you have any more questions, just post a reply
P.S. if you want a real-life example of this, check the maplestory unrandomizer address hook it to write down EAX and see how 'and' can very much change a value.
A few tricks with AND:
You can use the AND operator to limit the value of something. If you think about it, the result can NOT be greater than the lowest value. (because everything to the left of that variable's highest bit is going to be 0's, so there is no way that they are going to both be 1's for the result to have a 1.)
So, you can use it for little tricks. For instance: setting anything to 0.
Lets say EAX was 1337.
Well, lets line that binary up.
Code: | 0001 0011 0011 0111
0000 0000 0000 0000
___________________
0000 0000 0000 0000 | That __________ is the 'result' line like what you used for additon and long division whne you were young.
Notice how nothing can possibly line up? The result has to be 0
Now, lets do the exact opposite. Lets use AND to do absolutely nothing, but confuse people.
Again, lets solve this as if EAX was 1337.
Code: | 0000 0000 0000 0000 0001 0011 0011 0111
1111 1111 1111 1111 1111 1111 1111 1111
_____________________________________
0000 0000 0000 0000 0001 0011 0011 0111 | The result is 1337 Because with F's, all bits will be set. Which means that anything in that register that is set is going to lign up, and yet anything that isn't set is going to not be set in the result Therefore, an F is going to keep that digit the same.
Let's just use it to make 1337 show up from something not-so-noticable.
Code: | mov eax,52637b3F
AND eax,93b7 | (that F in the last digit was a bad idea )
Ok, now lets set this up. We know that everything to the left of that 93b7 is going to be 0's, so we don't even need to include them! That would just be a waste of time.
Code: | 0111 1011 0011 1111 <-7b3F
1001 0011 1011 0111 <-93b7
____________________ <- result line
0001 0011 0011 0111 <- 1337 =) |
Tadaaa Let's just all hope this doesn't get locked or moved to an area where it isn't going to be noticed (or not catch the interest of people who haven't begun ASM yet)
_________________
Last edited by Uzeil on Sun Mar 18, 2007 9:46 pm; edited 1 time in total |
|
Back to top |
|
|
--Pillboi-- Grandmaster Cheater Supreme Reputation: 0
Joined: 06 Mar 2007 Posts: 1383 Location: I don't understand the question. Is this a 1 to 10 thing?
|
Posted: Sun Mar 18, 2007 4:38 am Post subject: |
|
|
Hey cool, nice. Thx a lot.
--Pillboi--
_________________
Enter darkness, leave the light, Here be nightmare, here be fright...
Earth and Water, Fire and Air. Prepare to meet a creature rare.
Enter now if you dare, Enter now the dragon's lair. |
|
Back to top |
|
|
Liquid369 I post too much Reputation: 0
Joined: 15 Oct 2006 Posts: 3938 Location: Where ever I am
|
Posted: Sun Mar 18, 2007 8:36 am Post subject: |
|
|
Thanks for this Uzeil
Only thing why not write a tut on machine language conversion from hex
_________________
People are of no value.
We could make more sometime.
If we need them.
Life itself is only vision, a dream.
Nothing exists in empty space and you.
And you are but a thought. |
|
Back to top |
|
|
Uzeil Moderator Reputation: 6
Joined: 21 Oct 2006 Posts: 2411
|
Posted: Sun Mar 18, 2007 9:47 pm Post subject: |
|
|
This thread wrote: | Now. We convert to binary. (in binary, you set up hexadecimal digits as 8-4-2-1. So like A (which is 10) would be 1010 because the 8 slot and 2 slot are filled. add them together and you ahve 10. every hexadecimal digit is 4 bits of binary) |
Already did =(
*copy and paste tut from Mini Engine*
Already did =(
_________________
|
|
Back to top |
|
|
|
|
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
|
|