PARA2023 (Sinclair ZX Spectrum) by Massimiliano Arca

Add to
My games
Add to
Wishlist
Save to
Collection
No reviews
Exceptional
Meh
Skip

About

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:

1fx=1F6:Aa$:fy=0F7:An:oLa$+y,n:ny:nx:ll=23659:lj=l-99:lx=T*29:la$=U145:ls$=U32 2b5:C5:v:X4:pI21,x;U141+U143+U142:X3:fx=1F10:pI3+T*16,T*31;U149:nx:lx=15:ly=2 3X0:lt$="Landed!":pI0,15;U146+U147+U148;Iy-1,x;U144;Iy,x;a$:p#1;C1;P31;s$:ol,0 4pI22,0;C1;P31;s$:ol,2:D"a",16,56,124,254,254,68,108,170,"b",186,186,146,124 5lz=x:lu=y:ly=y+1:lx=R(x+T*2-1)+(Oj=112Yx<30)-(Oj=111Yx>0):D16,40,40,40,"c" 6uL(y,x)=43UL(y-1,x)=43Glt$="Bang!":la$=U18+U1+U16+U2+"*":g10:D192,192,255,255 7uL(y,x)=44Gg10:D0,0,0,0,"d",0,0,8,254,255,255,255,125,63,15,"e",0,0,192,112 8pIu-1,z;s$;Iu,z;s$;Iy-1,x;U144;Iy,x;a$:uy<21Gg5:D120,255,252,24,"f",24,60 9lt$="Splash!":la$=s$:ol,0:pI22,x;X7;C1;"o":ol,2:D126,255,126,90,153,24 10pIu-1,z;s$;Iu,z;s$;Iy-1,x;s$;Iy,x;a$:b1:C1:X7:pI12,(32-Kt$)/2;t$:m1:m0:r

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!

Platforms
Genre
Release date
Developer
BASIC 10Liner
Age rating
Not rated

System requirements for PC

Read more...
PARA2023 (Sinclair ZX Spectrum) by Massimiliano Arca screenshot, image №3841356 - RAWG
Edit the game info
Last Modified: Mar 27, 2023

Where to buy

itch.io