Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: George_Bain@bc.sympatico.ca (George Bain) Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: Kernal Management Date: 28 May 1997 18:53:05 GMT Organization: SCEA Net Yaroze News Lines: 85 Message-ID: <5mhuuh$shk9@scea> References: <5m10as$shk2@scea> <3384144A.234B@interactive.sony.com> NNTP-Posting-Host: vanc01m02-79.bctel.ca Mime-Version: 1.0 Content-Type: Text/Plain; charset=US-ASCII X-Newsreader: WinVN 0.99.9 (Released Version) (x86 32bit) In article <3384144A.234B@interactive.sony.com>, dev_support@interactive.sony.com says... > >George Bain wrote: >> >> I need help with system timer on PlayStation. Does anyone know >> the equalivant of this code on PSX? I know I have to use >> GetRCnt(),StartRCnt(), etc but what is the argument for the root counter >> spec..and what is RCntCNT2 macros?? Lib book is not giving me enough info. >> Any advice would help..thanx >> >> Latah..... >> >> George Bain >> >> ************ CODE SNIP E.G ****************** >> >> #include >> #include >> #include >> >> #define TICKS (*(volatile unsigned long far *)(0x0040006Clu)) >> >> /* ---------------------- get_tick() ------------------ February 11,1997 */ >> unsigned long get_tick(void) >> { >> return TICKS; >> } >> >> /* ---------------------- main() ---------------------- February 11,1997 */ >> void main(void) >> { >> unsigned long t2; >> >> printf("starting\n"); >> t2=TICKS + 40; >> while ( !kbhit() ) >> { >> if ( get_tick() == t2 ) >> { >> printf("An important event accoured\n"); >> t2=TICKS + 40; >> } >> >> } >> getch(); >> >> printf("done\n"); >> } >> >> /* ------------------------------ EOF -------------------------------- */ > >There are 3 root counters, 0, 1, and 2. The return values are 0-65535, >root counter 1 is slowest. As theres no information on which root >counter measures what, so we don't know the timings, so it'll have to be >trial and error (1 maybe hsyncs). > >As for the code, something like this should do the trick. > >void main(void) >{ > printf("starting\n"); > StartRCnt(1); // not needed on Yaroze > ResetRCnt(1); > > while(!kbhit()) > { > if (GetRCnt(1) == 40) > { > printf("event\n"); > ResetRCnt(1); > } > } > getch(); > printf("done\n"); >} YES! this is all I need!!! Latah... George Bain