home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / QWIK21.ZIP / QINIT.INC < prev    next >
Encoding:
Text File  |  1986-12-09  |  2.1 KB  |  54 lines

  1. { Qinit.inc - initialization for Q screen utilities         ver 2.0, 11-24-86 }
  2. { This initialization routine checks for the type of video card and sets the
  3.   limits for the utilities: address, wait-for-retrace, and number of pages.   }
  4.  
  5. type Str80 = string[80];               { Type for Qwrites.inc }
  6.  
  7. var
  8.   Vmode: byte absolute $0040:$0049;    { Video mode - Mono=7, Color<>7 }
  9.   Page0seg,                            { Segment for page 0 }
  10.   Qseg:       integer;                 { Segment for Q writing }
  11.   MaxPage:    byte;                    { Maximum possible page }
  12.   CardWait,                            { Wait for retrace for video card }
  13.   Qwait:      boolean;                 { Wait for retrace while Q writing }
  14.  
  15. { EGAcheck - check for EGA card                             ver 1.4, 11-13-86 }
  16. { This is the reliable method recommended by IBM.                             }
  17. Function EGAcheck: Boolean;
  18. begin
  19. Inline(
  20.    $B4/$12               {       MOV   AH,$12           ;Set AH for alt select}
  21.   /$BB/$10/$FF           {       MOV   BX,$FF10         ;Set BX for EGA info}
  22.   /$CD/$10               {       INT   $10              ;Interrupt}
  23.   /$80/$EF/$FF           {       SUB   BH,$FF           ;Check if BH changed}
  24.   /$74/$02               {       JZ    NoEGA            ;BH=false if no EGA}
  25.   /$B7/$01               {       MOV   BH,$01           ;Set BH=true ($01)}
  26.   /$88/$7E/$04           {NoEGA: MOV   [BP+$04],BH      ;EGAcheck: $01 or $00}
  27. );
  28. end;
  29.  
  30. { Qinit - initializes Q global variables                    ver 2.0, 11-24-86 }
  31. { Written in Turbo so you can change it to fit your needs.                    }
  32. procedure Qinit;
  33. begin
  34.   if Vmode=7 then
  35.     begin
  36.       Page0seg:=$B000;                 { Segment for Monochrome monitors }
  37.       CardWait:=false;
  38.       MaxPage:=0
  39.     end
  40.   else
  41.     begin
  42.       Page0seg:=$B800;                 { Segment for Color monitors }
  43.       CardWait:=true;
  44.       if (Vmode=0) or (Vmode=1) then MaxPage:=7 else MaxPage:=3
  45.     end;
  46.   if EGAcheck=true then
  47.   begin
  48.     CardWait:=false;
  49.     MaxPage:=7
  50.   end;
  51.   Qseg:=Page0seg;
  52.   Qwait:=CardWait;
  53. end;
  54.