home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Hack-Phreak Scene Programs
/
cleanhpvac.zip
/
cleanhpvac
/
SLOWRUNS.ZIP
/
SLOWSRC.ZIP
/
MAGIC8.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-12-20
|
963b
|
43 lines
#include<io.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<dos.h>
#include<bios.h>
#include<fcntl.h>
#include<memory.h>
#include<malloc.h>
#include<math.h>
#include<string.h>
#include "magic8.h"
long starting_time, // these are used to compute the length of some event
ending_time;
void Timer_Program(int timer, unsigned int rate)
{
// this function re-programs the internal timer
// first program the timer to mode 2 - binary and data loading sequence of
// low byte then high byte
_outp(TIMER_CONTROL, TIMER_SET_BITS);
// write the least significant byte of the new rate to the counter register
_outp(timer, LOW_BYTE(rate));
// and now the most significant byte
_outp(timer, HI_BYTE(rate));
} // end Timer_Program
long Timer_Query(void)
{
// this function is used to record the current time
long far *clock = (long far *)0x0000046CL; // address of timer
return(*clock);
}