home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / SVGAPAS.ZIP / INITSVGA.PAS next >
Encoding:
Pascal/Delphi Source File  |  1992-06-11  |  1.2 KB  |  58 lines

  1. { Sample program that initializes the SuperVGA driver}
  2. Program Test256;
  3.  
  4. Uses Graph,Crt,Dos;
  5.  
  6. {$I svga256.inc}
  7.  
  8. var
  9.   AutoDetect : pointer;
  10.   GraphMode, GraphDriver,i : integer;
  11.   a: dacpalette;
  12.   Ky : Char;
  13.  
  14. (* 'Detection' routine *)
  15. {$F+}                    (* Force to far calls *)
  16. function DetectVGA : Integer;
  17. var Vid : Integer;
  18.  
  19. begin
  20.   Writeln('Which video mode would you like to use?');
  21.   Writeln('  0) 320x200x256');
  22.   Writeln('  1) 640x400x256');
  23.   Writeln('  2) 640x480x256');
  24.   Writeln('  3) 800x600x256');
  25.   Writeln('  4) 1024x768x256');
  26.   Write('> ');
  27.   Readln(Vid);
  28.   DetectVGA := Vid;
  29. end;
  30. {$F-}
  31.  
  32. begin
  33.   for i:=0 to 255 do
  34.     begin
  35.       a[i][0]:=0;
  36.       a[i][1]:=0;
  37.       a[i][2]:=i;
  38.     end;
  39.  
  40.   AutoDetect := @DetectVGA;
  41.   GraphDriver := InstallUserDriver('SVGA256',AutoDetect);
  42.   GraphDriver := Detect;
  43.   InitGraph(GraphDriver,GraphMode,'');
  44.   setcolor(15);                (* Remember to do this *)
  45.  
  46.   setvgapalette(a);
  47.  
  48.   for i:=0 to 63 do
  49.     begin
  50.       setcolor(i);
  51.       line(i,0,i,200);
  52. {      outtextxy(9*i,100,'H');
  53.       line(0,0,GetMaxX,GetMaxY);
  54.       line(0,GetMaxY,GetMaxX,0);}
  55.     end;
  56.   Ky := ReadKey;
  57.   CloseGraph;
  58. end.