A downloadable game

PARA2023: a ZX Spectrum game


By Massimiliano Arca, 2023

The Story


Our hero is parachuted from a helicopter onto a small island in the middle of the ocean, from where he will - what else? - save the world. Unfortunately, strong oceanic winds make it impossible to safely direct the flight (fall?) to the target, and an evil enemy has suspended numerous flying mines.

The parachutist will have to try to counteract the winds, avoid the mines, and eventually land on the tiny target to complete the mission. Will he succeed?

The Game


This is a ZX Spectrum game written in standard factory built-in Sinclair ZX Basic. The whole game is contained in 10 lines of no more than 78 characters, including the line numbers, so it is submitted to compete in the PUR-80 section of the 10liner contest. The game can be run on a 16/48K ZX Spectrum or any subsequent version of Sinclair's most popular computer, including clone and fpga replicas. It runs smoothly on ZX Spectrum emulators.

Commands are straightforward: "o" and "p" move the parachuter left and right respectively.

The Submission


The game is submitted in several formats: tap, z80, bas (generated by BasinC). This text is part of the submission.

The Development


This game was developed entirely on the Fuse emulator (v. 1.5.6) coupled to BasinC (v. 1.794). During the development, it was constantly tested on an N-GO.

The Code


Although the coding of the program is not particularly elegant, being focused on the number of characters per line rather than on efficiency or memory usage, some details deserve comment.

Graphic objects (helicopter, parachute, parachuter, mines) are included as UDGs generated from numeric DATA (line 1). The DATA are distributed over the 10 lines (lines 4-9), due to the useful feature that allows DATA to be in different lines, read sequentially.

To detect collisions, the colour attributes (ATTR) are checked (lines 6 and 7), thanks to the different colours of the mines (magenta ink; ATTR = 43) and the small island (green ink; ATTR = 44).

Thanks to the parachute, our hero falls linearly (variable y), without any acceleration due to gravity. Random winds (RND) change the horizontal position (variable x). Of course, the directional keys also affect this variable.  All vertical and horizontal shifts are calculated on line 5. The horizontal shift is performed in a single statement using the Boolean AND operator. Note that instead of the usual (slower) INKEY$ command, the PEEK command reads memory location 23560.

To save characters, this last memory address is stored in the variable j of the previously defined one (23659, l) on line 1. This last address is POKEd to access line number 22, while line 21 is accessed with the well-known PRINT #1 command (lines 1 and 9).

To avoid undesired flashing effects of the landing character, the parachuter and the parachute at the old positions are deleted at the same time as the print at the newer positions (the variables u and z contain the previous positions).

There is a lot of use of the CHR$ function, which allows colour and flash attributes to be stored in a string variable, see line 6. This is only done when it is convenient (or equivalent) in terms of the number of characters.

A subtle hint can be found at line 8, where the parachuter (a$) is drawn. Here a semicolon is inserted at the end of the PRINT command (PRINT … a$;): although it is not needed to save the cursor position, the PRINT command is faster. This trick is used only on this line: the remaining PRINT command are not systematically repeated and therefore do not show particular need of speed.

The final code is as follows:

1 FOR x=1 TO 6: READ a$: FOR y=0 TO 7: READ n: POKE USR a$+y,n: NEXT y: NEXT x: LET l=23659: LET j=l-99: LET x=RND*29: LET a$=CHR$ 145: LET s$=CHR$ 32
2 BORDER 5: PAPER 5: CLS : INK 4: PRINT AT 21,x;CHR$ 141+CHR$ 143+CHR$ 142: INK 3: FOR x=1 TO 10: PRINT AT 3+RND*16,RND*31;CHR$ 149: NEXT x: LET x=15: LET y=2
3 INK 0: LET t$="Landed!": PRINT AT 0,15;CHR$ 146+CHR$ 147+CHR$ 148;AT y-1,x;CHR$ 144;AT y,x;a$: PRINT #1; PAPER 1;TAB 31;s$: POKE l,0
4 PRINT AT 22,0; PAPER 1;TAB 31;s$: POKE l,2: DATA "a",16,56,124,254,254,68,108,170,"b",186,186,146,124
5 LET z=x: LET u=y: LET y=y+1: LET x=INT (x+RND*2-1)+(PEEK j=112 AND x<30)-(PEEK j=111 AND x>0): DATA 16,40,40,40,"c"
6 IF ATTR (y,x)=43 OR ATTR (y-1,x)=43 THEN LET t$="Bang!": LET a$=CHR$ 18+CHR$ 1+CHR$ 16+CHR$ 2+"*": GO TO 10: DATA 192,192,255,255
7 IF ATTR (y,x)=44 THEN GO TO 10: DATA 0,0,0,0,"d",8,254,255,255,255,125,63,15,"e",0,0,192,112
8 PRINT AT u-1,z;s$;AT u,z;s$;AT y-1,x;CHR$ 144;AT y,x;a$;: IF y<21 THEN GO TO 5: DATA 120,255,252,24,"f",24,60
9 LET t$="Splash!": LET a$=s$: POKE l,0: PRINT AT 22,x; INK 7; PAPER 1;"o": POKE l,2: DATA 126,255,126,90,153,24
10 PRINT AT u-1,z;s$;AT u,z;s$;AT y-1,x;s$;AT y,x;a$: BORDER 1: PAPER 1: INK 7: PRINT AT 12,(32-LEN t$)/2;t$: PAUSE 1: PAUSE 0: RUN

Finally, by replacing each BASIC token with a single character and removing blank spaces, each line in the resulting source code does not exceed the 80 characters limit:


In the previous text, letters refer to the original ZX Spectrum keyboard (for example “p” for PRINT and “P” for TAB).

Have fun with PARA2023!


howtorun.txt 240 bytes
para2023.bas 1 kB
para2023_intro.pdf 1 MB
para2023_token.txt 2 kB
para2023.tap 1 kB
para2023.txt 5 kB
para2023.z80 2 kB

Install instructions

PARA2023: A ZX Spectrum Game

By Massimiliano Arca, 2023

To start the game:

1) open the file para2023.z80 in an emulator


2) open the file para2023.tap in an emulator, then press "R" and ENTER to start the game.

Have fun with PARA2023!

Leave a comment

Log in with itch.io to leave a comment.