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
Posted on 2002-09-21 14:16:40 by win32n00b
What is long1?
REAL4 or DWORD?
float or integer?

The code is good question the input.
Posted on 2002-09-21 15:04:30 by bitRAKE
long1 is an angle that you are computing the sine of :\ and its a dword
Posted on 2002-09-21 16:00:57 by win32n00b
1. FSIN needs radians.
2. If you going to load a DWORD integer on the FPU stack use FILD.
Posted on 2002-09-21 17:31:06 by bitRAKE
Thanks BitRake, I didn't think about vb's data types, and it was not a Float but a Integer :P (Problem Fixed!)
Posted on 2002-09-21 17:37:14 by win32n00b
	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. ;)
Posted on 2002-09-21 17:58:08 by bitRAKE
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.
Posted on 2002-09-23 00:10:48 by sluggy

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.
Posted on 2002-09-23 00:52:13 by bazik