Previous 15994 Revisions Next

r6546 Saturday 5th December, 2009 at 21:26:51 UTC by Tim Schuerewegen
[GP32] Corrected timer frequency.
[src/mess/drivers]gp32.c

src/mess/drivers/gp32.c
r6545r6546
234234   const int mux_shift[] = { 0, 4, 8, 12, 16};
235235   if (ctrl_bits & 1)   // timer start?
236236   {
237      UINT32 prescaler, mux, freq, cnt, cmp;
238      double hz;
237      UINT32 prescaler, mux, cnt, cmp;
238      double freq, hz;
239239      logerror( "starting timer %d\n", timer);
240240      prescaler = (s3c240x_timer_regs[0] >> prescaler_shift[timer]) & 0xFF;
241241      mux = (s3c240x_timer_regs[1] >> mux_shift[timer]) & 0x0F;
r6545r6546
245245         cmp = s3c240x_timer_regs[count_reg+1] & 0xFFFF;
246246      else
247247         cmp = 0;
248      hz = (double)((prescaler + 1) * mux_table[mux]) / (cnt - cmp + 1);
249//      logerror( "TIMER %d - FCLK=%d HCLK=%d PCLK=%d prescaler=%d div=%d freq=%d cnt=%d cmp=%d hz=%f\n", timer, s3c240x_get_fclk( MPLLCON), s3c240x_get_hclk( MPLLCON), s3c240x_get_pclk( MPLLCON), prescaler, mux_table[mux], freq, cnt, cmp, hz);
248      //hz = (double)((prescaler + 1) * mux_table[mux]) / (cnt - cmp + 1);
249      hz = freq / (cnt - cmp + 1);
250//      logerror( "TIMER %d - FCLK=%d HCLK=%d PCLK=%d prescaler=%d div=%d freq=%f cnt=%d cmp=%d hz=%f\n", timer, s3c240x_get_fclk( MPLLCON), s3c240x_get_hclk( MPLLCON), s3c240x_get_pclk( MPLLCON), prescaler, mux_table[mux], freq, cnt, cmp, hz);
250251      if (ctrl_bits & 8) // auto reload
251252      {
252253         timer_adjust_periodic( s3c240x_timers[timer], ATTOTIME_IN_HZ( hz), timer, ATTOTIME_IN_HZ( hz));
r6545r6546
272273   {
273274      if ((data & 1) != (old_value & 1))   // timer 0 status change
274275      {
275         s3c240x_timer_recalc(space->machine, 0, data&0xf, 0xc);
276         s3c240x_timer_recalc(space->machine, 0, data&0xf, 0xc / 4);
276277      }
277278      if ((data & 0x100) != (old_value & 0x100))   // timer 1 status change
278279      {
279         s3c240x_timer_recalc(space->machine, 1, (data>>8)&0xf, 0x18);
280         s3c240x_timer_recalc(space->machine, 1, (data>>8)&0xf, 0x18 / 4);
280281      }
281282      if ((data & 0x1000) != (old_value & 0x1000))   // timer 2 status change
282283      {
283         s3c240x_timer_recalc(space->machine, 2, (data>>12)&0xf, 0x24);
284         s3c240x_timer_recalc(space->machine, 2, (data>>12)&0xf, 0x24 / 4);
284285      }
285286      if ((data & 0x10000) != (old_value & 0x10000))   // timer 3 status change
286287      {
287         s3c240x_timer_recalc(space->machine, 3, (data>>16)&0xf, 0x30);
288         s3c240x_timer_recalc(space->machine, 3, (data>>16)&0xf, 0x30 / 4);
288289      }
289290      if ((data & 0x100000) != (old_value & 0x100000))   // timer 4 status change
290291      {
291         s3c240x_timer_recalc(space->machine, 4, (data>>20)&0xf, 0x3c);
292         s3c240x_timer_recalc(space->machine, 4, (data>>20)&0xf, 0x3c / 4);
292293      }
293294   }
294295}
r6545r6546
832833   MDRV_SMARTMEDIA_ADD("smartmedia")
833834MACHINE_DRIVER_END
834835
835ROM_START(gp32)
836ROM_START( gp32 )
836837   ROM_REGION( 0x80000, "maincpu", 0 )
837838   ROM_SYSTEM_BIOS( 0, "157e", "GP32 Firmware 1.57 (English)" )
838839   ROMX_LOAD( "gp32157e.bin", 0x000000, 0x080000, CRC(b1e35643) SHA1(1566bc2a27980602e9eb501cf8b2d62939bfd1e5), ROM_BIOS(1) )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team