home *** CD-ROM | disk | FTP | other *** search
- (* ====================================================== *)
- (* GRAU.PAS *)
- (* Das EGA/VGA-BIOS: *)
- (* Demo #2: Umwandlung in Graustufen (VGA) *)
- (* (c) 1990 Matthias Uphoff & TOOLBOX *)
- (* ====================================================== *)
-
- USES Dos, Crt, Bios2;
-
- VAR ColorSave: ARRAY[0..255] OF ColorValue;
- x, y: Word;
-
- PROCEDURE SetVideoMode(ModeNr: Byte);
- (* Intialisiert den Videomodus mit der Nummer ModeNr *)
- VAR R: Registers;
- BEGIN
- R.AH := 0; (* Funktionsnummer nach AH *)
- R.AL := ModeNr; (* Modusnummer ins AL-Register *)
- Intr($10,R); (* BIOS-Call über Interrupt $10 *)
- END;
-
- PROCEDURE Box(x1,y1,x2,y2: Word; c: Byte);
- (* Zeichnet ein mit der Farbe c gefülltes Rechteck *)
- (* x1,y1 = Ecke links oben, x2,y2 = Ecke rechts unten *)
- VAR x,y: Word;
- R: Registers;
- BEGIN
- FOR y := y1 TO y2 DO
- FOR x := x1 TO x2 DO BEGIN
- R.AH := $C; (* Funktionsnummer *)
- R.AL := c; (* Farbe nach AL *)
- R.BH := 0; (* Bildschirmseite 0 *)
- R.CX := x;
- R.DX := y;
- Intr($10,R); (* BIOS-Call Punkt setzen *)
- END;
- END;
-
- BEGIN (* Hauptprogramm *)
- (* 256-Farben-Modus einschalten: *)
- SetVideoMode($13);
- (* 256 farbige Rechtecke erzeugen: *)
- FOR y := 0 TO 15 DO
- FOR x := 0 TO 15 DO
- Box(x*20,y*12,x*20+19,y*12+11,x+y*16);
- (* Alle Farbregister retten: *)
- ReadColorBlock(0,256,ColorSave);
- REPEAT
- (* Alle Farbwerte in Graustufen umwandeln: *)
- FOR x := 0 TO 255 DO BEGIN
- GrayScale(x,1);
- Delay(50);
- END;
- (* Alle Farben wieder herstellen: *)
- FOR x := 0 TO 255 DO BEGIN
- SetColorReg(x,ColorSave[x]);
- Delay(50);
- END;
- UNTIL KeyPressed;
- SetVideoMode($3); (* Zurück in den Textmodus *)
- END.
-
- (* ====================================================== *)
- (* Ende GRAU.PAS *)