News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_zgedneil

NC200 leap year oddity

Started by zgedneil, 00:37, 24 August 22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zgedneil

I've been (slowly) working on updates for nc100em and ZCN for a while now, and one thing I've been trying to do is figure out how the NC200's real-time clock handles leap years. What really surprised me about this is that mine... doesn't seem to, or at least not correctly.

Based on setting the date/time to late on 28 February of various years and letting the day roll over, my NC200 seems to think 1992 wasn't a leap year, but 1994 was. 2000 wasn't, but 2002 was. Can any other NC200 owners confirm this? If it's just a fault with mine, that would be weird enough, but for Amstrad to have got leap years wrong to this extent would be even weirder.

zgedneil

Checking the NC200 real-time clock more closely, while it does seem to be an MC146818 clone it isn't 100%, at least on mine. The actual clock part seems fine if you're adding a base year divisible by 20, and it even appears to work in the normally-unused BCD mode, but there's no sign of the spare 50 bytes of RAM. Trying to write it has no obvious effect, even with (RTC) register B's SET bit on (just in case that made any difference), and trying to read it gives FFh.

Anyway, if the leap-year issue is real it should be easily avoidable on ZCN at least, just by counting years from e.g. 2000 or 2020 rather than 1990. But this would make the date setting incompatible with the ROM software, so it'd probably have to be optional.

Gryzor

Pretty strange thing to leave unresolved with '96 not far after the machine was released. Makes you wonder how much they believed in it! 

zgedneil

Even 1994 would have been wrong - every even year has a day either missing or added. To be fair, it looks like it's possible to manually set the clock hardware to 29 Feb for any year, which then seems to roll over to 1 Mar at the end of the day. I can imagine that being seen as "good enough" if they were rushing to get the thing out the door.

Gryzor

Hehe true, I think they were thinking "you're lucky we even threw in some time of clock and you don't have to set it every time you switch it on " 😆

I'll try to find my unit to check... 

pelrun

I just received a NC200, and it appears to handle leap years correctly.

What ROM version does yours have? This one is running v2.01.

zgedneil

The ROM on mine is v2.01 also, I don't think I've heard of any other versions out there. Just to confirm, did you test the date rolling over from 28 Feb on leap years and non-leap years?

pelrun

Ah ok. I see now - the calendar and time setting functions all behave correctly, but the RTC screws up when actually doing the transition. I can see how that sort of bug could have slipped through testing.

From the way it's getting the transition wrong I bet it is using the number of years since 1970 in the leap year check instead of the full four digit year.

zgedneil

Yeah, the RTC itself does two-digit years with leap years every four, so it's the base year added (1990) that's breaking it. Thanks for checking on yours.

So, wow, I guess it probably is broken then. I suppose this doesn't affect nc100em realistically, but for ZCN, I'm not sure. It might be best to just fit in with what the ROM does, as at least that way you "only" have to fix the date every two years, rather than e.g. every time you use runrom.

Powered by SMFPacks Menu Editor Mod