I am new to masm and assembly and need some help. I have spent probably 6 hours on this already. I have 3 text boxes and 2 buttons. I want one of the buttons to multiply the numbers in the text boxes and show the result in the third text box, and the other button to divide the numbers in the 2 text boxes and show the result in the third text box. the numbers are almost always going to have decimals in them.
I have tried a lot of things but this is the code I think is the closest.
divide
invoke GetDlgItemInt,hWin,textbox1,NULL,TRUE
mov esi,eax
invoke GetDlgItemInt,hWin,textbox2,NULL,TRUE
mov edi,eax
mov math1,esi
fild math1
mov math2,edi
fidiv math2
fstsw math3
invoke SetDlgItemInt,hWin,textbox3,math3,TRUE
multiply
invoke GetDlgItemInt,hWin,textbox1,NULL,TRUE
mov esi,eax
invoke GetDlgItemInt,hWin,textbox2,NULL,TRUE
mov edi,eax
mov math1,esi
fild math1
mov math2,edi
fimul math2
fstsw math3
invoke SetDlgItemInt,hWin,textbox3,math3,TRUE
.data
math1 dd ?
math2 dd ?
math3 dw ?
the code above gives the wrong numbers in the text box. can someone please show me what I need to do.
thank you
Update
this code works
LOCAL var1 :QWORD
LOCAL var2 :QWORD
LOCAL var3 :QWORD
LOCAL str1[19]:BYTE
LOCAL str2[19]:BYTE
LOCAL str3[19]:BYTE
invoke GetDlgItemText,hWin,textbox1,addr str1,9
invoke StrToFloat,addr str1,addr var1
invoke GetDlgItemText,hWin,textbox2,addr str2,9
invoke StrToFloat,addr str2,addr var2
finit
fld var1
fld var2
fdiv
fstp var3
invoke FloatToStr,var3,addr str3
invoke SetDlgItemText,hWin,textbox3,addr str3
FSTSW
is storing the status word, not the result. What you need is FISTP
(for integers) or FSTP
(for floating point).