Advertisement
Guest User

Old Pascal sourcecode

a guest
Feb 22nd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 9.54 KB | None | 0 0
  1. {$M 1024,0,0}
  2. {$R-,Q-,S-}
  3.  
  4. { Die Farbpalette - jetzt von 768 auf 45 Bytes optimiert ;-) }
  5.  
  6. Const PAL : Array [1..45] of Byte =($0A,$0A,$0A,$12,$12,$12,$1B,$1B,$1B,$24,
  7. $24,$24,$2D,$2D,$2D,$36,$36,$36,$3F,$3F,$3F,$10,$02,$00,$18,$07,$01,$20,$0F,
  8. $05,$28,$18,$0A,$31,$23,$11,$35,$2B,$18,$3A,$33,$1F,$3F,$3B,$28);
  9.  
  10. { Die Blume :-) (stammt aus TIMELESS von TRAN) }
  11.  
  12. Flower : Array [0..30,0..30] of Byte =(
  13. (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,193,193,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  14. (0,0,0,0,0,0,0,0,0,0,0,0,0,0,193,194,193,194,0,0,0,0,0,0,0,0,0,0,0,0,0),
  15. (0,0,0,0,0,0,0,0,0,0,0,0,0,193,194,195,194,195,194,0,0,0,0,0,0,0,0,0,0,0,0),
  16. (0,0,0,0,0,193,193,0,0,0,0,0,0,194,195,196,195,196,194,0,0,0,0,0,0,193,193,0,0,0,0),
  17. (0,0,0,0,193,193,195,195,194,194,0,0,194,195,196,196,196,196,195,194,0,0,0,193,194,193,193,194,193,0,0),
  18. (0,0,0,193,194,195,195,196,196,195,195,0,194,195,196,197,197,197,195,195,0,193,194,196,195,195,195,194,193,0,0),
  19. (0,0,0,193,194,195,196,196,197,196,196,196,194,195,196,197,197,197,196,195,193,194,195,196,197,196,195,195,193,0,0),
  20. (0,0,0,0,195,195,196,197,197,198,197,196,194,196,197,198,198,198,197,193,194,195,196,197,197,196,195,194,194,0,0),
  21. (0,0,0,0,194,195,196,197,198,198,197,197,194,195,197,198,198,198,193,194,196,196,198,197,197,197,196,195,0,0,0),
  22. (0,0,0,0,194,195,196,197,198,198,198,197,194,196,197,198,198,197,194,196,197,198,198,198,198,197,195,194,0,0,0),
  23. (0,0,0,0,0,194,195,196,197,198,198,198,194,195,196,198,198,193,195,196,197,198,198,198,197,197,195,0,0,0,0),
  24. (0,0,0,0,0,0,194,195,197,197,197,197,194,195,196,196,197,194,195,196,196,197,197,197,196,195,195,0,0,0,0),
  25. (0,0,0,0,0,0,194,193,194,196,197,196,193,195,200,201,201,200,200,193,194,194,194,193,194,194,194,193,193,0,0),
  26. (0,0,0,194,195,195,196,196,194,194,196,195,195,201,202,203,203,202,202,200,195,196,196,196,195,196,195,196,194,194,193),
  27. (0,193,194,194,196,196,197,197,197,194,194,194,200,202,203,205,205,204,203,201,196,197,197,197,197,197,196,196,195,195,194),
  28. (0,193,195,195,196,197,197,197,198,198,198,193,201,203,204,206,207,205,204,202,200,198,198,198,198,197,197,197,196,195,194),
  29. (193,194,195,195,196,197,198,198,198,198,198,197,201,203,205,206,207,206,204,202,200,197,198,198,198,198,197,196,196,195,194),
  30. (0,194,195,195,196,197,197,198,198,198,197,196,201,202,204,205,206,205,203,202,200,194,193,198,197,198,196,196,196,195,194),
  31. (0,193,193,194,195,196,196,196,196,196,196,196,200,201,203,204,204,204,202,200,195,196,195,194,196,197,196,195,195,194,194),
  32. (0,0,0,194,194,195,195,195,194,194,195,194,194,200,201,202,202,202,201,194,196,196,197,195,194,196,195,194,193,0,0),
  33. (0,0,0,0,0,0,193,193,193,193,193,197,197,196,194,200,200,200,196,195,197,197,196,196,194,194,0,0,0,0,0),
  34. (0,0,0,0,0,194,196,196,197,198,198,198,196,196,194,197,197,197,197,194,193,198,198,197,197,195,194,0,0,0,0),
  35. (0,0,0,0,0,195,196,196,198,198,198,198,197,195,194,197,198,198,197,195,193,198,198,198,197,196,194,194,0,0,0),
  36. (0,0,0,0,193,195,196,197,198,198,198,196,196,194,197,197,198,198,197,194,193,198,198,198,198,196,196,194,193,0,0),
  37. (0,0,0,0,194,195,196,197,197,198,197,195,194,193,197,198,198,198,197,195,193,197,198,198,198,197,196,195,193,0,0),
  38. (0,0,0,194,194,195,196,197,197,196,196,194,193,196,196,198,198,198,196,195,193,196,196,196,197,196,196,195,193,0,0),
  39. (0,0,0,193,194,194,196,196,196,195,194,193,195,195,196,197,198,197,196,194,193,196,195,196,196,196,195,195,193,0,0),
  40. (0,0,0,0,193,194,195,194,194,193,0,0,0,195,196,196,196,197,196,195,0,0,195,195,195,195,194,194,193,0,0),
  41. (0,0,0,0,193,194,194,193,0,0,0,0,0,194,195,195,196,196,195,194,0,0,0,193,194,194,194,194,0,0,0),
  42. (0,0,0,0,0,0,0,0,0,0,0,0,0,194,195,195,195,195,195,193,0,0,0,0,0,0,0,0,0,0,0),
  43. (0,0,0,0,0,0,0,0,0,0,0,0,0,0,193,194,194,193,194,0,0,0,0,0,0,0,0,0,0,0,0));
  44.  
  45.      b  = 159; { Breite }
  46.      h  = 199;  { Höhe   }
  47.      hb = b/2;
  48.      hh = h/2;
  49.      pw = pi/180;
  50.  
  51. Var
  52.    Pic                          : Array[0..255,0..127] of Byte; { Das Array, welches gedreht wird }
  53.    x,dw,nx,ny,xp,yp,s,o         : Word;
  54.    z,za,f1,f2                   : Real;
  55.    xqd,yqd,f1i,f2i,xwd,ywd      : Integer;
  56.    STab,CTab                    : Array [1..360] of Real;
  57.    YOffset                      : Array [0..199] of Word;
  58.  
  59.  
  60. { VGA Karte vorhanden ???? }
  61.  
  62. Function isVGA:Boolean;Assembler;
  63. Asm
  64.    mov  ah, $1A
  65.    mov  al, $00
  66.    int  $10
  67.    cmp  al, $1A
  68.    jne  @NoVGA
  69.    mov  al, 1
  70.    jmp  @Quit
  71.    @NoVGA:
  72.    mov  al, 0
  73.    @Quit:
  74. End;
  75.  
  76. { Keypressed - Ersatz }
  77.  
  78. Function Keypressed:Boolean;Assembler;
  79. Asm
  80.    mov  ah, $0b
  81.    int  $21
  82.    and  al, $0fe
  83. End;
  84.  
  85. { Das Hauptprogramm :-) }
  86. procedure SetBorder(color : byte); assembler;
  87. asm
  88.    mov     dx,03C0h
  89.    mov     al,31h
  90.    out     dx,al
  91.    mov     al,color
  92.    out     dx,al
  93. end;
  94.  
  95.  
  96. Begin
  97.      If not isVGA then
  98.      Begin
  99.           WriteLn('This little Demo needs VGA !!!!!!!!');
  100.           Halt;
  101.      End;
  102.      Asm
  103.         mov     ax,$13
  104.         int     $10
  105.      End;
  106.      s:=Seg(pal);
  107.      o:=Ofs(pal);
  108.      For x:=0 to 199 do
  109.          YOffset[x]:=x*320;
  110.      Asm
  111.         mov  es,s
  112.         mov  dx,o
  113.         mov  ax,$1012
  114.         mov  bx,193      { Palette von Farbe 193 an setzen      }
  115.         mov  cx,$000F    { Anzahl der zu setzenden Farben       }
  116.         int  $10
  117.      End;
  118.      FillChar(Pic,SizeOf(Pic),0);
  119.      dw:=1;x:=1;z:=0.01;za:=0.005;
  120.      Randomize;
  121.  
  122.      { Sinus/Cosinus vorberechnen }
  123.  
  124.      For x:=1 to 360 do
  125.      Begin
  126.           STab[x]:=Sin(x*pw);
  127.           CTab[x]:=Cos(x*pw);
  128.      End;
  129.  
  130.      Repeat
  131.            { Beginn der Rotate-Routine aus der PC-Heimwerker 8/95, allerdings
  132.              stark verÑndert und teilweise optimiert }
  133.  
  134.            F1:=STab[dw]*z;
  135.            F2:=CTab[dw]*z;
  136.            f1i:=Round(f1*256);
  137.            f2i:=Round(f2*256);
  138.            xqd:=Round((127-(F2*hh+f1*hb))*256);
  139.            yqd:=Round((63-(f2*hb-f1*hh))*256);
  140.            xwd:=xqd;
  141.            ywd:=yqd;
  142.  
  143.                 Asm
  144.                    { Segment initialisieren }
  145.                    mov   ax, $A000
  146.                    mov   es, ax
  147.                    mov   x, 0
  148.  
  149.                    @xp:
  150.                    xor   cx, cx
  151.  
  152.                    @yp:
  153.                    { Offset berechnen }
  154.                    mov   ax, cx
  155.                    mov   bx, ax
  156.  
  157.                    shl   bx, 1
  158.                    mov   dx, word ptr [YOffset+bx]
  159.                    mov   bx, dx
  160.                    add   bx, [x]
  161.  
  162.                    { Farbe des aktuellen Punktes holen }
  163.                    push  cx
  164.                    mov   ax, xwd
  165.                    mov   cx, ywd
  166.                    and   ch, $7F
  167.                    mov   cl, ah
  168.                    mov   si, cx
  169.                    mov   al, byte ptr Pic[si]
  170.                    pop   cx
  171.  
  172.                    { Punkt setzen - Oben links}
  173.                    mov   di, bx
  174.                    mov   es:[di], al
  175.  
  176.                    { Punkt setzen - Unten rechts }
  177.                    mov   di, 63999
  178.                    sub   di, bx
  179.                    mov   es:[di], al
  180.  
  181.                    { Punkt setzen - Oben rechts }
  182.                    add   dx, $13F
  183.                    sub   dx, x
  184.                    mov   di, dx
  185.                    mov   es:[di], al
  186.  
  187.                    { Punkt setzen - Unten links }
  188.                    mov   di, 63999
  189.                    sub   di, dx
  190.                    mov   es:[di], al
  191.  
  192.                    { xwd & ywd erhöhen }
  193.                    mov   ax, f1i
  194.                    add   xwd, ax
  195.                    mov   ax, f2i
  196.                    add   ywd, ax
  197.  
  198.                    { Schleife testen }
  199.                    inc   cx
  200.                    cmp   cx, h+1
  201.                    jne   @yp
  202.  
  203.                    { Den restlichen Kram erledigen }
  204.                    inc  f2i
  205.                    inc  f2i
  206.                    mov  ax, f2i
  207.                    add  xqd, ax
  208.                    mov  ax, f1i
  209.                    sub  yqd, ax
  210.                    mov  ax, xqd
  211.                    mov  xwd, ax
  212.                    mov  ax, yqd
  213.                    mov  ywd, ax
  214.  
  215.                    inc   x
  216.                    cmp   x, b+1
  217.                    jne   @xp
  218.  
  219.  
  220.                 End;
  221.  
  222.            { Ende der Rotate-Routine }
  223.  
  224.            { Zoomfaktor & Drehwinkel Ñndern }
  225.            Inc(dw);
  226.            z:=z+za;
  227.  
  228.            If (z<0.004) or (z>1.4) then
  229.               za:=-za;
  230.  
  231.            If dw=360 then
  232.               dw:=1;
  233.  
  234.            { Zufällig neue Blumen einfügen }
  235.  
  236.            If dw mod 60=0{Random(100)<=5} then
  237.            Begin
  238.                 xp:=Random(255);
  239.                 yp:=Random(128);
  240.                 For ny:=0 to 30 do
  241.                     For nx:=0 to 30 do
  242.                         If (xp+nx<=255) then
  243.                         Begin
  244.                              If (yp+ny<=127) and (Flower[nx,ny]<>0) then
  245.                                 Pic[nx+xp,ny+yp]:=Flower[nx,ny]
  246.                              Else
  247.                                 If Flower[nx,ny]<>0 then
  248.                                    Pic[nx+xp,(yp+ny)-128]:=Flower[nx,ny];
  249.                         End
  250.                         Else
  251.                             If (yp+ny<=127) and (Flower[nx,ny]<>0) then
  252.                                Pic[(nx+xp)-256,ny+yp]:=Flower[nx,ny]
  253.                             Else
  254.                                 If Flower[nx,ny]<>0 then
  255.                                    Pic[(nx+xp)-256,(yp+ny)-128]:=Flower[nx,ny];
  256.            End;
  257.      Until KeyPressed;
  258.      Asm
  259.         mov     ax,$3
  260.         int     $10
  261.      End;
  262.      WriteLn('     PSYCHEDELIC-FLOWERS (c) 1996 by DiGiTAL PRoJECTS');
  263.      For x:=0 to 79 do
  264.          Mem[$B800:(x*2)+1]:=30;
  265.      WriteLn;
  266. End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement