home *** CD-ROM | disk | FTP | other *** search
/ CD-X 1 / cdx_01.iso / demodisc / tyrant / dotchaos / dt2.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1995-03-17  |  5.9 KB  |  324 lines

  1.                     { Code by TyRaNT / MurmidoneS }
  2. Program DotChaos;
  3.  
  4. Var     SinTab    : Array[0..360] Of Shortint;
  5.         CosTab    : Array[0..360] Of Shortint;
  6.         CsilTab   : Array[0..20000] Of Word;
  7.         CsilMov   : Array[0..10000] Of Byte;
  8.         CsilTer   : Array[0..2000] Of Integer;
  9.         CsilTar   : Array[0..100] Of Integer;
  10.         Sor100    : Array[0..180] Of Word;
  11.         Szinek    : Array[0..300] Of Byte;
  12.  
  13.         CsP,Sza   : Word;
  14.         I         : LongInt;
  15.         te,aj     : Word;
  16.         te2,aj2   : Word;
  17.         J,K       : Word;
  18.         X,Y       : LongInt;
  19.         A,B       : Real;
  20.         MaxCs     : Word;
  21.         IrqSave   : Byte;
  22.  
  23. Procedure GenSinCos;
  24. Begin
  25. A:=0;
  26. I:=0;
  27. Repeat
  28. SinTab[I]:=Trunc(Sin(A)*256);
  29. CosTab[I]:=Trunc(Cos(A)*256);
  30. Inc(I);
  31. A:=A+Pi/180
  32. Until A>2*Pi;
  33. End;
  34.  
  35. Procedure GenCsilTab;
  36. Begin
  37. RandomIze;
  38. I:=0;
  39. J:=0;
  40. Repeat
  41. K:=110;
  42. Repeat
  43. X:=(SinTab[I]*K*768) Div 65536+160;
  44. Y:=(CosTab[I]*K*614) Div 65536+100;
  45. If (X<1) Or (X>319) Then Begin X:=0; Y:=0; End;
  46. If (Y<1) Or (Y>199) Then Begin X:=0; Y:=0; End;
  47. CsilTab[J]:=Y*320+X;
  48. Inc(J);
  49. K:=K-1;
  50. Until K=10;
  51. I:=I+2;
  52. Until I=360;
  53. {asm
  54.         jmp @ter
  55.  
  56. @Iv: dw 0
  57. @Jv: dw 0
  58. @Kv: dw 0
  59.  
  60. @ter:
  61.        mov cs:word ptr @Iv,0
  62.        mov cs:word ptr @Jv,0
  63. @Pc1:
  64.        mov cs:word ptr @kv,110
  65.  
  66.        lea si,sintab
  67.  
  68.  
  69. end;}
  70. End;
  71.  
  72. Procedure GenCsilMov;
  73. Begin
  74. I:=0;
  75. Repeat
  76. CsilMov[I]:=Random(180);
  77. CsilMov[I+1]:=Random(100);
  78. Inc(I,2);
  79. Until I>=(MaxCs*2);
  80. End;
  81.  
  82. Procedure GenCsilTer;
  83. Begin
  84. asm
  85.         push es
  86.         mov ax,ds
  87.         mov es,ax
  88.         lea di,Csiltar
  89.         xor ax,ax
  90.         mov cx,100
  91. rep     stosw
  92.         lea di,Csilter
  93.         xor ax,ax
  94.         mov cx,2000
  95. rep     stosw
  96.         pop es
  97. end;
  98.  
  99.  
  100. A:=2*Pi/360;
  101. B:=0;
  102. For I:=0 To 1440  Do Begin
  103.                    CsilTer[I+200]:=Round(Sin(B*3)*20)*320;
  104.                    CsilTer[I+200]:=CsilTer[I+200]+Round(Sin(B*4)*20);
  105.                    B:=B+A;
  106.                    End;
  107. End;
  108.  
  109.  
  110. Procedure GenSor100; assembler;
  111. asm
  112.         push es
  113.         mov ax,ds
  114.         mov es,ax
  115.         lea di,sor100
  116.         xor ax,ax
  117.         xor bx,bx
  118.         mov cx,180
  119.         xor dx,dx
  120. @gssz:  push cx
  121.         push ax
  122.         mov bx,100
  123.         mul bx
  124.         stosw
  125.         pop  ax
  126.         pop  cx
  127.         inc ax
  128.         loop @gssz
  129.         pop  es
  130. end;
  131.  
  132. Procedure Genszin; assembler;
  133. asm
  134.  
  135.         mov ax,ds
  136.         mov es,ax
  137.  
  138.         lea di,szinek
  139.         add di,298
  140.         xor dx,dx
  141.         mov cx,100
  142.  
  143. @yoo:   mov al,dl
  144.         shr al,1
  145.         stosb
  146.         sub di,2
  147.         mov al,dl
  148.         shr al,1
  149.         stosb
  150.         sub di,2
  151.         mov al,dl
  152.         stosb
  153.         sub di,2
  154.         cmp dx,62
  155.         je  @yot
  156.         add dx,2
  157. @yot:   loop @yoo
  158.  
  159.        MOV BX,1;
  160.        MOV CX,99;
  161.        push ds
  162.        pop  es
  163.        MOV DX,Offset szinek
  164.        mov ax,01012h
  165.        INT 10H
  166. End;
  167.  
  168. Begin
  169. asm
  170.           Jmp     @Start
  171.  
  172. @Ret:     mov     dx,03dah
  173. @y1:      in      al,dx
  174.           test    al,8
  175.           jz      @y1
  176. @y2:      in      al,dx
  177.           test    al,8
  178.           jnz     @y2
  179.           ret
  180.  
  181.  
  182. @Fel:     mov     CX,MaxCs
  183.           dec     cx
  184.           mov     si,offset CsilMov
  185. @Lo2:     push    cx
  186.  
  187.           lodsw
  188.  
  189.           cmp     ax,0
  190.           je      @t1
  191.  
  192.           nop
  193.  
  194. @ko:      inc     ah
  195.           cmp     ah,100
  196.           jne     @Lt1
  197.           xor     ah,ah
  198. @Lt1:     mov     [si-2],ax
  199.           push    ax
  200.  
  201.           mov     cl,ah
  202.           xor     ch,ch
  203.           xor     ah,ah
  204.  
  205.           mov     bx,offset sor100
  206.           add     bx,ax
  207.           add     bx,ax
  208.           mov     ax,[bx]
  209.           add     ax,cx
  210.  
  211.  
  212.           mov     Bx,offset CsilTab
  213.           add     bx,ax
  214.           add     bx,ax
  215.           mov     di,[bx]
  216.  
  217.           pop     ax
  218.  
  219.           mov     al,ah
  220.           xor     ah,ah
  221.           mov     bx,offset CsilTar
  222.           add     bx,ax
  223.           add     bx,ax
  224.           add     di,[bx]
  225.  
  226.           cmp     di,te
  227.           jb      @t1
  228.           cmp     di,aj
  229.           ja      @t1
  230.  
  231.           stosb
  232.  
  233. @T1:      pop     cx
  234.           loop    @Lo2
  235.           ret
  236.  
  237. @csilmv:  push  es
  238.           push  ds
  239.           pop   es
  240.  
  241.           mov   si,offset CsilTer
  242.           add   si,csp
  243.           mov   di,offset CsilTar
  244.           mov   cx,100
  245. rep       movsw
  246.  
  247.           add  csp,2
  248.           cmp  csp,920*2
  249.           jne  @cmk
  250.           mov  csp,200*2
  251.  
  252. @cmk:     pop   es
  253.           ret
  254.  
  255. @Start:   mov     ax,013h
  256.           int     10h
  257.  
  258.           Call    Genszin
  259.  
  260.           mov     ax,09000h
  261.           mov     es,ax
  262.           xor     di,di
  263.           xor     ax,ax
  264.           mov     cx,32000
  265. rep       stosw
  266.           mov     csp,20
  267.           mov     sza,500
  268.           call    @csilmv
  269.           mov     te,20*320
  270.           mov     te2,20*320
  271.           mov     aj,180*320
  272.           mov     aj2,180*320
  273.           mov     maxcs,5000
  274.           call    GenSinCos;
  275.           call    GenSor100;
  276.           call    GenCsilMov
  277.           call    GenCsilTab;
  278.           call    GenCsilTer;
  279.  
  280.           mov     cx,100
  281. @tmcs:    push    cx
  282.           call    @csilmv
  283.           pop     cx
  284.           loop    @tmcs
  285.  
  286. @E1:      call    @fel
  287.           push  ds
  288.           push  es
  289.           push  es
  290.           pop   ds
  291.           push  0a000h
  292.           pop   es
  293.           mov   si,20*320+20
  294.           mov   di,20*320+20
  295.           mov   cx,160
  296. @cl1:     push  cx
  297.           mov   cx,280/4
  298. db $66
  299. rep       movsw
  300.           add  si,40
  301.           add  di,40
  302.           pop   cx
  303.           loop  @cl1
  304.           pop   es
  305.           pop   ds
  306.  
  307.           call    @ret
  308.           xor   di,di
  309.           mov   cx,16000
  310. db $66
  311.           xor   ax,ax
  312. db $66
  313. rep       stosw
  314.  
  315.           call    @csilmv
  316.           call    @csilmv
  317.  
  318.           in      al,060h
  319.           cmp     al,1
  320.           jne     @e1
  321.  
  322. end;
  323.  
  324. End.