News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Nemo59

Julia set on Amstrad CPC+

Started by Nemo59, 23:03, 10 April 21

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Nemo59

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):



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.
CPC 6128+ / CPM+/ Turbo PASCAL v3
https://cpcrulez.fr/auteur-nemo59.htm

Powered by SMFPacks Menu Editor Mod