home *** CD-ROM | disk | FTP | other *** search
/ Black Art of 3D Game Programming / Black_Art_of_3D_Game_Programming.iso / source / msc / library / black8.h < prev    next >
Text File  |  1994-11-23  |  2KB  |  50 lines

  1.  
  2. // BLACK8.H - Header file for BLACK8.C
  3.  
  4. // D E F I N E S //////////////////////////////////////////////////////////////
  5.  
  6. // the 8259A programmable interrupt controller
  7.  
  8. #define PIC_ICR  0x20 // the interrupt control register
  9. #define PIC_IMR  0x21 // the interrupt mask register
  10. #define PIC_EOI  0x20 // end of interrupt command
  11.  
  12. // the 8253 timer chip
  13.  
  14. #define TIMER_CONTROL  0x43  // the 8253's control register
  15. #define TIMER_SET_BITS 0x3C  // the bit pattern that will place the timer into
  16.                              // binary counting with counter load sequence of
  17.                              // low byte then high byte
  18.  
  19. #define TIMER_COUNTER_0       0x40  // counter 0
  20. #define TIMER_COUNTER_1       0x41  // counter 1
  21. #define TIMER_COUNTER_2       0x42  // counter 2
  22.  
  23. #define TIMER_120HZ    0x26D7 // 120 hz
  24. #define TIMER_100HZ    0x2E9B // 100 hz
  25. #define TIMER_60HZ     0x4DAE // 60 hz
  26. #define TIMER_50HZ     0x5D37 // 50 hz
  27. #define TIMER_40HZ     0x7486 // 40 hz
  28. #define TIMER_30HZ     0x965C // 30 hz
  29. #define TIMER_20HZ     0xE90B // 20 hz
  30. #define TIMER_18HZ     0xFFFF // 18.2 hz (slowest possible)
  31.  
  32. #define TIME_KEEPER_INT     0x1C    // the time keeper interrupt
  33.  
  34. // M A C R O S ///////////////////////////////////////////////////////////////
  35.  
  36. #define LOW_BYTE(n) (n & 0x00FF)       // extracts the low-byte of a word
  37. #define HI_BYTE(n)  ((n>>8) & 0x00FF)  // extracts the hi-byte of a word
  38.  
  39. // E X T E R N A L S//////////////////////////////////////////////////////////
  40.  
  41. extern long starting_time, // these are used to compute the length of some event
  42.             ending_time;
  43.  
  44. // P R O T O T Y P E S ///////////////////////////////////////////////////////
  45.  
  46. long Timer_Query(void);
  47.  
  48. void Timer_Program(int timer,unsigned int rate);
  49.  
  50.