Breakwall is a Breakout game: move the bat to keep the ball in play and knock bricks out of a seven-colour wall. You have four balls; the score and remaining balls are shown at the top, and at the end it asks whether you want another game.
The REMs credit David Beales.
Program Analysis
A 64-byte machine-code routine is poked into memory reserved with RESPR and used through the udg function to print user-defined graphics; wall, bat and ball draw the wall, bat and ball.
It came from a QL owner’s floppy copies of QUANTA and IQLUG library material, imaged double-stepped so that only half of each disk survived; this file read back complete. The download holds the files exactly as recovered and a QL5A floppy image, Breakwall.img, with the same files and their QDOS headers. Mount the image as FLP1_ (drop it on the QLRun page, or use it as a floppy image in sQLux, QPC2 or Q-emuLator) and type lrun flp1_breakwall_bas.
Tested in QLRun with the JS ROM: a game in progress.
Source Code
100 REMark
110 REMark "Breakwall"
120 REMark
130 REMark By David Beales
140 REMark
150 RESTORE
160 a=RESPR(64)
170 FOR i=0 TO 46 STEP 2
180 READ x:POKE_W a+i,x
190 END FOR i
200 DEFine FuNction udg (chan,start,num)
210 LOCal space
220 space=RESPR(2+9*num)
230 CALL a,chan,space,start,num
240 RETurn space+2
250 END DEFine
260 DATA 8302,48,-15620,40,-11839
270 DATA -19986,52,27676,8246,-30720
280 DATA 27926,8256,28672,-27703,9282
290 DATA 5251,21316,5444,1,28709
300 DATA 20035,20085,28922,20085
310 chars=udg(1,128,1)
320 FOR i=0 TO 8:POKE chars+i,0:NEXT i
330 POKE chars+2,56:POKE chars+6,56:FOR i=3 TO 5:POKE chars+i,124:NEXT i
340 tot=1
350 norm:x1=11:x=19:y=16:a=-1:B=-1:xa=17:ya=17
360 WINDOW 512,256,0,0
370 c=4:wall:bat:move_bat
380 DEFine PROCedure wall
390 FOR i=60 TO 120 STEP 10
400 FOR j=48 TO 432 STEP 32 :BLOCK 28,8,j,i,i/10-5
410 END FOR i
420 PAPER 0
430 END DEFine
440 DEFine PROCedure bat
450 AT 22,x1:PRINT " ":BLOCK 62,8,(x1+2)*16,220,7
460 END DEFine
470 DEFine PROCedure move_bat
480 IF KEYROW(1)=2 THEN x1=x1-2:test1:bat:ball:GO TO 480
490 IF KEYROW(1)=16 THEN x1=x1+2:test2:bat:ball:GO TO 490
500 ball
510 GO TO 480
520 DEFine PROCedure test1:IF x1=-1 THEN x1=x1+2
530 END DEFine
540 DEFine PROCedure test2:IF x1=25 THEN x1=x1-2
550 END DEFine
560 DEFine PROCedure ball
570 spotb x,y,1
580 AT ya,xa:PRINT " ":AT y,x:PRINT CHR$(128)
590 IF x<4 OR x>27 THEN LET a=a-(a*2):BEEP 2,7
600 IF y<3 THEN B=B-(B*2):BEEP 2,7
610 IF y>15 THEN spotb x,y+1,2
620 IF y=24 THEN AT y,x:PRINT " "
630 IF y=24 THEN x=RND(4 TO 26)
640 IF y=24 AND x>x1-2 AND x<x1+10 THEN GO TO 630
650 IF y=24 THEN
660 B=ABS(B)-(ABS(B)*2):c=c-1:FOR i=1 TO 7:BEEP 2,7
670 PAUSE (200):AT 1,3:CLS 3:score 0
680 END IF
690 IF y<15 AND y>2 THEN spota x-1,y:spota x+1,y:spotb x,y-1,0:spotb x,y+1,0
700 IF c=-1 THEN ends
710 AT 1,3:PRINT "balls="!FILL$(CHR$(128),c):score 0
720 xa=x:ya=y
730 x=x+a:y=y+B
740 END DEFine
750 DEFine PROCedure spota(x2,y2)
760 IF (PEEK(131712+(1280*y2)+(4*x2))<>0 OR PEEK(131713+(1280*y2)+(4*2))<>0) THEN
770 a=a-(a*2):AT y2,INT((x2+1)/2)*2-1:PRINT " ":BEEP 2,7:score 1
780 END IF
790 END DEFine
800 DEFine PROCedure spotb(x2,y2,switch)
810 IF (PEEK(131712+(1280*y2)+(4*x2))<>0 OR PEEK(131713+(1280*y2)+(4*x2))<>0) THEN
820 B=B-(B*2):spotc:BEEP 2,7
830 END IF
840 IF ya>22 THEN B=ABS(B)-(ABS(B)*2)
850 END DEFine
860 DEFine PROCedure spotc
870 IF switch=0 THEN AT y2,INT((x2+1)/2)*2-1:PRINT " ":BEEP 2,7:score 1
880 IF switch=1 AND y<15 THEN AT y2,INT((x2+1)/2)*2-1:PRINT " ":BEEP 2,7:score 1
890 IF switch=1 THEN a=-a:GO TO 730
900 IF switch=2 THEN B=ABS(B)-(ABS(B)*2)
910 END DEFine
920 DEFine PROCedure score(val)
930 tot=tot+val:AT 1,17:PRINT "score="!tot-1
940 IF tot/92=INT(tot/92)THEN tot=tot+1:GO TO 350
950 END DEFine
960 DEFine PROCedure ends
970 CLS:AT 11,9:PRINT "another game?":AT 12,12:PRINT "y or n":in$=INKEY$(1000)
980 IF in$="y" THEN RUN
990 IF in$="" THEN GO TO 970
1000 GO TO 1020
1010 END DEFine
1020 norm:MODE 4
1030 CLS:PRINT #0, "You are in SuperBASIC"
1040 DEFine PROCedure norm
1050 WINDOW #0,422,30,40,210
1060 WINDOW #1,422,192,40,18
1070 WINDOW #2,422,192,40,18
1080 PAPER #1,0 : PAPER #2,0
1090 INK #1,4 : INK #2,4
1100 MODE 8
1110 CSIZE 1,0
1120 CSIZE #0,1,0
1130 END DEFineNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
