Julia set.

A forum for users of EhBASIC (Enhanced BASIC), a portable BASIC interpreter for 6502 microcomputers written by Lee Davison.
Post Reply
JenniferDigital
Posts: 92
Joined: 25 May 2015

Julia set.

Post by JenniferDigital »

I keep on seeing people running Mandlebrot sets on their homebrew computers, but I don't see many other fractals being run so... Here's my Julia set. I'm sure the brains trust could geatly improve it.

Anyway, here's the (Not very clever) code to generate it, including a little boilerplate for my machine to not mess up the terminal window with.

Code: Select all

1 zoom = 35
5 BITCLR $5E0,0: PRINT CHR$(12); : REM Serial out off, and clear screen.
10 creal=-0.8
20 cimag=0.156
30 FOR v=-48 TO 48
40 FOR h=-78 TO 78
50 x=h/(zoom*2)
60 y=v/zoom
70 FOR i=1 TO 50
80 zreal=x*x-y*y+creal
90 zimag=x*y*2+cimag
100 IF zreal*zreal>1000 THEN GOTO 150
110 x=zreal
120 y=zimag
130 NEXT i
140 px=h+79: py=v+49: GOSUB 4000
150 NEXT h
160 NEXT v
165 BITSET $5E0,0 : REM Serial out on again.
170 END
3997 :
3998 REM Plot
3999 :
4000 PRINT CHR$(5);CHR$(px);CHR$(py);
4010 RETURN
I wonder what else is out there, maybe a strange attractor?
Attachments
ToE-Julia.jpg
User avatar
BigEd
Posts: 11467
Joined: 11 Dec 2008
Location: England
Contact:

Re: Julia set.

Post by BigEd »

Looks nice!

Is that CHR$(5) plot routine something you've added to EhBasic? Or is there perhaps a VDU driver component to your system? Does it have more capabilities?
(I had a quick look in your Tower of Eight repo but didn't find an answer.)
JenniferDigital
Posts: 92
Joined: 25 May 2015

Re: Julia set.

Post by JenniferDigital »

Since the video-card my ToE is running at the moment is based on Grant Searles code, which is itself a derivative, it comes from there. Basically, I've got a set of bits that determine where output gets forwarded to. I plan to add some extra software to draw lines and circles to the OS too. I didn't put Grant's code in my repo because he's not replied to my request to do so. There are other graphics cards I could be using but one doesn't work yet (struggling with timing issues and tooling issues on FPGA) and the other one doesn't have Tower OS support yet.

Whilst I don't think Grant would mind, he does explicitly forbid publishing it without his permission.
User avatar
BigEd
Posts: 11467
Joined: 11 Dec 2008
Location: England
Contact:

Re: Julia set.

Post by BigEd »

Ah, thanks. I'm sure Grant wouldn't mind a link though.
User avatar
BigEd
Posts: 11467
Joined: 11 Dec 2008
Location: England
Contact:

Re: Julia set.

Post by BigEd »

So... how long does it take to plot the 15000 or so pixels?
JenniferDigital
Posts: 92
Joined: 25 May 2015

Re: Julia set.

Post by JenniferDigital »

Depends at which clock rate I've chosen at the tine. I guess (and I've not timed it yet) probsbly around 20 minutes. Nothing like that incredible one foe the BBC.
User avatar
BigEd
Posts: 11467
Joined: 11 Dec 2008
Location: England
Contact:

Re: Julia set.

Post by BigEd »

A strange attractor is a good idea: something where most of calculations result in plotting a point, rather than something where each point needs heaps of calculations.
JenniferDigital
Posts: 92
Joined: 25 May 2015

Re: Julia set.

Post by JenniferDigital »

I wrote a strange attractor based on some psuedocode I found in a book some time ago. Mind you, that was in FORTH on a Speccy. It'd probably only take an afternoon to get going.

There's also things like the Sierpinski Triangle that wouldn't look too bad on said low res screen.
JenniferDigital
Posts: 92
Joined: 25 May 2015

Re: Julia set.

Post by JenniferDigital »

@BigEd, I just added said link to the ToE wiki.
Chromatix
Posts: 1462
Joined: 21 May 2018

Re: Julia set.

Post by Chromatix »

There's also the "chaotic bifurcation" formula. There's an interesting discussion of this (in a Python context) here: https://ipython-books.github.io/121-plo ... al-system/
User avatar
BigEd
Posts: 11467
Joined: 11 Dec 2008
Location: England
Contact:

Re: Julia set.

Post by BigEd »

We had one of those in BBC Basic over on stardot:
https://stardot.org.uk/forums/viewtopic ... 00#p200300
Post Reply