Wednesday, May 25, 2022

Burning Ship Fractal in BASIC

Another port I recently posted on facebook.
It's a fractal program in BASIC I ported to the Color Computer. 
Stuff like this doesn't take long to port and it's kinda fun to play with.


REM SET COCO3 TO HIGH SPEED MODE, SET UP A PMODE4 SCREEN, AND INSTALL THE MULTIPLY PATCH
0 POKE65497,0:PCLEAR4:PMODE 4,1:PCLS0:SCREEN 1,0:GOSUB10000
1 G=130:A=0:B=1:C=2:D=3:E=4:F=105:P=255:Q=191:S=50:T=27:H=90:M=16:R=0
2 U=28672:V=32:W=28:L=29:N=30:Z=7:Z2=1/1000:G2=8:G3=1.7:G4=.06
3 G5=1/8:G6=63:FORI=R TOP:X=I*Z2-G3
REM FOR I = 0 TO 255
4 FORI=R TOP:X=I*Z2-G3
REM FOR J=0 TO 192
8 FORJ=R TOQ
9 Y=J*Z2-G4:A=U+INT(I*G5)+V*(J AND G6)
REM 12 PRESET(I,J):RE=R:IM=R:K=R
12 RE=R:IM=R:K=R
20 TM=RE*RE-IM*IM+X:IM=ABS(C*RE*IM)+Y:RE=TM:K=K+B
30 IFK<M AND RE*RE+IM*IM<E THEN20
40 IFK>=M THEN50
45 PSET(I,J)
50 NEXTJ,I
60 GOTO60
REM COCO3 HARDWARE MULTIPLY PATCH.
REM JUST ADD A GOSUB 10000 AT THE TOP OF YOUR CODE TO ADD IT
REM ADDRESS WE ARE STORING THE MULTIPLY PATCH IN RAM
10000 AD=VAL("&HFA0C")
REM POKE THE MULTIPLY PATCH INTO RAM
10001 FORI=0 TO 64:READ B$:A=VAL("&H"+B$):POKE AD+I,A:NEXT
REM MAKE BASIC JUMP TO OUR MULTIPY INSTEAD OF USING IT'S CODE. $BB00 JMP $FA0C
10002 POKE VAL("&HBB02"),VAL("&H7E"):POKE VAL("&HBB03"),VAL("&HFA"):POKE VAL("&HBB04"),VAL("&H0C")
10003 RETURN
10004 DATA 32,79,E7,60,96,60,3D,ED,63,E6,60,96,5E,3D,ED,61,E6,60,96,5D
10005 DATA 3D,ED,65,E6,60,96,5F,3D,E3,62,ED,62,EC,65,E9,61,89,00,ED,60
10006 DATA EC,63,D3,15,97,16,D7,63,EC,61,D9,14,99,13,DD,14,A6,60,89,00
10007 DATA 97,13,32,67,39



And with a slightly better configuration.



Change this line:
2 U=28672:V=32:W=28:L=29:N=30:Z=7:Z2=1/1250:G2=8:G3=1.8:G4=.1

Z2 = initial zoom level
g3 = initial X image landscape position value
g4 = intiial Y screen-position value

No comments:

Post a Comment