home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 8
/
CDASC08.ISO
/
NEWS
/
554
/
JUIN
/
FASTVGA.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-10-07
|
1KB
|
61 lines
{─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
Msg : 213 of 465
From : Peter Wokke 2:500/290.13 17 Jun 93 10:58
To : Mike Ryan 1:324/295.0
Subj : palette changes
────────────────────────────────────────────────────────────────────────────────
Hello Mike,
In a message on <Saturday Juni 12 1993>, you wrote:
MR> anyone know a way to set the DAC registers that's faster than int $1010?
I have a solution for your problem, see this program.}
PROGRAM vga_in_mode_13;
{ VGA in Mode $13 320 x 200 and 256 Colors for Turbo Pascal 6.0 }
USES Dos, Crt;
Procedure Plot(x, y : Integer; color : Byte);
Begin
Mem[$A000:word(y * 320 + x)] := color;
End;
Procedurte set_rgb(reg, Red, Green, Blue : Byte);
Begin
Port[$3C8] := reg;
Inline($FA);
Port[$3C9] := Red;
Port[$3C9] := Green;
Port[$3C9] := Blue;
Inline($FB);
End;
Var
x, y : Integer;
reg : Registers;
savemode : Byte;
n : Byte;
Begin
reg.AX := $0F00;
Intr($10, reg);
savemode := reg.al;
reg.AX := $0013;
Intr($10, reg);
For n := 0 TO 63 Do set_rgb(n, n, 0, 0);
For n := 63 Downto 0 Do set_rgb(127 - n, n, 0, 0);
For n := 128 TO 191 Do set_rgb(n, 0, 0, n);
For y := 0 TO 191 Do
For x := 0 TO 319 Do
Plot(x, y, y);
Readln;
reg.AX := savemode;
Intr($10, reg);
END.