Path: chuka.playstation.co.uk!news From: Developer Support Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: Kernal Management Date: Thu, 22 May 1997 10:39:22 +0100 Organization: Sony Computer Entertainment Europe Lines: 73 Message-ID: <3384144A.234B@interactive.sony.com> References: <5m10as$shk2@scea> Reply-To: N/A-Use-Newsgroup NNTP-Posting-Host: 194.203.13.10 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01 (Win95; I) 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"); }