okay well i use callwindowproc to call machine code in vb anywho here is the code and i will give you my prob
%Define long1
%Define long2
%Define long3
%Define long4
push ebp
mov ebp,esp
push ebx ; These 3 registers
push esi ; should be preserved
push edi ; in general. Though not essential
mov edi,long2 ; edi = pointer to a double (quadword)
fld dword long1
fsin
fstp qword
pop edi ; restore registers
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 16
okay well it returns 1.40129846432482E-45 for the sin of 1
but it should be 0.841470984807897 around that any help is appreciated
%Define long1
%Define long2
%Define long3
%Define long4
push ebp
mov ebp,esp
push ebx ; These 3 registers
push esi ; should be preserved
push edi ; in general. Though not essential
mov edi,long2 ; edi = pointer to a double (quadword)
fld dword long1
fsin
fstp qword
pop edi ; restore registers
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 16
okay well it returns 1.40129846432482E-45 for the sin of 1
but it should be 0.841470984807897 around that any help is appreciated
What is long1?
REAL4 or DWORD?
float or integer?
The code is good question the input.
REAL4 or DWORD?
float or integer?
The code is good question the input.
long1 is an angle that you are computing the sine of :\ and its a dword
1. FSIN needs radians.
2. If you going to load a DWORD integer on the FPU stack use FILD.
2. If you going to load a DWORD integer on the FPU stack use FILD.
Thanks BitRake, I didn't think about vb's data types, and it was not a Float but a Integer :P (Problem Fixed!)
mov eax, [esp + 8] ; eax = pointer to a double (quadword)
fld REAL4 [esp + 4]
fsin
fstp REAL8 [eax]
ret 16
...that is a lot of extra code for such a small routine. ;)okay well i use callwindowproc to call machine code in vb
Why do that? Why don't you just export your function so that it is publicly accessable? Then all you have to do is have a Declare somewhere at the top of one of your modules.Why do that? Why don't you just export your function so that it is publicly accessable? Then all you have to do is have a Declare somewhere at the top of one of your modules.
You should name it: dynamic link library (dll) ;)
I second that, using a dll would be more efficent.