Post Reply 
(75C) Breakout for HP75C
01-03-2021, 06:18 PM (This post was last modified: 01-05-2021 02:04 PM by Howard Owen.)
Post: #1
(75C) Breakout for HP75C
Here's a printout of the BREAKOUT game included on the Museum's 00075-13007 Games II LIF file. The game requires an HP 82163A and compatible display or equivalent. The display emulation included with pyilper connected via a PIL-Box works fine. To prepare a unicode text listing for conversion to basic use the lifutils (that come with pyilper) like this:

Code:

textlif75 -n  BREAKOUT <breakout.txt | lifput mylif.dat

Then, on the 75, type something like the following:
Code:

copy 'breakout:m1' to 'breakout'
transform 'breakout' into basic

One additional step is needed after transforming the file to basic. On lines 1110 and 1120, the variables N1 and N2 should be replaced with '⍺' ([shift][I/R][up arrow]) and 'β' ([shift][I/R][down arrow]) respectively. The given quotes should be preserved.

It's a lot easier to load this guy from LIF collection for the 75 (/HP%20Museum%20V8/data/cd27/sw/75swsftp.zip in the museum documents collection) but this technique should work for any other 75 BASIC listing you might run across.

Code:

10 ! Breakout- video game
20 ! Requires 82163A
30 !
40 ! Revision 11/01/82
50 !
60 OPTION BASE 1
70 DIM E$[1],L$[1],B$[1],S$[1],C$[4],A$[2],A0$[3],A3$[3],A5$[3],K$[1],U$[6],D$[6]
80 INTEGER T(6,13),X,Y,X0,Y0,I,J,S,B,M,U,V,P,T,H
90 E$=CHR$(27) @ L$=CHR$(10) @ B$=CHR$(8) @ S$=CHR$(160)
100 C$=E$&'E'&E$&'<'
110 A$=E$&'%' @ A0$=A$&CHR$(0) @ A3$=A$&CHR$(3) @ A5$=A$&CHR$(5)
120 U$=S$&L$&L$&L$&B$&' '
130 D$=' '&L$&L$&L$&B$&S$
140 H=0
150 RANDOMIZE
160 PRINTER IS ":TV" @ PWIDTH INF @ PRINT C$
170 PRINT 'Do you wish to play Break-Out   or Break-Thru?   Break-';
180 K$=UPRC$(KEY$)
190 IF K$="O" THEN M=-1 @ PRINT "Out" @ GOTO 220
200 IF K$="T" THEN M=1 @ PRINT "Thru" @ GOTO 220
210 GOTO 180
220 PRINT
230 PRINT "Auto or Normal mode? ";
240 K$=UPRC$(KEY$)
250 IF K$="A" THEN A=1 @ PRINT "Auto" @ GOTO 300
260 IF K$="N" THEN A=0 @ PRINT "Normal" @ GOTO 280
270 GOTO 240
280 PRINT
290 PRINT 'Use up/down arrows to move      paddle; any key to serve ball'
300 ! Construct playing board
310 WAIT 5 @ PRINT C$
320 ! Build frame
330 FOR I=0 TO 31 @ PRINT A$;CHR$(I);CHR$(0);S$; @ NEXT I
340 FOR I=1 TO 13 @ PRINT A$;CHR$(31);CHR$(I);S$; @ NEXT I
350 FOR I=31 TO 0 STEP -1 @ PRINT A$;CHR$(I);CHR$(14);S$; @ NEXT I
360 ! Build targets
370 FOR J=1 TO 6 @ FOR I=1 TO 13
380 T(J,I)=1
390 PRINT A$;CHR$(2*J+16);CHR$(I*(1-MOD(J,2))+(13-MOD(J,2)*(I-1))*MOD(J,2));S$;
400 NEXT I @ NEXT J
410 ! Initialize ball, score, paddle, target count
420 B,S=0 @ P=7 @ T=78
430 ! Serve ball: build paddle, get ball & coordinates, show score, wait for key
440 PRINT A0$;CHR$(P-1);S$;L$;B$;S$;L$;B$;S$;
450 R=0 @ B=B+1 @ IF B>5 THEN 960
460 IF A THEN GOTO 480
470 IF KEY$='' THEN GOTO 470
480 GOSUB 1150
490 X0=14 @ Y0=INT(26*RND)+2 @ U=-1 @ V=INT(5*RND)-2
500 ! Find next point; let paddle move
510 X=X0+U @ Y=Y0-V
520 GOSUB 1100
530 ! Did ball hit walls?
540 IF Y<2 OR Y>27 THEN V=-V @ GOTO 780
550 ! Did ball hit end?
560 IF X>30 THEN U=-U @ R=1 @ GOTO 780
570 ! Did ball miss paddle?
580 IF X<0 THEN GOTO 870
590 ! Did ball hit paddle?
600 IF X=0 AND (Y0\2>=P-1 AND Y0\2<=P+1 OR Y\2>=P-1 AND Y\2<=P+1) THEN GOTO 810
610 ! Ball in target range?
620 IF X>=18 AND X<=28 AND MOD(X,2)=0 THEN GOTO 670
630 ! Move ball, go find next point
640 GOSUB 1050
650 GOTO 510
660 ! Did ball hit target?
670 I=(X-18)\2+1 @ J=Y\2
680 IF NOT T(I,J) THEN GOTO 640
690 ! Process target hit
700 BEEP X*40+500,.05 @ T(I,J)=0 @ S=S+(I+3)*2 @ T=T-1
710 U=U*M
720 IF NOT R AND M<0 THEN U=-ABS(U)
730 GOSUB 1050
740 GOSUB 1150
750 IF T=0 THEN 910
760 GOTO 510
770 ! Process wall or end hit
780 X=X0 @ Y=Y0 @ BEEP 400,.05
790 GOTO 640
800 ! Process paddle hit
810 IF V=0 THEN V=V+INT(3*RND)-1
820 U=-U @ Y=Y0 @ X=X0 @ BEEP 600,.05
830 IF Y0\2<=P-1 AND V<0 OR Y0\2>=P+1 AND V>0 THEN V=-2*SGN(V)
840 V=V+INT(3*RND)-1 @ IF ABS(V)>2 THEN V=2*SGN(V)
850 GOTO 640
860 ! Process paddle miss
870 BEEP 20,.5
880 PRINT A0$;CHR$(Y0\2);' ';
890 GOTO 440
900 ! Cleared board: show bonus, score, restart
910 PRINT A$;CHR$(X0);CHR$(Y0\2);' ';
920 PRINT A3$;CHR$(3);'Bonus for';6-B;'balls left:';150*(6-B);
930 S=S+150*(6-B)
940 GOSUB 1150
950 ! Out of balls if entered here
960 IF S>H THEN H=S
970 PRINT A3$;CHR$(5);'High:';H;
980 PRINT A3$;CHR$(7);'Again? ';
990 K$=UPRC$(KEY$) @ IF A THEN K$="Y"
1000 IF K$='Y' THEN PRINT 'Yes' @ GOTO 310
1010 IF K$#'N' THEN GOTO 990
1020 PRINT C$
1030 END
1040 ! Move ball subroutine
1050 PRINT A$;CHR$(X0);CHR$(Y0\2);' ';
1060 PRINT A$;CHR$(X);CHR$(Y\2);'*';
1070 X0=X @ Y0=Y
1080 RETURN
1090 ! Move paddle subroutine
1100 K$=UPRC$(KEY$)
1110 IF (K$='α' OR A AND Y0\2<P) AND P>2 THEN P=P-1 @ PRINT A0$;CHR$(P-1);U$;
1120 IF (K$='β' OR A AND Y0\2>P) AND P<12 THEN PRINT A0$;CHR$(P-1);D$; @ P=P+1
1130 RETURN
1140 ! Show score subroutine
1150 PRINT A5$;CHR$(15);'Ball:';B;'   Score:';S;
1160 RETURN


Regards,
Howard
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)