News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

StrToFloat

Started by Farabi, July 13, 2009, 10:38:55 AM

Previous topic - Next topic

Farabi

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?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

ramguru

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

ToutEnMasm


PRESERVATION of esi edi ebx is a rule for each proc

dedndave

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

ToutEnMasm


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.


Farabi

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.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

dedndave

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