我在 FASM 中有这段代码,它使用在 32 位程序中运行良好的 FPU 计算测量值。我将如何转换它以便它可以在 64 位程序中运行。当我在 64 位程序中使用此代码时,它给了我 0.00000 而不是像 54.24457 这样的数字
macro calculateresultlengthX {
;calculate result length x
;formula is resultlengthX = resultlengthXpixelstextbox / MeasuredlengthXpixelstextbox * MeasuredlengthXtextbox
;read in resultlengthXinpixelstextbox
invoke GetDlgItemTextA, [hwnd], resultlengthxpixelstextbox, bufferbuffer1, 100
cinvoke sscanf, bufferbuffer1, "%f", buffer1
;read in MeasuredlengthXinpixelstextbox
invoke GetDlgItemTextA, [hwnd], measuredlengthxpixelstextbox, bufferbuffer2, 100
cinvoke sscanf, bufferbuffer2, "%f", buffer2
;resultlengthXpixels / MeasuredlengthXpixels
finit
fld dword [buffer1]
fld dword [buffer2]
fdivp
fstp qword [buffer3]
cinvoke sprintf, addr buffer1, "%.16lf", dword [buffer3], dword [buffer3 + 4]
invoke SetDlgItemTextA,[hwnd],resultlengthxtextbox,addr buffer1
;read in ResultlengthXtextbox to get the temporary value
invoke GetDlgItemTextA, [hwnd],resultlengthxtextbox, bufferbuffer1, 100
cinvoke sscanf, bufferbuffer1, "%f", buffer1
;read in MeasuredlengthXtextbox
invoke GetDlgItemTextA, [hwnd],measuredlengthxtextbox, bufferbuffer2, 100
cinvoke sscanf, bufferbuffer2, "%f", buffer2
;answer * MeasuredlengthXtextbox
finit
fld dword [buffer1]
fld dword [buffer2]
fmulp
fstp qword [buffer3]
cinvoke sprintf, addr buffer1, "%.16lf", dword [buffer3], dword [buffer3 + 4]
invoke SetDlgItemTextA,[hwnd],resultlengthxtextbox,addr buffer1
}
谢谢