static void timekeeper_write( UINT32 chip, offs_t offset, UINT8 data ) { struct timekeeper_chip *c; if( chip >= MAX_TIMEKEEPER_CHIPS ) { logerror( "%08x: timekeeper_write( %d, %04x, %02x ) chip out of range\n", activecpu_get_pc(), chip, offset, data ); return; } c = &timekeeper[ chip ]; if( offset == c->offset_control ) { if( ( c->control & CONTROL_W ) != 0 && ( data & CONTROL_W ) == 0 ) { counters_from_ram( chip ); } c->control = data; } else if( c->type == TIMEKEEPER_M48T58 && offset == c->offset_day ) { c->day = ( c->day & ~DAY_CEB ) | ( data & DAY_CEB ); } else if( c->type == TIMEKEEPER_M48T58 && offset == c->offset_date ) { data &= ~DATE_BL; } else if( c->type == TIMEKEEPER_MK48T08 && offset == c->offset_flags ) { data &= ~FLAGS_BL; } // logerror( "%08x: timekeeper_write( %d, %04x, %02x )\n", activecpu_get_pc(), chip, offset, data ); c->data[ offset ] = data; }
void TimeKeeperWrite(INT32 offset, UINT8 data) { #if defined FBA_DEBUG if (!DebugDev_TimeKprInitted) bprintf(PRINT_ERROR, _T("TimeKeeperWrite called without init\n")); #endif if( offset == Chip.offset_control ) { if( ( Chip.control & CONTROL_W ) != 0 && ( data & CONTROL_W ) == 0 ) { counters_from_ram(); } Chip.control = data; } else if( (Chip.type == TIMEKEEPER_M48T58 || Chip.type == TIMEKEEPER_M48T35) && offset == Chip.offset_day ) { Chip.day = ( Chip.day & ~DAY_CEB ) | ( data & DAY_CEB ); } Chip.data[ offset ] = data; }
void timekeeper_device::write(UINT16 offset, UINT8 data) { if( offset == m_offset_control ) { if( ( m_control & CONTROL_W ) != 0 && ( data & CONTROL_W ) == 0 ) { counters_from_ram(); } m_control = data; } else if( offset == m_offset_day ) { if( type() == M48T35 || type() == M48T58 ) { m_day = ( m_day & ~DAY_CEB ) | ( data & DAY_CEB ); } } m_data[ offset ] = data; }