ZX81 Listing for wb.p


ZX81 program listing for **WATER BUG**SLR/1984**

SYSTEM VARIABLES

PROG  : 16509
D-FILE: 27660
VARS  : 28453
E-LINE: 28855
STKBOT: 28855
STKEND: 28855


LEGEND

9999 means line number
PRINT means treat as KEYWORD P


PROGRAM LISTING

  10 REM **WATER BUG**SLR/1984**
  20 LET S=0
  30 FOR L=5 TO 20
  40 PRINT AT 21,0;"            
                    ";AT L,0;" !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!! "
  50 NEXT L
  60 PRINT AT 20,30;"$";AT 21,12
;"BOARD 1"
  70 GOSUB 90
  80 GOTO 170
  90 LET X=5
 100 LET Y=2
 110 LET C=X
 120 LET U=Y
 130 LET V=20
 131 LET I=20
 140 LET I=20
 160 RETURN
 170 PRINT AT 2,12;"SCORE:";
STR$ S;AT X,Y;"O";AT C,U;"!"
AND (X<>C OR Y<>U);AT V,I;"*"
 180 GOSUB 200
 190 GOTO 260
 200 LET C=X
 210 LET U=Y
 220 LET L$=INKEY$
 230 LET X=X-(L$="7")+(L$="6")
 235 LET X=X-(CODE L$=112)+(
CODE L$=113)
 240 LET Y=Y-(L$="5")+(L$="8")
 245 LET Y=Y-(CODE L$=114)+(
CODE L$=115)
 250 RETURN
 260 PRINT AT V,I;"!"
 270 IF RND>.5 THEN LET V=V-SGN
(V-X)
 280 IF RND>.5 THEN LET I=I-SGN
(I-Y)
 290 PRINT AT V,I;"*";AT X,Y;
 300 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
 310 IF L<>180 AND L<>8 AND L<>1
41 THEN GOTO 1010
 320 IF L=141 THEN GOTO 350
 330 LET S=S+1
 340 GOTO 170
 350 LET S=S+INT (RND*10*100)
 360 PRINT AT 4,0;"YEE GOT THY T
REASURE.HORAY ALL. "
 370 PAUSE 400
 380 RAND 0
 390 FOR L=1 TO 20
 400 PRINT AT INT (RND*19+SIN (L
*10)),INT (RND*29+COS (L/10));"º
"
 410 NEXT L
 420 CLS
 430 FOR L=1 TO 20
 440 PRINT AT 0,0;"             
                   ";AT 21,0;"  
           BOARD 2            ";
AT L,0;" !!!!!!!!!!!!!!!!!!!!!!!
!!!!!!! "
 450 NEXT L
 460 GOSUB 90
 470 LET G=INT (20*RND+1)
 480 LET H=INT (30*RND+1)
 490 LET O=0
 500 PRINT AT X,Y;"O";AT C,U;"!"
AND (X<>C OR Y<>U);AT V,I;"*";
AT G,H;"$" AND O
 510 GOSUB 200
 520 PRINT AT V,I;"!";AT G,H;"$"
AND O
 530 IF RND>.5 THEN LET V=V-SGN
(V-X)
 540 IF RND>.5 THEN LET I=I-SGN
(I-Y)
 550 PRINT AT V,I;"*";AT X,Y;
 560 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
 570 IF L<>141 AND L<>180 AND L
<>8 THEN GOTO 1010
 580 IF L=141 THEN GOTO 620
 590 LET S=S+1
 600 IF X=20 AND Y=H THEN LET O=
1
 610 GOTO 500
 620 LET S=S+INT (RND*10*100)
 630 PRINT AT 2,12;"SCORE:";S;
AT 4,0;"YEE GOT THY TREASURE.HOR
AY ALL. "
 640 PAUSE 400
 650 RAND 0
 660 FOR L=1 TO 20
 670 PRINT AT INT (RND*19+SIN (L
*10)),INT (RND*29+COS (L/10));"º
"
 680 NEXT L
 700 CLS
 710 DIM A$(704)
 720 FOR L=1 TO 704 STEP 32
 730 LET A$(L TO L+31)=" !!!!!!!
!!!!!!!!!!!!!!!!!!!!!!! "
 735 PRINT AT 0,0;A$
 740 NEXT L
 750 LET A$(1)="B"
 760 LET A$(33)="3"
 770 FOR L=1 TO 50
 780 PRINT AT 0,0;A$
 790 LET A$(INT (RND*22)*32+INT
(RND*30+1)+1)="º"
 800 NEXT L
 810 LET A$(INT (RND*22)*32+INT
(RND*30+1)+1)="$"
 820 LET Y=10
 825 LET U=Y
 830 CLS
 840 FOR L=21 TO 1 STEP -1
 850 PRINT AT 2,Y;"O";AT 2,U;" "
AND U<>Y;AT L,0;A$(1 TO (22-L)*
32)
 855 LET U=Y
 860 REM LET Y=Y-(INKEY$="5")+(
INKEY$="8")
 864 LET L$=INKEY$
 868 GOSUB 240
 870 NEXT L
 880 PRINT AT 0,0;A$;AT 2,Y;"O"
 890 REM LET Y=Y-(INKEY$="5")+(
INKEY$="8")
 895 LET L$=INKEY$
 898 GOSUB 240
 900 PRINT AT 3,Y;
 910 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
 920 IF L<>141 AND L<>180 AND L
<>8 THEN GOTO 1010
 930 IF L=141 THEN GOTO 970
 940 LET S=S+1
 950 LET A$=A$(33 TO )+A$( TO 32
)
 960 GOTO 880
 970 LET S=S+INT (RND*10*100)
 980 PRINT AT 2,12;"SCORE:";S;
AT 4,0;"YEE GOT THY TREASURE.HOR
AY ALL. "
 990 PAUSE 400
 992 FOR L=1 TO 20
 994 PRINT AT INT (RND*19+SIN (L
*10)),INT (RND*29+COS (L/10));"º
"
 996 NEXT L
1000 GOTO 1110
1010 PRINT AT 1,8;"**END OF GAME
**"
1020 PRINT AT 2,12;"SCORE:";
STR$ S
1030 PRINT AT 21,0;"PRESS ANY KE
Y TO BEGIN          "
1040 PAUSE 4E4
1050 CLS
1060 RUN
1070 SAVE "WB"
1080 PRINT AT 4,3;"õ    µ       
µ÷ó  óõ";AT 5,3;"òôµõ·ñµ³õ    µ÷
   ÷ñ";AT 6,4;"µõµõ õ µ    µ²³  
ò³";AT 9,9;"÷´ô     ·óó";AT 10,9
;"²±ñ      ·³";AT 11,9;"÷ó´ ò ñ 
´³±";AT 12,9;"²³ö";AT 16,8;"BY:"
;AT 17,11;"STEVEN";AT 18,13;"REI
D";AT 20,14;"(C) 1984";AT 21,0;"
PRESS ANY KEY TO BEGIN PLAY=-=-=
"
1090 PAUSE 4E4
1100 GOTO 1050
1110 CLS
1120 FOR L=1 TO 20
1130 PRINT AT 0,0;"             
                   ";AT 21,0;"  
           BOARD 4            ";
AT L,0;" !!!!!!!!!!!!!!!!!!!!!!!
!!!!!!! " AND INT (L/2)<>L/2;" !
!!! !!!! !!!!  !!!! !!!! !!!! "
AND INT (L/2)=L/2
1140 NEXT L
1150 GOSUB 90
1160 LET V=INT (20*RND+1)
1170 LET I=INT (20*RND+10)
1180 PRINT AT V,I;
1190 IF PEEK (PEEK 16398+256*
PEEK 16399)<>8 THEN GOTO 1160
1200 PRINT AT X,Y;"O";AT C,U;"!"
AND (X<>C OR Y<>U);AT V,I;"$"
1210 GOSUB 200
1220 PRINT AT V,I;"!"
1230 LET B=V+INT (3*RND-1)
1240 LET O=I+INT (3*RND-1)
1250 PRINT AT B,O;
1260 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
1270 IF L=8 THEN LET V=B
1280 IF L=8 THEN LET I=O
1290 PRINT AT V,I;"$";AT X,Y;
1300 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
1310 IF L=141 THEN GOTO 1340
1320 IF L<>8 AND L<>180 THEN
GOTO 1010
1330 GOTO 1200
1340 LET S=S+INT (RND*10*100)
1350 PRINT AT 2,12;"SCORE:";S;
AT 4,0;"YEE GOT THY TREASURE.HOR
AY ALL. "
1360 PAUSE 400
1370 FOR L=1 TO 20
1380 PRINT AT INT (RND*19+SIN (L
*10)),INT (RND*29+COS (L/10));"º
"
1390 NEXT L
1400 CLS
1410 FOR L=1 TO 20
1420 PRINT AT 0,0;"             
                   ";AT 21,0;"  
           BOARD 5            ";
AT L,0;" !!!!!!!!  !!!!!!!!!!  !
!!!!!!! "
1430 NEXT L
1440 DIM A$(320)
1450 FOR L=1 TO 320 STEP 32
1460 LET A$(L TO L+31)=" !!!!!!!
!!!!!!!!!!!!!!!!!!!!!!! "
1470 NEXT L
1480 FOR L=1 TO 25
1490 LET A$(INT (RND*10)*32+INT
(RND*30+1)+1)="º"
1500 PRINT AT 11,0;A$
1510 NEXT L
1520 GOSUB 90
1530 PRINT AT INT (RND*10+1),20;
"-"
1540 LET O=0
1550 PRINT AT 11,0;A$;AT X,Y;"O"
;AT C,U;"!" AND (X<>C OR Y<>U);
AT 1,30;"$" AND O
1560 GOSUB 200
1570 PRINT AT X,Y;
1580 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
1590 IF L=141 THEN GOTO 1670
1600 IF L=150 THEN LET O=1
1610 IF L<>8 AND L<>150 AND L<>1
80 THEN GOTO 1010
1615 IF X<11 THEN GOTO 1650
1620 PRINT AT X+1 AND X<21,Y;
1630 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
1640 IF L=138 THEN GOTO 1010
1650 LET A$=A$(33 TO )+A$( TO 32
)
1660 GOTO 1550
1670 LET S=S+INT (RND*10*100)
1680 PRINT AT 2,12;"SCORE:";S;
AT 4,0;"YEE GOT THY TREASURE.HOR
AY ALL. "
1690 PAUSE 400
1700 FOR L=1 TO 20
1710 PRINT AT INT (RND*19+SIN (L
*10)),INT (RND*29+COS (L/10));"º
"
1720 NEXT L
1730 CLS
1740 FOR L=1 TO 20
1750 PRINT AT 0,0;"             
                   ";AT 21,0;"  
           BOARD 6            ";
AT L,0;" !!!!!!!!!!!!!!!!!!!!!!!
!!!!!!! "
1760 NEXT L
1770 GOSUB 90
1780 LET O=0
1790 PRINT AT X,Y;"O";AT C,U;"!"
AND (X<>C OR Y<>U);AT V,I;"*"
AND O;"*" AND NOT O;AT 20,30;"$
" AND O
1800 GOSUB 200
1810 PRINT AT V,I;"!"
1820 IF RND>.5 THEN LET V=V-SGN
(V-X)
1830 IF RND>.5 THEN LET I=I-SGN
(I-Y)
1840 PRINT AT V,I;"*" AND O;"*"
AND NOT O;AT X,Y;
1850 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
1860 IF L=141 THEN GOTO 1900
1870 IF L=23 THEN LET O=1
1880 IF L<>8 AND L<>180 AND L<>2
3 THEN GOTO 1010
1890 GOTO 1790
1900 LET S=S+INT (RND*10*100)
2000 PRINT AT 2,12;"SCORE:";S;
AT 4,0;"YEE GOT THY TREASURE.HOR
AY ALL. "
2010 PAUSE 400
2020 FOR L=1 TO 20
2030 PRINT AT INT (RND*19+SIN (L
*10)),INT (RND*29+COS (L/10));"º
"
2040 NEXT L
2050 CLS
2060 FOR L=1 TO 20
2070 PRINT AT 0,0;"             
                   ";AT 21,0;"  
           BOARD 7            ";
AT L,0;" !!!!!!!!!!!!!!!!!!!!!!!
!!!!!!! "
2080 NEXT L
2090 GOSUB 90
2100 FOR L=1 TO 20
2110 PRINT AT INT (20*RND+1),
INT (30*RND+1);"*";AT 20,30;"$"
2120 NEXT L
2130 PRINT AT X,Y;"O";AT C,U;"!"
AND (X<>C OR Y<>U);AT V,I;"*"
2140 GOSUB 200
2150 IF RND>.5 THEN LET V=V-SGN
(V-X)
2160 IF RND>.5 THEN LET I=I-SGN
(I-Y)
2170 PRINT AT X,Y;
2180 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
2190 IF L=141 THEN GOTO 2230
2200 IF L<>8 AND L<>180 THEN
GOTO 1010
2210 LET S=S+1
2220 GOTO 2130
2230 LET S=S+INT (RND*10*100)
2240 PRINT AT 2,12;"SCORE:";S;
AT 4,0;"YEE GOT THY TREASURE.HOR
AY ALL. "
2250 PAUSE 400
2260 FOR L=1 TO 20
2270 PRINT AT INT (RND*19+SIN (L
*10)),INT (RND*29+COS (L/10));"º
"
2280 NEXT L
2290 CLS
2300 FOR L=1 TO 20
2310 PRINT AT 0,0;"             
                   ";AT 21,0;"  
           BOARD 8            ";
AT L,0;" !!!!!!!!!!!!!!!!!!!!!!!
!!!!!!! "
2320 NEXT L
2330 GOSUB 90
2340 DIM A$(64)
2350 LET A$=" !!    ! !! !!!    
! !! !!!    !  ! !    !!!  !  !!
!!  !!! !!   "
2360 PRINT AT 20,30;"-"
2370 LET O=0
2380 PRINT AT 6,1;A$( TO 30);AT
1,30;"$" AND O;AT 15,1;A$(31 TO
60);AT X,Y;"O";AT C,U;"!" AND (X
<>C OR Y<>U);AT V,I;"*"
2390 GOSUB 200
2400 PRINT AT V,I;"!"
2410 IF RND>.6 THEN LET V=V-SGN
(V-X)
2420 IF RND>.5 THEN LET I=I-SGN
(I-Y)
2430 PRINT AT V,I;"*";AT X,Y;
2440 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
2450 IF L=141 THEN GOTO 2490
2460 IF L=150 THEN LET O=NOT O
2470 IF L<>8 AND L<>150 AND L<>1
80 THEN GOTO 1010
2475 LET A$=A$(2 TO )+A$(1)
2480 GOTO 2380
2490 LET S=S+INT (RND*10*100)
2500 PRINT AT 2,12;"SCORE:";S;
AT 4,0;"YEE GOT THY TREASURE.HOR
AY ALL. "
2510 PAUSE 400
2520 FOR L=1 TO 20
2530 PRINT AT INT (RND*19+SIN (L
*10)),INT (RND*29+COS (L/10));"º
"
2540 NEXT L
2550 CLS
2560 FOR L=1 TO 20
2570 PRINT AT 0,0;"             
                   ";AT 5,0;" !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!! ";
AT 10,0;"             !!!!!!!!  
         ";AT 15,0;" !!!!!!!!!!!
!!!!!!!!!!!!!!!!!!! ";AT 21,0;" 
            BOARD 9            "
;AT L,0;" !!!!!!!!    !!!!!!!!  
  !!!!!! "
2580 NEXT L
2590 PRINT AT 20,1;"-"
2600 GOSUB 90
2610 LET O=0
2620 LET I=I+5
2630 LET Z=0
2640 LET T=0
2650 PRINT AT X,Y;"O";AT C,U;"!"
AND (X<>C OR U<>Y);AT V,I;"*"
AND O=2;AT 20,30;"$" AND O=2;
AT 1,30;"-" AND O=1
2660 GOSUB 200
2670 IF O<>2 THEN GOSUB 2760
2680 PRINT AT V,I;"!"
2690 IF RND>.5 THEN LET Z=V-SGN
(V-X)
2700 IF RND>.5 THEN LET T=I-SGN
(I-Y)
2710 PRINT AT Z,T;
2720 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
2730 IF L=8 OR L=180 THEN LET V=
Z
2740 IF L=8 OR L=180 THEN LET I=
T
2750 PRINT AT V,I;"*"
2760 PRINT AT X,Y;
2770 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
2780 IF L=141 THEN GOTO 2820
2790 IF L=150 THEN LET O=O+1
2800 IF L<>8 AND L<>150 AND L<>1
80 THEN GOTO 1010
2810 GOTO 2650
2820 LET S=S+INT (RND*10*100)
2830 PRINT AT 2,12;"SCORE:";S;
AT 4,0;"YEE GOT THY TREASURE.HOR
AY ALL. "
2840 PAUSE 400
2850 FOR L=1 TO 20
2860 PRINT AT INT (RND*19+SIN (L
*10)),INT (RND*29+COS (L/10));"º
"
2870 NEXT L
2890 CLS
2900 FOR L=1 TO 20
2910 PRINT AT 0,0;"             
                   ";AT 21,0;"  
          BOARD 10           ";
AT L,0;" !!!!!!!!!!!!!    !!!!!!
!!!!!!! "
2920 NEXT L
2930 GOSUB 90
2940 LET V=V-4
2950 DIM A$(30)
2960 LET A$=" !!   !!  !!!!  !!!
   ! !!! !!"
2970 LET Z=18
2980 LET T=.8
2990 PRINT AT 20,13;"-"
3000 PRINT AT Z,1;A$;AT X,Y;"O";
AT C,U;"!" AND (X<>C OR Y<>U);
AT V,I;"*"
3010 GOSUB 200
3015 PRINT AT V,I;"!"
3020 IF RND>T THEN LET V=V-SGN (
V-X)
3030 IF RND>T THEN LET I=I-SGN (
I-Y)
3040 IF I<18 THEN LET I=18
3050 PRINT AT V,I;"*";AT X,Y;
3060 LET L=PEEK (PEEK 16398+256*
PEEK 16399)
3070 IF L=141 THEN GOTO 3180
3080 IF L=150 THEN GOSUB 3120
3090 IF L<>8 AND L<>180 AND L<>1
50 THEN GOTO 1010
3100 LET A$=A$(2 TO )+A$(1)
3110 GOTO 3000
3120 LET T=.6
3130 PRINT AT 20,30;"$";AT Z,1;"
!!!!!!!!!!!!!    !!!!!!!!!!!!!"
3140 LET Z=4
3150 IF Y>18 AND X>5 THEN LET T=
.45
3160 PRINT AT Z,1;A$
3170 RETURN
3180 LET S=S+INT (RND*5*1000)
3190 PRINT AT 2,12;"SCORE:";S;
AT 4,0;"YEE GOT THY TREASURE.HOR
AY ALL. "
3200 PAUSE 200
3210 PRINT AT 10,0;" YOU COMPLET
ED ALL TEN BOARDS**  YOU RECEIVE
 SPECIAL BONUS AND   GAIN THE TI
TLE OF               W A T E R  
B U G  M A S T E R  ºººººººººººº
ºººººººººººººººººººº"
3220 PAUSE 500
3230 FOR L=1 TO 25
3240 PRINT AT INT (RND*19+SIN (L
*10)),INT (RND*29+COS (L/10));"º
"
3250 NEXT L
3260 CLS
3270 GOTO 30