peanut_gb.h
void gb_tick_rtc(struct gb_s *gb)
{
	/* is timer running? */
	if((gb->cart_rtc[4] & 0x40) == 0)
	{
		if(++gb->rtc_bits.sec == 60)
		{
			gb->rtc_bits.sec = 0;

			if(++gb->rtc_bits.min == 60)
			{
				gb->rtc_bits.min = 0;

				if(++gb->rtc_bits.hour == 24)
				{
					gb->rtc_bits.hour = 0;

					if(++gb->rtc_bits.yday == 0)
					{
						if(gb->rtc_bits.high & 1)  /* Bit 8 of days*/
						{
							gb->rtc_bits.high |= 0x80; /* Overflow bit */
						}

						gb->rtc_bits.high ^= 1;
					}
				}
			}
		}
	}
}
/**
 * Tick the internal RTC by one second.
 * This was taken from SameBoy, which is released under MIT Licence.
 */
Tick the internal RTC by one second.
This was taken from SameBoy, which is released under MIT Licence.
Tick the internal RTC by one second . This was taken from SameBoy which is released under MIT Licence .
void gb_tick_rtc(struct gb_s *gb)
{
	if((gb->cart_rtc[4] & 0x40) == 0)
	{
		if(++gb->rtc_bits.sec == 60)
		{
			gb->rtc_bits.sec = 0;
			if(++gb->rtc_bits.min == 60)
			{
				gb->rtc_bits.min = 0;
				if(++gb->rtc_bits.hour == 24)
				{
					gb->rtc_bits.hour = 0;
					if(++gb->rtc_bits.yday == 0)
					{
						if(gb->rtc_bits.high & 1)  
						{
							gb->rtc_bits.high |= 0x80; 
						}
						gb->rtc_bits.high ^= 1;
					}
				}
			}
		}
	}
}
void gb_tick_rtc ( struct gb_s * gb ) { if ( ( gb -> cart_rtc [ 4 ] & 0x40 ) == 0 ) { if ( ++ gb -> rtc_bits . sec == 60 ) { gb -> rtc_bits . sec = 0 ; if ( ++ gb -> rtc_bits . min == 60 ) { gb -> rtc_bits . min = 0 ; if ( ++ gb -> rtc_bits . hour == 24 ) { gb -> rtc_bits . hour = 0 ; if ( ++ gb -> rtc_bits . yday == 0 ) { if ( gb -> rtc_bits . high & 1 ) { gb -> rtc_bits . high |= 0x80 ; } gb -> rtc_bits . high ^= 1 ; } } } } } }
Tick the internal RTC by one second.
Tick the internal RTC by one second .
/* is timer running? */ /* Bit 8 of days*/ /* Overflow bit */