A downloadable game for Windows, macOS, Linux, and Android

Download NowName your own price

Zx81 Basic program entry for BASIC 10Liner Contest. 


IDEA

You control a spider robot running through long corridors in a Moon base, you need to escape with all the data!

The walls are magnetic and destroy the robot!


INSTRUCTIONS

  1.   Open zx81 emulator (EightyOne: https://sourceforge.net/projects/eightyone-sinclair-emulator/)
  2.   Menu File -> Open Tape -> Select corridors81.p
  3.   The LOAD command will appear automcatically if not type L (LOAD Command) and shift-p twice 
  4.   Wait until "0/0" appears
  5.   If you press Enter (New Line in ZX81) key the listing will appear.
  6.   Press R for RUN command and then enter
  7.   You need to wait for the level to finish drawing, but you can start moving with the keys 5 and 8 (cursors keys in ZX81)
  8.   Then the level will scroll down and you can try to advance without touching the white walls.
  9.   Please bear in mind that theres a little delay (lag...) between you press the key and you start moving.
  10.   I worked a lot around this, but the zx81 basic is too slow, you can crank up the emulation speed if you want!
  11.   A good strategy to handle this lag is to press the key (5 or 8) and say "one" and then release the key, the lag is part of the gameplay :-) because the robot is in the moon... :-)
  12.   In the top left corner, you will see the score (increases with each sector you cleared).
  13.   When you touch a wall the score resets back to 0 and a new level start.


CODE EXPLANATION 

  •   The code below is formated to be converted with the utility ZXText2P.
  •   Once converted the lines are much shorter in the ZX81 Basic.
  •   You can see the final listing opening the .P file on the emulator.
  •   Please bear in mind that ZX81 Basic only supports one statement for code line.


LINE 01 

This code is to init all the vars in a string, this is the only way to get

10 lines, the idea behind this is from Marco's retrobits (https://retrobits.itch.io/)

 Init vars players + 2 sectors y and type

 all the vars are stored in one big string!

 the int values are encoded in char values, use CODE and CHR$!!!

 POS 1 = X of player

 POS 2 = Y of Sector 1

 POS 3 = Y of Sector 2

 POS 4 = older X of player

 POS 5 = flip 0/1 not used

 POS 6 = Type of Sector 1

 POS 7 = Type of Sector 2

 POS 8 = Score (is up to 255 points then resets back to 0)

1 LET A$=CHR$ 16+CHR$ 13+CHR$ 5+CHR$ 16+CHR$ 0+CHR$ 1+CHR$ 3+CHR$ 0


LINE 02 

 This setups all the types of sectors in a long string

 Init sector data AT 1+Type(I) TO 1+Type(I)*8

 escape secuences for converting using ZXText2P

              <--5-->

 Sector 01 = "X.....X" 

 Sector 02 = "X..X..X" 

 Sector 03 = "X.X.X.X"  

 Sector 04 = "XX...XX"

 Sector 05 = "X.XXX.X"

 Sector 06 = "XXX.XXX"

 Sector 07 = "XXXX..X"

 Sector 08 = "X..XXXX"

 The sector data does not include the borders

 I'm using inverse chars for the corridor pathway

2 LET S$="\::\::\::\::\::\::\::\  \::\::\::\  \::\  \::\  \::\::\::\  \::\  \  \  \::\  \  \::\  \  \  \  \  \::\::\::\::\  \  \  "


LINE 03

 Update player X pos with the pressed key

 Update y pos of each sector

 Saves the previous X player

 Copy the last 3 chars of the string (3 last vars)

 The last byte is score and the previous was a ver to flip between 0 and 1, not used anymore, it was used before for animating the player and a way to For..Next loop for the sectors.

 The key of this program is the powerfull ZX81 Basic's String slicing!

3 LET A$=CHR$(CODE A$(1)-(INKEY$="5")+(INKEY$="8"))+CHR$(CODE A$(2)+1)+CHR$(CODE A$(3)+1)+A$(1)+A$(5TO)


LINE 04

 Print sector 1 and also prints a clear section below to allow the player to

 switch more easily between corridors.

4 PRINT AT CODE A$(2),14;S$(CODE A$(6)*5-4 TO CODE A$(6)*5);AT CODE A$(2)+1,14;"\::\::\::\::\::"


LINE 05

 Print sector 1 and also prints a clear section below to allow the player to

 switch more easily between corridors.

 This line and the one before could be easily converted to one line using the

 the var that flip 0 and 1, but you would get a more longer line then!

5 PRINT AT CODE A$(3),14;S$(CODE A$(7)*5-4 TO CODE A$(7)*5);AT CODE A$(3)+1,14;"\::\::\::\::\::"


LINE 06

 Check for Player collision, I'm peeking the dfile directly:

  DFILE + x + y*33  

 First you need to get the dfile location and then you peek it!

 The y*33 value is precalculated because it never changes.

 if there's a white wall then Restart the game!

6 IF PEEK(PEEK 16396+PEEK 16397*256+496+CODE A$(1))=0 THEN GOTO 1


LINE 07

 Delete player previous position and then Print player

7 PRINT AT15,CODE A$(4);"\::";AT15,CODE A$(1);"%*";AT1,1;CODE A$(8);" "


LINE 08

 Check if sector 1 reach bottom of screen, reset y=0 and type sector to rnd() 

 Increase the score by 1.

 Important you need to take care to copy the rest of the vars in the string!

8 IF CODE A$(2)>17 THEN LET A$=A$(1)+CHR$ 0+A$(3TO5)+CHR$(INT(RND*7)+2)+A$(7)+CHR$(CODE A$(8)+1)


LINE 09

 Check if sector 2 reach bottom of screen, reset y=0 and type sector to rnd() 

 Increase the score by 1.

 As stated before this 2 lines could be condensed in one, using the var that

 flip 0/1, but then the line would be too long for the compo.

9 IF CODE A$(3)>17 THEN LET A$=A$(TO2)+CHR$ 0+A$(4TO6)+CHR$(INT(RND*7)+2)+CHR$(CODE A$(8)+1)


LINE 10

 Go to top of the loop (line 3, update vars...)

10 GOTO 3

Download

Download NowName your own price

Click download now to get access to the following files:

Corridors81.zip 201 kB

Leave a comment

Log in with itch.io to leave a comment.