[SDL] Re: Timed functions.

Mattias Engdegård f91-men at nada.kth.se
Mon Apr 24 16:56:04 PDT 2000


Den 24 april 2000 18:25:34 +0200 skrev Santiago Romero:
> yes, that's the way I want to do it. There is a 50Hz interrupt and
> I want to link my emulator speed to the real emulator speed by
> executing opcodes up to 224 T-States, and then wait until a 50Hz
> interrupt occurs.

224 T-states if for one scanline, not for a full frame. A frame is
(64 + 192 + 56) * 224 = 69888 T-states (OK, so I cheated and looked it
up). I suppose synching to each frame is all right, but no matter how fast
your machine is, you are never going to have more than 20ms free time
until the next frame so sleeping is out of the question under Unix, unless
you have an Alpha :-).

The hardest part might be to get the sound play cleanly, but that should be
doable without time-locking the entire emulator to the audio device :-)

> I don't want (still) to do a perfect opcode by opcode spectrum
> emulation, I've seen R80 working (very good) and it syncs on each
> scanline, so I'll try this (at least in my 0.0.1 version :).

Sync on each scanline is OK, but then you need a high resolution timer
like gettimeofday() - I don't think milliseconds (from SDL_GetTicks) would
do.




More information about the SDL mailing list