windows - masm FPU to fasm FPU cannot translate and it does not work -
i have code in masm deal fpu , works great
in code number 2 different textboxes , divide them , output results textbox
this data local
local variable1 :qword local variable2 :qword local variable3 :qword local string1[20]:byte local string2[20]:byte local string3[20]:byte this code
invoke getdlgitemtext,hwin,textbox1,addr string1,9 invoke strtofloat,addr string1,addr variable1 invoke getdlgitemtext,hwin,textbox2,addr string2,9 invoke strtofloat,addr string2,addr variable2 finit fld variable1 fld variable2 fdiv fstp variable3 invoke floattostr,variable3,addr string3 invoke setdlgitemtext,hwin,textbox3,addr string3 i trying convert code fasm
this have far not working textbox3 says 0
this data (this not local data because have not learned how in fasm yet)
v1 dq ? v2 dq ? v3 dd ? v4 rb 20 this code
invoke getdlgitemtexta,[hwin],textbox1,addr v1,100 invoke getdlgitemtexta,[hwin],textbox2,addr v2,100 finit fld qword [v1] fld qword [v2] fdivp fstp qword [v3] cinvoke wsprintfa,addr v4,"%u",[v3] invoke setdlgitemtexta,[hwin],textbox3,addr v4 i know code not right because not converting text float @ begining not know how to
i tried simpler version , did not work either
mov [v1],5.3 mov [v2],7.1 finit fld [v1] fld [v2] fdivp fstp [v3] cinvoke wsprintfa,addr v4,"%u",[v3] invoke setdlgitemtexta,[hwin],maximumoutputpowertext,addr v4 so question can please show me how read number 2 different textboxes , divide them , return result textbox using fasm code
thank you
there several problems in demonstrated code.
at first, not clear strtofloat procedure is? imported dll or part of code, or other library?
if procedure imported, has imported in fasm program well. else can written scratch or ported in source form masm program.
the immediate show stopper here mov [v1], float_constant instruction. reason v1 qword variable, mov can moves dword immediate values (even in 64bit environment).
mov dword [v1], 5.0 works fine, of course not op needs. floating qword constants can defined in compile time well: v1 dq 3.2
if want set qword floating constant in run time, have make in 2 instructions following way:
= 5.3 mov dword [var], (a , $ffffffff) mov dword [var+4], (a shr 32) var dq ? the original fpu code in fasm syntax be:
finit fld [variable1] fdiv [variable2] fstp [variable3]
Comments
Post a Comment