Keep the finished program from lesson nine. This lesson changes no numbered lines. We want a tape that starts at the instructions and reconstructs the graphics and wall for itself.
Save the entry point
Press Q to return to BASIC. Follow the Meet BASIC tape workflow using this unnumbered command:
SAVE "bricks" LINE 10LINE 10 records where execution should begin after loading. That line installs the six custom characters and visits the title before initialising the round. Starting in the middle could rely on graphics or variables left behind by a previous run.
Follow the ROM’s recording prompt, then export the recording through your emulator’s tape controls. Keep the readable source too. Check which recording you export if the tape contains more than one program.
Load into a fresh session
Start a fresh 48K Spectrum session, attach the tape and enter:
LOAD "bricks"Start playback. The title should appear automatically. If the ROM keeps searching, check the recording name, tape position and playback. If the wrong version appears, check which tape was attached.
Press S, move the waiting ball and serve. Make a catch, miss deliberately, retry and check that all eighteen bricks return. Play through a clearance, then retry and quit. This checks that the saved program can recreate a round without depending on the old session’s memory.
Does a saved picture of eighteen bricks preserve the rules of the game?
Show the explanation
No. The game needs its program, character data and initialisation. The picture cannot tell a fresh BASIC session how to move the ball, remember removed bricks or restart a round.
Complete Brick Bash program
10 GO SUB 7000: GO SUB 5000
100 DIM g(3,6): LET left=18: LET p=14: LET x=127: LET y=40
110 LET dx=4: LET dy=4: LET served=0: LET steps=0
120 FOR r=1 TO 3: FOR c=1 TO 6: LET g(r,c)=1: NEXT c: NEXT r
130 GO SUB 1000: GO SUB 3000
200 LET k$=INKEY$
210 IF k$="q" OR k$="Q" THEN GO TO 9000
220 IF k$="r" OR k$="R" THEN GO TO 100
230 LET oldp=p
240 IF k$="o" OR k$="O" THEN LET p=p-1
250 IF k$="p" OR k$="P" THEN LET p=p+1
260 IF p<2 THEN LET p=2
270 IF p>26 THEN LET p=26
280 IF p<>oldp THEN PRINT AT 18,oldp;" ";AT 18,p; INK 7;p$
290 IF served=1 THEN GO TO 350
300 IF k$=" " THEN LET served=1: PRINT AT 1,2;"Clear every brick. ": GO TO 350
310 IF p=oldp THEN GO TO 200
320 GO SUB 3000: LET x=8 *p+15: GO SUB 3000: GO TO 200
350 LET nx=x+dx: LET ny=y+dy
360 IF nx<16 THEN LET nx=32 -nx: LET dx=ABS dx
370 IF nx>238 THEN LET nx=476 -nx: LET dx=-ABS dx
380 IF ny>149 THEN LET ny=298 -ny: LET dy=-ABS dy
390 IF ny>=32 THEN GO TO 440
400 IF nx+1 <8 *p OR nx>8 *p+31 THEN LET e$="Missed! R for another go.": GO TO 4000
410 LET ny=64 -ny: LET dy=4: LET dx=0
420 IF nx+1 <8 *p+11 THEN LET dx=-4
430 IF nx>8 *p+20 THEN LET dx=4
440 LET tx=nx: LET ty=y: GO SUB 2000
450 IF hit=1 THEN LET dx=-dx: LET nx=x: GO SUB 2500
460 LET tx=nx: LET ty=ny: GO SUB 2000
470 IF hit=1 THEN LET dy=-dy: LET ny=y: GO SUB 2500
480 IF left=0 THEN LET e$="Wall cleared! Nicely done.": GO TO 4000
490 GO SUB 3000
500 LET x=nx: LET y=ny: LET steps=steps+1
510 GO SUB 3000: GO TO 200
1000 BORDER 0: PAPER 0: INK 7: CLS
1010 PRINT AT 0,2; INK 5;"BRICK BASH";AT 0,21; INK 7;"BRICKS 18"
1020 PRINT AT 1,2;"SPACE serves. O/P move."
1030 PLOT INK 1;15,16: DRAW INK 1;0,136: DRAW INK 1;225,0: DRAW INK 1;0,-136
1040 FOR r=1 TO 3: LET inkcol=6
1050 IF r=2 THEN LET inkcol=3
1060 IF r=3 THEN LET inkcol=5
1070 FOR c=1 TO 6: PRINT AT 2+2*r,4*c; INK inkcol;b$: NEXT c: NEXT r
1080 PRINT AT 18,p; INK 7;p$
1090 PRINT AT 21,2; INK 5;"O/P move R retry Q quit";
1100 RETURN
2000 LET hit=0: LET br=1 +INT ((143 -ty)/16): LET bc=1 +INT ((tx+1 -32)/32)
2010 IF br<1 OR br>3 OR bc<1 OR bc>6 THEN RETURN
2020 IF ty+1 <152 -16 *br OR tx>32 *bc+23 THEN RETURN
2030 IF g(br,bc)=0 THEN RETURN
2040 LET hit=1: RETURN
2500 LET g(br,bc)=0: LET left=left-1
2510 PRINT AT 2+2*br,4*bc;" ";AT 0,28; INK 7;left;" "
2520 RETURN
3000 PLOT INK 7; OVER 1;x,y: DRAW INK 7; OVER 1;1,0: DRAW INK 7; OVER 1;0,1: DRAW INK 7; OVER 1;-1,0: RETURN
4000 PRINT AT 1,0;" ";AT 1,2; INK 6;e$
4010 PRINT AT 21,2; INK 7;"R plays again Q quits ";
4020 IF INKEY$<>"" THEN GO TO 4020
4030 LET k$=INKEY$
4040 IF k$="q" OR k$="Q" THEN GO TO 9000
4050 IF k$="r" OR k$="R" THEN GO TO 100
4060 GO TO 4030
5000 BORDER 0: PAPER 0: INK 7: CLS
5010 PRINT AT 3,11; INK 5;"BRICK BASH"
5020 PRINT AT 6,3;"One ball. Eighteen bricks."
5030 PRINT AT 9,3;"O left P right"
5040 PRINT AT 11,3;"SPACE serves when ready."
5050 PRINT AT 13,3;"Use the paddle edges to aim."
5060 PRINT AT 15,3;"Clear the wall to finish."
5070 PRINT AT 17,3;"R retries. Q quits."
5080 PRINT AT 20,10; INK 6;"S starts."
5090 LET k$=INKEY$
5100 IF k$="q" OR k$="Q" THEN GO TO 9000
5110 IF k$<>"s" AND k$<>"S" THEN GO TO 5090
5120 RETURN
7000 RESTORE 7200: FOR j=0 TO 47: READ v: POKE USR "a"+j,v: NEXT j
7010 LET b$=CHR$ 144 +CHR$ 145 +CHR$ 146
7020 LET p$=CHR$ 147 +CHR$ 148 +CHR$ 148 +CHR$ 149: RETURN
7200 DATA 127,255,255,255,255,255,255,127
7210 DATA 255,255,255,255,255,255,255,255
7220 DATA 254,255,255,255,255,255,255,254
7230 DATA 63,127,127,63,0,0,0,0
7240 DATA 255,255,255,255,0,0,0,0
7250 DATA 252,254,254,252,0,0,0,0
9000 PAPER 0: INK 7: PRINT AT 21,0;"Finished. RUN to try again. ";: STOPKeep the representations separate
The six character designs and program are original course material under the samples repository’s MIT licence. The brick array decides which obstacles exist; rectangle coordinates decide contact; the character data decides how they look.
For a small experiment, change a brick row’s colour at lines 1040–1060 and predict what will happen to collision. Play to check it. The same rectangles and live entries should produce the same rules. Restore your preferred colours before saving the version you want to keep.
We have a complete one-wall game: catch, aim, clear or miss, and try again. Keep this version before experimenting with different dimensions or movement amounts. Those values work together; a larger step can cross a thin obstacle without ever landing inside it.
Sources
Steven Vickers, edited by Robin Bradbeer, ZX Spectrum BASIC Programming, second edition (Sinclair Research, 1983), chapters 20.
Run it here
This unit's program, built for you.
- Program
- brick-bash.tap
- Machine
- ZX Spectrum 48K (PAL)