home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Emulation / Atari800 / atari_obsolete.c < prev    next >
C/C++ Source or Header  |  1997-10-17  |  2KB  |  90 lines

  1.  
  2. #endif
  3. #ifdef OLD      
  4. #ifndef BASIC
  5.       if (++test_val == refresh_rate)
  6.     {
  7.       ANTIC_RunDisplayList ();
  8.       Atari_DisplayScreen ((UBYTE*)atari_screen);
  9.       test_val = 0;
  10.     }
  11.       else
  12.     {
  13.       ANTIC_RunDisplayList ();
  14. /*
  15.       for (ypos = 0;ypos < 8; ypos++)
  16.         GO (114);
  17.       NMIST = 0x3f; // Reset VBLANK
  18.  
  19.       for (ypos=8;ypos<ATARI_HEIGHT;ypos++)
  20.         {
  21.           GO (114);
  22.         }
  23.  
  24.       NMIST |= 0x40; // Set VBLANK 
  25.       if (NMIEN & 0x40)
  26.         {
  27.           GO (1); 
  28.           NMI ();
  29.         }
  30. */
  31.  
  32.     }
  33. #else
  34.       for (ypos=0;ypos<ATARI_HEIGHT;ypos++)
  35.     {
  36.       GO (114);
  37.     }
  38. #endif
  39. #endif
  40.     }
  41.  
  42. #ifndef DJGPP
  43.       if (deltatime > 0.0)
  44.     {
  45.       if (lasttime >= 0.0)
  46.         {
  47.           double curtime;
  48.  
  49.           do
  50.         {
  51.           gettimeofday (&tp, &tzp);
  52.           curtime = tp.tv_sec + (tp.tv_usec / 1000000.0);
  53.         } while (curtime < (lasttime + deltatime));
  54.       
  55.           lasttime = curtime;
  56.         }
  57.       else
  58.         {
  59.           gettimeofday (&tp, &tzp);
  60.           lasttime = tp.tv_sec + (tp.tv_usec / 1000000.0);
  61.         }
  62.     }
  63. #else  // for dos, count ticks and use the ticks_per_second global variable
  64.        // Use the high speed clock tick function uclock()
  65.       if (deltatime > 0.0) {
  66.         static uclock_t lasttime = 0;
  67.         uclock_t curtime, uclockd;
  68.         unsigned long uclockd_hi, uclockd_lo;
  69.         unsigned long uclocks_per_int;
  70.  
  71.         uclocks_per_int = (deltatime * (double) UCLOCKS_PER_SEC) + 0.5;
  72.         // printf( "ticks_per_int %d, %.8X\n", uclocks_per_int, (unsigned long) lasttime );
  73.  
  74.         do {
  75.           curtime = uclock();
  76.           if( curtime > lasttime ) {
  77.             uclockd = curtime - lasttime;
  78.           }
  79.           else {
  80.             uclockd = ((uclock_t) ~0 - lasttime) + curtime + (uclock_t) 1;
  81.           }
  82.           uclockd_lo = (unsigned long) uclockd;
  83.           uclockd_hi = (unsigned long) (uclockd >> 32);
  84.         } while( (uclockd_hi == 0) && (uclocks_per_int > uclockd_lo) );
  85.  
  86.         lasttime = curtime;
  87.       }
  88. #endif
  89.     }
  90.