Subversion Repositories Kolibri OS

Rev

Rev 9288 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9288 Rev 9785
Line 31... Line 31...
31
#include 
31
#include 
Line 32... Line 32...
32
 
32
 
33
#include "SDL_error.h"
33
#include "SDL_error.h"
34
#include "SDL_timer.h"
34
#include "SDL_timer.h"
35
#include "SDL_timer_c.h"
35
#include "SDL_timer_c.h"
Line 36... Line 36...
36
#include "kos32sys.h"
36
#include 
37
 
37
 
38
#if _POSIX_THREAD_SYSCALL_SOFT
38
#if _POSIX_THREAD_SYSCALL_SOFT
Line 39... Line 39...
39
#include 
39
#include 
40
#endif
40
#endif
41
 
41
 
Line 42... Line -...
42
#if defined(DISABLE_THREADS) || defined(FORK_HACK)
-
 
43
#define USE_ITIMER
-
 
44
#endif
-
 
45
 
-
 
46
 
-
 
47
/* The first ticks value of the application */
42
#if defined(DISABLE_THREADS) || defined(FORK_HACK)
Line 48... Line 43...
48
//static struct timeval start;
43
#define USE_ITIMER
49
//static unsigned startlo,starthi;
44
#endif
50
//static unsigned clockrate;
45
 
51
static unsigned starttime;
-
 
52
 
-
 
53
void SDL_StartTicks(void)
-
 
54
{
46
static unsigned starttime;
Line 55... Line 47...
55
// gettimeofday(&start, NULL);
47
 
56
//  __asm__ ("int $0x40" : "=a"(clockrate) : "a"(18),"b"(5));
48
void SDL_StartTicks(void)
57
//  __asm__ ("rdtsc" : "=a"(startlo),"=d"(starthi));
-
 
58
	__asm__ ("int $0x40" : "=a"(starttime) : "a"(26),"b"(9));
-
 
59
}
-
 
60
 
-
 
61
 
-
 
62
Uint32 SDL_GetTicks (void)
-
 
63
{
-
 
64
/* struct timeval now;
-
 
65
 Uint32 ticks;
-
 
66
 gettimeofday(&now, NULL);
-
 
67
 ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
-
 
68
 return(ticks);*/
-
 
69
	/*int res;
-
 
70
	__asm__ ("rdtsc\n\t"
-
 
71
		"sub (_startlo),%%eax\n\t"
-
 
72
		"sbb (_starthi),%%edx\n\t"
-
 
73
		"push %%eax\n\t"
-
 
74
		"mov %%edx,%%eax\n\t"
-
 
75
		"mov $1000,%%ecx\n\t"
-
 
76
		"mul %%ecx\n\t"
49
{
77
		"xchg (%%esp),%%eax\n\t"
-
 
78
		"mul %%ecx\n\t"
50
	starttime = _ksys_get_tick_count();
79
		"add %%edx,(%%esp)\n\t"
51
}
Line 80... Line 52...
80
		"pop %%edx\n\t"
52
 
81
		"divl (_clockrate)\n\t" : "=a"(res));
53
 
82
	return res;*/
54
Uint32 SDL_GetTicks (void)
83
	unsigned curtime;
55
{
84
	__asm__ ("int $0x40" : "=a"(curtime) : "a"(26),"b"(9));
56
	unsigned curtime = _ksys_get_tick_count();
85
	return (curtime-starttime)*10;
57
	return (curtime-starttime)*10;
Line 86... Line 58...
86
}
58
}
87
 
59