Skip to content

Commit

Permalink
CMOS: Add register 37h as an alias of register 32h (Century) because …
Browse files Browse the repository at this point in the history
…that is where Windows 2000 looks for it. This resolves error messages about invalid date on login
  • Loading branch information
joncampbell123 committed Jun 1, 2022
1 parent 04ad81e commit 1fceadc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
0.83.26
- CMOS century register now aliased to register
32h and 37h to appease Windows 2000, which assumes
the century is stored there and will complain
about invalid date/time otherwise (joncampbell123).
- Treat IDE command E7h (FLUSH CACHE) as a no-op
so that the common use of it from Windows 2000
doesn't spam your log file (joncampbell123).
Expand Down
4 changes: 4 additions & 0 deletions src/hardware/cmos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ static void cmos_writereg(Bitu port,Bitu val,Bitu iolen) {
break;

case 0x32: /* Century */
case 0x37: /* Century (alternate used by Windows NT/2000/XP) */
if (val < 19) return; // invalid century value?
loctime->tm_year += (int)((val * 100) - 1900);
break;
Expand Down Expand Up @@ -251,6 +252,7 @@ static void cmos_writereg(Bitu port,Bitu val,Bitu iolen) {
case 0x08: /* Month */
case 0x09: /* Year */
case 0x32: /* Century */
case 0x37: /* Century (alternate used by Windows NT/2000/XP) */
/* Ignore writes to change alarm */
break;
case 0x01: /* Seconds Alarm */
Expand Down Expand Up @@ -374,6 +376,7 @@ static Bitu cmos_readreg(Bitu port,Bitu iolen) {
case 0x09: /* Year */
return MAKE_RETURN(loctime->tm_year % 100);
case 0x32: /* Century */
case 0x37: /* Century (alternate used by Windows NT/2000/XP) */
return MAKE_RETURN(loctime->tm_year / 100 + 19);

case 0x01: /* Seconds Alarm */
Expand Down Expand Up @@ -409,6 +412,7 @@ static Bitu cmos_readreg(Bitu port,Bitu iolen) {
case 0x09: /* Year */
return MAKE_RETURN(loctime->tm_year % 100);
case 0x32: /* Century */
case 0x37: /* Century (alternate used by Windows NT/2000/XP) */
return MAKE_RETURN(loctime->tm_year / 100 + 19);
case 0x01: /* Seconds Alarm */
case 0x03: /* Minutes Alarm */
Expand Down

0 comments on commit 1fceadc

Please sign in to comment.