09 August 2012, 15:26 | #1 |
Registered User
Join Date: Jun 2012
Location: France
Posts: 183
|
Battery Backed Up RTC year
Hello. I use WinUAE 2.4.1.
I'm looking at the hardware registers of the Battery Backed Up clock (whatever type) for the current year. The year value for 2012 is 0xb2, it is not strictly correct because valid BCD digits should be in the range 0-9 and B is not. This value can still be interpreted correctly by using the classic formula (a*10)+b, which gives 112 in this case. By adding 1900 we get the correct value of 2012. On the other side, it has been reported there that the actual value found on Blizzard A1260 for the year 2012 is 0x12, which is a legal BCD value (the 2 lower digits). Having a different behavior between WinUAE and real hardware looks like a WinUAE bug... |
09 August 2012, 15:46 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
|
You are right, it should be in BCD format. I guess it was missed because all other clock register values are always less than 10.
I guess it has been broken since the beginning. |
03 October 2012, 17:02 | #3 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
|
Actually both are correct!
AOS supports two different year formats when reading RTC time, current year - 1900 (2012 = 112) or last two digits (2012 = 12). It seems when writing the time, older AOS versions (or perhaps only if MSM clock chip?) use "-1900" method, newer ones "last 2 digits" method. |
05 October 2012, 22:20 | #4 |
Registered User
Join Date: Jun 2012
Location: France
Posts: 183
|
If I understood well, the hardware registers should contain only decimal digits. Having a value of 0xb (as in my original example) sounds odd.
IMHO, it is simply a classic Y2K but. Before 2000, people were used to store the dates on 2 digits, then do: - % 10 to get the 2nd digit - / 10 to get the 1st digit. But after the year 2000 it overflows. That could explain that earlier AmigaOS had the above "bug", then newer ones fixed it. Anyway, any program reading the hardware clock should be prepared to find one or other value in the registers. |
06 October 2012, 09:47 | #5 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
|
I did more tests.
WB 1.x writes RTC year as current_year - 1900: 2012 = B 2. (At least MSM clock chip type accepts it) WB 2.x+ writes last two digits. 2012 = 1 2. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
(Son of) A4000 RTC/Battery Problem (revisited) | squidbass | support.Hardware | 5 | 11 June 2010 12:10 |
Is HOL backed up regularly for safety? | rsn8887 | HOL suggestions and feedback | 1 | 18 October 2006 19:36 |
Exchanging the RTC-battery in a A4000T | lomaxx | support.Hardware | 8 | 23 September 2006 13:56 |
RTC problem | anathema | support.WinUAE | 0 | 15 July 2003 11:22 |
Battery Backed Up Clock | NytroX86 | support.Hardware | 24 | 17 December 2002 20:32 |
|
|