|
|
| version 1.3, 2004/08/12 14:03:14 | version 1.5, 2008/06/02 20:07:30 |
|---|---|
| Line 38 static void secinc(_SYSTIME *dt) { | Line 38 static void secinc(_SYSTIME *dt) { |
| if (month < 12) { | if (month < 12) { |
| daylimit = days[month]; | daylimit = days[month]; |
| if ((daylimit == 28) && (!(dt->year & 3))) { | if ((daylimit == 28) && (!(dt->year & 3))) { |
| daylimit++; // = 29; | daylimit++; /* = 29 */ |
| } | } |
| } | } |
| else { | else { |
| Line 62 secinc_exit: | Line 62 secinc_exit: |
| } | } |
| // ---- | /* ---- */ |
| void calendar_getdate(UINT8 *bcd) { | void calendar_getdate(UINT8 *bcd) { |
| bcd[0] = AdjustAfterMultiply((UINT8)(cal.dt.year % 100)); | bcd[2] = AdjustAfterMultiply((UINT8)(cal.dt.year % 100)); |
| bcd[1] = ((cal.dt.month << 4) + cal.dt.week); | bcd[1] = ((cal.dt.month << 4) + cal.dt.week); |
| bcd[2] = AdjustAfterMultiply((UINT8)cal.dt.day); | bcd[0] = AdjustAfterMultiply((UINT8)cal.dt.day); |
| } | } |
| void calendar_setdate(const UINT8 *bcd) { | void calendar_setdate(const UINT8 *bcd) { |
| UINT year; | UINT year; |
| year = AdjustBeforeDivision(bcd[0]); | year = AdjustBeforeDivision(bcd[2]); |
| if (year < 80) { | if (year < 80) { |
| year += 100; | year += 100; |
| } | } |
| cal.dt.year = (UINT16)(year + 1900); | cal.dt.year = (UINT16)(year + 1900); |
| cal.dt.week = (UINT8)(bcd[1] & 0x0f); | cal.dt.week = (UINT8)(bcd[1] & 0x0f); |
| cal.dt.month = (UINT8)(bcd[1] >> 4); | cal.dt.month = (UINT8)(bcd[1] >> 4); |
| cal.dt.day = AdjustBeforeDivision(bcd[2]); | cal.dt.day = AdjustBeforeDivision(bcd[0]); |
| } | } |
| void calendar_gettime(UINT8 *bcd) { | void calendar_gettime(UINT8 *bcd) { |
| bcd[0] = AdjustAfterMultiply((UINT8)cal.dt.hour); | bcd[2] = AdjustAfterMultiply((UINT8)cal.dt.hour); |
| bcd[1] = AdjustAfterMultiply((UINT8)cal.dt.minute); | bcd[1] = AdjustAfterMultiply((UINT8)cal.dt.minute); |
| bcd[2] = AdjustAfterMultiply((UINT8)cal.dt.second); | bcd[0] = AdjustAfterMultiply((UINT8)cal.dt.second); |
| } | } |
| void calendar_settime(const UINT8 *bcd) { | void calendar_settime(const UINT8 *bcd) { |
| cal.dt.hour = AdjustBeforeDivision(bcd[0]); | cal.dt.hour = AdjustBeforeDivision(bcd[2]); |
| cal.dt.minute = AdjustBeforeDivision(bcd[1]); | cal.dt.minute = AdjustBeforeDivision(bcd[1]); |
| cal.dt.second = AdjustBeforeDivision(bcd[2]); | cal.dt.second = AdjustBeforeDivision(bcd[0]); |
| } | } |
| // ---- | /* ---- */ |
| void neitem_rtc(UINT id) { | void neitem_rtc(UINT id) { |
| Line 114 void neitem_rtc(UINT id) { | Line 114 void neitem_rtc(UINT id) { |
| void calendar_reset(void) { | void calendar_reset(void) { |
| SINT32 clock; | |
| timemng_gettime(&cal.dt); | timemng_gettime(&cal.dt); |
| nevent_set(NEVENT_RTC, pccore.realclock / 5, neitem_rtc, NEVENT_RELATIVE); | #if defined(FIX_Z80A) |
| clock = 2000000 * 2 / 5; | |
| #else | |
| clock = pccore.realclock / 5; | |
| #endif | |
| nevent_set(NEVENT_RTC, clock, neitem_rtc, NEVENT_RELATIVE); | |
| } | } |