Author Topic: Julia set on Amstrad CPC+  (Read 152 times)

0 Members and 1 Guest are viewing this topic.

Offline Nemo59

  • CPC464
  • **
  • Posts: 29
  • Country: fr
  • Liked: 59
  • Likes Given: 25
Julia set on Amstrad CPC+
« on: 01:03, 11 April 21 »
The program takes  full advantage of the 4096 colors palettes of the CPC+. Note that this is only the display of calculations made by another program wich also runs   on CPC+ but take.... some time  to produce these images ;D  No real time here  ;)



https://youtu.be/RieLLYW0zoU


Code (Need the TP-Tools library):


Code: [Select]
Program Julia;

{$i UGraph.inc}
{$i UAsic.inc}
{$i UKbd.inc}

Const
  Iteration=120;
  XMin=-0.7; XMax= 0.9;
  YMin=-1.0; YMax= -0.0;

Var
 x,y,i : Integer;
 Cr,Ci,Zr,Zi,Tmp,Zr2,Zi2: Real;
 ZrX: Array[0..159] Of Real;
 ZiY: Array[0..199] Of Real;

Begin
  SetMod(0); HidTxtCur;
  DlkAsic; OpnAsic; SetPal4096;
  For i:=0 To 15 Do SetAsicPal(i,i);
  ColBdr:=$fff;
  CloAsic;

  Cr:=0.36; Ci:=0.36;

  For x:=0 To 159 Do ZrX[x]:=XMin+(XMax-YMin)*x/160.0;
  For y:=0 To 199 Do ZiY[y]:=YMin+(YMax-YMin)*y/200.0;

  For x:=0 To 159 Do Begin
    For y:=0 To 199 Do Begin
      Zr:=ZrX[x]; Zi:=ZiY[y];
      i:=0;
      Repeat
        Zr2:=Sqr(Zr); Zi2:=Sqr(Zi);
        If TstKey(66) Then Begin SetMod(2); SetGraPen(1); Halt; End;
        i:=i+1; Tmp:=Zr;
        Zr:=Zr2-Zi2+Cr;
        Zi:=2*Tmp*zi+ci;
      Until (i>Iteration) Or ((Zr2+Zi2)>4.0);

      SetGraPen(Round(15.0*(i/Iteration))); DrwPntAbs(4*x,2*y);

    End;
  End;
  WaitChr; SetMod(2);
End.
« Last Edit: 01:15, 11 April 21 by Nemo59 »
CPC 6128+ / CPM+/ Turbo PASCAL v3
https://cpcrulez.fr/auteur-nemo59.htm