PDA

View Full Version : limiting emu speed in c++



refraction
May 28th, 2004, 14:27
what code do i need to detect the speed of a processor an limit the speed of emulation, for instance chip 8 runs WELL too fast on todays pcs, wanted to know what code i could use to slow it down so its a playable speed.

cheers

-//zAe\\-
May 28th, 2004, 15:41
what code do i need to detect the speed of a processor an limit the speed of emulation, for instance chip 8 runs WELL too fast on todays pcs, wanted to know what code i could use to slow it down so its a playable speed.

cheers
Yo!
You need to write an FPS (Frames Per Second) counter. For example take a look at the GStaris code.
To limit your speed, you need to write an FPS limit code :)
EDIT:
Or you need the code itself?

bjz
May 28th, 2004, 22:40
DWORD lt = GetTickCount();
for(;cpurunning;)
{
if(GetTickCount() - lt >= 1000/60)
{
lt=GetTickCount();
//execute 1 op here
}
}

a similar method to this i used to slow down mine.

refraction
May 29th, 2004, 00:22
DWORD lt = GetTickCount();
for(;cpurunning;)
{
if(GetTickCount() - lt >= 1000/60)
{
lt=GetTickCount();
//execute 1 op here
}
}

a similar method to this i used to slow down mine.


cheers pal! sort of think i was looking for! i have the emu running so it does the op codes while execute = 1, so ill put it within that and put it so it doesnt do more than 60 op's a second!!

Thanks muchley :)