home *** CD-ROM | disk | FTP | other *** search
/ Loadstar - Compleat Programmer / comprog1.d81 / carom (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1990-01-01  |  6.7 KB  |  239 lines

  1. 5 dv=peek(186):ifdv<8thendv=8
  2. 10 goto20
  3. 17  
  4. 18     --- set up everything ---
  5. 19  
  6. 20 poke53281,0:poke53280,0:print""chr$(142)tab(13)"loading"
  7. 24 printtab(21)"cf1":poke147,0:sys57812"cf1",dv,1:sys62631
  8. 25 printtab(21)"cf2":poke147,0:sys57812"cf2",dv,1:sys62631
  9. 26 printtab(21)"cf3":poke147,0:sys57812"cf3",dv,1:sys62631
  10. 27 printtab(21)"cf4":poke147,0:sys57812"cf4",dv,1:sys62631
  11. 28 poke53272,24
  12. 30 h=1:e=24:fl=0:d=2:dm=0:c=54272:v=53248
  13. 31 dimrq%(12),cm%(12)
  14. 32 x$(0)=" VVV "
  15. 33 x$(1)="W W W"
  16. 34 x=rnd(-ti):def fnra(x)=int(rnd(0)*x)
  17. 35 fori=0to3:readn%(i):next
  18. 36 fori=0to7:readrq%(i),cm%(i):next
  19. 37 fori=0to1:forj=0to7:readf%(i,j):next:next
  20. 38 fori=0to3:readr%(i):next
  21. 39 fori=0to3:forj=0to1:readw%(i,j),z%(i,j):next:next:rem carom pokes-directions
  22. 40 fori=0to3:forj=0to1:readrm%(i,j),zm%(i,j):next:next
  23. 41 fori=1to4:readro%(i),cl%(i):next
  24. 42 fori=0to1:readm1%(i),m2%(i):next
  25. 43 fori=1to4:reado%(i):next
  26. 45 fori=ctoc+21:pokei,0:next
  27. 48 pokec+5,4:pokec+6,4:pokec+24,15
  28. 49 gosub1500
  29. 50 gosub2000:print"":goto370
  30. 52  
  31. 53     --- switch barriers ---
  32. 54  
  33. 55 poke214,rq%(i):print:printtab(cm%(i))x$(f%(y,i)):return
  34. 57  
  35. 58     --- sound subroutine ---
  36. 59  
  37. 60 pokec+1,60:pokec+5,1:pokec+6,1:pokec+24,15:pokec+4,17
  38. 62 fort=0to40:next:pokec+4,16:return
  39. 67  
  40. 68     --- ball hits something ---
  41. 69  
  42. 70 pokec+4,17:fl=1:gosub80
  43. 71 ifbh<>86andbh<>87then73
  44. 72 pokec+1,80:p=p+w%(k,bh-86):k=z%(k,bh-86):return
  45. 73 ifbh<>90then76
  46. 74 pokec+1,100:p=p+r%(k):cn=cn+1:j=o%(pl)+cn:pokej,90:pokej+c,5:ifcn>3thenfl=2
  47. 75 return
  48. 76 pokec+1,60:p=p+rm%(k,dm):k=zm%(k,dm):return
  49. 77  
  50. 78    --- font moving subroutine ---
  51. 79  
  52. 80 poke53272,e
  53. 81 e=e+d
  54. 82 ife>30thene=24:return
  55. 84 ife<24thene=30
  56. 86 return
  57. 87  
  58. 88      --- input subroutine ---
  59. 89  
  60. 90 k$="":poke198,0:lx=0
  61. 91 gosub80:poke646,int(rnd(0)*15)+1:print" ";
  62. 92 geta$:ifa$=""or(a$=chr$(20)andlx=0)then91
  63. 93 ifa$=chr$(13)thenprint" ":return
  64. 94 ifa$=chr$(20)andlxthenlx=lx-1:k$=left$(k$,lx):goto98
  65. 95 lx=lx+1:iflx>5thenlx=5:goto91
  66. 96 ifa$<"a"ora$>"z"then91
  67. 97 k$=k$+a$
  68. 98 print""a$;:ifa$=chr$(20)thenprintchr$(148);
  69. 99 goto91
  70. 100 h=1:e=24:d=2:dm=0
  71. 101  
  72. 102     --- the screen subroutine ---
  73. 103  
  74. 104 h=1:e=24:d=2:dm=0
  75. 105 print"";
  76. 110 print"4555555555555555555555556455555555555556";
  77. 120 print"T{SHIFT-*}AAAAAAAAAAAAAAAAAAAAABVT{SHIFT-*}AAAAAAAAAAABV";
  78. 130 print"TC                     DVTCijklmnopqrsDV";
  79. 140 print"TC                     DVTC)*+,-./0123DV";
  80. 150 print"TC                     DVTCIJKLMNOPQRSDV";
  81. 160 print"TC                     DVTC{SHIFT-POUND}{CBM-N}{CBM-Q}{CBM-D}{CBM-Z}{CBM-S}{CBM-P}{CBM-A}{CBM-E}{CBM-R}{CBM-W}DV";
  82. 170 print"TC                     DVTEFFFFFFFFFFFGV";
  83. 180 print"TC                     DV{CBM-H}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-L}";
  84. 190 print"TC                     DV"
  85. 200 print"TC                     DV4555556 4555556";
  86. 210 print"TC                     DVTV TV";
  87. 220 print"TC                     DVTV TV";
  88. 230 print"TC                     DVTV TV";
  89. 240 print"TC                     DV{CBM-H}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-L} {CBM-H}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-L}";
  90. 250 print"TC                     DV4555556 4555556";
  91. 260 print"TC                     DVTV TV";
  92. 270 print"TC                     DVTV TV";
  93. 280 print"TC                     DVTV TV";
  94. 290 print"TC                     DV{CBM-H}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-L} {CBM-H}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-L}";
  95. 300 print"TC                     DV"
  96. 310 print"TC                     DV455555555555556";
  97. 320 print"TC                     DVT             V";
  98. 330 print"TC                     DVT             V";
  99. 340 print"TEFFFFFFFFFFFFFFFFFFFFFGVT             V";
  100. 350 print"{CBM-H}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-L}{CBM-H}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}{CBM-J}";
  101. 360 poke2023,246:poke2023+c,5
  102. 362 fori=217to242:pokei,peek(i)or128:next
  103. 363 poke1516,160:poke1516+c,1
  104. 365 return
  105. 367  
  106. 368   --- place objects on screen ---
  107. 369  
  108. 370 gosub104:fori=0to7:gosub55:next:print""
  109. 372 fori=1tomp:poke214,ro%(i)-2:print:lg=len(na$(i))
  110. 373 printtab(cl%(i)-(lg<4)-(lg<2)-2)na$(i)
  111. 374 next
  112. 375 n=0:pl=0:bs=100
  113. 380 fori=0to1:n=n+1
  114. 382 j=fnra(7):k=fnra(4):l=m1%(i)+j+i*40:pokel,90:pokel+c,5:b%(n)=l:next
  115. 384 fori=0to1:n=n+1
  116. 386 j=fnra(4):k=fnra(7):l=m2%(i)+j+i*40:pokel,90:pokel+c,5:b%(n)=l:next
  117. 387 k=0:pl=pl+1:ifpl>mpthen700
  118. 388 fori=0to7:gosub55:next
  119. 390 poke53272,e
  120. 395 poken%(k),81:poken%(k)+c,3:goto400
  121. 397  
  122. 398   --- choose initial direction ---
  123. 399  
  124. 400 jv=peek(56320):geta$
  125. 405 ifa$=""andjv=31then440
  126. 410 ifa$=chr$(13)or((jvand16)=0)thenp=n%(k):goto500
  127. 420 ifa$=" "or(jv<>127)thengosub60:poken%(k),32:k=k+1:ifk>3thenk=0
  128. 440 gosub80
  129. 470 goto390
  130. 497  
  131. 498     --- the main play loop ---
  132. 499  
  133. 500 h=0:sc=0:cn=0:d=2:y=0:poke646,7
  134. 510 bh=peek(p+r%(k))
  135. 520 ifbh<>32thenpokep,32:gosub70:pokec+4,16:goto535
  136. 530 pokep,32:p=p+r%(k):pokep,81:pokep+c,3:goto550
  137. 535 sc%(pl)=sc%(pl)+1:ifsc%(pl)>99then600
  138. 540 poke214,ro%(pl):print:print""tab(cl%(pl)+(sc%(pl)>9))str$(sc%(pl))
  139. 550 gosub80
  140. 570 iffl=2then600
  141. 580 jv=peek(56320):geta$:ifjv=127anda$<>chr$(13)anda$<>chr$(32)then510
  142. 585 ifa$=chr$(13)orjv<112theny=y+1:y=yand1:fori=0to7:gosub55:next:goto510
  143. 590 dm=dm+1:dm=dmand1:d=-d
  144. 595 goto510
  145. 597  
  146. 598     --- end of player's turn ---
  147. 599  
  148. 600 ifsc%(pl)<bsthenbs=sc%(pl):bp=pl
  149. 610 gosub104
  150. 620 fori=1to4:pokeb%(i),90:pokeb%(i)+c,5:pokeo%(pl)+i,32:next
  151. 630 cn=0:fl=0
  152. 640 goto387
  153. 697  
  154. 698   --- end of last player's turn ---
  155. 699  
  156. 700 zx$=na$(bp)+" wins!"
  157. 705 cm=0:fori=1tomp:ifsc%(i)=bsthencm=cm+1
  158. 710 next:ifcm>1thenzx$="it's a tie!"
  159. 715 kk=0
  160. 720 poke214,21:print:printtab(27)zx$
  161. 730 kk=kk+1:ifkk<50thengosub80:print""tab(27)"           ":goto720
  162. 740 poke214,20:print:printtab(27)"same players"
  163. 745 printtab(27)"new players"
  164. 747 printtab(27)"loadstar"
  165. 750 gosub80:geta$:ifa$<>"s"anda$<>"n"anda$<>"l"then750
  166. 755 fori=1to4:sc%(i)=0:next
  167. 760 ifa$="s"thenprint"":goto370
  168. 765 ifa$="n"then50
  169. 766 goto770
  170. 767  
  171. 768     --- back to loadstar ---
  172. 769  
  173. 770 goto60000
  174. 996  
  175. 997     --- data statements ---
  176. 998  
  177. 999 rem starting positions
  178. 1000 data1476,1517,1556,1515
  179. 1009 rem barrier positions
  180. 1010 data4,5,4,17,7,8,7,14,13,8,13,14,16,5,16,17
  181. 1019 rem barrier flags
  182. 1020 data1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0
  183. 1029 rem r%(k) directions  0=up 1=right
  184. 1030 data-40,1,40,-1
  185. 1039 rem carom directions
  186. 1040 data-39,1,-41,3,-39,0,41,2,39,3,41,1,39,2,-41,0
  187. 1050 data-1,2,1,2,-40,3,40,3,1,0,-1,0,40,1,-40,1
  188. 1059 rem score tabs
  189. 1060 data11,28,11,36,16,28,16,36
  190. 1070 data1153,1387,1753,1402
  191. 1080 data1490,1498,1690,1698
  192. 1197  
  193. 1198    --- opening title screen ---
  194. 1199  
  195. 1500 gosub104
  196. 1510 print""
  197. 1520 print"{SHIFT-*}AB {SHIFT-*}AB {SHIFT-*}AB {SHIFT-*}AB {SHIFT-*}B {SHIFT-*}B"
  198. 1530 print"C D C D C D C D CD CD"
  199. 1540 print"C   CFD CHG C D CJAKD"
  200. 1550 print"C D C D CJB C D C   D"
  201. 1560 print"EFG C D C D EFG C   D"
  202. 1570 print"a loadstar production"
  203. 1580 print"     (c) 1988 by"
  204. 1590 print"    fender tucker"
  205. 1600 print"  move the joystick"
  206. 1610 print" in any direction or"
  207. 1620 print"  press any key to"
  208. 1630 print" toggle the border"
  209. 1640 print"  direction.  press"
  210. 1650 print"  the firebutton or"
  211. 1660 print"  the return key to"
  212. 1670 print"      toggle the"
  213. 1680 print"  barrier direction."
  214. 1690 print""tab(26)"press any key"
  215. 1700 printtab(26)"to start the"
  216. 1710 printtab(26)"ball rolling.":poke198,0
  217. 1750 gosub80:geta$:ifa$=""then1750
  218. 1760 return
  219. 1997  
  220. 1998    --- get players' names ---
  221. 1999  
  222. 2000 gosub104:mp=1:poke1516,32
  223. 2010 poke214,3:print:printtab(6)"players' names"
  224. 2020 poke214,19:print:printtab(7)"press return"
  225. 2025 printtab(8)"when done"
  226. 2030 poke214,4+mp*2:print:printtab(5)"player"mp": ";
  227. 2040 gosub90:ifk$=""thenmp=mp-1:return
  228. 2050 na$(mp)=k$
  229. 2060 mp=mp+1:ifmp=5thenmp=4:return
  230. 2070 goto2030
  231. 10000 open15,8,15,"s0:carom.v7":close15:save"carom.v7",8
  232. 60000 a$="hello connect":fori=8to29:ifi=14thennext
  233. 60005 close2:open2,i,2:close2:ifstthen60020
  234. 60010 close15:open15,i,15,"r0:"+a$+"="+a$:input#15,er:close15:ifer=63then60030
  235. 60020 next:print"":poke53272,23:poke186,8:end
  236. 60030 q$=chr$(34):poke646,peek(53281):print"":poke53272,23
  237. 60040 print"pO2048,0:pO44,8:pO43,1:pO56,160:pO55,0:clr:lO"q$a$q$","i
  238. 60050 print"run:":poke631,13:poke632,13:poke198,2:end
  239.