PicoMiteVGA DEMO


Author Message
Bleep

Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 795
Posted: 07:55pm 01 May 2025      

Just playing, :-) here is the same pattern as above, but speed up, using some of the Math array functions and then plotting a whole line of Pixels at a time.

Dim Integer C(319),X(319),Y(319),D,K,I,J,R1,R2,R3,C1,C2,C3
MODE 2
'Initialise the X array 0 to 319 sequentially.
For J=0 To 319:X(J)=J:Next
Do
'Colour (RGB(255,255,255))
'Print Timer:Timer =0
R1=Int(Rnd*10)+1
R2=Int(Rnd*10)+10
R3=Int(Rnd*10)+20
C1=Map(Int(Rnd*15)+1)
C2=Map(Int(Rnd*15)+1)
C3=Map(Int(Rnd*15)+1)

For I=0 To 239
'Initialise Y array to line number, C array to 0 (Black)
Math Set I,Y()
Math Set 0,C()
For J=0 To 319
 K=J Xor I
 If Not(K Mod R3) Then:C(J)=C3
 ElseIf Not(K Mod R2) Then:C(J)=C2
 ElseIf Not(K Mod R1) Then:C(J)=C1
 EndIf
Next
'Display whole line of pixels in one go.
Pixel X(),Y(),C()
Next
Loop