top of page

LOADING...

SCREECH

Vintage & Modern Tech Blog

Stephen Nichol

< FIVE MINUTE BASIC #1 - LASER Light Show


Here's a five minute listing I entered into a ZX Spectrum emulator on my phone recently. I was waiting for a relative's school play to start, and decided to give them a little laser light show, like a Hollywood celeb would be given at a movie premiere.

1 REM Laser Light Show

2 REM 2014 By Stephen Nichol

10 BORDER 0: PAPER 0: CLS

20 PLOT 1,1

30 DRAW INK RND*7; 80, RND *80

40 PLOT 254,1

50 DRAW INK RND*7; -80, RND*80

60 PLOT 1,174

70 DRAW INK RND*7, 80, RND* -100

80 PLOT 254,174

90 DRAW INK RND*7, -80, RND* -80

100 PRINT INK 7; AT 11,10; "My Name Rules!"

110 PAUSE 2

120 GO TO 10

Explanation/Refresher (If required):

Line 10 tells the computer to make the border and paper colour zero (black), CLS clears the screen.

Line 20 plots a position 1 pixel in from the left of the screen, and 1 pixel up from the bottom

(algebra - x1, y1).

Line 30 draws a line in one of seven random colours, that always ends 80 pixels across, but is any random height between 0 and 80 pixels.

Line 40 plots a position 254 pixels to the right, and 1 pixel up, that is - at the bottom right of the screen.

Line 50 does the same as Line 30, but the minus (-) sign before the 80, tells the computer to draw the line from 'right to left' instead of 'left to right'.

Line 60 and 70 draw lines from the top left of the screen. The minus(-) is now in front of the number controlling height (in algebra, the y-axis).

Line 80 and 90 draw lines from the top right of the screen, so both numbers need to be negative, with a minus sign (-) in front of them.

100 You can put your own name in the quotes, or anything you like (if it's too long, it will wrap around to the next line on the screen.

110 Our message is flickering very quickly. On a PAL television, the ZX Spectrum refreshed the screen 50 times every second, or 50Hz (60Hz for NTSC). So, PAUSE 50 pauses the Spectrum for 1 second (or earlier, if any key is pressed). All those whole seconds of pausing add up, so we're just going to PAUSE 2. We're telling the computer "Don't do anything for 2/50 of a second".

120 The GO TO statement tells the computer to go back to the beginning of the program unless it is interrupted, for example by pressing 'Break'.

43 views

Related Posts

See All
bottom of page