Previous 15994 Revisions Next

r1086 Sunday 7th October, 2007 at 13:26:17 UTC by Wilbert Pol
[GAMEBOY] Small improvements to the timer.
[src/mess/machine]gb.c

src/mess/machine/gb.c
r1085r1086
675675      }
676676      break;
677677   case 0x04:                  /* DIV - Divider register */
678      gb_divcount = 0xFFF7;            /* The actual value here is closely tied with some implementation details of the z80gb cpu core */
678      /* Force increment of TIMECNT register */
679      if ( gb_divcount >= 16 )
680         gb_timer_callback( 1024 );
681      gb_divcount = 0;
679682      return;
680683   case 0x05:                  /* TIMA - Timer counter */
681684      break;
r1085r1086
684687   case 0x07:                  /* TAC - Timer control */
685688      data |= 0xF8;
686689      gb_timer_shift = timer_shifts[data & 0x03];
690      /* Check if timer is just enabled */
691      if ( ( data & 0x04 ) && ! ( TIMEFRQ & 0x04 ) ) {
692         TIMECNT = TIMEMOD;
693      }
687694      break;
688695   case 0x0F:                  /* IF - Interrupt flag */
689696      data &= 0x1F;
r1085r1086
12441251   switch(offset)
12451252   {
12461253      case 0x04:
1247         return ( ( gb_divcount + 9 ) >> 8 ) & 0xFF;
1254         return ( gb_divcount >> 8 ) & 0xFF;
12481255      case 0x00:
12491256      case 0x01:
12501257      case 0x02:

Previous 15994 Revisions Next


© 1998-2018 The MESS Team