PER_GET_TIM problem

vbt

Staff member
I'd need to get the seconds of the Saturn clock and got problem to read the internal clock, do :


Code:
	Uint8	*time;

	time = PER_GET_TIM();

	sprintf((char *)buff,"%02x%02x-%02x-%02x %02x:%02x:%02x",time[6],time[5],time[4] & 0x0F,time[3],time[2],time[1],time[0]);


the same as samples and it displays only zeros :( Can someone help ?
 
All that does is fetch a pointer to an SBL internal variable. You still have to setup the PER library to regularly fetch the time data(see PER_Init and PER_KD_PERTIM).
 
CyberWarriorX said:
All that does is fetch a pointer to an SBL internal variable. You still have to setup the PER library to regularly fetch the time data(see PER_Init and PER_KD_PERTIM).


Thanks a lot CyberWarriorX :congrats: it works perfectly, now I can display the full date of the BIOS and can do test on seconds :) Here is the working source :


Code:
Uint8	*t;


void	UsrVblankIn( void )

{

	SCL_VblankStart();

            _spr2_transfercommand();  	

}

void   UsrVblankOut( void ){


		char my_date[50];

		t = PER_GET_TIM();

		PER_GetPort(__port);	

		sprintf(my_date,"%02x%02x-%02x-%02x %02x:%02x:%02x",t[6],t[5],t[4] & 0x0F,t[3],t[2],t[1],t[0]);

		FNT_Print256_2bpp((volatile Uint8 *)SCL_VDP2_VRAM_A1,(Uint8 *)my_date,10,230,9,9,9,0);

		SCL_VblankEnd();

}


void	SetVblank( void ){


	__port = PER_OpenPort();

	PER_LInit( PER_KD_PERTIM, 2, 2, per_work, 0 );

	INT_ChgMsk(INT_MSK_NULL,INT_MSK_VBLK_IN | INT_MSK_VBLK_OUT);

	INT_SetScuFunc(INT_SCU_VBLK_IN,UsrVblankIn);

	INT_SetScuFunc(INT_SCU_VBLK_OUT,UsrVblankOut);

	INT_ChgMsk(INT_MSK_VBLK_IN | INT_MSK_VBLK_OUT,INT_MSK_NULL);


}
 
Back
Top