home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / FLASHEQ.ZIP / FLASH.INC < prev    next >
Encoding:
Text File  |  1985-09-08  |  6.6 KB  |  212 lines

  1. { FLASH.INC (C) Copyright 1985 by Bill Hileman
  2.  
  3.   The following routines are released to the Public Domain to be used
  4.   in programs and/or be distributed free of charge, provided that they
  5.   are distributed in their original form, and including this copyright
  6.   notice.
  7.  
  8.   Version 1.00  09/08/85
  9.  
  10. -------------------------------------------------------------------------------
  11.  
  12.   Function get_equipment_flag
  13.  
  14.   This function helps add flash to a program as it helps avoid having
  15.   to prompt the user for such questions as 'Color or Mono', and other
  16.   hardware dependent questions...
  17.  
  18.   The hardware equipment flags are located at absolute hexadecimal address
  19.   0000:0410.  The word (two bytes) at that location contain information as
  20.   to the hardware configuration.  The bit table below shows the two bytes
  21.   and their bit meaning as is returned by BIOS interrupt #17 (11h) which
  22.   actually returns byte 0000:0411 first, and then 0000:0410:
  23.  
  24.   F E D C B A 9 8 7 6 5 4 3 2 1 0 Meaning
  25.   --------------- --------------- -------------------------------------------
  26.   X X . . . . . . . . . . . . . . Number of printers installed
  27.   . . X . . . . . . . . . . . . . Serial Printer: 1=installed (PCjr only)
  28.   . . . X . . . . . . . . . . . . Game Adapter: 1=installed
  29.   . . . . X X X . . . . . . . . . Number of RS232 serial ports
  30.   . . . . . . . X . . . . . . . . DMA chip: 0=installed
  31.   . . . . . . . . X X . . . . . . Number of floppy drives (1-4) (see bit 0)
  32.   . . . . . . . . . . X X . . . . Initial video mode: 01=CO40 10=CO80 11=MONO
  33.   . . . . . . . . . . . . X X . . System board RAM: 11=64K (normal for all)
  34.   . . . . . . . . . . . . . . X . Not used (set to 0)
  35.   . . . . . . . . . . . . . . . X Floppy Drives: 1=installed
  36.  
  37.   The routine is used by assigning an INTEGER variable to the function, i.e.
  38.  
  39.   equip_flag := get_equip_flag;
  40.  
  41.   Boolean variables can then be assigned by ANDing values to equip_flag, i.e.
  42.  
  43.   no_printer := ((equip_flag and $B000) = $B000); (* True if no printer *)
  44.   mono       := ((equip_flag and $0300) = $0300); (* True if monochrome *)
  45.   color      := (not mono);
  46.  
  47.   or, numbers can be returned, such as
  48.  
  49.   numb_print := (equip_flag shr 14);  (* number of printers installed *)
  50.   numb_flops := ((equip_flag shr 6) and $0003); (* number of floppies *)
  51.  
  52. ------------------------------------------------------------------------------}
  53.  
  54. function get_equip_flag : integer;
  55.  
  56. type
  57.   result  = record
  58.               ax,bx,cx,dx,bp,si,di,ds,es,flags : integer;
  59.             end;
  60.  
  61. var
  62.   regpack : result;
  63.  
  64. begin
  65.   with regpack do begin
  66.     intr($11,regpack);
  67.     get_equip_flag:=ax;
  68.   end;
  69. end;
  70.  
  71. {------------------------------------------------------------------------------
  72.  
  73.   Function get_installed_ram
  74.  
  75.   This function returns the installed RAM (random access memory) in Kbytes.
  76.  
  77.   The routine is used by assigning an INTEGER variable to the function, i.e.
  78.  
  79.   ram := get_installed_ram;
  80.  
  81. ------------------------------------------------------------------------------}
  82.  
  83. function get_installed_ram : integer;
  84.  
  85. type
  86.   result  = record
  87.               ax,bx,cx,dx,bp,si,di,ds,es,flags : integer;
  88.             end;
  89.  
  90. var
  91.   regpack : result;
  92.  
  93. begin
  94.   with regpack do begin
  95.     intr($12,regpack);
  96.     get_installed_ram:=ax;
  97.   end;
  98. end;
  99.  
  100. {------------------------------------------------------------------------------
  101.  
  102.   Procedure set_cursor_size
  103.  
  104.   This procedure allows you to define the shape of your cursor, as well as
  105.   hide it from the screen completely!  Hiding the cursor makes the program
  106.   look better while it is writing to the screen.  A good programming practise
  107.   might be to only show a cursor when input is required.  Another possibility
  108.   is to show one shape of a cursor for 1-key entries (like Y/N responses), and
  109.   another shape for line entries (like name) which require [ENTER] to complete.
  110.  
  111.   The routine requires two integer parameters: c_start and c_end.  They can be
  112.   INTEGER variables or constants, or literals.  'c_start' is the starting scan
  113.   line of the cursor, and 'c_end' is the ending scan line.  It is recommended
  114.   that the user first make a call to the get_equip_flag (above) first to deter-
  115.   mine if the display is color or mono, since a monochrome screen has 14 scan
  116.   lines (0-13) for its cursor, and the color screen has eight scan lines (0-7).
  117.  
  118.   To turn the cursor off, use 32 (20h) for the c_start parameter, and anything
  119.   (preferably 0), for c_end.
  120.  
  121.   To define a block cursor:
  122.  
  123.   if mono then             (* Assumes get_equip_flag called *)
  124.     set_cursor_size(0,13)  (* mono *)
  125.   else
  126.     set_cursor_size(0,7);  (* color *)
  127.  
  128.   To define an bar cursor:
  129.  
  130.   if mono then             (* Assumes get_equip_flag called *)
  131.     set_cursor_size(12,13) (* mono *)
  132.   else
  133.     set_cursor_size(6,7);  (* color *)
  134.  
  135. ------------------------------------------------------------------------------}
  136.  
  137. procedure set_cursor_size(c_start,
  138.                           c_end    : integer);
  139.  
  140. type
  141.   result  = record
  142.               ax,bx,cx,dx,bp,si,di,ds,es,flags : integer;
  143.             end;
  144.  
  145. var
  146.   regpack : result;
  147.  
  148. begin
  149.   with regpack do begin
  150.     ax:=1 shl 8;
  151.     cx:=(c_start shl 8)+c_end;
  152.     intr($10,regpack);
  153.   end;
  154. end;
  155.  
  156. {------------------------------------------------------------------------------
  157.  
  158.   Procedure get_cursor_size
  159.  
  160.   This procedure allows you to determine the cursor's shape at any time.  It
  161.   is a good programming practise to determine the computer's orginal state as
  162.   much as possible and return the user to that state upon the completion of
  163.   your program.  This routine should be called early in the program (before
  164.   any calls to the set_cursor_size procedure.
  165.  
  166.   You will need to define two INTEGER variables in your program to store the
  167.   c_start and c_end values returned.  Like the set_cursor_size procedure
  168.   described above, c_start is the starting scan line of the cursor, and c_end
  169.   is the ending scan line of the cursor.
  170.  
  171.   This procedure should be used something like this:
  172.  
  173.   program xxxx;
  174.  
  175.   ...
  176.  
  177.   var
  178.     org_c_start, org_c_end : Integer;
  179.  
  180.   ...
  181.  
  182.   Begin
  183.     get_cursor_size(org_c_start,org_c_end);
  184.  
  185.     ...
  186.  
  187.     set_cursor_size(org_c_start,org_c_end);
  188.   end.
  189.  
  190. ------------------------------------------------------------------------------}
  191.  
  192. procedure get_cursor_size(var c_start,
  193.                               c_end    : integer);
  194.  
  195. type
  196.   result  = record
  197.               ax,bx,cx,dx,bp,si,di,ds,es,flags : integer;
  198.             end;
  199.  
  200. var
  201.   regpack : result;
  202.  
  203. begin
  204.   with regpack do begin
  205.     bx:=0;
  206.     ax:=3 shl 8;
  207.     intr($10,regpack);
  208.     c_start:=cx shr 8;
  209.     c_end:=(cx and 255);
  210.   end;
  211. end;
  212.