Commit dd0faf7d authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

winedos: Compute CMOS image checksum automatically.

parent 3ae00daf
...@@ -67,9 +67,8 @@ static BYTE parport_8255[4] = {0x4f, 0x20, 0xff, 0xff}; ...@@ -67,9 +67,8 @@ static BYTE parport_8255[4] = {0x4f, 0x20, 0xff, 0xff};
static BYTE cmosaddress; static BYTE cmosaddress;
/* if you change anything here, use IO_FixCMOSCheckSum below to compute static int cmos_image_initialized = 0;
* the checksum and put the right values in.
*/
static BYTE cmosimage[64] = static BYTE cmosimage[64] =
{ {
0x27, /* 0x00: seconds */ 0x27, /* 0x00: seconds */
...@@ -118,8 +117,8 @@ static BYTE cmosimage[64] = ...@@ -118,8 +117,8 @@ static BYTE cmosimage[64] =
0x00, /* 0x2b: options 2 */ 0x00, /* 0x2b: options 2 */
0x00, /* 0x2c: options 3 */ 0x00, /* 0x2c: options 3 */
0x3f, /* 0x2d: reserved */ 0x3f, /* 0x2d: reserved */
0x03, /* 0x2e: low CMOS ram checksum */ 0xcc, /* 0x2e: low CMOS ram checksum (computed automatically) */
0x19, /* 0x2f: high CMOS ram checksum */ 0xcc, /* 0x2f: high CMOS ram checksum (computed automatically) */
0x00, /* 0x30: low extended memory byte */ 0x00, /* 0x30: low extended memory byte */
0x1c, /* 0x31: high extended memory byte */ 0x1c, /* 0x31: high extended memory byte */
0x19, /* 0x32: century byte */ 0x19, /* 0x32: century byte */
...@@ -138,7 +137,6 @@ static BYTE cmosimage[64] = ...@@ -138,7 +137,6 @@ static BYTE cmosimage[64] =
0x5f /* 0x3f: reserved */ 0x5f /* 0x3f: reserved */
}; };
#if 0
static void IO_FixCMOSCheckSum(void) static void IO_FixCMOSCheckSum(void)
{ {
WORD sum = 0; WORD sum = 0;
...@@ -148,9 +146,8 @@ static void IO_FixCMOSCheckSum(void) ...@@ -148,9 +146,8 @@ static void IO_FixCMOSCheckSum(void)
sum += cmosimage[i]; sum += cmosimage[i];
cmosimage[0x2e] = sum >> 8; /* yes, this IS hi byte !! */ cmosimage[0x2e] = sum >> 8; /* yes, this IS hi byte !! */
cmosimage[0x2f] = sum & 0xff; cmosimage[0x2f] = sum & 0xff;
MESSAGE("calculated hi %02x, lo %02x\n", cmosimage[0x2e], cmosimage[0x2f]); TRACE("calculated hi %02x, lo %02x\n", cmosimage[0x2e], cmosimage[0x2f]);
} }
#endif
#ifdef DIRECT_IO_ACCESS #ifdef DIRECT_IO_ACCESS
...@@ -459,6 +456,11 @@ DWORD WINAPI DOSVM_inport( int port, int size ) ...@@ -459,6 +456,11 @@ DWORD WINAPI DOSVM_inport( int port, int size )
res = (DWORD)cmosaddress; res = (DWORD)cmosaddress;
break; break;
case 0x71: case 0x71:
if (!cmos_image_initialized)
{
IO_FixCMOSCheckSum();
cmos_image_initialized = 1;
}
res = (DWORD)cmosimage[cmosaddress & 0x3f]; res = (DWORD)cmosimage[cmosaddress & 0x3f];
break; break;
case 0x200: case 0x200:
...@@ -506,8 +508,8 @@ DWORD WINAPI DOSVM_inport( int port, int size ) ...@@ -506,8 +508,8 @@ DWORD WINAPI DOSVM_inport( int port, int size )
case 0x3dd: case 0x3dd:
case 0x3de: case 0x3de:
case 0x3df: case 0x3df:
if(size > 1) if (size > 1)
FIXME("Trying to read more than one byte from VGA!\n"); FIXME("Trying to read more than one byte from VGA!\n");
res = (DWORD)VGA_ioport_in( port ); res = (DWORD)VGA_ioport_in( port );
break; break;
case 0x00: case 0x00:
...@@ -677,6 +679,11 @@ void WINAPI DOSVM_outport( int port, int size, DWORD value ) ...@@ -677,6 +679,11 @@ void WINAPI DOSVM_outport( int port, int size, DWORD value )
cmosaddress = (BYTE)value & 0x7f; cmosaddress = (BYTE)value & 0x7f;
break; break;
case 0x71: case 0x71:
if (!cmos_image_initialized)
{
IO_FixCMOSCheckSum();
cmos_image_initialized = 1;
}
cmosimage[cmosaddress & 0x3f] = (BYTE)value; cmosimage[cmosaddress & 0x3f] = (BYTE)value;
break; break;
case 0x226: case 0x226:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment