vbt
Staff member
Thanks to CyberWarriorX advice, I started getTick and getDelay functions using a FRT timer. The functions are quoted below. I have tested only on emu but on them I got different problems :
- On Girigiri it stays locked
- On Yabause, it starts but get stucked later
- On Satourne, I got an opcode problem
Is there something I missed to setup the timer? Could I reach an overflow ? something else ?
- On Girigiri it stays locked
- On Yabause, it starts but get stucked later
- On Satourne, I got an opcode problem
Is there something I missed to setup the timer? Could I reach an overflow ? something else ?
Code:
static Uint32 count=0;
Uint16 previouscount=0;
Uint16 multip=0;
void InitTimer()
{
TIM_FRT_INIT(TIM_CKS_32);
TIM_FRT_SET_16(0);
}
Uint32 GetTicks(void)
{
Uint16 count1 = TIM_FRT_GET_16();
if (count1<previouscount)
multip++;
count=((multip<<15)+count1);
previouscount=count1;
return TIM_FRT_CNT_TO_MCR(count)/1000;
}
void Delay(int delay)
{
Uint16 cnt_delay;
cnt_delay= TIM_FRT_MCR_TO_CNT(delay);
TIM_FRT_DELAY_16(cnt_delay);
}