Dec 192017
 
C routines which allow you to check CPU type and speed.
File CPU100.ZIP from The Programmer’s Corner in
Category C Source Code
C routines which allow you to check CPU type and speed.
File Name File Size Zip Size Zip Type
COMP.BAT 317 205 deflated
COMPACT.LIB 5120 2715 deflated
CPU.DOC 4654 1825 deflated
CPU.H 795 267 deflated
HUGE.LIB 5120 2789 deflated
LARGE.LIB 5120 2760 deflated
MEDIUM.LIB 5120 2744 deflated
SMALL.LIB 5120 2699 deflated
TEST.C 1212 498 deflated
TEST.EXE 26632 18086 deflated

Download File CPU100.ZIP Here

Contents of the CPU.DOC file




CPU Toolkit Library

Version 1.00



Reference






Written by Lindsay Vagg

Copyright (C) 1993, Lindsay Vagg
Trading as Vaggabond Software.

10/522 Mowbray Rd.
Lane Cove, 2066, NSW, Sydney,
Australia.

(612) 975-1466 (Voice)
(612) 452-3493 (Fax)



Introduction

CPU Library is a basic library of C runtime routines that
allow easy anaylasis of the Processor chip in your PC

The CPU Library routines are written mainly in C with some portions
in Assembly language. The routines make use of C library functions
when possible and are compatible with TURBO C, TURBO C++, and
BORLAND C++, although i would like to think that they will also
work with Microsoft C, Microsoft QuickC. However, i'm not a big
enough fan to worry about testing that theory.

CPU Library supports the five major memory models, all of which
are supplied here.

TURBO C is a registered trademark of Borland International Inc.

TURBO C++ is a registered trademark of Borland International Inc.

BORLAND C++ is a registered trademark of Borland International Inc.

Microsoft is a registered trademark, and QuickC is a trademark of
the Microsoft Corporation.



Registration

None is required or even expected...or even wanted.
As you can probably tell, i've experienced Public Domain, Shareware
and Free Ware responses before.

The registered version includes:

This file.

All five popular memory models.

CPU.H header file.

Sample C source (and EXE file) of the use of the Library.

Sample batch file for compilation.




The Un-registered version includes:

The same as above.



FUNCTIONS:


This is a list of all the functions in the CPU librarys. Each
is described in detail on the following pages. (The functions
are listed in alphabetical order by function name.)

int cpu(void);

char *cpuspeed(unsigned int round,unsigned int cputype);

int isprot(void);

int iswin(void);


=============================================================


cpu


Function:Test the processor to determine its type.

Syntax:int cpu(void);

Remarks:Activates a number of assembler procedures to attempt
to determine the processor type and any details of a
co-processor.
Works with the following CPUs:-
8086/8088,80286,i386,i486

Return:CPU returns a value from 0 to 9.

Table:0 = Undetermined
1 = 8086/8088
2 = 8086/8088 with Coprocessor
3 = 80286
4 = 80286 with Coprocessor
5 = i386tm
6 = i386tm with 387 Coprocessor
7 = i386tm with 87/287 Coprocessor
8 = i486tm (SX)
9 = i486tm (DX) or i487tm (SX) with Coprocessor




cpuspeed

Function:Test the processor speed in real MHz.

Syntax:char *cpuspeed(unsigned int round,unsigned int cputype);

Remarks:This function relys on the CPU() function to determine

firstly, detect the correct processor type to
accurately test the processors real MHz speed,
irrespective of its possible Turbo switch setting.
CPUTYPE, MUST be an accurate result from the CPU()
function.
If ROUND is set to 1, the result will be rounded to
a whole figure, otherwise the result will contain a
decimal point with decimal place precision.

Return:CPUSPEED returns a string containing the speed
in ASCII form.


isprot

Function:Test to see if the processor is operating in
Protected Mode.

Syntax:int isprot(void);

Remarks:Makes some tests to determine if the processor
is operating in a Protected Mode.

Return:ISPROT returns a value from 0 to 2.

Table:0 = Not in Protected mode
1 = Protected mode
2 = Protected mode via MS-Windows Enhanced mode




iswin

Function:Check if MS-Windows is currently active or not.

Syntax:int iswin(void);

Remarks:Tests the PC for some unique signatures and/or
interrupt responses to determine if MS-Windows
is active or if the program is running on just
plain old DOS.

Return:ISWIN returns a value from 0 to 6.

Table:0 = DOS
1 = Windows/386 2.x is running
2 = Windows 3.x is running in Enhanced mode
3 = Windows 4.x is running in Enhanced mode
4 = Windows/386 2.x is running
5 = Windows 3.0 is running in Real mode
or Windows 3.1+ is running in Standard mode
6 = Windows 3.0 is running in Standard mode


 December 19, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)