home *** CD-ROM | disk | FTP | other *** search
/ CD-X 3 / cdx_03.iso / democomp / 64kintro / _op_demo.arj / OP_DEMO.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1999-12-31  |  3.0 KB  |  163 lines

  1. Uses Crt,OpGr;   {Demo program by OP Software Studio  1995.09.09.   16:31}
  2.  
  3. Const
  4.  
  5.    palrot_speed = 5;
  6.  
  7.    X            : Word = 0;
  8.    Y            : Word = 0;
  9.    palx         : integer = palrot_speed;
  10.  
  11. Var Pal                       : Array[0..767] of byte;
  12.     RGBr                      : Array[0..2] of byte;
  13.     xx,j,i,l                  : integer;
  14.     r,g,b,aa,bb,cc            : byte;
  15.     colors                    : Array[0..764] of byte;
  16.     xi,yi,dx,dy               : integer;
  17.     kep                       : array[1..25,1..80,1..2] of char absolute $b800:0;
  18.  
  19. Procedure Palanim;
  20. Begin
  21.   move(Pal,RGBr,3);
  22.   move(Pal[3],Pal,759);
  23.   move(RGBr,Pal[759],3);
  24.   asm
  25.     cld
  26.     mov  dx,03c8h
  27.     mov  al,1
  28.     out  dx,al
  29.     lea  si,Pal
  30.     mov  cx,253*3
  31.     inc  dx
  32.     rep outsb
  33.   end;
  34. End;
  35.  
  36. Procedure ShowPal; Assembler;
  37. Asm
  38.   mov  bx,X
  39.   mov  cl,bl
  40.   shr  bx,2
  41.   mov  ax,160
  42.   mul  Y
  43.   add  bx,ax
  44.   mov  dx,03d4h
  45.   mov  al,0ch
  46.   mov  ah,bh
  47.   out  dx,ax
  48.   inc  al
  49.   mov  ah,bl
  50.   out  dx,ax
  51.   and  cl,3
  52.   shl  cl,1
  53.   mov  dx,03dah
  54. @wait:
  55.   in   al,dx
  56.   and  al,8
  57.   jz   @wait
  58.   mov  dl,0c0h
  59.   mov  al,13h
  60.   out  dx,al
  61.   mov  al,cl
  62.   out  dx,al
  63.   mov  al,020h
  64.   out  dx,al
  65.   dec  palx
  66.   jnz  @exit
  67.   mov  palx,palrot_speed
  68.   Call Palanim
  69. @exit:
  70. End;
  71.  
  72. Procedure RGBsin(l:byte);
  73. var r,g,b:byte;
  74. Begin
  75.   j:=0;
  76.   for i:=1 to l do
  77.   Begin
  78.     r:=32+round(30*sin(  i*pi*2/l )); pal[j]:=r;
  79.     g:=32+round(30*cos(  i*pi*2/l )); pal[j+1]:=g;
  80.     b:=32+round(30*sin( -i*pi*2/l )); pal[j+2]:=b;
  81.     SetRGBreg(i,r,g,b);
  82.     inc(j,3);
  83.   End;
  84. End;
  85.  
  86. Procedure Fade;
  87. begin
  88.   TextColor(0);
  89.   ClrScr;
  90.   SetRGBreg(1,0,0,0);
  91.   TextColor(1);
  92.   GotoXY(35,13);
  93.   Writeln('by OP Master');
  94.   GotoXY(1,1);
  95.   TextColor(0);
  96.   for i:=0 to 63 do
  97.   begin
  98.     Delay(20);
  99.     SetRGBreg(1,i,i,i);
  100.   end;
  101.   Delay(700);
  102.   for i:=63 downto 0 do
  103.   begin
  104.     Delay(20);
  105.     SetRGBreg(1,i,i,i);
  106.   end;
  107. end;
  108.  
  109. Procedure Mindegy; {Ezt a rutint írta : Pakó Géza}
  110. begin
  111.   for aa:=1 to 24 do
  112.    for bb:=24 downto 1 do
  113.     for cc:=1 to 80 do
  114.     begin
  115.       if kep[bb+1,cc,1]=' ' then
  116.       begin
  117.         kep[bb+1,cc,1]:=kep[bb,cc,1];
  118.         kep[bb+1,cc,2]:=kep[bb,cc,2];
  119.         kep[bb,cc,1]:=' ';
  120.         kep[bb,cc,2]:=#7;
  121.       end;
  122.     end;
  123. end;
  124.  
  125. Begin
  126.   Mindegy;
  127.   Delay(500);
  128.   asm
  129.     mov ax,0013h
  130.     int 10h
  131.   end;
  132.   RGBsin(255);
  133.   OutStrXY(0,0,'     ');{Ettöl az utasítástól lesz a program mérete 10 Kbyte}
  134.   dx:=1;
  135.   dy:=1;
  136.   xi:=1;
  137.   yi:=1;
  138.   repeat
  139.     ShowPal;
  140.     Box(xi,yi,xi+10,yi+10,0);
  141.     inc(xi,dx);
  142.     inc(yi,dy);
  143.     if xi=309 then dx:=-dx;
  144.     if yi=190 then dy:=-dy;
  145.     if xi=1 then dx:=-dx;
  146.     if yi=1 then dy:=-dy;
  147.     Box(xi,yi,xi+10,yi+10,l-4);
  148.     ink:=120;
  149.     OutStrXY(90,95,'OP Software Studio');
  150.   until keypressed;
  151.   Box(xi,yi,xi+10,yi+10,0);
  152.   ink:=120;
  153.   OutStrXY(90,95,'OP Software Studio');
  154.   for i:=0 to 90 do
  155.   begin
  156.     Delay(20);
  157.     ScrollLf(90,95,180,105);
  158.     ScrollRg(181,95,250,105);
  159.   end;
  160.   TextMode(3);
  161.   Fade;
  162.   TextMode(3);
  163. End.