NESe (pronounced "Nessie") is a NES emulator based on the e6502 emulator, also written in C with a focus on speed and portability for use on embedded platforms, especially ARM.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

22 lines
371B

  1. #include "timer.h"
  2. #include <SDL.h>
  3. time_us time_now(void) {
  4. return (SDL_GetTicks64() * 1000U);
  5. }
  6. void time_sleep(time_us sleep_us) {
  7. SDL_Delay(sleep_us / 1000U);
  8. }
  9. time_us time_sleep_until(time_us t_target) {
  10. time_us t_now = time_now();
  11. time_us t_diff = t_target - t_now;
  12. if (t_diff > 0) {
  13. time_sleep(t_diff);
  14. }
  15. return t_diff;
  16. }