hsync counter?

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
Steve F
Posts: 75
Joined: Wed Apr 27, 2005 2:30 am
Location: Texas USA

hsync counter?

Post by Steve F »

I read somewhere that the hsync count (or line count) can be used to tell how far into the frame processing a process is and that PS2 makes this available. I can't find it in the docs. Do I need to set up my own hsync call back counter or is hsync count already in the SDK?
User avatar
Saotome
Posts: 182
Joined: Sat Apr 03, 2004 3:45 am

Post by Saotome »

actually thats pretty simple, its not worth to implement special functions for that in the SDK ;)

i only used the VR-interrupt, but HR shouldn't be that different

Code: Select all

void vrStartHandler(u32 cause)
{
	vrcounter++;
}
//-----------------------------------------------
void install_vrStartHandler(void)
{
	asm volatile ("di");
	
	AddIntcHandler(2, vrStartHandler, 0);
	EnableIntc(2);

	asm volatile ("ei");
}
for hsync you have to replace the "2" with some other value, dont know which (2 is for vrStart, 3 is for vrEnd - maybe 0 or 1 or >2?).

or you could use one of the 4 timers on the EE, and tell it to count "H-BLNKs".
infj
shawn_t
Posts: 11
Joined: Tue Jul 26, 2005 4:32 am

Post by shawn_t »

Check out my blurb on EE timers: EE Timers

The enum:

Code: Select all

enum
{
   kINTC_GS,
   kINTC_SBUS,
   kINTC_VBLANK_START,
   kINTC_VBLANK_END,
   kINTC_VIF0,
   kINTC_VIF1,
   kINTC_VU0,
   kINTC_VU1,
   kINTC_IPU,
   kINTC_TIMER0,
   kINTC_TIMER1
}; 
enumerates the interrupts. I'm not familiar with an interrupt for an H-BLNK, but as mentioned, you can easily set up any of the EE timers to count H-BLNKS.

If you still don't understand how to set it up for counting H-BLNK's, then let me know and I'll explain it.
Post Reply