[comp.os.msdos.programmer] CMOS read/write & CPU + CPU SPEED tester

pingel@jt.dk (Soren Pingel Dalsgaard) (06/21/91)

Hi everybody!

  I found a program the reads the CMOS of a 286+ machine, and (because it
was a bit buggy) took the information about the CMOS (sparsely written in
the source) and wrote another version, which I intend to turn into a device
driver that will show you system's configuration at boot time.

  I also have two different programs that will tell what CPU is installed
and test for the presence of a numeric coprocessor. These programs works
almost satisfactory, except that one of them sometimes call a 386SX a 286,
and the other simply halt the computer.

  Problem 1: The CMOS on a IBM PS/2 model 55 SX and the model 70 386 seems
             to differ a little in the CMOS layout. Century and harddisk
             type are two examples. 

  Problem 2: Any fool proof method of determining the CPU type would be of
             great interest. Whether there is a coprocessor or not, should
             also be tested. By the way: Is it possible to mix CPU type and
             coprocessor? e.g. 386 + 287 or 286 + 387 etc, or is it enough
             to test for CPU type and coprocessor, and then the coprocessor
             will be same type as the CPU?

  Problem 3: Testing for CPU speed (in MHz). Norton does this in the sysinfo
             tool, but can other people do this too? I though of dis-
             assembling some parts of sysinfo to see the method, and then
             rewrite a piece of code to do it, but I'd rather not. (copy-
             rights and the size of the sysinfo file are major reasons)

  Problem 4: Since all the information I have about the CMOS is from a
             PD program (which only read the CMOS), I would like to get
             some information about writing the CMOS as well.

Do *YOU* have the solution (whole or partial) to any of the above problems
then don NOT hesitate to e-mail any piece of information to me. If (and I
do have a feeling that it will) a usefull program is the result of this
request, I will dedicate it to the public domain, and you will be the first
to get a copy.

E-mail to the following address:     pingel@jt.dk
                                 or  pingel@daimi.aau.dk
                                 or  both :-)

Can't wait to read my mailbox next week....
   -pingel

"Whenever somebody mention the word 'association', I can't help thinking of
oranges."   -- my girl friend.

pshuang@athena.mit.edu (Ping-Shun Huang) (06/24/91)

In article <824@jt.dk> pingel@jt.dk (Soren Pingel Dalsgaard) writes:

 > also be tested. By the way: Is it possible to mix CPU type and
 > coprocessor? e.g. 386 + 287 or 286 + 387 etc, or is it enough to test
 > for CPU type and coprocessor, and then the coprocessor will be same type
 > as the CPU?

It was possible on some of the older 386 motherboards to connect a 80287
coprocessor (they had the hardware socket for it).  I don't know if any
of the non-obvious combinations are acceptable.

You should probably explicitly test everything.  Don't make assumptions.
New hardware can obviate old assumptions; e.g. some software assumed
that if the CPU was a i486 that there would be a NPU, and so didn't test
for one, and then Intel introduced the i486SX, which required bug-fix
releases from disgruntled software manufacturers (can't blame the
programmers, really, when Intel made such a big deal before about the
fact that with its new generation of CPU's, *ALL* machines would ship
with a math co-processor and software could count on having it there...)

--
Above text where applicable is (c) Copyleft 1991, all rights deserved by:
UNIX:/etc/ping instantiated (Ping Huang) [INTERNET: pshuang@athena.mit.edu]

rcollins@gumby.Altos.COM (Robert Collins) (06/27/91)

In article <824@jt.dk> pingel@jt.dk (Soren Pingel Dalsgaard) writes:
>  Problem 2: Any fool proof method of determining the CPU type would be of
>             great interest. Whether there is a coprocessor or not, should
>             also be tested. By the way: Is it possible to mix CPU type and
>             coprocessor? e.g. 386 + 287 or 286 + 387 etc, or is it enough
>             to test for CPU type and coprocessor, and then the coprocessor
>             will be same type as the CPU?
>


Look in the Intel 486SX Data sheet, appendix B.  It contains the "Intel-
recommended" algorithm for determing CPU type.  Intel doesn't state this
in the algorithm, but it is intended to run in real mode only.  It also
detects the different math coprocessors.  And no, the math coprocessor
doesn't need to be the same as the CPU.  Some early '386's had provisions
for '287's.


>  Problem 3: Testing for CPU speed (in MHz). Norton does this in the sysinfo
>             tool, but can other people do this too? I though of dis-
>             assembling some parts of sysinfo to see the method, and then
>             rewrite a piece of code to do it, but I'd rather not. (copy-
>             rights and the size of the sysinfo file are major reasons)
>


Determing CPU speed is a "trade secret."  There is a totally reliable way
to do it, and Norton doesn't use this method.  Hint:  Look at the resolution
of the counter/timer chip and CPU instructions that don't do any bus access.


R. Collins