home *** CD-ROM | disk | FTP | other *** search
/ UpTime Volume 2 #5 / utv2n5s1.d64 / race.exe (.txt) < prev    next >
Commodore BASIC  |  2022-08-28  |  6KB  |  234 lines

  1. 30 poke 45,peek(174):poke 46,peek(175)
  2. 31 poke 56,160:clr
  3. 32 dim p1$(8),p2$(15),p2(15),hi$(10),hi(10),p1(8)
  4. 33 open5,8,5,"hiscore,p,r"
  5. 34 fori=1to10:input#5,hi$(i):input#5,hi(i):nexti:close5
  6. 40 sa=16577:cl=16635
  7. 42 poke 53280,6:poke 53281,6:print"[147]"chr$(8)chr$(142)
  8. 45 sys sa:poke54296,4
  9. 50 poke 53272,21:poke866,1
  10. 60 poke 2040,236:poke 2041,234:poke2042,235
  11. 70 v=53248:poke v,160:pokev+1,54
  12. 80 pokev+2,129:pokev+4,191:pokev+3,220:pokev+5,220
  13. 83 pokev+16,0
  14. 85 pokev+28,0:pokev+39,1:poke v+40,3:pokev+41,3
  15. 90 pokev+23,1:pokev+29,7:pokev+21,7
  16. 94 print""tab(19)"by":a$="":p=1:poke198,0:de=0
  17. 95 print"    music composed by greg gauthier."
  18. 96 b$=" 1 player"
  19. 100 print""tab(13)"f1:"b$a$
  20. 101 printtab(13)"f3: best times"
  21. 105 printtab(13)"f7: start"
  22. 110 printtab(13)"f8: quit to uptime"
  23. 115 getz$:ifz$="[133]"thenp=p+1:de=0:b$=" player":ifp=9thenp=0:a$=" "
  24. 116 ifz$="[133]"andp>1thenb$=b$+"s"
  25. 117 de=de+1:ifp=0thenb$=" practice"
  26. 118 ifp>0andz$="[133]"thenb$=str$(p)+b$
  27. 119 ifz$="[134]"thende=500
  28. 120 ifde=500then1200
  29. 122 if z$="[140]" then 700
  30. 125 ifz$<>"[136]"then100
  31. 130 rem start here
  32. 135 ifp=0then1700
  33. 140 poke828,p:p=int(p/2+.5)*2
  34. 150 fori=1to15:p2$(i)="":p2(i)=96000:nexti
  35. 155 poke53269,0
  36. 156 ifpeek(828)>1then160
  37. 157 print"[147]what computer level do you want (1-3)? ";
  38. 158 geta$:ifa$<"1"ora$>"3"then158
  39. 159 printa$:poke 857,val(a$)
  40. 160 fori=1topeek(828)
  41. 170 print"player #"i", enter your name."
  42. 180 poke198,0:n$=""
  43. 185 print":[164][157]";
  44. 190 geta$:ifa$=chr$(20)then240
  45. 200 ifa$=chr$(13)then260
  46. 205 if a$="[140]" then 700
  47. 210 ifa$<" "ora$>"z"then190
  48. 215 if a$=chr$(34) then 190
  49. 220 iflen(n$)=10then190
  50. 230 n$=n$+a$:printa$"[164][157]";:goto190
  51. 240 iflen(n$)=0then190
  52. 250 n$=left$(n$,len(n$)-1):print" [157][157][164][157]";:goto190
  53. 260 iflen(n$)=0then190
  54. 265 print" "
  55. 270 p1$(i)=n$:nexti
  56. 275 ifpeek(828)<>pthenp1$(p)="computer "+chr$(8)
  57. 280 fori=1top:p2$(i)=p1$(i):next:fori=1to15:p2(i)=101000:next
  58. 283 p1=peek(828)
  59. 285 fori=1to16:x1=int(rnd(1)*p1)+1:x2=int(rnd(1)*p1)+1
  60. 286 a$=p2$(x1):p2$(x1)=p2$(x2):p2$(x2)=a$:next
  61. 290 print"[147]"tab(15)"standings:"
  62. 291 poke53280,6:poke53281,6
  63. 295 d$=""
  64. 300 x=3:fori=1to8
  65. 305 printleft$(d$,x)p2$(i):ifp2$(i)<>""thenprint"[163][163][163][163][163][163][163][163][163][163]"
  66. 310 x=x+2:ifi/2=int(i/2)thenx=x+2
  67. 315 nexti
  68. 320 x=6:fori=9to12
  69. 324 printleft$(d$,x)tab(10)p2$(i)
  70. 325 if(p>2andi=10)or(p>4andi=11)orp>6ori=9thenprinttab(10)"[163][163][163][163][163][163][163][163][163][163]"
  71. 326 x=x+2:ifi/2=int(i/2)thenx=x+8
  72. 330 nexti
  73. 340 x=11:fori=13to14
  74. 345 printleft$(d$,x)tab(20)p2$(i)
  75. 350 if(p>2andi=13)orp>4thenprinttab(20)"[163][163][163][163][163][163][163][163][163][163]"
  76. 355 x=x+4 :nexti
  77. 360 ifp>4thenprintleft$(d$,13)tab(29)p2$(15):printtab(29)"[163][163][163][163][163][163][163][163][163][163]"
  78. 370 gosub900
  79. 380 rem choose next contestant
  80. 385 ifp2(1)>96000thenga=1:goto450
  81. 390 ifp2(3)>96000andp>2thenga=3:goto450
  82. 395 ifp2(5)>96000andp>4thenga=5:goto450
  83. 400 ifp2(7)>96000andp>6thenga=7:goto450
  84. 405 ifp2(9)>96000andp>2thenga=9:goto450
  85. 410 ifp2(11)>96000andp>6thenga=11:goto450
  86. 415 ifp2(13)>96000andp>5thenga=13:goto450
  87. 420 goto 1300
  88. 450 a$="next heat:"
  89. 451 poke53280,14:poke53281,14
  90. 452 ifp2(ga)=98000thena$=a$+"(rematch)"
  91. 453 print"[147]"tab(20-len(a$)/2)a$
  92. 454 a$=p2$(ga)+" vs "+p2$(ga+1)
  93. 455 print""tab(20-len(a$)/2)a$
  94. 456 if(peek(56320)and16)=0or(peek(56321)and16)=0then456
  95. 460 print"press your button "p2$(ga);
  96. 465 x1=0:x2=0
  97. 470 a=(peek(56321)and16):if(aand16)=0thenx1=1:print" blue car":goto490
  98. 475 ifp2$(ga+1)="computer "+chr$(8)then470
  99. 480 a=(peek(56320)and16):if(aand16)=0thenx1=0:print" red car":goto490
  100. 485 goto470
  101. 490 x2=1-x1:poke 856,2
  102. 495 p1=peek(828):ifp2$(ga+1)="computer "+chr$(8)thenpoke856,1:goto550
  103. 500 print"press your button "p2$(ga+1);
  104. 501 ifx2=1thenprint" blue car"
  105. 502 ifx2=0thenprint" red car"
  106. 505 a=(peek(56320+x2)and16):if(aand16)=16then505
  107. 550 rem start race
  108. 551 print"get ready"
  109. 552 fori=1to1500:next:sys cl
  110. 555 sys16384:sys49152:poke53280,12:poke53281,12
  111. 556 poke 53269,0:print"[147]"
  112. 557 poke53272,21
  113. 560 print""tab(16)"results:"
  114. 561 a1$="":a2$="":ifx2=0thena1$="":a2$=""
  115. 562 x1=(1-x1)*2:x2=(1-x2)*2
  116. 565 poke828,p1
  117. 570 t1=peek(850+x1)*1000+peek(849+x1)
  118. 571 ifpeek(842+x1/2)=3thent1=96000
  119. 575 t2=peek(850+x2)*1000+peek(849+x2)
  120. 576 ifpeek(842+x2/2)=3thent2=96000
  121. 580 printa1$p2$(ga)tab(12)":";
  122. 585 a=t1:gosub1000:p2(ga)=a
  123. 587 printa2$""p2$(ga+1)tab(12)":";
  124. 590 a=t2:gosub1000:p2(ga+1)=a
  125. 595 ift1=t2thenp2(ga)=98000:p2(ga+1)=98000:goto620
  126. 596 ifpeek(842)=3andpeek(843)=3thenp2(ga)=98000:p2(ga+1)=98000:goto620
  127. 600 rem put winner into proper place
  128. 605 x=9:ifga=3thenx=10
  129. 606 ifga=5thenx=11
  130. 607 ifga=7thenx=12
  131. 608 ifga=9thenx=13
  132. 609 ifga=11thenx=14
  133. 610 ifga=13thenx=15
  134. 611 ift1<t2thenp2$(x)=p2$(ga)
  135. 612 ift2<t1thenp2$(x)=p2$(ga+1)
  136. 613 ifpeek(828)=porp<3then620
  137. 619 ifp2$(ga+1)="computer "+chr$(8)thenp2$(x)=p2$(ga)
  138. 620 rem go back to chart
  139. 625 gosub900
  140. 630 goto290
  141. 700 clr:load"upt.reboot",8
  142. 899 end
  143. 900 if(peek(56320)and16)=0or(peek(56321)and16)=0then900
  144. 904 print""tab(8)"press button to continue"
  145. 905 if(peek(56320)and16)=16and(peek(56321)and16)=16then905
  146. 920 return
  147. 1000 rem given a, print out time
  148. 1005 b1=int(a/1000):b2=a-b1*1000
  149. 1010 ifb1=96thenprint"[158]out of race":goto1020
  150. 1015 b3=int(b1/16):b4=b1-b3*16:b5=int(b2/16):b6=b2-b5*16
  151. 1017 printchr$(b3+48)chr$(b4+48)"."chr$(b5+48)chr$(b6+48)
  152. 1020 return
  153. 1100 sys cl:forx=1to50:nextx
  154. 1103 poke856,0:poke857,2:sys16384:sys49152:poke53269,0:print"[147]":poke53281,12
  155. 1105 poke53280,12:goto40
  156. 1200 rem high score display
  157. 1205 print"[147]":poke53248+29,1
  158. 1206 poke53269,1:poke53249,54:poke53248,160:poke2040,236:poke53248+23,1
  159. 1210 poke53280,0:poke53281,0
  160. 1215 printtab(16)"[164][164][164][164][164][164][164][164]"
  161. 1220 printtab(8)"[164][175][185][162][184][183][163] all time [163][183][184][146][162][185][175][164]"
  162. 1225 fori=1to10:a$=str$(i)
  163. 1230 a$=""+right$(a$,2)+"."
  164. 1235 printtab(8)a$"  [159]"hi$(i)tab(27)"[158]";
  165. 1240 a=hi(i):gosub1000
  166. 1245 nexti
  167. 1246 printtab(8)"[164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]"
  168. 1250 printtab(9)"[163][183][184][162][185][175][164]  best  [164][175][185][162][146][184][183][163]"
  169. 1251 printtab(3)"[152]press a key to return to the menu."
  170. 1255 poke198,0
  171. 1260 ifpeek(198)<>0then40
  172. 1270 de=de+1:ifde<1200then1260
  173. 1280 goto1100
  174. 1300 rem high score update
  175. 1301 print"                                 "
  176. 1305 z=0:fori=1to15
  177. 1310 ifp2(i)<hi(10)thengosub1400:z=z+1
  178. 1315 nexti:ifzthengosub1450
  179. 1320 de=300:goto1500
  180. 1400 ifp2$(i)="computer "+chr$(8)thenz=z-1:return
  181. 1402 hi$(10)=p2$(i):hi(10)=p2(i)
  182. 1404 x=9
  183. 1405 ifhi(x)<=hi(x+1)thenreturn
  184. 1410 a=hi(x):hi(x)=hi(x+1):hi(x+1)=a:a$=hi$(x):hi$(x)=hi$(x+1):hi$(x+1)=a$
  185. 1415 x=x-1:ifx>0then1405
  186. 1420 return
  187. 1450 rem rewrite highscores
  188. 1455 print"[147]":sys cl:open15,8,15,"s0:hiscore":close15
  189. 1460 open5,8,5,"hiscore,p,w"
  190. 1465 fori=1to10:print#5,hi$(i):print#5,hi(i):nexti:close5
  191. 1466 open15,8,15:input#15,a,b$,c,d:close15:ifa=0thenreturn
  192. 1470 print"[147]disk error:"b$
  193. 1471 a=peek(56320)and16:b=peek(56321)and16:ifa=0orb=0then1471
  194. 1475 print"press either button to try again."
  195. 1476 a=peek(56320)and16:b=peek(56321)and16:ifa=16andb=16then1476
  196. 1480 goto1450
  197. 1500 rem display each player best time
  198. 1501 wi$=""
  199. 1505 fori=1top:p1(i)=96000:next
  200. 1510 fori=1to15:a$=p2$(i):forx=1top:ifa$<>p1$(x)thennextx:goto1520
  201. 1513 wi$=p2$(i)
  202. 1515 ifp2(i)<p1(x)thenp1(x)=p2(i)
  203. 1520 nexti
  204. 1525 print"[147]"tab(15)"best times"
  205. 1530 print""
  206. 1535 fori=1top
  207. 1540 ifp1$(i)="computer "+chr$(8)thengoto1560
  208. 1550 print""p1$(i)tab(11)":";:a=p1(i):gosub1000
  209. 1560 nexti
  210. 1562 ifwi$="computer "+chr$(8)thenwi$="computer"
  211. 1565 print"";:a$="winner:[158]"+wi$
  212. 1567 printtab(21-len(a$)/2)a$
  213. 1568 if(peek(56320)and16)=0or(peek(56321)and16)=0then1568
  214. 1570 print""tab(6)"press <return> to go to menu"
  215. 1575 print"  press button to play with same names"
  216. 1580 poke198,0
  217. 1581 fori=1to15:p2$(i)="":next
  218. 1585 geta$:ifa$=chr$(13)then1200
  219. 1590 if(peek(56320)and16)=16and(peek(56321)and16)=16then1585
  220. 1595 goto280
  221. 1600 rem practice
  222. 1700 poke53280,6:poke53281,6
  223.