home *** CD-ROM | disk | FTP | other *** search
/ UpTime Volume 1 #6 / utv1n6s2.d64 / records (.txt) < prev    next >
Commodore BASIC  |  2022-08-28  |  7KB  |  193 lines

  1. 0 rem ** records ** written by: denis h. gregg **
  2. 1 rem **
  3. 2 if a=0 then a=1:load"0:lptr rtn",8,1
  4. 3 clr
  5. 40 dim g$(200):dim rs(200):dimn$(200):c=0
  6. 50 p1$=" *                                    *"
  7. 60 p2$="[209]                                      [209]":p3$="**********"
  8. 70 open15,8,15:open2,8,2,"0:rec_,s,r"
  9. 80 input#15,e,em$:ife<>0 and e<>62 then gosub 1500:run
  10. 100 c=c+1:input#2,g$(c),rs(c),n$(c):ifg$(c)<>""then100
  11. 110 c=c-1:close15:close2
  12. 120 rem ****   menu for options   ****
  13. 130 poke53280,3:poke53281,10:printchr$(142)"[147]"
  14. 140 print"[146] **************************************":printp1$
  15. 150 print" *        select  your  option        *":printp1$:printp1$
  16. 160 print" *     1[146])  [158]view all records           *":printp1$
  17. 170 print" *     2[146])  [158]check on one record        *":printp1$
  18. 180 print" *     3[146])  [158]update a record            *":printp1$
  19. 190 print" *     4[146])  [158]add another record         *":printp1$
  20. 200 print" *     5[146])  [158]delete a record            *":printp1$
  21. 210 print" *     6[146])  [158]printout all records       *":printp1$
  22. 220 print" *     7[146])  [158]exit the program           *":printp1$
  23. 230 printp1$:print" *      [ enter your selection ]      *":printp1$
  24. 240 print" ****";p3$;p3$;p3$;"****     ";
  25. 242 poke198,0:wait198,1:getx$
  26. 245 if val(x$)=0 or x$>"7" then 242
  27. 250 on val(x$) gosub 270,400,560,750,490,1060,1020:goto130
  28. 260 rem ****  list all records ****
  29. 270 a=0:gosub310:for a=1toc:d=d+1
  30. 272 ifd=9 then wait 197,1:poke 198,0:gosub 310
  31. 280 rs$=str$(rs(a)):l=len(rs$)
  32. 290 printtab(2)g$(a);tab(27-l)rs$;tab(31)n$(a):nexta:goto1400
  33. 300 rem **** print 'record page' background ****
  34. 310 poke53280,13:poke53281,14:printchr$(147):d=0
  35. 320 print"[146][191][191][191][191][191][191][191][191][191][191][191][191] ** [144]records ** [191][191][191][191][191][191][191][191][191][191][191][191][191]";
  36. 330 printp2$;"[209]  [144]game              score    * pro *  [209]";
  37. 340 print"[209]  [144][197][197][197][197]              [197][197][197][197][197]    [197][197][197][197][197][197][197]  [209]";
  38. 350 forb=1to18:printp2$;:nextb
  39. 360 if(a+9)>cthenprint"[209][209] that's all - press return for menu [209][209]";:goto380
  40. 370 print"[209][209][209][209][209][209]<press return for next page>[209][209][209][209][209][209][145][145][145][145]"
  41. 380 print"[158]":return
  42. 390 rem **** format for checking one record. ****
  43. 400 print"[147]   which game did you want to check?"
  44. 405 printtab(9)"[enter * for listing]":print">";
  45. 410 gosub 2000:g1$=t$:print"":ifg1$="*"thengosub1230:goto440
  46. 415 if t$="" then return
  47. 420 fora=1toc:if g$(a)=g1$ then440
  48. 430 next a:goto1170
  49. 440 print"[147]       the record for the game of [158]"
  50. 445 printtab(20-len(g$(a))/2)g$(a)
  51. 450 print " is[158]";rs(a);"points, held by [158]";n$(a);" !!"
  52. 460 print tab(8)"[press return for menu]"
  53. 470 goto 1400
  54. 480 rem ** delete record ****
  55. 490 print"[147]    which game do you want to delete "
  56. 495 printtab(9)"[enter * for listing]":print">";
  57. 500 gosub 2000:g1$=t$:ifg1$="*"thengosub1230:goto520
  58. 505 if t$="" then return
  59. 510 fora=1toc:ifg$(a)<>g1$then540
  60. 520 g$(a)=g$(c):rs(a)=rs(c):n$(a)=n$(c):c=c-1:a=0:ch$="yes"
  61. 530 printtab(12)"record deleted.":goto820
  62. 540 nexta:goto1170
  63. 550 rem *** update record **
  64. 560 print"[147]    enter the game would you like to"
  65. 570 printtab(9)"change the record in:"
  66. 575 printtab(9)"[enter * for listing]":print">";
  67. 580 gosub 2000:g1$=t$:ifg1$="*"thengosub1230:goto610
  68. 585 if t$="" then return
  69. 590 fora=1toc:ifg$(a)=g1$then610
  70. 600 nexta:goto1170
  71. 610 print "enter your new record score":print">";:gosub 2000:s2=val(t$)
  72. 612 if t$="" then return
  73. 615 if s2>rs(a) then 650
  74. 620 print"[147] you need to do better than";s2
  75. 625 print" points, when[158]";rs(a);"points"
  76. 630 print" is the record ![160]!"
  77. 635 print"    practice, practice, practice,"
  78. 640 print " or better yet, ask ** ";n$(a)" **":print" for help !!"
  79. 645 print "    [hit any key to return to menu]":goto 1400
  80. 650 g1$=n$(a):print"and who, may i ask, achieved this goal?":print">";
  81. 655 gosub 2000:n$(a)=t$
  82. 660 print"[147]   *****[146]  [158]congratulations !!!  *****[146]"
  83. 670 printtab(20-(len(n$(a))+10)/2)"***[146]  [158]";n$(a);"  ***[146]"
  84. 675 if g1$=n$(a)then 690
  85. 680 printtab(16)"[158]you beat ";g1$"'s record in":goto 695
  86. 690 printtab(16)"[158]you beat your own record in"
  87. 695 printtab(20-(len(g$(a)))/2)g$(a):s1=s2-rs(a)
  88. 700 print" by a whopping";s1;"points ! !":print"[158] i suggest that you ";
  89. 710 print"call the press and":printtab(8)"have this feat published !!"
  90. 720 rs(a)=s2:if ch$<>"yes"then ch$="yes-1"
  91. 730 goto 1400
  92. 740 rem  **** add record ****
  93. 750 print"[147]"
  94. 760 print" enter the name of the game as you want"
  95. 765 printtab(11)"to have it listed:":print">";:gosub 2000:g1$=t$
  96. 767 if t$="" then return
  97. 770 for a=1toc:ifg$(a)=g1$ then 950
  98. 780 nexta:print:print"what is the record in ";g1$:print">";
  99. 785 gosub 2000:if t$="" then return
  100. 787 g(c)=val(t$)          
  101. 788 c=c+1:g$(c)=g1$
  102. 790 print"and, who holds this record":print">";:gosub 2000:n$(c)=t$:ch$="yes"
  103. 800 printtab(5)"any more records to add [y/n]":poke 198,0:wait 198,1:get j$
  104. 805 if j$="y"thenprint"[147]":goto760
  105. 810 rem *** sort then write to disk **
  106. 820 ifc>8 thenprint"[147]        standby... sorting files"
  107. 830 if ch$="yes"then ch$="yes-1"
  108. 840 fora=1toc-1:forb=a+1toc:ifg$(a)<g$(b)then870
  109. 850 te$=g$(a):g$(a)=g$(b):g$(b)=te$:te=rs(a):rs(a)=rs(b):rs(b)=te
  110. 860 te$=n$(a):n$(a)=n$(b):n$(b)=te$
  111. 870 nextb:nexta:poke198,0:ifx=6thenreturn
  112. 880 ifx<6then130
  113. 890 printtab(6)"writing updated file to disk"
  114. 900 open15,8,15,"s0:rec_":open2,8,2,"0:rec_,s,w":input#15,e,e$:ife=0then920
  115. 910 gosub 1500:goto 890
  116. 920 fora=1toc:print#2,g$(a):print#2,rs(a):print#2,n$(a):nexta
  117. 930 close15:close2:ifx=7thenend
  118. 940 ch$="":goto130
  119. 950 print"[147] you have attempted to enter a game that ":print" already exists";
  120. 960 print" on this program !":print" if you have that much time to waste,"
  121. 970 print" then better do some practicing in"
  122. 980 print" leader board or something !!":print" let's try again - - -"
  123. 990 print "do you want to: ":print" [1] try to enter another record,"
  124. 1000 print" [2] return to main menu, or"
  125. 1010 print" [3] quit this program"
  126. 1012 poke 198,0:wait 198,1:get x$
  127. 1015 x=val(x$):if x=0 or x>3 then 1012
  128. 1017 on x goto 750,1410,1020
  129. 1020 if ch$="yes"then820
  130. 1030 if ch$="yes-1"then890
  131. 1040 sys 8*4096+4
  132. 1050 rem *** print records ***
  133. 1060 if ch$="yes"then gosub820
  134. 1070 print"what is today's date ";:gosub 2000:j$=t$
  135. 1072 poke 780,4:rem channel number
  136. 1075 poke 782,0:rem secondary addr
  137. 1078 sys 828:if peek(783) and 1 then close 4:gosub 1600:goto 1072
  138. 1080 print#4,chr$(14)chr$(16)"07current commodore records"
  139. 1090 print#4,chr$(15):print#4,chr$(16)"07"p3$;p3$;p3$;p3$;p3$:print#4,chr$(15)
  140. 1095 if j$="" then print#4:goto 1110
  141. 1100 print#4,chr$(16)"45effective as of: ";j$:print#4,
  142. 1110 print#4,chr$(14)"name of game       record    * pro *"
  143. 1120 print#4,"[184][184][184][184][184][184][184][184][184][184][184][184]       [184][184][184][184][184][184]    [184][184][184][184][184][184][184]"
  144. 1130 print#4,:fora=1toc:print#4,g$(a);
  145. 1140 print#4,chr$(16)"37"rs(a);:print#4,chr$(16)"60"n$(a):nexta
  146. 1150 print#4,chr$(15):print#4,:print#4,:close4,4:goto130
  147. 1160 rem ** format if record is not listed as entered **
  148. 1170 print:print" "g1$" is not listed in the records."
  149. 1180 print "       please recheck your data."
  150. 1190 print""tab(7)"[press return to continue]"
  151. 1200 goto 1400
  152. 1220 rem the following will give listing of games for deletions and changes
  153. 1230 print"   use the [158]cursor keys to scroll the"
  154. 1240 print"  games, and the [158]return key to select"
  155. 1250 print"          [172][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][187]"
  156. 1252 print"          [161]                  [161]"
  157. 1254 print"          [188][146][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][190]"
  158. 1260 a=1
  159. 1270 ifa>cthena=1
  160. 1280 ifa<1thena=c
  161. 1290 print""tab(11)g$(a);
  162. 1295 for j=1 to 18-len(g$(a)):print" ";:next
  163. 1300 getk$:ifk$=""then13