Wednesday, May 25, 2022

Another Fractal in BASIC

Another quick BASIC conversion. 


0 POKE65497,0:PCLEAR4:PMODE 4,1:PCLS1:SCREEN 1,0
1 AD=VAL("&HFA0C")
2 FORI=0 TO 64:READ B$:A=VAL("&H"+B$)
3 POKE AD+I,A:NEXT
REM $BB00 JMP $FA0C
4 POKE VAL("&HBB02"),VAL("&H7E"):POKE VAL("&HBB03"),VAL("&HFA"):POKE VAL("&HBB04"),VAL("&H0C")

5 X=0:Y=X:XN=X:YN=X:R=X:Q=1/100:L=160:P=100:M=80:N=25:O=15:S=1:T=86:U=93:V=16:W=26:Z=X:A=85:B=20:C=4:D=-4:E=23:F=22:G=-15:H=28:J=24:K=44
10 R=RND(Z)*P:XN=X:YN=Y
12 IFR<S THENX=Z:Y=V*YN:GOTO20
14 IFR<T THENX=A*XN+C*YN:Y=D*XN+A*YN+L:GOTO20
16 IFR<U THENX=B*XN-W*YN:Y=E*XN+F*YN+L:GOTO20
18 X=G*XN+H*YN:Y=W*XN+J*YN+K
20 X=X*Q:Y=Y*Q
25 PRESET(M+X*N,L-Y*O):GOTO10

1000 DATA 32,79,E7,60,96,60,3D,ED,63,E6,60,96,5E,3D,ED,61,E6,60,96,5D
1001 DATA 3D,ED,65,E6,60,96,5F,3D,E3,62,ED,62,EC,65,E9,61,89,00,ED,60
1002 DATA EC,63,D3,15,97,16,D7,63,EC,61,D9,14,99,13,DD,14,A6,60,89,00
1003 DATA 97,13,32,67,39

No comments:

Post a Comment