top of page

LOADING...

SCREECH

Vintage & Modern Tech Blog

  • Stephen Nichol

< FIVE MINUTE BASIC #9 - ZX Cylon


screenshot of cylon type-in

This little tutorial let's you relive a familiar sight from 1970s and 80s television - the sweeping, red lights, as seen on a certain type of evil silver robot and that un-named sleek, black sports car with the helpful onboard A.I.

1 REM ZX Cylon 2 REM Stephen Nichol 3 REM Loading Screech 4 REM 9th April 2016 10 PAPER 0: INK 2: CLS 20 FOR x=6 TO 26 STEP 1 30 PRINT AT 11,x;"::" 40 PRINT AT 11,x-1;" " 50 PAUSE 5 60 NEXT x 70 FOR x=25 TO 6 STEP -1 80 PRINT AT 11,x;"::" 90 PRINT AT 11,x+1;" " 100 PAUSE 5 110 NEXT x 120 GO TO 20

Note - replace the "::" in lines 30 and 80 with the ZX Spectrum's block ROM graphic found by pressing GRAPH (CAPS SHIFT+9) then 8.

Explanation/Refresher

Lines 1 to 4 are REMarks, notes that do not affect the running of the program.

Line 10 makes the Paper black, the ink red, and clears the screen.

Line 20 starts a FOR...NEXT loops of the cylon's x co-ordinates.

Line 30 prints a red block.

Line 40 prints a space one character cell to the left of the red block.

Line 50 pauses the program for one tenth of a second (50Hz = 1 sec).

Line 60 makes the program loop until x=26.

Lines 70 to 110 reverse motion of the red block.

Line 120 infinitely loops the program.

Exercises 1. Delete lines 40 and 90 - see what goes wrong. 2. Add two BEEP commands to give sound to the program. 3. Narrow the sweep of the red block by altering lines 20 and 70. 4. Cycle the INK colours of the cylon (Hint: try a LET statement). 5. Make a User Defined Graphic to replace the red block.

36 views

Related Posts

See All
bottom of page