Made _ftol take argument from FPU stack. Starcraft v1.04 (*not* Brood

Wars) now works perfectly with Wine's crtdll. Wrote a test
implementation of _CIpow too, which those who do have Brood Wars can
report on, so it can be implemented correctly.
This commit is contained in:
Ove Kaaven 1999-04-11 14:50:34 +00:00 committed by Alexandre Julliard
parent 2031d6c430
commit f8de23e32e
2 changed files with 40 additions and 4 deletions

View File

@ -91,6 +91,12 @@ typedef VOID (*new_handler_type)(VOID);
static new_handler_type new_handler;
#if defined(__GNUC__) && defined(__i386__)
#define USING_REAL_FPU
#define DO_FPU(x,y) __asm__ __volatile__( x " %0;fwait" : "=m" (y) : )
#define POP_FPU(x) DO_FPU("fstpl",x)
#endif
/*********************************************************************
* _GetMainArgs (CRTDLL.022)
*/
@ -2000,11 +2006,41 @@ VOID __cdecl CRTDLL_signal(int sig, sig_handler_type ptr)
}
/*********************************************************************
* _ftol (CRTDLL.113)
* _ftol (CRTDLL.113)
*/
LONG __cdecl CRTDLL__ftol(double fl) {
#ifdef USING_REAL_FPU
LONG __cdecl CRTDLL__ftol(void) {
/* don't just do DO_FPU("fistp",retval), because the rounding
* mode must also be set to "round towards zero"... */
double fl;
POP_FPU(fl);
return (LONG)fl;
}
#else
LONG __cdecl CRTDLL__ftol(double fl) {
FIXME(crtdll,"should be register function\n");
return (LONG)fl;
}
#endif
/*********************************************************************
* _CIpow (CRTDLL.14)
*/
#ifdef USING_REAL_FPU
LONG __cdecl CRTDLL__CIpow(void) {
double x,y;
POP_FPU(y);
POP_FPU(x);
FIXME(crtdll,"(%f,%f): argument order unknown! Please report!\n",x,y);
return pow(x,y);
}
#else
LONG __cdecl CRTDLL__CIpow(double x,double y) {
FIXME(crtdll,"should be register function\n");
return pow(x,y);
}
#endif
/*********************************************************************
* _sleep (CRTDLL.267)
*/

View File

@ -15,7 +15,7 @@ type win32
11 stub _CIfmod
12 stub _CIlog
13 stub _CIlog10
14 stub _CIpow
14 cdecl _CIpow() CRTDLL__CIpow
15 stub _CIsin
16 stub _CIsinh
17 stub _CIsqrt
@ -114,7 +114,7 @@ type win32
110 stub _fsopen
111 cdecl _fstat(long ptr) CRTDLL__fstat
112 stub _ftime
113 cdecl _ftol(double) CRTDLL__ftol
113 cdecl _ftol() CRTDLL__ftol
114 cdecl _fullpath(ptr str long) CRTDLL__fullpath
115 stub _futime
116 stub _gcvt