home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 186 / 186.d81 / bridge (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1999-01-01  |  19.5 KB  |  593 lines

  1. 1 rem    ***** bridge *****
  2. 5 dv=peek(186):ifdv<8thendv=8
  3. 40 sys57812"f.bridge",dv,0:poke780,0:poke781,0:poke782,8:sys65493
  4. 60 clr:dv=peek(186):ifdv<8thendv=8
  5. 100 rem    **** set variables *****
  6. 105 ad=49152:ag=4096:s=54272:poke53272,19:printchr$(14):printchr$(8)
  7. 110 a$="":at=0:b$="":bh$="":bd=0:bk=0:bl=0:c$="":cd%=0
  8. 115 ch=0:cs=0:ct=0:d=0:df$="":dl$="":dr=0:ds=0:el%=0:ev%=0:
  9. 120 f%=0:fc%=0:fl%=0:fu%=0:ft%=1000:gl%=0:gt=0:gw=0:k=0
  10. 130 ms$="":nm$="":pc%=0
  11. 135 q=0:q$=chr$(34):qf=0:rn%=0:se%=0:ra%=0
  12. 140 sd%=0:sn%=0:p%=0:sz=0:ts%=0:tv%=0:us%=0
  13. 145 v=0:w$="":x=0:y=0:z=0:zs=0:x$=""
  14. 150 dima$(24),gl$(99),l1%(48),l2%(48),md$(2,20),sd$(5),sp$(5),zl(5)
  15. 155 dimst%(48),ub%(48),fl$(3),vt%(3,4),fm%(3)
  16. 160 dl%(1)=1:dl%(2)=12:dl%(3)=24:dl$(1)="[211][197][195][212][207][210] =":dl$(2)=":[199][210][201][196] = "
  17. 165 dl$(3)=":%[198][213][197][204] =":hd$(1)="[204]iverpool.":hd$(2)="[211]outhampton.":
  18. 170 hd$(3)="on the rocks":hd$(4)="by enemy action":he$(1)="due":he$(2)="and"
  19. 175 sa%(1)=-1:sa%(2)=1:sa%(3)=-9:sa%(4)=9:sa%(5)=-10:sa%(6)=10:sa%(7)=-11
  20. 180 sa%(8)=11:fl$(1)=".ex":fl$(2)=".fc":fl$(3)=".ag"
  21. 185 kf$="[136][140][133][135][134]^_[138][139][137]*"
  22. 190 sd$(1)="[206]orth":sd$(2)="[206]ortheast":sd$(3)="[211]outheast":sd$(4)="[211]outh"
  23. 195 sd$(5)="[197]ast":sp$(1)="5 [203]nots":sp$(2)="10 [203]nots":sp$(3)="15 [203]nots"
  24. 200 sp$(4)="20 [203]nots":sd$(0)="[211]topped":sp$(0)="[200]ove to"
  25. 205 vt%(1,4)=120:vt%(1,3)=180:vt%(1,2)=240:vt%(1,1)=300
  26. 210 vt%(2,4)=180:vt%(2,3)=240:vt%(2,2)=300:vt%(2,1)=360
  27. 215 vt%(3,4)=240:vt%(3,3)=300:vt%(3,2)=360:vt%(3,1)=420:fm%(1)=-10:fm%(2)=-20
  28. 800 rem    ***** startup *****
  29. 805 ms$="[207]rganizing [206]avigation [205]aps.[144]":v=10:gosub5210
  30. 810 df$="ac.game":dr=dv:gosub5115:ifpr<>3then5515
  31. 815 open3,dv,3,"l:"+df$:input#3,nm$,b$,a$:close3:ra%=val(a$):gosub5740
  32. 820 gosub7705:ifqf<>1thengoto5515
  33. 825 df$="navigation data":dr=dv:gosub5115:ifpr<>3then5505
  34. 830 open3,dv,3,"l:"+df$+",p,r"
  35. 835 forx=0to1:fory=0to20:input#3,md$(x,y):next:next
  36. 840 forx=0to99:input#3,gl$(x):next:close3
  37. 1000 rem    ***** bridge *****
  38. 1005 print"[147]":bd=1:bk=1:ch=0:gosub5005
  39. 1010 zs=2:gosub6105:ms$=md$(0,0):gosub5208
  40. 1015 h=8:forv=2to16:ms$=md$(0,v-1):gosub5070:next
  41. 1020 h=3:v=7:ms$=md$(0,16):gosub5070:h=32:v=5:ms$=md$(0,17):gosub5070
  42. 1025 v=9:ms$=md$(0,18):gosub5070:h=1:forv=17to18:ms$=md$(0,v+2):gosub5070:next
  43. 1030 gosub5225:ss=5:ss$="s":gosub5405
  44. 1032 gosub6955
  45. 1035 gosub1405:gosub1410
  46. 1040 ifse%<>100thengosub1445:goto1060
  47. 1045 ms$="[217]ou are in [200]alifax [200]arbour.":gosub5208
  48. 1050 ms$="[193]ny key exits harbour.":cs=4:q=0:gosub5300:sp%=1:sd%=5:se%=2:gl%=40
  49. 1055 gosub1445:forx=0to5:gosub1505:next
  50. 1060 gosub1805:gosub5034:as$="[195]hange [195]ourse/[211]peed? (c/s)"
  51. 1070 gosub1415:gosub1420:gosub1425:gosub1430:gosub1375
  52. 1075 ms$=as$:gosub5205:zs=3
  53. 1100 ch$="cs":gosub6505:onqfgoto1105,1175,1100,1705,1100,3205,1170,1140
  54. 1105 iff%=2then1125
  55. 1110 gosub5034:ms$="[195][207][213][210][211][197]: 1 = [206]orth, 2 = [206]ortheast,":gosub5206
  56. 1115 ms$="3 = [211]outheast, 4 = [211]outh, 5 = [197]ast.":gosub5205
  57. 1120 ch$="12345":gosub6510:sd%=f%:gosub1420:gosub5034:goto1060
  58. 1125 gosub5034:ms$="[211][208][197][197][196](knots): [193] = 5, [194] = 10,":gosub5206
  59. 1130 ms$="[195] = 15, [196] = 20.":gosub5205
  60. 1135 ch$="abcd":gosub6510:sp%=f%:ifds%<>0andsp%>1thensp%=sp%-1
  61. 1137 gosub5034:goto1060
  62. 1140 gosub5034:mn%=sp%
  63. 1145 gosub1505:onsd%gosub3005,3105,3135,3035,3065
  64. 1150 a=qf/2:onagoto1205,1705,3205
  65. 1155 gosub1450:mn%=mn%-1:gosub1235:ifmn%<1then1060
  66. 1160 goto1145
  67. 1170 gosub5034:gosub5245:goto5515
  68. 1175 gosub5034:gosub5245:goto5505
  69. 1200 rem    ***** lost convoy *****
  70. 1205 lv%=tv%/2:tv%=tv%-lv%:gosub5034
  71. 1210 ms$="[217]ou loose "+str$(lv%)+" ships due to bad":gosub5206
  72. 1215 ms$="weather and faulty navigation.":gosub5205
  73. 1220 ms$="[195]onvoy stops to regroup. [193]ny key.":cs=4:q=0:v=24:gosub5305
  74. 1225 gosub5034:sp%=0:sd%=0:gosub1405:gosub1415:gosub1420:goto1060
  75. 1230 rem    ***** sailing problems *****
  76. 1235 e=1:ifst%(se%)=1andub%(se%)=1thene=3:b%=l1%(se%):d%=l2%(se%):goto1265
  77. 1240 ifst%(se%)=1thenb%=l1%(se%):goto1265
  78. 1245 ifub%(se%)=1thend%=l2%(se%):goto1270
  79. 1250 return
  80. 1260 rem    ***** problem filter/action *****
  81. 1265 c%=0:a%=b%:d=1:a=0:gosub1290:ifa=1then1275
  82. 1270 c%=0:a%=d%:d=2:a=0:gosub1290:ifa=1then1275
  83. 1272 gosub5043:return
  84. 1275 gosub1305
  85. 1276 gosub6020:rn%=rnd(0)*4+1:ifrn%<>c%thenondgosub1355,1365
  86. 1280 ife=3andd=1then1270
  87. 1281 gosub5034:return
  88. 1290 ifgl%=a%thenc%=2:a=1:return
  89. 1291 forx=1to8:ifgl%=(a%+sa%(x))thenc%=1:x=8:next:a=1:return
  90. 1295 return
  91. 1300 rem    ***** warnings/course change *****
  92. 1305 ms$="[217]ou are entering a storm.":cn=2
  93. 1307 ifd=2thenms$="[217]ou are in a [213]-boat area.":cn=4
  94. 1310 gosub2005:gosub5205:rn%=rnd(0)*5+1:ifrn%=sd%thenreturn
  95. 1312 a=1
  96. 1315 a%=rnd(0)*8+1:b%=gl%+sa%(a%)
  97. 1320 ifb%>9andb%<90thengl%=b%:gosub1445:goto1335
  98. 1325 a=a+1:ifa<5then1315
  99. 1326 return
  100. 1335 gosub6010:a$="[211]torm path":ifd=2thena$="[213]-boat sighting"
  101. 1340 ms$=a$+" causes course change.":gosub5206:sd%=rn%:gosub1415
  102. 1345 return
  103. 1350 rem    ***** losses *****
  104. 1355 cn=2:gosub2005:rn%=rnd(9)*2+1:ifrn%=2then1358
  105. 1356 ms$="[211]torm damage to "+str$(c%)+" vessel(s).":ifsp%>1thensp%=sp%-1
  106. 1357 ds%=ds%+c%:goto1360
  107. 1358 ms$="[211]torm sinks"+str$(c%)+" vessel(s).":tv%=tv%-c%
  108. 1360 gosub5206:gosub1405:gosub1420:gosub1425
  109. 1361 gosub6020:gosub5034:ife=3then1270
  110. 1362 return
  111. 1365 forf=1toc%:cn=3:gosub2005:nextf
  112. 1366 ms$="[213]boats sink "+str$(c%)+" vessel(s).":tv%=tv%-c%:gosub5206
  113. 1367 gosub1405:gosub6020:goto5034
  114. 1370 rem    ***** hq alert *****
  115. 1375 ms$="[198]8 = [200][209] obstacle reports.":v=18:goto5210
  116. 1380 rem    ***** fuel consumption *****
  117. 1385 qf=1:fc%=fc%+mf%:fu%=(1000-fc%)*100/1000:iffu%<1thenfu%=0:qf=4
  118. 1390 q=8:ifqf<>4andmf%<10then1475
  119. 1395 return
  120. 1400 rem    ***** print status data *****
  121. 1405 a$=str$(tv%):v=6:goto1435
  122. 1410 a$=str$(ev%):v=7:goto1435
  123. 1415 a$=sd$(sd%):v=8:goto1435
  124. 1420 a$=sp$(sp%):v=9:goto1435
  125. 1425 a$=str$(ds%):v=10:goto1435
  126. 1430 a$=str$(us%):v=11
  127. 1435 h=28:ms$="         ":gosub5070:ms$=a$:goto5070
  128. 1440 rem    ***** print status line *****
  129. 1445 gosub5040:forx=1to3:h=dl%(x):ms$=dl$(x):gosub5070:next
  130. 1450 a%=1:q=8
  131. 1455 ona%goto1460,1465,1475
  132. 1460 h=9:e$="   ":a$=str$(se%):goto1480
  133. 1465 h=20:e$="   ":a$=gl$(gl%):goto1480
  134. 1475 h=32:e$="    ":a$=str$(fu%):goto1480
  135. 1480 v=0:ms$=e$:gosub5070:ms$=a$:gosub5070:ifq<>8thenreturn
  136. 1485 a%=a%+1:ifa%<4then1455
  137. 1490 return
  138. 1500 rem    ***** set/unset problem locations *****
  139. 1505 pl%=4-ra%:ss=0:ms$="[210]eviewing situation - be patient.":gosub5205
  140. 1510 a%=ra%:ot=ot+1:ifot>3thenot=1
  141. 1511 rn%=rnd(0)*48+1
  142. 1512 onotgoto1515,1520,1525
  143. 1515 st%(rn%)=0:l1%(rn%)=0:a%=a%-1:ifa%=0then1530
  144. 1516 goto1511
  145. 1520 ub%(rn%)=0:l2%(rn%)=0:a%=a%-1:ifa%=0then1530
  146. 1521 goto1511
  147. 1525 ds%=ds%-ra%:ifds%=<0thends%=0
  148. 1526 gosub1425
  149. 1530 pa%=pa%+1:ifpa%=3thenpa%=1
  150. 1535 qf=1:sn%=rnd(0)*48+1:ifsn%<7orsn%=se%then1535
  151. 1540 ifpa%=1then1550
  152. 1545 st%(sn%)=1:goto1555
  153. 1550 ub%(sn%)=1
  154. 1555 rn%=rnd(0)*88+1:forx=1to8:ifrn%>x*10andrn%<x*10+9then1560
  155. 1557 next:goto1555
  156. 1560 x=8:next:ifpa%=1then1570
  157. 1565 l1%(sn%)=rn%:goto1575
  158. 1570 l2%(sn%)=rn%
  159. 1575 ss=ss+1:ifss<pl%then1530
  160. 1580 goto5043
  161. 1600 rem    ***** search/attack *****
  162. 1605 ifev%<1thenms$="[206]o escorts. [193]ny key.":cs=4:q=0:goto5300
  163. 1606 ss=6:ss$="s":gosub5405:gosub1825:gosub5610:gosub1765
  164. 1607 gosub1445:ms$="[195]onvoy status above.":v=2:gosub5210
  165. 1609 gosub1780:gosub1475
  166. 1610 ms$="[211]elect - s,k,^, or _":gosub5205:sysad+48,"sk^_"
  167. 1611 gosub5043:iff%=4then1685
  168. 1612 iff%=3thengosub1770:goto1615
  169. 1613 onf%gosub1855,1905
  170. 1614 goto1610
  171. 1615 gosub1805:h=1:ms$="[211]earch [211]ector =":gosub5043:gosub5070:gosub6180
  172. 1620 h=18:v=23:gosub5015:ll=2:gosub5715:ifw$=""then1609
  173. 1622 a=1:forx=1to2:ifmid$(w$,x,1)<chr$(48)ormid$(w$,x,1)>chr$(57)thena=2
  174. 1623 next:ifa=2then1615
  175. 1624 ss%=val(w$):ifss%<0orss%>48then1615
  176. 1625 h=1:ms$="[211]earch [199]rid location =":gosub5043:gosub5070:gosub6180
  177. 1630 h=24:v=23:gosub5015:ll=2:gosub5715:ifw$=""then1609
  178. 1632 a=1:forx=1to2:ifmid$(w$,x,1)<chr$(48)ormid$(w$,x,1)>chr$(57)thena=2
  179. 1633 next:ifa=2then1625
  180. 1634 sg%=val(w$):ifsg%<0orsg%>99then1625
  181. 1635 ifss%=se%then1646
  182. 1640 ar%=se%/7:ifss%>ar%+7then1646
  183. 1645 ms$="[194]ad choice. [212]ry again. [193]ny key.":cs=4:q=0:gosub5300:goto1615
  184. 1646 fm%(0)=2:mf%=0:cn=1:gosub2005:ms$="[200]unting":gosub5206
  185. 1647 a=0:b=4-ra%:ifub%(ss%)=0thengosub6010:goto1660
  186. 1649 z=5*ra%:ifl2%(ss%)=sg%thena=3:b=1:goto1660
  187. 1650 forx=1toz:ifl2%(ss%)+x=sg%thena=2:b=x+1:x=z:l2%(ss%)=0:goto1655
  188. 1652 next:forx=1toz:ifl2%(ss%)-x=sg%thena=2:b=x+1:x=z:l2%(ss%)=0
  189. 1655 next:ifra%=3andus%=0anda<1thena=1
  190. 1657 a%=rnd(0)*25+1:ifa%=(gl%+1)/4thenev%=ev%-1:cn=3:gosub2005:goto1690
  191. 1660 mf%=b*25:gosub1385:mf%=0:gosub1475
  192. 1661 ifa=0thenms$="[206]o [213]boat found.":goto1676
  193. 1665 ifl2%(ss%)=0thenub%(ss%)=0:gosub1555
  194. 1670 forf=1toa:us%=us%+1:cn=5:gosub2005:nextf
  195. 1675 ms$="[197]scorts sink"+str$(a)+" [213]boat(s)"
  196. 1676 gosub5034:gosub5206:mf%=z*3*(4-ra%):gosub1385
  197. 1677 ifa>0thengosub6010:gosub5042:goto1609
  198. 1678 gosub1475:ms$="[195]ontinue search? (y/n)":cs=1:q=0:gosub5300
  199. 1680 gosub5034:onqfgoto1609,1625
  200. 1685 print"[147]":ss=6:ss$="r":gosub5405:goto1430
  201. 1690 ms$="[217]ou lose an escort vessel."
  202. 1695 ifev%<1thenms$="[217]ou just lost your last escort."
  203. 1696 gosub5206:ifev%<1thengosub5225:goto1685
  204. 1697 onra%gosub6005,6010,6015
  205. 1698 goto1677
  206. 1700 rem    ***** game fail *****
  207. 1705 print"[147]":bd=2:bk=1:ch=0:gosub5005
  208. 1710 ms$="[217][207][213] [194][204][197][215] [201][212]![144]":v=1:gosub5210
  209. 1715 ms$="[217]ou ran out of fuel."
  210. 1720 iftv%=0thenms$="[217]ou went down with the last ship."
  211. 1725 v=10:gosub5210
  212. 1730 ms$="[196]o you wish to [210]edo, re[211]tart, or":v=15:gosub5210
  213. 1735 ms$="[209]uit? (r/s/q)"
  214. 1740 ch$="rsq":sp%=0:gosub6510:iff%=3thengosub5220:onqfgoto1740,5505
  215. 1745 iff%=2then5515
  216. 1750 gosub7705:onqfgoto1032,5515
  217. 1760 rem    ***** attack display *****
  218. 1765 h=1:forv=4to13:ms$=md$(1,v-1):gosub5070:next:return
  219. 1770 a$(1)="([199]rid [204]etter: [193] = 0,":a$(2)="[202] = 9. [204]ocation = [210]ow"
  220. 1775 a$(3)="[206]umber-1, times 10,":a$(4)="plus [204]etter value.)"
  221. 1776 a$(5)="[205]in 2 digits. eg:8=08":goto1790
  222. 1780 a$(1)="[211] = [211]ector [205]ap":a$(2)="[203] = [200][209][160][196]ata"
  223. 1785 a$(3)="^ = [211]earch":a$(4)="_ = [206]av bridge":a$(5)=""
  224. 1790 d$="                     ":h=16:forv=5to9:ms$=d$:gosub5070
  225. 1795 ms$=a$(v-4):gosub5070:next:return
  226. 1800 rem    ***** collect garbage *****
  227. 1805 qf=1:ifpeek(52)>peek(50)+2thenreturn
  228. 1810 qf=2:ms$="[206]umber [207]ne re-evaluating convoy data.":v=18:gosub5210
  229. 1815 sys45949
  230. 1816 goto1375
  231. 1820 rem    ***** attack screen *****
  232. 1825 print"[147]":sysad+3,0,39,1,1,160,0
  233. 1830 sysad+3,0,39,20,20,160,0
  234. 1835 return
  235. 1850 rem    ***** attack sector map *****
  236. 1855 ss=7:ss$="s":gosub5405:print"[147]":ss=5:ss$="r":gosub5405
  237. 1860 ms$="[195]onvoy is in [211]ector"+str$(se%)+". [193]ny key.":cs=4:q=0:gosub5300
  238. 1865 print"[147]":ss=7:ss$="r":gosub5405:return
  239. 1900 rem    ***** hq report *****
  240. 1905 ms$="[208]atience - organizing data.":v=18:gosub5210:gosub5086
  241. 1910 b%=3:ss=7:forx=3to6:a$="":next
  242. 1911 a%=0:a$(b%)="":forx=ssto48:ifst%(x)=0then1925
  243. 1915 a$(b%)=a$(b%)+str$(x):a%=a%+1:ifx=48then1925
  244. 1920 ifa%=12thenss=x:b%=b%+1:x=48:next:goto1911
  245. 1925 next:b%=9:ss=7:forx=9to12:a$="":next
  246. 1930 a%=0:a$(b%)="":forx=ssto48:ifub%(x)=0then1945
  247. 1935 a$(b%)=a$(b%)+str$(x):a%=a%+1:ifx=48then1945
  248. 1940 ifa%=12thenss=x:b%=b%+1:x=48:next:goto1930
  249. 1945 next:a$(0)="[200][197][193][196][209][213][193][210][212][197][210]'[211]  [210][197][208][207][210][212]":a$(2)="[211][212][207][210][205] [211]ectors:-"
  250. 1950 a$(8)="[213][194][207][193][212] [211]ectors:-"
  251. 1955 v=18:gosub5045:ss=7:ss$="s":gosub5405:print"[147]"
  252. 1960 ms$=a$(0):gosub5208:h=1:v=2:ms$=a$(2):gosub5070
  253. 1965 forv=3to6:ms$=a$(v):gosub5070:next:v=8:ms$=a$(8):gosub5070
  254. 1970 forv=9to12:ms$=a$(v):gosub5070:next:gosub5225
  255. 1975 print"[147]":ss=7:ss$="r":gosub5405:return
  256. 2000 rem    ***** sound s/r *****
  257. 2005 oncngosub2025,2045,2065,2085,2115
  258. 2010 forx=0to24:pokes+x,0:next:return
  259. 2020 **** attack ****
  260. 2025 forx=1to5:fory=70to100step5:pokes+1,y:pokes+5,15:pokes+6,10:pokes+24,15
  261. 2030 pokes+4,17:forz=0to5:next:next:next:pokes+4,16:return
  262. 2040 **** storm ****
  263. 2045 pokes+24,15:pokes+5,12:pokes+6,240:pokes+1,96:pokes,0:pokes+4,129
  264. 2050 forx=0to5000:next:pokes+4,128:return
  265. 2060 **** torpedo strike ****
  266. 2065 pokes+5,17:pokes+6,240:pokes+1,1:forx=2to12step.25:pokes+4,129
  267. 2070 pokes+24,x/2+9:pokes+1,x:next:fory=0to250:next:pokes+4,128:return
  268. 2080 **** uboat warning ****
  269. 2085 pokes+24,15:pokes+5,0:pokes+6,240:pokes+1,150:pokes,0:pokes+4,17
  270. 2090 pokes+5+7,0:pokes+6+7,240:pokes+1+7,75:pokes+7,0:pokes+4+7,33
  271. 2095 fora=1to6:forb=150to70step-8:pokes+1,b:pokes+1+3+4,b*1.5:pokes+0,0:next
  272. 2100 forb=70to150step6:pokes+1,b:pokes+1+3+4,b*1.3:pokes+0,0:next:next
  273. 2105 pokes+11,0:pokes+4,16:return
  274. 2110 **** uboat kill ****
  275. 2115 pokes+5,17:pokes+6,112:pokes+4,17:forx=15to1step-.2:pokes+24,x
  276. 2120 pokes+1,x*10:next:pokes+4,16:pokes+24,15:pokes+4,129:forx=15to1step-.4
  277. 2125 pokes+24,x:pokes+1,int(rnd(1)*3+x):next:pokes+4,128:return
  278. 3000 rem    ***** north *****
  279. 3005 qf=1:ns%=se%:nl%=gl%-10
  280. 3010 ifnl%<0thennl%=(nl%+1)+90:ns%=se%-1:ifns%<0thensp%=0:sd%=0:qf=2:return
  281. 3015 gl%=nl%:ifns%<>se%thense%=ns%
  282. 3020 fm%(0)=1:goto1385
  283. 3030 rem    ***** south *****
  284. 3035 qf=1:ns%=se%:nl%=gl%+10
  285. 3040 ifnl%>99thennl%=nl%-100:ns%=se%+1:ifns%>48thensp%=0:sd%=0:qf=2:return
  286. 3045 gl%=nl%:ifns%<>se%thense%=ns%
  287. 3050 fm%(0)=1:goto1385
  288. 3060 rem    ***** east *****
  289. 3065 qf=1:ns%=se%:nl%=gl%+1:a%=gl%/10:b%=a%*10
  290. 3070 ifnl%>b%+9thennl%=b%:goto3080
  291. 3075 fm%(0)=1:gl%=nl%:goto1385
  292. 3080 ns%=se%+7:ifns%>48thenns%=ns%-7:qf=6:return
  293. 3085 fm%(0)=1:gl%=nl%:se%=ns%:goto1385
  294. 3100 rem    ***** north east *****
  295. 3105 gosub3065:ifqf=6thenreturn
  296. 3110 goto3005
  297. 3130 rem    ***** south east *****
  298. 3135 gosub3035:ifqf=2thenreturn
  299. 3140 goto3065
  300. 3200 rem    ***** game end *****
  301. 3205 ed%=ns%-41:ifed%=1ored%=3thenf%=3:lv%=tv%/2:goto3230
  302. 3210 ifed%<>2anded%<>4thenf%=4:lv%=(tv%/5)*(e%-4):goto3230
  303. 3215 f%=ed%/2:a$(1)="[217]ou arrive safely at "+hd$(f%)
  304. 3220 a$(2)="":iftv%<30thena$(2)="[195]annot say as much for the convoy."
  305. 3225 goto3245
  306. 3230 iflv%<0thenlv%=0
  307. 3231 tv%=tv%-lv%:iftv%<0thentv%=0:goto1705
  308. 3232 a$(1)="":a$(2)=""
  309. 3233 iflv%=0then3245
  310. 3234 a$(1)="[217]ou lose "+str$(lv%)+" ships "+hd$(f%)
  311. 3235 a$(2)=he$(f%-2)+" to your faulty navigation."
  312. 3245 a$(3)="[217]ou make port with"+str$(tv%)+" transports"
  313. 3247 a$(4)="and"+str$(ev%)+" escorts after sinking"
  314. 3250 a$(5)="a total of"+str$(us%)+" [213]boats."
  315. 3255 a$(6)="[215]ell let us see how the [193]dmiralty"
  316. 3260 a$(7)="and [195][200][193][198] view your performance."
  317. 3265 a$(8)="[193]ny key takes you to the review board."
  318. 3270 gosub3305:print"[147]":bd=1:bk=1:ch=0:gosub5005
  319. 3275 h=1:forv=8to9:ms$=a$(v-7):gosub5070:next:gosub6015
  320. 3280 forv=11to13:ms$=a$(v-8):gosub5070:next:gosub6015
  321. 3285 forv=15to17:ms$=a$(v-9):gosub5070:next
  322. 3290 a$="":geta$:ifa$=""then3290
  323. 3295 gosub5033:gosub7805:goto5515
  324. 3300 rem    ***** scoring *****
  325. 3305 el%=11:iftv%>5thenel%=10
  326. 3310 iftv%>10thenel%=9
  327. 3315 iftv%>15thenel%=8
  328. 3320 iftv%>20thenel%=7
  329. 3325 iftv%>25thenel%=6
  330. 3330 iftv%>30thenel%=5
  331. 3335 iftv%>35thenel%=4
  332. 3340 iftv%>40thenel%=3
  333. 3345 iftv%>45thenel%=2
  334. 3350 iftv%>48thenel%=1
  335. 3355 uc%=us%:ifuc%>40thenuc%=40
  336. 3360 ts%=(tv%*100)+(ev%*200)+(uc%*500)+(fu%*50):return
  337. 5000 rem    ***** colour setup *****
  338. 5005 poke53280,bd:poke53281,bk:poke646,ch:return
  339. 5010 rem    ***** cursor locate *****
  340. 5015 poke211,h:poke214,v:sys58732
  341. 5020 return
  342. 5025 rem    ***** delete line(s) *****
  343. 5030 tl=0:bl=24:goto5035 :rem * screen
  344. 5031 tl=2:bl=6:goto5035  :rem * window1
  345. 5032 v=8:goto5035        :rem * window2
  346. 5033 tl=17:bl=19:goto5035:rem * window3
  347. 5034 tl=21:bl=24:goto5035:rem * window4
  348. 5035 forv=tltobl:gosub5045:next:return
  349. 5036 gosub5031:gosub5032:gosub5033:goto5034:rem * windows 1 to 4
  350. 5037 gosub5032:gosub5033:goto5034:rem * windows 2 to 4
  351. 5038 gosub5033:goto5034  :rem * windows 3 & 4
  352. 5039 gosub5031:goto5032  :rem * windows 1 & 2
  353. 5040 v=0:goto5045        :rem * line0
  354. 5042 v=22:goto5045       :rem * line22
  355. 5043 v=23:goto5045       :rem * line23
  356. 5044 v=24:goto5045       :rem * line24
  357. 5045 poke781,v:sys59903
  358. 5046 return
  359. 5050 tl=12:bl=19:goto5035
  360. 5055 tl=14:bl=24:goto5035
  361. 5060 rem    ***** print data/at *****
  362. 5065 forv=tltobl:ms$=a$(v):gosub5070:next:return
  363. 5070 sysad+15,h,v,ms$
  364. 5075 return
  365. 5080 rem    ***** delete data *****
  366. 5085 forx=tltobl:a$(x)="":next:return
  367. 5086 tl=1:bl=22:goto5085
  368. 5100 rem    ***** check disk *****
  369. 5105 d=1:goto5120       :rem - load
  370. 5110 d=2:goto5120       :rem - save
  371. 5115 d=3                :rem - check
  372. 5120 gosub5258:open15,dr,15,"r:"+df$+"="+df$:input#15,er,a$,a,a:close15
  373. 5130 gosub5043:ifer=62thenondgoto5145,5145,5170
  374. 5135 ifer=63thenondgoto5175,5150,5175
  375. 5140 ifd=3then5180
  376. 5145 ms$="":gosub5300:onqfgoto5120,5180,5180
  377. 5150 ms$="":gosub5300:onqfgoto5160,5180,5180
  378. 5160 gosub5735:onqfgoto5135,5180
  379. 5165 pr=1:return
  380. 5170 pr=2:return
  381. 5175 pr=3:return
  382. 5180 pr=4:return
  383. 5200 rem    ***** centre print *****
  384. 5205 v=23:goto5210
  385. 5206 v=22:goto5210
  386. 5207 v=24:goto5210
  387. 5208 v=0
  388. 5210 gosub5045
  389. 5211 gosub5370:return
  390. 5215 ms$="[205]enu? (y/n)":cs=1:q=0:goto5300ready.
  391. 5220 sz=zs:ms$="[193]re you sure you want to quit?(y/n)":cs=5:q=0:goto5300
  392. 5222 sz=zs:ms$="[196]ata unavailable. [193]ny key.":cs=4:q=0:goto5300
  393. 5225 sz=zs:ms$="[193]ny key when ready.":cs=4:q=0:goto5300
  394. 5230 return
  395. 5235 ms$="[195]hange disk now. [193]ny key.":cs=4:q=0:goto5300
  396. 5240 sz=zs:ms$="[198]unction/file not available. [193]ny key.":cs=4:zs=4:q=8:goto5300
  397. 5245 ms$="[211]ave game to date? (y/n)":cs=6:q=0:goto5300
  398. 5250 sz=zs:ms$="[195]ontinue?(y/n)":cs=2:q=0:goto5300
  399. 5255 sz=zs:ms$="[193]re you [210][197][193][204][204][217] sure?(y/n)":cs=2:q=0:goto5300
  400. 5258 ms$="[195][193][213][212][201][207][206] - drive activity":q=0:goto5205
  401. 5260 sz=zs:q=0:ifer=26thenms$="[215]rite protect on! [210]emoved?(y/n)":cs=2:goto5370
  402. 5280 ifer=62thenms$="[198]ile not found. [206]ew disk?(y/n)":cs=5:goto5370
  403. 5285 ifer=63thenms$="[198]ile exists. [210]eplace?(y/n)":cs=2:goto5370
  404. 5290 ifer=74thenms$="[196]rive unready. [195]orrected?(y/n)":cs=2:goto5370
  405. 5295 ms$="[205]ajor drive/disk error. [193]ny key.":cs=4:qf=3:goto5370
  406. 5300 gosub5043:zz=v:b$=ms$:goto5306
  407. 5305 zz=v:b$=ms$:gosub5045
  408. 5306 ifq=8thengosub5044:gosub6165
  409. 5307 v=zz:ms$=b$:gosub5365
  410. 5310 poke198,0:wait198,15:geta$
  411. 5315 sysad+24,a$
  412. 5320 gosub5044:ifa$="^"andq=8thengosub6105:goto5306
  413. 5321 q=0:ifa$="^"thengosub6985:goto5306
  414. 5325 zs=sz:ifcs=4thena$="":v=zz:goto5045
  415. 5330 ifcs=3thenv=zz:goto5045
  416. 5335 qf=1:ifa$<>"y"anda$<>"n"thengosub6985:goto5306
  417. 5340 ifcs=6anda$="y"thengosub7805
  418. 5345 ifcs=5anda$="y"thena=1:goto5245
  419. 5350 ifcs=2anda$="n"thenqf=2
  420. 5355 ifcs=1anda$="y"thenqf=2
  421. 5357 ifa=1thena=0:qf=2
  422. 5360 a$="":v=zz:goto5045
  423. 5365 ifms$=""then5260
  424. 5370 sysad+18,v,ms$
  425. 5375 return
  426. 5400 rem    ***** screen stash *****
  427. 5405 onssgoto5410,5415,5420,5425,5430,5435,5440
  428. 5410 sp=160:goto5450 :rem - help/harbour
  429. 5415 sp=168:goto5450 :rem - hotkeys
  430. 5420 sp=174:goto5450 :rem - help/bridge
  431. 5425 sp=16:goto5450  :rem - help load
  432. 5430 sp=208:goto5450 :rem - sector map
  433. 5435 sp=216:goto5450 :rem - temp 1
  434. 5440 sp=224:goto5450 :rem - temp 2
  435. 5445 sp=232          :rem - temp 3
  436. 5450 m=6:ifss$="r"thenm=9
  437. 5455 sysad+m,sp
  438. 5460 return
  439. 5500 rem    ***** module load *****
  440. 5503 ifdr=25thenpoke186,dv:q=64:goto5546
  441. 5505 open2,dr,2:close2:ifst<-120thendr=dr+1:goto5503
  442. 5510 qf=1:df$="hello connect":gosub5115:ifpr=3then5530
  443. 5512 dr=dr+1:goto5503
  444. 5515 x$="1":ifts%<>0thenx$="2"
  445. 5520 qf=1:df$="harbour":dr=dv:gosub5115:ifpr<>3thenq=64:goto5546
  446. 5525 dl$=df$:goto5565
  447. 5530 print"[147]":bd=0:bk=0:ch=1:gosub5005
  448. 5535 ms$="[197]ntering "+df$:gosub5205:poke646,0
  449. 5540 print"[144]load"q$df$q$","dv
  450. 5545 print"run":ifdf$<>"hello connect"then5548
  451. 5546 poke44,8:poke2048,0:poke53272,23:printchr$(9)
  452. 5547 ifq=64thenprint"[147]":poke646,1:printchr$(9):new
  453. 5548 print"":poke631,13:poke632,13:poke633,13:poke198,3:end
  454. 5565 df%=1:df$="ac.game":dr=dv:gosub5115:ifpr=1orpr=4then5595
  455. 5570 ifpr=3thengosub5740:ifqf=2then5595
  456. 5575 gosub5258:open3,dv,3,"l:"+df$+",s,w":print#3,nm$:print#3,x$
  457. 5580 print#3,str$(ra%):close3:df$=dl$:gosub5043:goto5530
  458. 5595 ms$="[198]ile (ac.game)/disk problem. [193]ny.":cs=4:gosub5300
  459. 5596 gosub5740:df$=dl$:goto5530
  460. 5600 rem    ***** bload *****
  461. 5605 df$="h.convoy"+str$(zs):gw=0:goto5635
  462. 5610 df$="getword 1000":ifgw=1thenreturn
  463. 5635 gosub5258:sysad+51,df$,dv,4096
  464. 5640 ifdf$="getword 1000"thengw=1
  465. 5645 gosub5043:return
  466. 5700 rem    ***** data entry *****
  467. 5705 ch=0
  468. 5706 sysag,ch,5,ll      :rem - alpha
  469. 5710 return
  470. 5715 ch=0
  471. 5716 sysag+3,ch,7,ll    :rem - numeric
  472. 5720 return
  473. 5730 rem    ***** scratch file *****
  474. 5735 ifq=1thenq=0:goto5740
  475. 5736 qf=1:ms$="[193]re you sure you want to delete?(y/n)":cs=2:gosub5300
  476. 5737 ifqf=2thenreturn
  477. 5740 gosub5258:open15,dv,15,"s:"+df$:input#15,er,a$,a,a:close15:gosub5043
  478. 5745 ifer=62orer<20thenqf=1:pr=2:return
  479. 5750 qf=2:return
  480. 6000 rem    ***** timer *****
  481. 6005 x=60:goto6085
  482. 6010 x=90:goto6085
  483. 6015 x=120:goto6085
  484. 6020 x=180:goto6085
  485. 6025 x=210:goto6085
  486. 6030 x=240:goto6085
  487. 6035 x=270:goto6085
  488. 6040 x=300:goto6085
  489. 6045 x=330:goto6085
  490. 6050 x=360:goto6085
  491. 6055 x=390:goto6085
  492. 6060 x=420:goto6085
  493. 6065 x=480:goto6085
  494. 6070 x=510:goto6085
  495. 6075 x=540:goto6085
  496. 6080 x=600
  497. 6085 ti$="000000"
  498. 6090 ifti<xthen6090
  499. 6095 return
  500. 6100 rem    ***** help screen s/r *****
  501. 6105 ss=6:ss$="s":gosub5405:print"[147]":bd=0:bk=1:ch=0:gosub5005
  502. 6106 ifzs>3thenz=zs-3:goto6118
  503. 6110 ifzl(zs)=1thenss=zs:ss$="r":gosub5405:goto6120
  504. 6115 gosub5605:ss=4:ss$="r":gosub5405:zl(zs)=1:ss=zs:ss$="s":gosub5405
  505. 6116 gosub5610:goto6120
  506. 6118 onzgosub6130
  507. 6120 gosub5225:print"[147]":ss=6:ss$="r":gosub5405:return
  508. 6125 ms$="[198]unction cannot be used with available":v=10:gosub5210
  509. 6126 ms$="data/information    --- [207][210] ---":v=11:gosub5210
  510. 6127 ms$="[210]equested file not available":v=12:gosub5210
  511. 6128 ms$="--- [207][210] --- not used with this option.":v=13:gosub5210:return
  512. 6160 rem    ***** info line data *****
  513. 6165 ms$="^ = [200]elp.":goto5207
  514. 6170 ms$="_ = [193]bort.":goto5207
  515. 6175 ms$="or [200][207][212] keys.":goto5207
  516. 6180 ms$="[210][197][212][213][210][206] = [193]bort.":goto5207
  517. 6500 rem    ***** brancher *****
  518. 6505 tl=v:bm$=ms$:k=len(ch$):bh$=ch$+kf$:qn$="a":goto6515
  519. 6510 tl=v:bm$=ms$:k=len(ch$):bh$=ch$:qn$=""
  520. 6515 v=tl:ms$=bm$:gosub5205:ifqn$="a"thengosub6175
  521. 6516 a=1:poke198,0:a%=0:qf=1:ti$="000000"
  522. 6517 a$="":geta$:ifa$<>""then6521
  523. 6518 ifsp%=0orti<vt%(ra%,sp%)then6517
  524. 6519 mf%=sp%:gosub1385:ifqf=4thenreturn
  525. 6520 qf=8:return
  526. 6521 forx=1tolen(bh$):ifa$<>mid$(bh$,x,1)thennext:goto6515
  527. 6522 f%=x:x=len(bh$):next:iff%<k+1thenreturn
  528. 6525 a%=f%-k:ifa%=1thengosub1605:gosub1475:goto6515
  529. 6530 ifa%=2thengosub1905:gosub1375:goto6515
  530. 6535 ifa%=3thengosub5220:onqfgoto6515,6595
  531. 6540 ifa%=4thenqf=5:gosub7705:goto6519
  532. 6545 ifa%=5thengosub7805:goto6515
  533. 6550 ifa%=6thengosub6105:goto6515
  534. 6555 ifa%=7thenqf=3:return
  535. 6560 ifa%=8thensz=zs:zs=2:gosub6105:zs=sz:goto6515
  536. 6562 ifa%=9thenqf=7:return
  537. 6565 ifa%=10thengosub6585:goto6515
  538. 6566 ifse%<>28andse%<>29thengosub5230:goto6515
  539. 6567 c%=rnd(0)*12+1:ifc%>9then6570
  540. 6568 c%=rnd(0)*3+1:ms$="[212]ransports on rocks = "+str$(c%):gosub5206:gosub5225
  541. 6569 tv%=tv%-c%:gosub1405:goto6580
  542. 6570 c%=rnd(0)*12+1:ifc%>9then6580
  543. 6571 c%=rnd(0)*3+1:cn=3:forf=1toc%:gosub2005:nextf
  544. 6572 ms$="[213]-boats sink "+str$(c%)+" vessels.":gosub5206:gosub5225
  545. 6575 tv%=tv%-c%:gosub1405
  546. 6580 gosub5042:se%=28:gl%=6:sp%=0:sd%=0:fc%=0:mf%=0:gosub1385:gosub1415
  547. 6581 gosub1420:gosub1445
  548. 6582 ms$="[210]efuel in [201]celand.":gosub5206:goto6515
  549. 6585 ms$="[206]o nearby base. [193]ny key.":cs=4:q=0:gosub5300
  550. 6590 print"[147]":ss=7:ss$="r":gosub5405:return
  551. 6595 return
  552. 6950 rem    ***** bridge screen *****
  553. 6955 print"[147]":bd=0:bk=1:ch=0:gosub5005
  554. 6960 sysad+3,0,39,1,1,160,0
  555. 6965 sysad+3,0,39,20,20,160,0
  556. 6970 h=1:forv=2to14:ms$=md$(1,v-2):gosub5070:next
  557. 6975 h=16:forv=6to11:ms$=md$(1,v+7):gosub5070:next:return
  558. 6980 rem    ***** rebuke *****
  559. 6985 gosub5034:ms$="[217]ou are bad "+nm$+",":v=21:gosub5210
  560. 6990 ms$="follow instructions.":v=22:gosub5210
  561. 6991 ms$="[193]ny key continues.":gosub5205
  562. 6992 a$="":geta$:ifa$=""then6992
  563. 6995 goto5034
  564. 6996 goto5034
  565. 7700 rem    ***** load game *****
  566. 7705 qf=1:df$="cg."+nm$+fl$(ra%):dr=dv:gosub5115:ifpr<>3thenqf=4:goto7770
  567. 7715 gosub5258:open15,dv,15:open3,dv,3,"l:"+df$+",s,r"
  568. 7720 input#3,a$,b$,c$,d$,e$,f$,g$,h$,i$,j$,k$,l$,m$,n$:ev%=val(a$):gl%=val(b$)
  569. 7721 se%=val(c$):sd%=val(d$):sp%=val(e$):us%=val(f$)
  570. 7725 tv%=val(g$):gc%=val(h$):ds%=val(i$):fu%=val(j$):el%=val(k$):fc%=val(l$)
  571. 7730 ts%=val(m$):uc%=val(n$):forx=0to48:input#3,a$,b$,c$,d$:l1%(x)=val(a$)
  572. 7735 l2%(x)=val(b$):st%(x)=val(c$):ub%(x)=val(d$):next
  573. 7740 input#15,er,a$,a,a:close3:close15:gosub5043:qf=1:ifer<20orer=63then7755
  574. 7745 qf=2:return
  575. 7755 ifqf=1andgc%=0andts%=0thenreturn
  576. 7760 qf=2:return
  577. 7800 rem    ***** save game *****
  578. 7805 df$="cg."+nm$+fl$(ra%):dr=dv:gosub5115
  579. 7806 ifpr=3thengosub5740:onqfgoto7815,7855
  580. 7810 ifpr<>2then7860
  581. 7815 qf=1:gosub5258:open15,dv,15:open3,dv,3,"l:"+df$+",s,w"
  582. 7820 print#3,str$(ev%):print#3,str$(gl%):print#3,str$(se%):print#3,str$(sd%)
  583. 7825 print#3,str$(sp%):print#3,str$(us%):print#3,str$(tv%):print#3,str$(gc%)
  584. 7830 print#3,str$(ds%):print#3,str$(fu%):print#3,str$(el%):print#3,str$(fc%)
  585. 7835 print#3,str$(ts%):print#3,str$(uc%):forx=0to48:print#3,str$(l1%(x))
  586. 7836 print#3,str$(l2%(x)):print#3,str$(st%(x)):print#3,str$(ub%(x)):next
  587. 7850 input#15,er,a$,a,a:close3:close15:gosub5043:ifer<20orer=63then7865
  588. 7855 ms$="[211]ave error. [210]etry?(y/n)":cs=2:gosub5300:onqfgoto7805,7865
  589. 7860 ms$="[196]rive error. [210]etry?(y/n)":cs=2:gosub5300:ifqf=1then7805
  590. 7865 return
  591. 10000 dv=peek(186):open15,dv,15,"s:bridge":close15:save"bridge",dv:end
  592. 20000 a%=rnd(0)*12+1:printa%
  593.