home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Current Shareware 1994 January
/
SHAR194.ISO
/
dos_util
/
4utils76.zip
/
TEST286.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-10-31
|
993b
|
43 lines
UNIT Test286;
{ Copyright (c) 1990 by Borland International, Inc. }
(* Programs compiled with {$G} compiler directive enabled do not
check the processor at runtime to determine whether it is
286-compatible. Trying to execute 80286 instructions on an 8086
or an 8088 will lock up the computer. This program shows how to
check for the presence of a 286-compatible chip at runtime.
If you want to put code like this in a program with {$G+}
enabled, put the test and halt code in the initialization
section of the first unit in the main program's USES clause. *)
INTERFACE
IMPLEMENTATION
FUNCTION Is286Able: BOOLEAN; ASSEMBLER;
ASM
PUSHF
POP BX
AND BX,0FFFH
PUSH BX
POPF
PUSHF
POP BX
AND BX,0F000H
CMP BX,0F000H
MOV AX,0
JZ @@1
MOV AX,1
@@1:
END;
BEGIN
IF NOT Is286Able THEN
BEGIN
WriteLn('You need an 80286 or better system to run this program.');
HALT(1);
END;
END.