Hi everybody, I have been thinking about the issue described in bug 1748:
freedos.sourceforge.net/bugzilla/cgi-bin/show_bug.cgi?id=1748 On some embedded systems, when you set the date to >= 2000 with DOS and reboot, DOS will report a date of 1980. My theory is that this is because that embedded system BIOS fails to really store the century first, and FreeDOS CLIPS "1901" to 1980 while other DOSes like DR DOS and MS DOS might just ignore the century and WRAP "1901" into 2001 which is the date the user tried to set. While RBIL gives evidence that DOS could even hook BIOS int 1a to fix y2k issues in a "lowlevel" way, I suggest that FreeDOS should only have a fix inside DOS itself, without hooking yet another BIOS interrupt. See: kernel/initclk.c drivers/*clk.asm kernel/sysclk.c and kernel/systime.c ... Init_clk_driver will call int 1a.2 and 1a.4 and then call int 21.2b. SUGGESTION: Add "fold 1900-1979 to 2000-2079 before callint int 21.2b" in initclk.c (note that DOS date keeping uses DaysSinceEpoch as set via int 21, initially by Init_clk_driver, so the date is fetched from the BIOS once at boot time, not later...!) Index: kernel/initclk.c =================================================================== --- kernel/initclk.c (revision 1354) +++ kernel/initclk.c (working copy) @@ -58,6 +58,8 @@ dosregs.a.b.h = 0x2b; dosregs.c.x = 100 * InitBcdToByte(regsD.c.b.h) /* century */ + InitBcdToByte(regsD.c.b.l);/* year */ + /* A BIOS with y2k (year 2000) bug will always report year 19nn */ + if ((dosregs.c.x >= 1900) && (dosregs.c.x < 1980)) dosregs.c.x += 100; dosregs.d.b.h = InitBcdToByte(regsD.d.b.h); /* month */ dosregs.d.b.l = InitBcdToByte(regsD.d.b.l); /* day */ init_call_intr(0x21, &dosregs); Are there any objections against that initclk.c modification? Bonus QUESTION: Why is YearsSince1980 and daysSince1980 never modified? See kernel.asm, it is stuck to 0 and -1. The whole area of date related things in the SDA seems to be dummy...?? ( CALL int 1ah, ah=4, carry cleared in case BIOS leaves carry unchanged will RETURN carry cleared if okay and the BCD encoded date as century CH, year CL, month DH and day DL... ) RBIL has several interesting notes about int 1a.4: START RBIL NOTES Notes: DR-DOS 7.02 (after 1998-06-06) and 7.03 hook this function and correct the century to 20xx if the reported year is 1900..1980 to auto-fix ROM-BIOSes which are not Year 2000 compliant. On a running system, it would also correct the rollover bug from 1999/12/31 to 2000/01/01. The latter can be turned off using the new CONFIG.SYS YEAR2000=ON|OFF command, as hooking INT 1Ah can sometimes cause compatibility problems with 3rd party software... Using EXCLUDESTEALTHINT=1A, though, will allow QEMM's Stealth features to coexist with the DR-DOS Year 2000 rollover support... PC DOS 7 plus Y2K fixes and PC DOS 2000 provide similar, though not identical means, which cannot be switched off. MS-DOS and older issues of PC DOS do not provide any such means, and thus requires extra Y2K-TSRs to be loaded when run on buggy BIOSes... END RBIL NOTES ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Freedos-kernel mailing list Freedos-kernel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-kernel