home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1984 October / 1984-10.d64 / cabby_64 (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  9KB  |  278 lines

  1. 5 poke53281,11:poke53280,11:printchr$(142):poke52,56:poke56,56:clr
  2. 10 print"[147]":dim a%(26),f$(26),tl%(12),t1%(12),lc%(70),cm%(26)
  3. 15 poke214,12:print:poke211,5:print"setting up ........please wait"
  4. 20 fori=1to26:readf$(i):nexti
  5. 50 poke56334,peek(56334)and254:poke1,peek(1)and251
  6. 51 fori=0to511:pokei+14336,peek(i+53248):pokei+15360,peek(i+54272):next
  7. 52 poke1,peek(1)or4:poke56334,peek(56334)or1
  8. 55 fori=1to12:readz:forj=ztoz+7:readk:pokej,k:nextj,i
  9. 100 fori=1to26:reada%(i):next:fori=1to8:readv(i):next
  10. 110 fori=1to26:ifi=1thencm%(i)=a%(i):goto150
  11. 120 cm%(i)=cm%(i-1)+a%(i)
  12. 150 next:h=1024:c=54272:s=c:ch=28:fori=1to5:readb%(i),e%(i):next
  13. 160 fori=1to12:readt1%(i):next
  14. 165 deffna(x)=int(rnd(1)*x)+1:deffnl(q)=h+40*y+x
  15. 167 deffnd(zz)=abs((zz=39)+(zz=-39)+(zz=41)+(zz=-41))
  16. 170 fori=1to5:a=fna(2):d%(i)=(a=1)-(a=2):next
  17. 175 fori=1to5:tr(i)=(d%(i)=-1)*(-e%(i))-(d%(i)=1)*(b%(i))
  18. 176 vr(i)=(tr(i)=e%(i))-(tr(i)=b%(i)):ifi>2thenvr(i)=vr(i)*40
  19. 177 ty=(vr(i)=1)*36+(vr(i)=-1)*37+(vr(i)=40)*39+(vr(i)=-40)*38:ty(i)=(-1)*ty
  20. 180 ed(i)=(tr(i)=b%(i))*(-e%(i))+(tr(i)=e%(i))*(-b%(i)):next
  21. 185 print"[147]":poke214,8:print:poke211,13:print"select a level"
  22. 187 poke214,10:print:poke211,16:print"1) easy"
  23. 189 poke214,12:print:poke211,16:print"2) hard"
  24. 190 getz$:lv=val(z$):rd=rnd(1):ifz$=""then190
  25. 191 iflv<1orlv>2then190
  26. 195 print"[147]":poke53272,(peek(53272)and240)or14
  27. 197 formc=stos+24:pokemc,0:next:pokes+24,15:pokes+5,120:pokes+6,240:hf=s+1:lf=s
  28. 200 print"[147]":gosub3005:fori=1to12:a=t1%(i):gosub3200:next
  29. 210 p%=h+81:pokep%,ch:pokep%+c,7
  30. 220 m1=0:m2=0:m3=0:m4=0:xf%=0:cf%=0:gs=1400
  31. 300 gosub1000:ifen=1then6000
  32. 310 ifxf%=0thengosub2000
  33. 320 gosub400:ifen=1then6000
  34. 330 gosub7000:gosub500:ifen=1then6000
  35. 340 gosub1000:ifen=1then6000
  36. 350 gosub5000:ifen=1then6000
  37. 360 gosub500:ifen=1then6000
  38. 390 goto300
  39. 400 fort=1to5:a=tr(t):tr(t)=tr(t)+vr(t)
  40. 410 iftr(t)=ed(t)thenvr(t)=(-1)*vr(t):gosub700:goto440
  41. 420 ifpeek(tr(t))>=36andpeek(tr(t))<=39thentr(t)=tr(t)-vr(t):goto450
  42. 430 ifpeek(tr(t))=27orpeek(tr(t))=28thenen=1:t=5:goto450
  43. 440 pokea,32:poketr(t),ty(t):poketr(t)+c,15:gosub9810:ifn4=1then450
  44. 445 gosub500:ifen=1thent=5
  45. 450 next:return
  46. 500 jv=peek(56320):jv=15-(jvand15):fr=peek(56320)and16
  47. 505 iffr=0andsh=0thengosub9600
  48. 510 dy=(jv=1)+(jv=5)+(jv=9)-(jv=6)-(jv=10)-(jv=2)
  49. 520 dx=(jv=4)+(jv=5)+(jv=6)-(jv=9)-(jv=10)-(jv=8)
  50. 525 if(dx=0anddy=0)orgs=0thenreturn
  51. 535 ch=28:ifdx<>0thench=28
  52. 540 ifdy<>0thench=27
  53. 550 zz=40*dy+dx:z=p%+zz:pk=peek(z)
  54. 555 iffnd(zz)=1and(pk=32orpk=160)then625
  55. 557 ifsh=1then800
  56. 560 cp=(pk=30)+(pk=32)*2+(pk=40)*3+(pk=41)*4+(pk=42)*5+(pk=160)*6+(pk=0)*7
  57. 570 onabs(cp)goto600,620,8000,8000,9000,625,3300
  58. 580 ifpeek(z)>=129andpeek(z)<=154then4000
  59. 590 ifpeek(z)>=36andpeek(z)<=39thenen=1:return
  60. 600 if(peek(z+c)and15)=5then620
  61. 605 goto625
  62. 620 gosub9820:pokep%,32:pokez,ch:pokez+c,7:p%=z
  63. 625 gs=gs-2:ifgs=<0thengs=0:gosub9700
  64. 630 return
  65. 700 ty=(vr(t)=1)*36+(vr(t)=-1)*37+(vr(t)=40)*39+(vr(t)=-40)*38:ty(t)=(-1)*ty
  66. 710 ed=(ed(t)=b%(t))*(-e%(t))+(ed(t)=e%(t))*(-b%(t)):ed(t)=ed
  67. 720 return
  68. 800 ifpeek(z)=30and(peek(z+c)and15)=5then620
  69. 810 ifpeek(z)<>32then625
  70. 820 goto620
  71. 1000 forll=1to12:pk=peek(tl%(ll)+c)and15
  72. 1005 ifpeek(tl%(ll))=32thenpoketl%(ll),30:poketl%(ll)+c,pk
  73. 1010 poketl%(ll)+c,pk:tl=(pk=2)*1+(pk=5)*2+(pk=7)*3
  74. 1012 gosub500:ifen=1thenll=12:goto1030
  75. 1015 gosub400:ifen=1thenll=12:goto1030
  76. 1020 gosub5000:ifen=1thenll=12:goto1030
  77. 1025 onabs(tl)gosub1040,1050,1060
  78. 1030 next:return
  79. 1040 a=fna(3):ifa=1thenpoketl%(ll)+c,5:poketl%(ll),30
  80. 1045 return
  81. 1050 a=fna(3):ifa=2thenpoketl%(ll)+c,7:poketl%(ll),30
  82. 1055 return
  83. 1060 a=fna(3):ifa=3thenpoketl%(ll)+c,2:poketl%(ll),30
  84. 1065 return
  85. 1500 fori=22to23:forj=1to37
  86. 1510 poke214,i:print:poke211,j:printchr$(32);:nextj,i:return
  87. 2000 px=fna(26):xf%=px+128
  88. 2005 gosub1500:poke214,22:print:poke211,1
  89. 2010 print"cabby, go to the ";f$(xf%-128);:pt=px:cl=0:x=1:gosub5155
  90. 2020 gosub500:return
  91. 3005 i=49152:if peek(49154)=216thensys49160:goto3030
  92. 3010 read a:if a=256 thensys49160:goto3030
  93. 3020 poke i,a:i=i+1:goto 3010
  94. 3030 poke1064,40:poke1065,41:poke1066,40:poke1067,41:fori=1064to1067:pokei+c,1:
  95. 3040 next:poke1104+c,1:poke1104,40:fori=1105to1107:pokei,32:pokei+40,32:next
  96. 3050 poke1144,40:poke1144+c,1:fori=1265to1301:pokei,32:next
  97. 3055 fori=1545to1581:pokei,32:next
  98. 3060 fori=1114to1754step40:pokei,32:pokei+10,32:pokei+20,32:next
  99. 3065 fori=1to5
  100. 3067 x=fna(38):y=fna(19):l=fnl(q)
  101. 3070 ifpeek(l)=32orpeek(l)<>160then3067
  102. 3075 pokel,42:pokel+c,7:next
  103. 3080 k=0:fori=1to26:forj=1toa%(i)
  104. 3090 x=fna(40):y=fna(19):l=fnl(q)
  105. 3100 if peek(l)=32orpeek(l)<>160then3090
  106. 3110 ifpeek(l+1)=160andpeek(l-1)=160andpeek(l+40)=160andpeek(l-40)=160then3090
  107. 3120 k=k+1:lc%(k)=l:pokel,i+128:next:next:return
  108. 3200 ifpeek(a)<>32thengosub3220
  109. 3210 tl%(i)=a:pokea,30:pokea+c,5:return
  110. 3220 forj=1to8
  111. 3230 ifpeek(a+v(j))=32thena=a+v(j):k=8
  112. 3240 next:return
  113. 3300 ifxf%<>0thenreturn
  114. 3310 pokep%,32:pokez,ch:pokez+c,7:gosub2000
  115. 3320 pokep%,ch:pokep%+c,7:pokez,160:pokez+c,1:mn=1:return
  116. 3330 m1=abs(sp-z)/10+1:pokep%,32:pokez,ch:pokez+c,7:gosub9820
  117. 3340 m2=int(fna(100*m1)/10)/100
  118. 3350 gosub1500:poke214,22:print:poke211,1
  119. 3360 print"you collect";m1;"plus tip of";m2;
  120. 3370 m3=m1+m2+m3:m1=0:m2=0:pokep%,ch:pokep%+c,7:pokez,xf%:pokez+c,1
  121. 3375 pt=px:cl=1:x=1:gosub5155
  122. 3380 poke214,23:print:poke211,1:print"you have";m3;:mn=0:xf%=0:cf%=0:return
  123. 4000 ifmn=1then3330
  124. 4005 ifcf%<>0then4500
  125. 4010 ifpeek(z)<>xf%then630
  126. 4030 iflv=2andz<>dzthen630
  127. 4050 pc=fna(26):cf%=pc+128
  128. 4200 sp=z:pokez,ch:pokez+c,7:pokep%,32:gosub9820
  129. 4210 iflv=1thenpt=pc:cl=1:gosub5155
  130. 4260 gosub1500:poke214,22:print:poke211,1
  131. 4265 print"take me to the ";f$(cf%-128);:pt=pc:cl=0:x=2:gosub5155
  132. 4280 pokep%,ch:pokep%+c,7:gosub9820:pokez,xf%:pokez+c,1
  133. 4285 ifcf%=xf%thenpokez+c,0
  134. 4290 iflv=1andxf%<>cf%thenpt=px:cl=1:gosub5155
  135. 4300 goto630
  136. 4500 ifpeek(z)<>cf%then630
  137. 4505 iflv=2andz<>dcthen630
  138. 4510 pokez,ch:pokez+c,7:pokep%,32:gosub9820
  139. 4550 m1=abs(sp-z)/10+1
  140. 4560 m2=int(fna(100*m1)/10)/100
  141. 4570 gosub1500:poke214,22:print:poke211,1
  142. 4573 print"you collect";m1;"plus tip of";m2;
  143. 4580 m3=m1+m2+m3:m1=0:m2=0
  144. 4600 poke214,23:print:poke211,1:print"you have";m3;
  145. 4650 pokep%,ch:pokep%+c,7:gosub9820:pokez,cf%:pokez+c,1
  146. 4655 iflv=1thenpt=pc:cl=1:gosub5155
  147. 4660 cf%=0:xf%=0:goto630
  148. 5000 mx=0:my=0:goto5010
  149. 5005 my=int((p%-h)/40):mx=(p%-h)-40*my:return
  150. 5010 gosub5005:ct=abs((my=6)*1+(my=13)*2):t=ct:ifct>0thengosub5050
  151. 5015 gosub5005:ct=abs((mx=10)*3+(mx=20)*4+(mx=30)*5):t=ct:ifct>0thengosub5050
  152. 5020 return
  153. 5050 ifp%>tr(ct)andvr(ct)>0then5080
  154. 5060 ifp%<tr(ct)andvr(ct)<0then5080
  155. 5070 vr(ct)=(-1)*vr(ct):gosub700
  156. 5080 b=fna(2):dn=(b=1)*(-p%)-(b=2)*(ed(ct))
  157. 5100 poketr(ct),32:formv=tr(ct)todnstepvr(ct):pk=peek(mv)
  158. 5110 ifpk>=36andpk<=39thentr(ct)=mv-vr(ct):mv=dn:next:gosub5150:return
  159. 5115 ifpk=27orpk=28thenmv=dn:next:en=1:return
  160. 5120 pokemv,ty(ct):pokemv+c,15:sh=1
  161. 5125 gosub9810:gosub500:sh=0:pokemv,32
  162. 5126 ifen=1thenmv=dn
  163. 5130 next:ifen=1thenreturn
  164. 5135 ifdn=ed(ct)thentr(ct)=ed(ct)-vr(ct):pokeed(ct),ty(ct):return
  165. 5140 tr(ct)=dn:poketr(ct),ty(ct):return
  166. 5150 poketr(ct),ty(ct):gosub500:return
  167. 5155 iflv=2thenonxgoto5160,5170
  168. 5156 forlc=cm%(pt-1)+1tocm%(pt)
  169. 5157 pokelc%(lc)+c,cl:next:return
  170. 5160 r=fna(a%(pt)):dz=lc%(cm%(pt-1)+r):pokedz+c,0:return
  171. 5170 r=fna(a%(pt)):dc=lc%(cm%(pt-1)+r):pokedc+c,0:return
  172. 6000 print"[147]":en=0:gosub9830:poke53272,21
  173. 6050 poke214,8:print:poke211,6:print"your cab lost to the trolley"
  174. 6070 poke214,10:print:poke211,15:print"game over!"
  175. 6075 poke214,12:print:poke211,8:print"you made ";m4;"[146]dollars"
  176. 6080 print"play again (y/n)"
  177. 6085 getz$:rd=rnd(1):ifz$=""or(z$<>"y"andz$<>"n")then6085
  178. 6090 ifz$="n"thenend
  179. 6095 print"[147]":restore:goto165
  180. 7000 x=fna(40):y=fna(19)
  181. 7010 ifpeek(fnl(q))<>160then7040
  182. 7030 pokefnl(q),0:pokefnl(q)+c,3
  183. 7040 return
  184. 8000 m4=m4+m3:gosub9820
  185. 8010 gosub1500:poke214,22:print:poke211,1:print"safe in depot";m4
  186. 8020 m3=0:pokep%,ch:pokep%+c,7:pokez,40:pokez+c,1:fordl=1to500:next
  187. 8025 ifm4>200then8300
  188. 8040 ifcf%<>0then8050
  189. 8041 ifxf%=0then630
  190. 8043 gosub1500:poke214,22:print:poke211,1
  191. 8045 print"cabby, go to the ";f$(xf%-128);:n4=1:gosub400:n4=0
  192. 8046 return
  193. 8050 gosub1500:poke214,22:print:poke211,1
  194. 8060 print"take me to the ";f$(cf%-128);:n4=1:gosub400:n4=0
  195. 8070 return
  196. 8300 print"[147]":poke214,8:print:poke211,9:p