home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / NEWS / 554 / JUIN / FASTVGA.PAS < prev    next >
Pascal/Delphi Source File  |  1993-10-07  |  1KB  |  61 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 213 of 465
  3. From : Peter Wokke                         2:500/290.13         17 Jun 93  10:58
  4. To   : Mike Ryan                           1:324/295.0
  5. Subj : palette changes
  6. ────────────────────────────────────────────────────────────────────────────────
  7. Hello Mike,
  8.  
  9. In a message on <Saturday Juni 12 1993>, you wrote:
  10.  
  11.  MR> anyone know a way to set the DAC registers that's faster than int $1010?
  12.  
  13. I have a solution for your problem, see this program.}
  14.  
  15.  
  16. PROGRAM vga_in_mode_13;
  17.  
  18. { VGA in Mode $13  320 x 200 and 256 Colors for Turbo Pascal 6.0 }
  19.  
  20. USES Dos, Crt;
  21.  
  22. Procedure Plot(x, y : Integer; color : Byte);
  23.   Begin
  24.     Mem[$A000:word(y * 320 + x)] := color;
  25.   End;
  26.  
  27.   Procedurte set_rgb(reg, Red, Green, Blue : Byte);
  28.   Begin
  29.     Port[$3C8] := reg;
  30.     Inline($FA);
  31.     Port[$3C9] := Red;
  32.     Port[$3C9] := Green;
  33.     Port[$3C9] := Blue;
  34.     Inline($FB);
  35.   End;
  36.  
  37. Var
  38.   x, y : Integer;
  39.   reg : Registers;
  40.   savemode : Byte;
  41.   n : Byte;
  42. Begin
  43.   reg.AX := $0F00;
  44.   Intr($10, reg);
  45.   savemode := reg.al;
  46.  
  47.   reg.AX := $0013;
  48.   Intr($10, reg);
  49.  
  50.   For n := 0 TO 63 Do set_rgb(n, n, 0, 0);
  51.   For n := 63 Downto 0 Do set_rgb(127 - n, n, 0, 0);
  52.   For n := 128 TO 191 Do set_rgb(n, 0, 0, n);
  53.  
  54.   For y := 0 TO 191 Do
  55.      For x := 0 TO 319 Do
  56.         Plot(x, y, y);
  57.   Readln;
  58.  
  59.   reg.AX := savemode;
  60.   Intr($10, reg);
  61. END.