\r
u32 pcd_stopwatch_read(int sub)\r
{\r
- // ugh..\r
+ // ugh... stopwatch runs 384 cycles per step, divide by mult with inverse\r
u32 d = sub ? SekCyclesDoneS68k() : pcd_cycles_m68k_to_s68k(SekCyclesDone());\r
- d = (d - Pico_mcd->m.stopwatch_base_c) / 384;\r
+ d = ((d - Pico_mcd->m.stopwatch_base_c) * ((1LL << 32) / 384)) >> 32;\r
return d & 0x0fff;\r
}\r
\r
* Starting a timer takes place at the next tick, so xcycles needs to be\r
* rounded up to that: t = next tick# = (xcycles / TICK_ZCYCLES) + 1\r
*/\r
- unsigned t = ((xcycles * (((1<<20)/TIMER_A_TICK_ZCYCLES)+1))>>20) + 1;\r
+ unsigned t = ((xcycles * (((1LL<<32)/TIMER_A_TICK_ZCYCLES)+1))>>32) + 1;\r
Pico.t.timer_a_next_oflow = t*TIMER_A_TICK_ZCYCLES + Pico.t.timer_a_step;\r
}\r
}\r
* reset by loading timer b. The first run of timer b after loading is\r
* therefore shorter by up to 15 ticks.\r
*/\r
- unsigned t = ((xcycles * (((1<<20)/TIMER_A_TICK_ZCYCLES)+1))>>20) + 1;\r
+ unsigned t = ((xcycles * (((1LL<<32)/TIMER_A_TICK_ZCYCLES)+1))>>32) + 1;\r
int step = Pico.t.timer_b_step - TIMER_A_TICK_ZCYCLES*(t&15);\r
Pico.t.timer_b_next_oflow = t*TIMER_A_TICK_ZCYCLES + step;\r
}\r