home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / dos_util / 4utils76.zip / TEST286.PAS < prev    next >
Pascal/Delphi Source File  |  1993-10-31  |  993b  |  43 lines

  1. UNIT Test286;
  2. { Copyright (c) 1990 by Borland International, Inc. }
  3.  
  4. (* Programs compiled with {$G} compiler directive enabled do not
  5.    check the processor at runtime to determine whether it is
  6.    286-compatible. Trying to execute 80286 instructions on an 8086
  7.    or an 8088 will lock up the computer. This program shows how to
  8.    check for the presence of a 286-compatible chip at runtime.
  9.  
  10.    If you want to put code like this in a program with {$G+}
  11.    enabled, put the test and halt code in the initialization
  12.    section of the first unit in the main program's USES clause. *)
  13.  
  14. INTERFACE
  15.  
  16. IMPLEMENTATION
  17.  
  18. FUNCTION Is286Able: BOOLEAN; ASSEMBLER;
  19.  
  20. ASM
  21.  PUSHF
  22.  POP     BX
  23.  AND     BX,0FFFH
  24.  PUSH    BX
  25.  POPF
  26.  PUSHF
  27.  POP     BX
  28.  AND     BX,0F000H
  29.  CMP     BX,0F000H
  30.  MOV     AX,0
  31.  JZ      @@1
  32.  MOV     AX,1
  33. @@1:
  34. END;
  35.  
  36. BEGIN
  37.  IF NOT Is286Able THEN
  38.   BEGIN
  39.    WriteLn('You need an 80286 or better system to run this program.');
  40.    HALT(1);
  41.   END;
  42. END.
  43.