Hello,
i'm looking for nice basic codes making good graphic effects. They can be slow, that is no problem. But they shouldn't have any call, peek or poke routines!
I put an example as picture here.
Hope to get lot's of nice code-snipets ... :)
This program was written by
@abalore some time back, there's a CALL &BD19, it can work without it also but is only for refreshing screen to get a smoother movement sensation
10 MODE 0
20 INK 0,0
30 INK 1,26
40 BORDER 0
50 FOR i=60 TO 0 STEP -1
60 FOR j=0 TO 3
70 IF j MOD 2 = 0 THEN c=(i MOD 14)+2 ELSE c=((i+7) MOD 14)+2
80 l = (400-(i*4))/4
90 b=i*2
100 y=b+j*l
110 MOVE i*4,y
120 DRAWR 0,l,c
130 MOVE 640-i*4,y
140 DRAWR 0,l,c
150 NEXT j
160 MOVE i*4,i*2
170 DRAW 640-i*4,i*2
180 MOVE i*4,400-i*2
190 DRAW 640-i*4,400-i*2
200 NEXT i
210 MOVE 0,0:DRAW 240,120,1
220 MOVE 0,100:DRAW 240,160,1
230 MOVE 0,200:DRAW 240,200,1
240 MOVE 0,300:DRAW 240,240,1
250 MOVE 0,400:DRAW 240,280,1
260 MOVE 640,0:DRAW 400,120,1
270 MOVE 640,100:DRAW 400,160,1
280 MOVE 640,200:DRAW 400,200,1
290 MOVE 640,300:DRAW 400,240,1
300 MOVE 640,400:DRAW 400,280,1
310 FOR i=60 TO 100
320 PLOT i*4,120,i MOD 2
330 PLOT i*4,280,i MOD 2
340 NEXT
350 FOR i=60 TO 140
360 PLOT 240,i*2,i MOD 2
370 PLOT 400,i*2,i MOD 2
380 NEXT
390 t=2
400 INK t,3
410 IF t=15 THEN INK 2,25:INK 3,15
420 IF t=14 THEN INK 15,25:INK 2,15
430 IF t<14 THEN INK t+1,25:INK t+2,15
440 t=t-1
450 IF t=1 THEN t=15
460 CALL &BD19
470 GOTO 400
5 ORIGIN 320,200
10 FOR x=-320 TO 320 STEP 2
30 MOVE x,-200:DRAW -x,200,1,1
60 NEXT
120 FOR y=-200 TO 200 STEP 2
130 MOVE -320,y:DRAW 320,-y,1,1
150 NEXT
160 GOTO 160
Quote from: trocoloco on 11:14, 06 February 25This program was written by @abalore some time back, there's a CALL &BD19, it can work without it also but is only for refreshing screen to get a smoother movement sensation
10 MODE 0
20 INK 0,0
30 INK 1,26
40 BORDER 0
50 FOR i=60 TO 0 STEP -1
60 FOR j=0 TO 3
70 IF j MOD 2 = 0 THEN c=(i MOD 14)+2 ELSE c=((i+7) MOD 14)+2
80 l = (400-(i*4))/4
90 b=i*2
100 y=b+j*l
110 MOVE i*4,y
120 DRAWR 0,l,c
130 MOVE 640-i*4,y
140 DRAWR 0,l,c
150 NEXT j
160 MOVE i*4,i*2
170 DRAW 640-i*4,i*2
180 MOVE i*4,400-i*2
190 DRAW 640-i*4,400-i*2
200 NEXT i
210 MOVE 0,0:DRAW 240,120,1
220 MOVE 0,100:DRAW 240,160,1
230 MOVE 0,200:DRAW 240,200,1
240 MOVE 0,300:DRAW 240,240,1
250 MOVE 0,400:DRAW 240,280,1
260 MOVE 640,0:DRAW 400,120,1
270 MOVE 640,100:DRAW 400,160,1
280 MOVE 640,200:DRAW 400,200,1
290 MOVE 640,300:DRAW 400,240,1
300 MOVE 640,400:DRAW 400,280,1
310 FOR i=60 TO 100
320 PLOT i*4,120,i MOD 2
330 PLOT i*4,280,i MOD 2
340 NEXT
350 FOR i=60 TO 140
360 PLOT 240,i*2,i MOD 2
370 PLOT 400,i*2,i MOD 2
380 NEXT
390 t=2
400 INK t,3
410 IF t=15 THEN INK 2,25:INK 3,15
420 IF t=14 THEN INK 15,25:INK 2,15
430 IF t<14 THEN INK t+1,25:INK t+2,15
440 t=t-1
450 IF t=1 THEN t=15
460 CALL &BD19
470 GOTO 400
The CALL &BD19 is equivalent to the command FRAME in BASIC 1.1 (in 664 and 6128), sadly lacking in the 464. So I don't think can be considered as a machine code call, just a command they forgot to add to the 464 :D
Furthermore, the CALL &BD19 is mentioned and used in the CPC464 BASIC manual.
That's what I always entered into a CPC that was in a shop but only showed the boot screen.
MATRIX "digital rainfall" effect with 10 lines of BASIC code:
https://muckypaws.com/2024/06/02/matrix-digital-rainfall-effect-10-lines-of-basic-code-and-z80-assembler-comparison/
That are codes im looking for!
Maybe someone else can remember better than I can. I had a book that contained a lot of small programs to create different abstract graphics. I think it was from "Data Becker", but I'm not sure. The graphics were made up from a bunch of squares, scaled and rotated around different center points. Here an example, though the book contained better ones.
100 MODE 2 : DEG
110 DATA 55,295,710,10,-20,0,3
120 DATA 0,0,300,0,-10,10,0.1
130 DATA 640,0,240,0,-15,-20,-0.1
140 DATA 420,350,50,10,-2,0,10
150 DATA 350,320,30,5,-2,0,10
160 FOR objectIndex=1 TO 5
170 READ centerX,centerY
180 READ scaleBegin,scaleEnd,scaleStep
190 READ angleBegin,angleStep
200 GOSUB 230
210 NEXT
220 GOTO 220
230 ORIGIN centerX,centerY : angle=angleBegin
240 FOR scale=scaleBegin TO scaleEnd STEP scaleStep
250 s=scale*SIN(angle) : c=scale*COS(angle) : angle=angle+angleStep
260 MOVE s,c : DRAW -c,s : DRAW -s,-c : DRAW c,-s : DRAW s,c
270 NEXT
280 RETURN