[SDL] Re: Timed functions.

Santiago Romero nop at todolinux.org
Mon Apr 24 09:25:34 PDT 2000


El 23 Apr 2000 11:12:58 -0700, Mattias Engdegård escribió:
>> I want a function to be executed 50 times per second (it is the
>> function that updates the keyboard array and screen for my
>> emulator) and I don't know how to do this under SDL... ¿Must I
>> use a separate thread with a wait like SDL_Delay into it?
>
>Don't you want the refresh interrupt linked to the emulation speed?

 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. That's the way the R80 emulator works, and I
 think its a good idea to sync the emulator (I accept any advice,
 in the other hand :). The R80 emulator uses a global variable
 (changed by the 50Hz function) and after executing 224 t-states
 the emulator waits till that variable changes in a while loop
 with a delay into it.
 
>A Speccy is so simple that most people prefer to do a cycle-exact
>emulation, and I suppose that you could count T-states instead?

 I'm counting them, but I must still to wait to sync with the real
 spectrum speed (3.59Mhz)...

 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 :).

-- 

 _-----------------------------------------------------_
|  NoP / Compiler          --       nop @ todolinux.org |
|-------------------------------------------------------|
|  POWERED BY - Linux RedHat 6.0  -  Reg. User #74.821  |
|             http://www.ctv.es/USERS/sromero           |
 ~-----------------------------------------------------~



More information about the SDL mailing list