home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / KMAGV1.ZIP / RASTEXAM.PAS < prev    next >
Pascal/Delphi Source File  |  1995-09-13  |  3KB  |  114 lines

  1. {RASTEXAM.PAS / EXAMPLE FOR RASTER BARS}
  2. {WRITING BY THE KING IN 10/14/95     }
  3.  
  4. Uses Crt;
  5. Var
  6.     BLUEBAR : Array[1..63*2,1..3] Of Byte;   {THE RASTER BAR}
  7.     Num:Byte;
  8.     R,G,B:Byte;
  9.     Del:Byte;
  10.  
  11. {---------------------------------------------}
  12. {Build The Palette for the BLUE BAR ...       }
  13. {---------------------------------------------}
  14. Procedure BuildBlueBar;
  15. Var T:Byte;
  16. Begin
  17.     For T:=1 To 63 Do Begin
  18.         BlueBar[T,1] := 0;
  19.         BlueBar[T,2] := 0;
  20.         BlueBar[T,3] := T;
  21.     End;
  22.     For T:=1 To 63 Do Begin
  23.         BlueBar[63+T,1] := 0;
  24.         BlueBar[63+T,2] := 0;
  25.         BlueBar[63+T,3] := 63-T;
  26.     End;
  27. End;
  28.  
  29. {-------------------------------------------------}
  30. {Init The Program ...                             }
  31. {-------------------------------------------------}
  32.  
  33. Procedure Init;
  34. Begin
  35.     Clrscr;
  36.     Port[$21] := 1;          {Disable Interrupts for speed}
  37.     BuildBlueBar;            {Build Blue Bars}
  38.     TextColor(15);
  39.     Writeln('                                 HI EVERYONE !           ');
  40.     Writeln('                                 -------------           ');
  41.     Writeln('         This is the example for the RASTER EFFECT wrote by THE KING');
  42.     Writeln;
  43.     Gotoxy(1,20);
  44.     Writeln('                            Press Any Key To Continue');
  45. End;
  46. {----------------------------------------}
  47. { If Retrace End Sent TRUE , Else FALSE. }
  48. {----------------------------------------}
  49. Function Retrace:Boolean; Assembler;
  50. asm
  51.     Xor Ah,Ah                  {Ah = 0}
  52.     Mov Dx,3dah                {Dx = 3DAh}
  53. @Vert1:
  54.     In Al,Dx                   {Al = Port[3DAh]}
  55.     Test Al,8                  {Check The 4 Bit For Checking If}
  56.     Jz @Exit                   {Finish With Vertical Retrace}
  57.     Inc Ah
  58.  
  59. @Exit:
  60.     Mov Al,Ah
  61. End;
  62.  
  63. {--------------------------------------------------}
  64. {Put the Bars on the screen ..                     }
  65. {--------------------------------------------------}
  66. Procedure PutBars;
  67. Begin
  68.     Num:=1;
  69.     Repeat
  70.         Del:=1;
  71.         Num :=1;
  72.         Repeat
  73.             If Num > 63*2 Then Num := 1;
  74.             R := BlueBar[Num,1];
  75.             G := BlueBar[Num,2];
  76.             B := BlueBar[Num,3];
  77.             If Del = 6 Then
  78.             Begin
  79.                 Inc(Num);
  80.                 Del := 1;
  81.             End;
  82.             Inc(Del);
  83.             Asm
  84.                 Mov Al,0                      {Paint On Color 0}
  85.                 Mov Dx,3c8h                   {The R,G,B}
  86.                 Out Dx,Al
  87.                 Inc Dx
  88.                 Mov Al,R
  89.                 Out Dx,Al
  90.                 Mov Al,G
  91.                 Out Dx,Al
  92.                 Mov Al,B
  93.                 Out Dx,Al
  94.             End;
  95.         Until(Retrace);
  96.     Until(KeyPressed);
  97. End;
  98. Begin
  99. Init;
  100. PutBars;
  101. Port[$21] := 0;     {Enable Interrupts.}
  102. Asm
  103.     Mov Al,0                      {Paint On Color 0}
  104.     Mov Dx,3c8h                   {0,0,0 To Return To Reglar Mode}
  105.     Out Dx,Al
  106.     Inc Dx
  107.     Mov Al,0
  108.     Out Dx,Al
  109.     Mov Al,0
  110.     Out Dx,Al
  111.     Mov Al,0
  112.     Out Dx,Al
  113. End;
  114. End.