Just an image from the modifications in the reply to the last post starting with points on the sides as well as in the middle.
My on again off again blog about whatever computer related hobby projects I happen to be working on at the moment.
Friday, October 14, 2022
Thursday, October 13, 2022
Brownian Tree in BASIC
Brownian Tree
Random values are chosen for X,Y position of new pixels, but the are only set if they are next to existing pixels. If not the position is randomly moved til it's next to a pixel
This is really slow due to so many random numbers not being near an existing pixel.
Limiting the random range to where they could be next to pixels should help, and I do have code to do that. I'll post that once it's tested.
0 POKE 65497,0:PMODE4,1:PCLS0:COLOR1:SCREEN1,1
REM GET BASIC TOPRAM POINTER, SUBTRACT SIZE OF USER CODE
1 AD=PEEK(116)*256+PEEK(117)-24
REM RESERVE MEMORY FOR USR CODE
2 CLEAR 100,AD
REM VARIABLES ERASED BY CLEAR, SO REDO AD, POKE USR CODE INTO RAM
3 AD=PEEK(116)*256+PEEK(117):FOR I=0 TO 23:READ B$:A=VAL("&H"+B$):POKE AD+I,A:NEXT
REM DEFINE USR ROUTINES
4 DEFUSR0=AD:DEFUSR1=AD+12
REM ENABLE 6309 NATIVE MODE
5 A=USR0(0)
10 L=1:K=254:M=174:N=3:O=2:S=0:T=255:U=175:NP=10000:PSET(128,88)
40 FOR I=L TO NP
50 X=RND(K):Y=RND(M)
60 IF ((PPOINT(X+L,Y+L) + PPOINT(X,Y+L) + PPOINT(X+L,Y) + PPOINT(X-L,Y-L) + PPOINT(X-L,Y) + PPOINT(X,Y-L))<>0) THEN PSET(X,Y):NEXT I:GOTO100
70 X=X+RND(N)-O:Y=Y+RND(N)-O
80 IF X<L OR X>K OR Y<L OR Y>M THEN 50
90 GOTO 60
100 A=USR1(0)
110 GOTO110
11000 DATA CC,FF,FF,10,4F,5D,26,03,11,3D,01,39,CC,FF,FF,10,4F,5D,26,03,11,3D,00,39
If you aren't sure if it's doing anything, you can add the following line, but it will run even slower:
65 PSET(X,Y):PRESET(X,Y)
Tuesday, October 4, 2022
Raytracing Code Changes to Run the Code on a Color Computer 1 & 2
These are the changes needed to run this on a Color Computer 1 or 2 in PMODE 4 graphics mode using color artifacting.
The changes are related to graphics mode (lines 5, 6, and 80), horizontal resolution (lines 9 and 30), generating the shadow (line 48), and the high speed mode (line 0)
Copy the code from the original post and paste it into the VCC emulator.
Then copy and paste the code below into VCC. It will overwrite the lines needed to run it on the Color Computer 1 & 2.
The crosshatch code in line 48 could use some work do to how PMODE3, and artifacting interact with the math, but it's not too bad as is.
0 POKE 65495,0
5 PMODE4,1:PCLS:SCREEN1,1:PMODE3,1
REM DELETE LINE 6
6
9 RX=0:RY=0:RZ=0:T=0:OX=0:OY=0:OZ=0:X1=0:X2=0:A=0:B=1:C=2:D=5:E=-1:F=1/256:G=1/2:H=192:M=1/5:J=.95:L=.001
30 FOR X = 0 to 255
48 IF FA=A THEN FA=((X AND B)<>(Y AND B))+B
80 PSET(X,Y,FA)