Unit VGA


      { TURBO PASCAL SOURCE }
      { JOAO PAULO SCHWARZ SCHULER }
           Unit VGA;
      
           INTERFACE
           uses dos,crt;
      
           type TVIDEO = array[0..199,0..319] of byte;
           type TVIDEOPtr = ^TVideo;
      
           procedure SETPALREG(COR:WORD;re,g,b:byte);
           {set color registers}
           procedure GETPALREG(COR:WORD;VAR re,g,b:byte);
           {get color registers}
           procedure DMG(b:BYTE);
           {define video mode }
      
           var RVIDEO: TVIDEO absolute $a000:0000;
           {RVIDEO[Y,X]:=10; <=====> PutPixel(X,Y,10);}
           procedure CLS;
           {clear screen}
      
           IMPLEMENTATION
      
      procedure SETPALREG(COR:WORD;re,g,b:byte);
      {set color registers}
      VAR R:REGISTERS;
      BEGIN
       R.AL:=$10;
       R.AH:=$10;
       R.BX:=COR;
       R.DH:=RE;
       R.CH:=G;
       R.CL:=B;
       INTR($10,R);
      END;
      
      procedure GETPALREG(COR:WORD;VAR re,g,b:byte);
      {get color registers}
      VAR R:REGISTERS;
      BEGIN
       R.AL:=$15;
       R.AH:=$10;
       R.BX:=COR;
       INTR($10,R);
       RE:=R.DH;
       G:=R.CH;
       B:=R.CL;
      END;
      
      procedure DMG(b:BYTE);
      {define video mode }
      VAR R:REGISTERS;
      BEGIN
       R.AL:=B;
       R.AH:=0;
       INTR($10,R);
      END;
      
      
      procedure CLS;
      {clear screen}
      var X,Y:integer;
      begin
      for X:=0 to 319 do
          for Y:=0 to 199 do
              RVIDEO[Y,X]:=0;
      end;
      
      end. { of unit }
      

      See Also
    • MEUCAOS: Eu inventei esse caos; I did this chaos.
    • Logic Chaos: Eu inventei esse caos; I did this chaos.
    • Bezier Curves Unit: Unidade de Curvas de Bezier.
    • Life: Life de John H. Conway

      Return to the Home Page

      Return to the Fontes em Pascal Page

      I want to read your E-Mail