timer pointer
im trying (in djgpp) to have a pointer to the timer that is 18.2 hz, my source code looks fine, but the address where the timer is supposed to be always stays the same. can you find my problem?
#include <stdio.h>
#include <dos.h>
#include <sys/nearptr.h>
#include <conio.h>
unsigned short *my_clock = (unsigned short *)0x046C;
unsigned short cur_time = 0;
int main(void)
{
if (__djgpp_nearptr_enable() == 0)
{
printf("Could not get access to first 640K of memory.\n");
return -1;
}
my_clock += __djgpp_conventional_base;
for(long i=0; i<1000; i++)
{
cur_time = *my_clock;
printf("%d : %d\n", i, cur_time);
}
__djgpp_nearptr_disable();
printf("done.\n");
}
Edited by - jeremiah on 7/5/00 10:34:04 PM
http://fakemind.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement