|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
malis2007 How do I cheat? Reputation: 0
Joined: 31 Jul 2017 Posts: 1
|
Posted: Fri Aug 11, 2017 9:47 pm Post subject: need help understanding the carry flag.. |
|
|
Hello there
i have a problem understanding the carry flag :/
i added these lines to the SUB instruction in the CE's step 2 TUT
Code: | pushad
pushfd
mov eax,2
add eax,1
popfd
popad |
after the add instruction, why is the carry flag being set? (CF=1)
>>image in attachment <<
and why is it cleared (CF=0) when i replaced this code:
with either 7,A or even F the carry flag is cleared? (CF=0)
e.g.
>> image in attachment <<
Thanks for reading, and your help inadvanced..
Description: |
pushad
pushfd
mov eax,F
add eax,1
popfd
popad |
|
Filesize: |
100.5 KB |
Viewed: |
3656 Time(s) |
|
Description: |
pushad
pushfd
mov eax,2
add eax,1
popfd
popad |
|
Filesize: |
100.2 KB |
Viewed: |
3656 Time(s) |
|
|
|
Back to top |
|
|
OldCheatEngineUser Whateven rank Reputation: 20
Joined: 01 Feb 2016 Posts: 1587
|
Posted: Fri Aug 11, 2017 10:12 pm Post subject: |
|
|
Quote: | Carry Flag
The rules for turning on the carry flag in binary/integer math are two:
The carry flag is set if the addition of two numbers causes a carry out of the most significant (leftmost) bits added. 1111 + 0001 = 0000
(carry flag is turned on)
The carry (borrow) flag is also set if the subtraction of two numbers requires a borrow into the most significant (leftmost) bits subtracted. 0000 - 0001 = 1111
(carry flag is turned on) Otherwise, the carry flag is turned off (zero).
0111 + 0001 = 1000 (carry flag is turned off [zero])
1000 - 0001 = 0111 (carry flag is turned off [zero])
|
_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote: | i am a sweetheart. |
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sat Aug 12, 2017 7:32 am Post subject: |
|
|
@OldCheatEngineUser the second image is 2 + 1, 00000010 + 00000001 = 00000011, at what point is that causing a carry out, or a borrow, from the most significant bit?
You can see the >> on the popfd so the add has been run but the flag restore has not.
Hello again @malis2007 I'm sure it's something that'll seem simple once it's pointed out but I'm not seeing it either lol
|
|
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
|
|