home *** CD-ROM | disk | FTP | other *** search
- /******************************************
- * TICKRATE.C *
- * Copyright TimeSlice, Inc. 1985, 86, 87. *
- ******************************************/
-
- #include <ts.h>
-
- #if defined(TURBOC)
- #define outp outport
- #endif
- /***
- * TICKRATE( DIV )
- * Divide regular (1/18.2 sec) timer tick by DIV.
- ***/
- void tickrate( div ) {
- union {
- int i;
- char c[2];
- } cntr;
- int cpuflags;
-
- cntr.i = 0x10000L / div; /*compute new counter value*/
- cpuflags = cli(); /*hold interrupts until done*/
- outp( 0x43, 0x36 ); /*initialize 8259 to get its counter reset*/
- outp( 0x40, cntr.c[0] ); /*give new cntr to 8259*/
- outp( 0x40, cntr.c[1] );
- _tckcnt = _tckrst = div; /*set counters for slicer*/
- putf( cpuflags ); /*reset interrupt flag*/
- }
-
-
-