ZX81 Listing for et23.p


ZX81 program listing for **E.T.**SLR/1985/2023**

**E.T.**SLR/1985/2023** (et23.p)

My semi-optimized version of E.T. to make it more playable in BASIC. This version fixes a number of bugs and issues from the original game. These include each pit having different contents, power pills that work, and a more interesting intro with Elliott taking E.T. home.

Loosely based on the Atari 2600 E.T. game, this is my single board game for the ZX81. Use A and Z to move up or down, and N and M to move left or right. Instructions for E.T. are available off my old ZX81 website.


SYSTEM VARIABLES

PROG  : 16509
D-FILE: 22278
VARS  : 23071
E-LINE: 23072
STKBOT: 23072
STKEND: 23072


LEGEND

9999 means line number
PRINT means treat as KEYWORD P


PROGRAM LISTING

  10 REM **E.T.**SLR/1985/2023**
  30 CLS
  40 FOR A=0 TO 21
  50 PRINT AT A,0;" ";AT A,31;" 
";AT 0,A;"          ";AT 21,A;" 
         "
  60 NEXT A
  62 PRINT AT 3,5;"±P²";AT 4,5;"
òóñ";AT 5,11;"±P²";AT 6,11;"òóñ"
;AT 8,4;"±P²";AT 9,4;"òóñ";AT 13
,5;"±P²";AT 14,5;"òóñ";AT 17,3;"
±P²";AT 18,3;"òóñ";AT 18,9;"±P²"
;AT 19,9;"òóñ"
  65 PRINT AT 12,25;"¸¸¸¸¸¸";AT
1,25;" ENRG:";AT 2,25;" >   <";
AT 3,25;"      ";AT 9,25;"!!!!!!
";AT 10,25;"¸   TE";AT 11,25;"¸ 
  LP"
  70 FOR A=4 TO 8
  80 PRINT AT A,25;"!    !"
  90 NEXT A
 100 PRINT AT 15,29;"³";AT 16,28
;"± ²";AT 17,28;" H ";AT 18,28;"
   "
 110 PRINT AT 21,0;"PRESS ENTER 
TO BEGIN GAME PLAY**"
 120 PAUSE 4E4
 130 PRINT AT 21,0;"            
                    "
 140 LET T=17
 150 LET Z=19
 160 LET A$=" K "
 170 LET D=2
 180 GOSUB 1000
 190 GOSUB 1300
 200 FOR A=27 TO Y1 STEP -1
 210 PRINT AT X,A;"R";AT X1,Y1;"
 "
 220 LET Y1=A
 221 LET X1=X
 230 NEXT A
 240 FOR A=Y1 TO 27
 242 PRINT AT X,A;"R";AT X1,Y1;"
 "
 244 LET Y1=A
 245 LET X1=X
 246 NEXT A
 247 PRINT AT X1,Y1;" "
 250 PRINT AT X,Y;"K";AT X1,Y1;"
 " AND (X1<>X OR Y1<>Y)
 260 LET X1=X
 270 LET Y1=Y
 290 LET X=X-(INKEY$="A")+(
INKEY$="Z")
 300 LET Y=Y-(INKEY$="N")+(
INKEY$="M")
 310 PRINT AT X,Y;
 320 LET P=PEEK (PEEK 16398+256*
PEEK 16399)
 330 IF X=Z-1 AND Y>=T AND Y<=T+
2 THEN LET C=1
 340 IF P=23 THEN GOSUB 2000
 350 IF P=0 OR P=176 OR P=23
THEN GOTO 400
 360 IF P=181 THEN GOSUB 500
 370 IF P=173 THEN GOSUB 700
 380 LET X=X1
 390 LET Y=Y1
 400 IF P<>181 THEN GOSUB 1500
 410 PRINT AT 2,27;N$(E(3));N$(E
(2));N$(E(1))
 420 IF C=1 THEN PRINT AT Z,T;"ú
!ú"
 430 IF TI>0 THEN GOSUB 720
 440 IF R=0 AND RND>.8 THEN
GOSUB 3000
 450 IF R>0 THEN LET R=R-1
 460 IF R=1 THEN PRINT AT RX,RY;
" "
 470 GOTO 250
 500 LET PIT=1+(1 AND X=5)+(2
AND X=8)+(3 AND X=13)+(4 AND X=
17)+(5 AND X=18)
 510 FOR A=4 TO 8
 520 PRINT AT A-1,29;" " AND A>4
;AT A,29;"K"
 530 LET Y2=29
 540 NEXT A
 550 LET OP=H(PIT)
 560 IF OP=1 THEN PRINT AT 7,27;
"-";AT 8,27;"/"
 570 IF OP=2 THEN PRINT AT 8,27;
"X"
 580 IF OP=3 THEN PRINT AT 8,27;
"0"
 590 IF OP>3 THEN PRINT AT 8,27;
"¶" AND PH=0;"º" AND PH=1;"ö"
AND PH=2
 600 GOSUB 1500
 610 IF INKEY$="N" THEN LET Y2=2
8
 620 IF INKEY$="A" THEN GOTO 250
0
 630 PRINT AT 2,27;N$(E(3));N$(E
(2));N$(E(1));AT 8,29;" " AND Y2
=28;AT 8,Y2;"K"
 640 IF Y2=28 AND OP=1 THEN
PRINT AT 7,27;"*";AT 8,27;"T"
 650 GOTO 590
 700 IF PH=3 THEN LET TI=1 AND T
I=0
 705 IF PH<3 THEN RETURN
 710 PRINT AT 10,26;"·ôTI¸";AT 1
1,26;"òñME¸"
 720 IF TI=1 THEN PRINT AT 10,27
;"õ"
 725 LET TI=TI+1
 730 IF TI=5 THEN PRINT AT 10,27
;"ö"
 740 IF TI=10 THEN PRINT AT 10,2
7;"³"
 750 IF TI=15 THEN PRINT AT 10,2
7;"ô";AT 11,27;"ó"
 760 IF TI=20 THEN PRINT AT 11,2
7;"¶"
 770 IF TI=25 THEN PRINT AT 11,2
7;"õ"
 780 IF TI=30 THEN PRINT AT 11,2
6;"µñ"
 790 IF TI=35 THEN PRINT AT 11,2
6;"ö"
 800 IF TI=40 THEN PRINT AT 11,2
6;"ó"
 810 IF TI=45 THEN PRINT AT 11,2
6;"ò";AT 10,26;"³"
 820 IF TI=50 THEN PRINT AT 10,2
6;"¶"
 830 IF TI=55 THEN PRINT AT 10,2
6;"µ"
 840 IF TI<60 THEN RETURN
 850 PRINT AT 10,26;"õ¸µTE";AT 1
1,26;"µ õLP"
 860 IF X=Z-1 AND Y=T+1 THEN
GOTO 950
 870 LET TI=0
 880 RETURN
 900 LET PH=PH+(PH<3)
 910 IF PH=1 THEN PRINT AT 10,26
;"õ";AT 11,26;"µ"
 920 IF PH=2 THEN PRINT AT 10,27
;"¸";AT 11,27;" "
 930 IF PH=3 THEN PRINT AT 10,28
;"µ";AT 11,28;"õ"
 940 RETURN
 950 GOSUB 1000
 960 PRINT AT 21,0;"YOU GOT E.T.
 HOME...GAME OVER***"
 970 PAUSE 4E4
 980 RUN
1000 PRINT AT 1,T;"÷";A$(D);"´"
1010 LET L=SIN PI
1020 PRINT AT 1,T;"· ô";AT 2,T;"
÷";A$(D);"´"
1030 LET L=SIN PI
1040 FOR A=1 TO Z-4
1050 PRINT AT A+2,T;"÷";(A$(D)
AND A$(D)<>" ");AT A+2,T+2;"´";
AT A+1,T;"· ô";AT A,T;"   "
1060 LET L=SIN PI
1070 NEXT A
1071 PRINT AT Z-1,T;"÷";(A$(D)
AND A$(D)<>" ");AT Z-1,T+2;"´";
AT Z-2,T;"· ô";AT Z-3,T;"   "
1075 LET D=D+1
1080 FOR A=Z-3 TO 1 STEP -1
1090 PRINT AT A,T;"· ô";AT A+1,T
;"÷";A$(D);"´";AT A+2,T;" ";(" "
AND A$(D)="K");AT A+2,T+2;" "
1100 LET L=SIN PI
1110 NEXT A
1120 PRINT AT 1,T;"÷";A$(D);"´";
AT 2,T;"   "
1130 LET L=SIN PI
1140 PRINT AT 1,T;"   "
1150 LET L=SIN PI
1160 RETURN
1200 SAVE "ET23"
1210 RUN
1300 GOSUB 2050
1310 DIM H(6)
1320 LET N$="0123456789"
1330 LET C=0
1340 LET PH=0
1350 LET Z=INT (RND*13+8)
1360 LET T=INT (RND*8+14)
1370 LET R=0
1380 FOR A=1 TO 6
1390 LET D=INT (RND*6+1)
1400 IF H(D)<>0 THEN GOTO 1390
1410 LET H(D)=A
1420 NEXT A
1430 LET TI=0
1440 LET X=18
1450 LET Y=29
1460 LET X1=1
1470 LET Y1=18
1480 RETURN
1490 REM E-1
1500 LET D=1
1510 LET E(D)=E(D)-1
1520 IF E(D)>0 THEN RETURN
1530 IF E(D+1)>1 THEN GOTO 1580
1540 LET D=D+1
1550 IF E(D+1)>1 THEN GOTO 1580
1560 PRINT AT X,Y;"-";AT 21,0;"N
O ENERGY...YOU DIED************"
1570 GOTO 1170
1580 LET E(D)=10
1590 IF D=2 THEN LET E(1)=10
1600 LET D=D+1
1610 GOTO 1510
1640 REM E=E-100
1650 LET D=2
1660 GOTO 1550
1990 REM E+10
2000 LET E(2)=E(2)+1
2010 IF E(2)<11 THEN RETURN
2020 LET E(3)=E(3)+1
2030 LET E(2)=1
2040 IF E(3)<11 THEN RETURN
2050 DIM E(3)
2060 LET E(3)=4
2070 LET E(2)=1
2080 LET E(1)=1
2090 RETURN
2500 IF OP=1 AND Y2=28 THEN
GOSUB 2050
2510 IF OP=2 THEN GOSUB 1650
2520 IF OP=3 THEN GOSUB 2000
2530 IF OP=3 THEN GOSUB 2000
2540 IF Y2=28 THEN LET H(PIT)=0
2550 PRINT AT 7,27;"   ";AT 8,27
;"   "
2560 IF Y2=28 AND OP>3 THEN
GOTO 900
2570 RETURN
3000 LET R=15-INT (RND*5)
3010 LET D=INT (RND*5)
3020 LET RX=5+(6 AND D=1)+(7
AND D=2)+(11 AND D=3)+(13 AND D
=4)
3030 LET RY=19+(2 AND D=1)+(-12
AND D=2)+(-7 AND D=3)+(3 AND D=
4)
3040 PRINT AT RX,RY;"*"
3050 RETURN