Is StrToFloat destroy edi?
Im not sure but everytime Im not save the edi register before use StrToFloat and then used edi my app crash, is edi destroyed?
1) 'LAZY' way to check:
LOCAL buf[16]:BYTE
invoke dwtoa, edi, ADDR buf
invoke MessageBox, 0, ADDR buf, 0, 0
invoke StrToFloat... ; invoke any_proc
invoke dwtoa, edi, ADDR buf
invoke MessageBox, 0, ADDR buf, 0, 0
2) 'CLEVER' way to check:
check source-code of \masm32\masm32lib\atofp.asm
3) 'SMARTEST' way to check
open \masm32\help\masmlib.chm, type StrToFloat ... see if prototype uses 'USES edi'
if it does then it saves edi
PRESERVATION of esi edi ebx is a rule for each proc
it uses EBX, ESI, and EDI - no PUSH's or other preservation that i can see
EBP should also be preserved - StrToFloat does not use that one
You are right,
the \masm32\m32lib\atofp.asm don't preserve anything and modifies the registers.
Not usual coming from a proc of the masm32 library that as been verify.
Quote from: ToutEnMasm on July 13, 2009, 12:14:55 PM
You are right,
the \masm32\m32lib\atofp.asm don't preserve anything and modifies the registers.
Not usual coming from a proc of the masm32 library that as been verify.
Yeah, not usual. Unfortunately I dont know where is StrToFloat located so I dont checked it out. I thought every MASM32 lib function is preserve all the registers.
it is in this file - not hard to fix it - but let Hutch know so he can update it on the next release, as well
that is a good find, Farabi :U
\masm32\masm32lib\atofp.asm