| View previous topic :: View next topic |
| Author |
Message |
supercharger Advanced Cheater
Reputation: 0
Joined: 06 Aug 2009 Posts: 61
|
Posted: Sat Jul 10, 2010 9:43 am Post subject: ASM- comparing float value- test ah |
|
|
i am confused about the use of:
test ah,01 / test ah,40 / test ah,41
after FNSTSW AX
do they produce the same result, or what is the difference?
i consulted www.intel.com but didn't find an explanation about those three. |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25839 Location: The netherlands
|
Posted: Sat Jul 10, 2010 11:08 am Post subject: |
|
|
01 checks if "Invalid operation" was set in the status word of the fpu
40 checks if "stack fault" was set
41 checks for both at the same time
good doc:
Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 1: Basic Architecture
chapter 8 _________________
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 |
|
 |
supercharger Advanced Cheater
Reputation: 0
Joined: 06 Aug 2009 Posts: 61
|
Posted: Sat Jul 10, 2010 8:31 pm Post subject: |
|
|
| thanks, i found the use of TEST AH in float value comparison, in the Manual,chapter 8. |
|
| Back to top |
|
 |
turbocharger How do I cheat?
Reputation: 0
Joined: 24 Apr 2011 Posts: 1
|
Posted: Sun Apr 24, 2011 5:05 pm Post subject: |
|
|
Since FNSTSW AX copies the floating point unit's status register into AX,
the TEST checks the high byte of the low word of the EAX register, which holds the condition codes of a previous floating point comparison:
ST(0) > m32fp => AH = 00h
ST(0) == m32fp => AH = 40h
ST(0) < m32fp => AH = 01h
So if you watch AH in your debugger, you can determine the result of a floating point comparison. |
|
| Back to top |
|
 |
|