Page 1 of 1

QIX-like screensaver

Posted: Thu May 11, 2023 6:18 am
by DragWx
Inspired by the Windows Mystify demo, here's a simple BASIC program which repeatedly paints the screen with a happy little QIX that bounces around. It actually started out as the classic text bounce before turning into a line in graphics mode. :D

See latest revision here!
Try It Now!

The original revision is below:

Code: Select all

10 SCREEN 128
20 DIM X(2),Y(2),DX(2),DY(2)
30 LX=319:LY=239:C=1:A=RND(-TI):A=0
100 RECT 0,0,LX,LY,0
110 FOR Z=1 TO 2
120 X(Z)=X(Z)+DX(Z):Y(Z)=Y(Z)+DY(Z)
130 IF X(Z)>LX OR X(Z)<1 OR Y(Z)>LY OR Y(Z)<1 THEN C=INT(RND(1)*16)
140 IF X(Z)>LX THEN X(Z)=LX:DX(Z)=-(RND(1)*5+1)
150 IF Y(Z)>LY THEN Y(Z)=LY:DY(Z)=-(RND(1)*5+1)
160 IF X(Z)<1 THEN X(Z)=1:DX(Z)=RND(1)*5+1
170 IF Y(Z)<1 THEN Y(Z)=1:DY(Z)=RND(1)*5+1
180 NEXT
190 LINE X(1),Y(1),X(2),Y(2),C
200 A=A+1:SLEEP 1
210 IF A>500 THEN A=0:GOTO 100
220 GOTO 110
NOTE: As of this writing, it unfortunately pulls black as the random starting color for the line, so the screen stays blank for the first few moments.

Re: QIX-like screensaver

Posted: Thu May 11, 2023 8:09 pm
by DragWx
V2 update:
- Starting position of line is randomized at program start.
- After clearing screen, if line color is black, color is rerolled until it isn't.

Code: Select all

10 SCREEN 128
20 DIM X(2),Y(2),DX(2),DY(2)
30 LX=319:LY=239:C=0:A=RND(-TI):A=0

100 FOR Z=1 TO 2
110 X(Z)=RND(1)*LX:Y(Z)=RND(1)*LY:DX(Z)=RND(1)*5+1:DY(Z)=RND(1)*5+1
120 IF RND(1)>.5 THEN DX(Z)=DX(Z)*-1
130 IF RND(1)>.5 THEN DY(Z)=DY(Z)*-1
140 NEXT

200 RECT 0,0,LX,LY,0
210 IF INT(C)=0 THEN C=RND(1)*16:GOTO 210

300 FOR Z=1 TO 2
310 X(Z)=X(Z)+DX(Z):Y(Z)=Y(Z)+DY(Z)
320 IF X(Z)>LX OR X(Z)<1 OR Y(Z)>LY OR Y(Z)<1 THEN C=RND(1)*16
330 IF X(Z)>LX THEN X(Z)=LX:DX(Z)=-(RND(1)*5+1)
340 IF Y(Z)>LY THEN Y(Z)=LY:DY(Z)=-(RND(1)*5+1)
350 IF X(Z)<1 THEN X(Z)=1:DX(Z)=RND(1)*5+1
360 IF Y(Z)<1 THEN Y(Z)=1:DY(Z)=RND(1)*5+1
370 NEXT
380 LINE X(1),Y(1),X(2),Y(2),C
390 A=A+1:SLEEP 1
400 IF A>500 THEN A=0:GOTO 200
410 GOTO 300

Re: QIX-like screensaver

Posted: Fri May 12, 2023 10:41 pm
by ahenry3068
Wondering why you limited it to 15 colors in 256 color mode ?

Also 0 is listed as translucent (though I don't see it either) 16 is true Black in
mode $80

Re: QIX-like screensaver

Posted: Fri May 12, 2023 11:01 pm
by DragWx
ahenry3068 wrote: Fri May 12, 2023 10:41 pm Wondering why you limited it to 15 colors in 256 color mode ?
Stylistic choice; I liked how it looked when it steps through that nice bright C64-like palette, but it's simple enough to modify if you want to see what it looks like when it can use all 256 colors. :D
ahenry3068 wrote: Fri May 12, 2023 10:41 pm Also 0 is listed as translucent (though I don't see it either) 16 is true Black in
mode $80
Hey, that just means if a later revision of the VERA ever supports genlocking (i.e., video overlay on external video signal), this can give you a nice 80s effect for a music video. :P

Re: QIX-like screensaver

Posted: Fri May 12, 2023 11:18 pm
by ahenry3068
Nothing to argue with on those answers.. :)


I kinda concur on the vibrant colors ... :)
Though with a more complex algorithm you could grap the higher vibrant
colors too.

Re: QIX-like screensaver

Posted: Fri May 12, 2023 11:19 pm
by ahenry3068
I'm porting mystify to Prog8 Hoping it is significanly faster with integer math

Re: QIX-like screensaver

Posted: Fri May 12, 2023 11:24 pm
by ahenry3068
If we ever do genlock its going to be an external device....... aLa the Video Toaster...

I was infatuated with the Amiga 1200.. But by the time my finances were in
order a 486 machine seemed the better deal...

Re: QIX-like screensaver

Posted: Sat May 13, 2023 7:43 am
by TomXP411
ahenry3068 wrote: Fri May 12, 2023 11:24 pm If we ever do genlock its going to be an external device....... aLa the Video Toaster...

I was infatuated with the Amiga 1200.. But by the time my finances were in
order a 486 machine seemed the better deal...
Hmm... the difference being that the Amiga was specifically designed to work with an external video clock. There are two pins on the video connector that let you feed in a clock from outside, along with a pin that changes the sync pins from outputs to inputs. So the Amiga would then use the sync and clock from an external source for its video timing.

The Toaster didn't so much do the frame synchronization, as it did video mixing. And we don't really need a Toaster or a Genlock for that today - you can buy a video mixer for $300 or less on Amazon. (The BlackMagic ATEM Mini is a good piece of gear for a starter system.)

The ATEM (and other mixers) now have internal time base correctors, which adjust the timing of each of the input devices, eliminating the need for external TBC or genlock type devices.

All you really need to get an X16 into a video system is a scaler that can convert the VGA output to something a video mixer can handle - either an HDMI or SDI signal at a compatible resolution. I'll let you know how the ATEM+OSSC deals with that when my board arrives.