Re: [hatari-devel] Error in SetClock / ReadClock |
[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]
On 23/12/2012 11:45, Thomas Huth wrote:
Am Sat, 22 Dec 2012 16:09:53 +0100 schrieb Nicolas Pomarède <npomarede@xxxxxxxxxxxx>:So, would someone object if I changed ikbd.c to behave the same : - check BCD encoding in setclock and store bytes - return BCD bytes in readclock - add an update function (called from the VBL for example) that would maintain the ikbd clock by updating it every second (in emulation time, not in real system time) This means we completly remove OS specific date/time conversions (time, localtime, mktime) and all the possible nightmares that go with them.Fine for me - we've had enough trouble with the old way in the past, so if these changes really ease the situation, please go ahead!
Hi,new code is now available. The complex part was to figure out exactly what the HD6301 code does when incrementing date/time to propagate the same overflows and get the same behaviour.
One interesting thing is that the IKBD's code doesn't check that the SetClock's bytes are in the correct range, only that they're BCD encoded. So you can provide day=0x40 or month=0x70 ; you will get incoherent date/time values, but after each byte reaches 0x99, it will go normal again and stay in the correct range.
I checked Captain Blood and it still works ; don't hesitate to check Zombi too or a few different TOS to see if it's OK.
Most notably, previous IKBD_ToBCD() function said BCD conversion needed overflow, but I don't see anything like that in the IKBD's code.
Do you have an example ? Can you check if this still work and in which case ? Nicolas
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |