Wall81 (Sinclair ZX81] by lupoman
A downloadable game
[WALL81] ----------------------------------------------------------------------
BY LUIS PIERI
[COMPO] -----------------------------------------------------------------------
CATEGORY : PUR-120
LINK : https://lupoman.itch.io/Wall81
DATE : 04-FEB-2025 TO 21-FEB-2025
COMPO : BASIC 10 LINER CONTEST
https://gkanold.wixsite.com/homeputerium/rules2025
DEADLINE : April 5th, 2025
[IDEA] ------------------------------------------------------------------------
Destroy the incoming radioactive blocks, using your ship laser!
Contain the contamination while you can, if the contamination reach the left is game over.
Use the E key to go up and the D key to go down
Autofire is enabled
[FILES] -----------------------------------------------------------------------
In the ZIP file you will find:
- Wall81.p : the basic program to be loaded in the Zx81 or in a emulator
(see help section)
- Wall81.jpg : Screenshot of the game
- Wall81.gif : An animated gif to show the gameplay
- Wall81.bas : The version to be converted into .p developed in a modern
computer, much easier to work with and the converted with
ZXText2P (http://freestuff.grok.co.uk/zxtext2p/index.html)
- pur120proof.txt : A text file with the zx81 basic dump to calculate properly
then length of each line (taking into account token and
automatic spaces)
- wall81.txt : This file.
[HELP] ------------------------------------------------------------------------
- Open your favarite zx81 emulator
(EightyOne: https://sourceforge.net/projects/eightyone-sinclair-emulator/)
- Menu File -> Open Tape -> Select wall81.p
- The LOAD command will appear automcatically if not type L (LOAD Command)
and shift-p twice.
- Wait until "0/0" appears.
- If you press Enter (New Line in ZX81) key the listing will appear.
- Press R for RUN command and then enter.
- The game starts automatically, you can control your ship with 'E' and 'D',
autofire is enabled, so you dont have to worry to fire missiles.
- Destroy the blocks before the contamination reach the left of the screen.
- Randomly the contamination will spread, one row at a time.
- Please bear in mind that the ZX81 basic is slow, so the controls can be
sluggish.
- Below the playfield, you will see the score (increases with each block you
cleared).
[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/sentence
for code line.
- So its critical to store vars as string and use it as arrays
- Use Boolean expressions directly to the vars in order to save Ifs
- Use calculated GOTO to save lines and IFs
- Use one big print sentence.
# LINE 01 ---------------------------------------------------------------------
# INIT VARS
# All the vars are stored in one big string!
# the int values are encoded in char values, use CODE and CHR$!!!
#
# POS 1 = Y of player (PLY)
# POS 2 = X of missile (MISX)
# POS 3 = Y of missile (MISY)
# POS 4 = NROW (Current Row of the level 0..4, works like a for..next loop)
# POS 5 = AROW (Precalculated start pos of the row in A$, to save time and space)
# POS 6 = old player Y (OLPLY1)
# POS 7 = HIT STATUS (STATUS if the missile hit a block a 1 is stored else a 0)
# POS 8 = Score (SCORE)
# POS 9 = oldx missile (OLDMX)
# POS 10= oldy missile (OLDMY)
# POS 11= old NROW
# |PLY Y |MISX |MISY |NROW |AROW |OLD PY|HIT ST|SCORE |OLD MX|OLD MY|OLD NROW
1 LET B$=CHR$ 2+CHR$ 0+CHR$ 2+CHR$ 0+CHR$ 0+CHR$ 0+CHR$ 0+CHR$ 0+CHR$ 0+CHR$ 2+CHR$ 0
# LINE 02 ---------------------------------------------------------------------================================================
# INIT NEW LEVEL (5 rows by 15 columns)
# 111111111122222222223333333333444444444455555555556666666666777777
# 123456789012345678901234567890123456789012345678901234567890123456789012345
2 LET A$ = " OOOO OOOO OOOO OOOO OOOO"
# LINE 03 ---------------------------------------------------------------------================================================
# PRINT LEVEL
# print the full level in one print, no for loops to save lines...
#
3 PRINT AT 0,0;A$(TO15);"\::";AT 1,0;A$(TO15);"\::";AT 2,0;A$(TO15);"\::";AT 3,0;A$(TO15);"\::";AT 4,0;A$(TO15);"\::"
# LINE 04 ---------------------------------------------------------------------================================================
# UPDATE VARS (LOOP START)
# You can update all the vars in one line just using "clever" evaluated expressions
# Update Y of player, X,Y of missile, oldplayer y, hitstatus
#
# | PLAYER Y | MISSILE X | MISY-MISC | OLDPY | HIT STATUS | Score | OLDMX | OLDMY | OLD NROW
4 LET B$=CHR$(CODE B$(1)-(INKEY$="E" AND CODE B$(1)>0)+(INKEY$="D" AND CODE B$(1)<4)) + CHR$(CODE B$(2)+1) + B$(3 TO 5) + B$(1) + CHR$(A$(CODE B$(3)*15+2+CODE B$(2))="O") + B$(8) + B$(2TO4)
# LINE 05 ---------------------------------------------------------------------================================================
# UPDATE VARS II
# Update NROW, AROW, Score. We need to split this in order to comply with 120 chars or less per line
#
# | Start | NROW | AROW | Mid str | SCORE | END
5 LET B$=B$(TO3) + CHR$((CODE B$(4)+1)*(CODE B$(4)<4)) + CHR$( CODE B$(4)*15+1) + B$(6TO7) + CHR$(CODE B$(8)+CODE B$(7)) + B$(9TO)
# LINE 06 ---------------------------------------------------------------------================================================
# MISSILE COLLISION WITH LEVEL
# If the hit status flag is set
# Erase the correspoding block in the level string A$
#
6 IF CODE B$(7)=1 THEN LET A$ = A$(TO (CODE B$(3)*15+CODE B$(2))-1)+" "+A$(CODE B$(3)*15+2+CODE B$(2) TO)
# LINE 07 ---------------------------------------------------------------------================================================
# SCROLL LEVEL (one row at a time)
# Only 30% Chance to advance towards the player
7 IF RND*100>70 THEN LET A$=A$(TO CODE B$(5)-1)+A$(CODE B$(5)+1 TO CODE B$(5)+14)+A$(CODE B$(5)+14 TO)
# LINE 08 ---------------------------------------------------------------------================================================
# PRINT LEVEL, MISSILE, PLAYER & SCORE
#
# | Horizontal sector of the wall | Print Missile | ERASE OLD MISSILE | ERASE PLAYER | PRINT PLAYER | SCORE
8 PRINT AT CODE B$(11),0;A$(CODE B$(5) TO CODE B$(5)+14);AT CODE B$(3),CODE B$(2);CHR$ NOT CODE B$(7);AT CODE B$(10),CODE B$(9);" ";AT CODE B$(6),0;" ";AT CODE B$(1),0;"%X";AT 7,0;CODE B$(8)
# LINE 09 ------------------------------------------------------------------===================================================
# RESET MISSILE IF HIT SOMETHING OR GO TO FAR RIGHT
# Check if the missile hit a block or goes behind the wall and then reset missile
#
9 IF CODE B$(7)=1 OR CODE B$(2)>14 THEN LET B$ = B$(1)+CHR$(0)+B$(1)+B$(4TO8)+B$(2)+B$(3)+B$(11)
# LINE 10 ---------------------------------------------------------------------================================================
# END OF LOOP
# The game status conditions are checked here
# Go to top of the loop (line 4, update vars...)
# or if gameover go to line 1 (check if there's one block to same column player)
# or if win go to line 2 to start a new level (check if all right blocks are empty)
#
10 GOTO 4-3*(CODE A$(CODE B$(5))>0)-2*(CODE A$(15)+CODE A$(30)+CODE A$(45)+CODE A$(60)+CODE A$(75)<1)
[END] -------------------------------------------------------------------------
Leave a comment
Log in with itch.io to leave a comment.