kolibrios-fun/contrib/games/wolf3d/SDL/uSDL.c
turbocat 8835a95cf8 Wolf3D:
- Fixed in-game time. 
- Fixed incorrect implementation of SDL_Delay.
- Achieved maximum smoothness.

git-svn-id: svn://kolibrios.org@9123 a494cfbc-eb01-0410-851d-a64ba20cac60
2021-08-06 01:39:17 +00:00

29 lines
558 B
C

static unsigned __starttime;
void uSDL_StartTicks(void){
__asm__ __volatile__ (
"int $0x40"
:"=a"(__starttime)
:"a"(26),"b"(9)
:"memory"
);
}
unsigned uSDL_GetTicks(void){
unsigned __curtime;
__asm__ __volatile__(
"int $0x40"
:"=a"(__curtime)
:"a"(26),"b"(9)
:"memory"
);
return (__curtime-__starttime)*10;
}
void uSDL_Delay(unsigned ms){
unsigned start = uSDL_GetTicks();
do{
__asm__("int $0x40" :: "a"(68),"b"(1));
}while (uSDL_GetTicks()-start < ms);
}