home *** CD-ROM | disk | FTP | other *** search
/ UpTime Volume 2 #3 / utv2n3s2.d64 / calcalc (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1988-01-01  |  9.7 KB  |  345 lines

  1. 300 rem *******************************
  2. 400 rem *                             *
  3. 500 rem *  written by m.d. smith      *
  4. 600 rem *  1000 monte sano blvd.,s.e. *
  5. 700 rem *  huntsville, al  35801      *
  6. 800 rem *  version 8.802  2/14/88     *
  7. 900 rem *  (205) 533-3131             *
  8. 1000 rem*******************************
  9. 1100 poke53280,15:poke 53265,11:poke53281,15:rem screen
  10. 1150 print"[147]"
  11. 1200 date$="06-01-88"
  12. 1400 print"[147]"spc(9)"[176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
  13. 1500 for x=1to10
  14. 1600 printspc(9)"[221]"spc(20)"[221]"
  15. 1700 next
  16. 1800 printspc(9)"[173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  17. 1900 print"[145][145][145][145][145][145][145][145][145]"spc(14)"   [213]p[212]ime  ":print
  18. 2000 printspc(16)"[208]resents":print
  19. 2100 printspc(11)"[149][195]alorie [195]alculator":print
  20. 2200 printspc(13)"[144]by [205]. [196]. [211]mith"
  21. 2300 print:print:print
  22. 2400 for y=1to5
  23. 2500 printspc(7);
  24. 2600 for x=2to15
  25. 2700 poke 646,x
  26. 2800 print"  ";
  27. 2900 next x:print
  28. 3000 next y
  29. 3100 printspc(8)"[145][145][145][145][144] [203]eep [195]ount of [195]alories "
  30. 3200 printspc(8)"[144]      [204]oading [196]ata      "
  31. 3300 printspc(8)"[144]   [207]ne moment, please   "
  32. 3400 print:print" [208]ublished by [211]oftdisk [208]ublishing, [201]nc."
  33. 3410 dimct$(50),ft$(50),ct(500),un(99)
  34. 3420 dimfo$(200),cal$(200),cal(200)
  35. 3430 dimf$(200),u(200),mi(99),ml$(99)
  36. 3440 me2$="breakfast":ml=1:poke53280,6:poke 53265,27
  37. 3500 gosub 9400:printtab(13)"[145][145][145][145][145]             "
  38. 3550 printtab(11)"                  [146]"
  39. 3600 gosub 28700:poke 53280,0:poke 53281,0:poke 646,7
  40. 3700 rem ========================  main menu screen ========================
  41. 3800 rem print chr$(14)
  42. 3900 print"[147][176][192][192][192][192][192][192][192][192][192] [195]alorie [195]alculator [192][192][192][192][192][192][192][192][192][174]";
  43. 4000 for p=1 to 22
  44. 4100 print "[221][157][157][221]";
  45. 4200 next p
  46. 4300 print "[173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]";
  47. 4400 print "[158]":rem cursor ups
  48. 4500 rem ======================== printer hardcopy   =======================
  49. 4600 poke 53280,0:poke 53281,0:poke 646,7
  50. 4700 rem
  51. 4800 rem
  52. 4900 cd=1:rem set counter for meal incrementer
  53. 5300 me2$="breakfast":ml=1
  54. 5500 rem       **********    version of feb. 14, 1988  *********
  55. 5600 rem 3 inst. screens
  56. 5700 print tab(4)"[196]o you want [201]nstructions ([217]/[206])"
  57. 5900 getis$:ifis$=""then5900
  58. 6000 ifis$="[206]" oris$="n"then10400
  59. 6100 if is$<>"y" and is$<>"[217]" then 5900
  60. 6400 print"[147][212]his program will allow you to input a"
  61. 6500 print"days foods and calculate the total "
  62. 6600 print"calories consumed.  [217]ou can do it for"
  63. 6700 print"any number of meals."
  64. 6800 print"[212]he screen that you will see will
  65. 6900 [153]"ask you to input the date and which"
  66. 7000 [153]"meal or snack you want this called."
  67. 7100 [153]"(NULL)hen prompted for date and meal,"
  68. 7200 [153]"pressing <(NULL)val(NULL)(NULL)(NULL)(NULL)> alone, will print"
  69. 7300 [153]"program date and ";[199](34);"breakfast.";[199](34)""
  70. 7400 [141]28700
  71. 7500 [153]"load(NULL)ou will need to type the name of the"
  72. 7600 [153]"food (spelled correctly)...and wait for"
  73. 7700 [153]"the program to find it in memory.  right$f it"
  74. 7800 [153]"does, it will then ask you to input the"
  75. 7900 [153]"amount you have eaten, in units (liquid"
  76. 8000 [153]"or weight).  right$f the food is not found,"
  77. 8100 [153]"or it is misspelled, you should enter "
  78. 8200 [153]"";[199](34);"s";[199](34);" to search the food database"
  79. 8300 [153]"to get the correct spelling or listing."
  80. 8400 [141]28700
  81. 8500 [153]"load(NULL)ou must burn 3500 calories more than"
  82. 8600 [153]"you eat to lose a pound.  (NULL)he average"
  83. 8700 [153]"person will be stable on about 2100-"
  84. 8800 [153]"2300 calories a day.  right$f you eat 1200 "
  85. 8900 [153]"calories a day, you should lose about"
  86. 9000 [153]"two pounds a week.  ascor shopping, print"
  87. 9100 [153]"out the entire list of foods as a"
  88. 9200 [153]"guide to take with you."
  89. 9300 [141]28700
  90. 9350 [137] 10400
  91. 9400 [143] ==== load file of data ====
  92. 9410 x[178]1:[159] 15,8,15,"i0"
  93. 9420 [141] 9500:[139] fl[178]1 [167] 9400
  94. 9440 [159] 2,8,2,"0:calcalc.dta"
  95. 9450 [141] 9500:[139] fl[178]1 [167] 9400
  96. 9460 [132]2,fo$(x),cal$(x),cal(x)
  97. 9470 x[178]x[170]1
  98. 9480 [139](st [175] 64)[178]0[167]9460
  99. 9490 [160]2:[160] 15:et[178]x:[142]
  100. 9500 [161]#15,a$:[139] a$[178]"0" [167] fl[178]0:[142]
  101. 9505 fl[178]1:[151] 53281,0
  102. 9510 fl[178]1:[153]"loaddef str$isk valrror: sys"a$;
  103. 9520 [161]#15,a$:[153]a$;
  104. 9530 [139] a$[179][177][199](13) [167] 9520
  105. 9535 [160] 2:[160] 15
  106. 9540 [153][163]6)"def(open(NULL)def)etry or (open(NULL)def)uit to (NULL)p(NULL)ime?stop"
  107. 9550 [161] a$:[139] a$[178]"r" [167] [153]"load";:[142]
  108. 9560 [139] a$[178]"q" [167] 9600
  109. 9570 [137] 9550
  110. 9600 [151]204,1:[158] 8[172]4096[170]4
  111. 10400 [153]"load=======================================sys"
  112. 10410 [153]"======== lenallenalc right$nput (NULL)creen =========sys"
  113. 10412 [153]"=======================================sys"
  114. 10500 [153] [166]2);"(NULL)hat date do you want to use"
  115. 10600 [153] [166]2);"for your entry ((NULL)(NULL)-str$str$-(NULL)(NULL)) ";
  116. 10650 rx[178]1:mx[178]8:[141] 32000
  117. 10700 dl$[178]o1$
  118. 10710 [153]
  119. 10800 [139]dl$[178]""[167]dl$[178]date$:[137]10900
  120. 10900 [153]:[153]"  (NULL)he date for this"
  121. 11000 [153]"  entry is....";dl$;"sys"
  122. 11100 s2[178]0
  123. 11200 [153]:[153]
  124. 11300 [153]"(NULL)hat meal is this (or snack)"
  125. 11400 [153]"(default is breakfast) ";
  126. 11450 rx[178]2:mx[178]16:[141] 32000
  127. 11455 me$[178]o1$
  128. 11500 [139]me$[178]""[167] me$[178]"breakfast"
  129. 11550 [153]
  130. 11600 [153]:[153]"(NULL)k, this entry is for ";me$;"sys"
  131. 11700 [153]:[153]
  132. 11800 [141]28700
  133. 11900 [153][199](147);
  134. 12000 [139]ic[178]0[167]ic[178]1:[143]  for first time,set incremental counter to 1
  135. 12100 [143] cursor 3,10:
  136. 12200 [153]"printreturn    ***** mealplan and calorie *****"
  137. 12300 [153]"     ***** chart for ";dl$;" *****for"
  138. 12400 [153]" enter food name or 'tfor' to total meal,"
  139. 12500 [153]" 'sfor' to search food list or 'efor' to end"
  140. 12600 f[178]1
  141. 12700 z[178]1
  142. 12800 [153]"sysname of food:  cmd";
  143. 12810 rx[178]3:mx[178]22:[141] 32000
  144. 12815 [139] o1$[178]"" [167] [153]"onon";:[137] 12800
  145. 12820 f$(f)[178]o1$
  146. 12821 [153]
  147. 12900 [129] zz[178]1 [164] 15:[153]"                                 ":[130]
  148. 12950 [153]"                                        ";
  149. 12975 [153]"                                  ";
  150. 13000 [153]"ononononononononononononononon":[143] 12 cursor ups arrow keys,and ^,*, to search for
  151. 13100 [139]f$(f)[178]"(NULL)"[176]f$(f)[178]"t"[167]15300
  152. 13200 [139]f$(f)[178]"val"[176]f$(f)[178]"e"[167]29200
  153. 13300 [139]f$(f)[178]"(NULL)"[176]f$(f)[178]"s"[167][141]21600
  154. 13400 [129]z[178]1[164]et[170]1
  155. 13500 [139]f$(f)[178]fo$(z)[167]13900
  156. 13600 [139]fo$(z)[178]"end"[167][141]20200:[137]11900:[143] can't find a match
  157. 13700 [139]z[177]et[167][141]20200:[137]11900
  158. 13800 [130]z
  159. 13900 [153]:[153]:[153]fo$(z),cal$(z)
  160. 14000 [153]:[153]"how many units of this food: ";:mx[178]3:[141]32000:u(f)[178][197](o1$)
  161. 14100 [153]:[153]"for for";f$(f);"sys you have ";(u(f)[172]cal(z));" cals."
  162. 14200 t2[178](u(f)[172]cal(z))
  163. 14300 s2[178]s2o[170]t2
  164. 14400 c2[178]c2[170]t2
  165. 14500 [153]:[153]"total for ";me$;" is";s2;"cals."
  166. 14600 [153]:[153]"total for the day is";c2;"cals."
  167. 14700 [141]28700
  168. 14800 ft$(ic)[178]f$(f):[143] this is name of food for this icrement
  169. 14900 un(ic)[178]u(f):[143] this is units of the food selected for this inc.
  170. 15000 ct(ic)[178]t2:[143] this is the total cal for this food
  171. 15100 ic[178]ic[170]1
  172. 15200 [137]11900
  173. 15300 [153][199](147)
  174. 15400 [143] cursor 10,10
  175. 15500 [153]"you asked for a total for ";me$;"."
  176. 15600 [143]
  177. 15700 [153]"you have ";s2;" cals. for this meal."
  178. 15800 [143]
  179. 15900 [153]"you have ";c2;" cals. for the day."
  180. 16000 [143]
  181. 16100 [153]"want to continue to addsys foods to this    same meal (y/n) [n] "
  182. 16150 [151] 198,0
  183. 16200 [161]ad$:[139]ad$[178]""[167]16200
  184. 16400 [139]ad$[178]"(NULL)"[176]ad$[178]"y"[167]11900
  185. 16450 [139] ad$[179][177]"n" [175] ad$[179][177]"(NULL)" [175] ad$[179][177][199](13) [167] 16200
  186. 16500 ml$(ml)[178]me$
  187. 16600 mi(ml)[178]ic
  188. 16700 ml[178]ml[170]1
  189. 16800 [143] cursor 17,10
  190. 16900 [153]"want to start anothersys meal or snack for"
  191. 16920 [153]"the samesys date (y/n) [n] ":[151] 198,0
  192. 17000 [161] an$:[139] an$[178]""[167]17000
  193. 17200 [139]ano$[178]"(NULL)"[176]ano$[178]"y"[167][153]"load":[137]10900
  194. 17210 [139] an$[179][177]"(NULL)" [175] an$[179][177]"n" [175] an$[179][177][199](13) [167] 17000
  195. 17300 cd[178]1:[143] ***** should not be 0 at start
  196. 17400 [153]:[153]
  197. 17500 [153]"loaddef foods and calories for ";dl$;"sys"
  198. 17600 [129]mt[178]1[164]ml[171]1
  199. 17700 [153]:[153]"  *** ";ml$(mt);" ***"
  200. 17800 [129]it[178]cd[164]mi(mt)[171]1
  201. 17900 [153]ft$(it);[163]18);un(it);[163]23)" =";
  202. 18000 [153][163]26);ct(it);[163]32);"cals."
  203. 18100 [130]it
  204. 18200 cd[178]mi(mt)
  205. 18300 [130]mt
  206. 18400 [153]
  207. 18500 [153]"====== total calories ===== ";c2
  208. 18600 [153]:[153]
  209. 18700 [141]28700
  210. 18900 [143] cursor 6,10
  211. 19000 [153]"load(NULL)ould you like a copy of these meals on the printer  ((NULL)/(NULL)) [(NULL)] "
  212. 19050 [151] 198,0
  213. 19100 [161]al$:[139]al$[178]""[167]19100
  214. 19200 [139]al$[178]"(NULL)"[176]al$[178]"y"[167]26300
  215. 19300 [139] al$[179][177]"(NULL)" [175] al$[179][177]"n" [175] al$[179][177][199](13) [167] 19100
  216. 19400 [143] cursor 8,10
  217. 19500 [153]"(NULL)ould you like a listing of all the"
  218. 19600 [153]"foods & calories ((NULL)/(NULL)) [(NULL)]":[151] 198,0
  219. 19700 [161] al$:[139] al$[178]""[167]19700
  220. 19800 [139] al$[178]"y"[176]all$[178]"(NULL)"[167][141]20500:[137] 19910
  221. 19900 [139] al$[179][177]"n" [175] al$[179][177]"(NULL)" [175] al$[179][177][199](13) [167] 19700
  222. 19910 [153]"(NULL)ould you like to start over? ((NULL)/(NULL))"
  223. 19920 [161] a$:[139] a$[179][177]"y" [175] a$[179][177]"n" [167] 19920
  224. 19930 [139] a$[178]"y" [167] 3600
  225. 20000 [153][163]8)"(NULL)ress (NULL)val(NULL)(NULL)(NULL)(NULL) for (NULL)p(NULL)ime":[151] 198,0
  226. 20010 [161] a$:[139] a$[179][177][199](13) [167] 20010
  227. 20100 [137]9600
  228. 20200 [153]:[153][163]8)"can't find a food match."
  229. 20210 [153][163]12)"check spelling."
  230. 20300 [141]28700
  231. 20400 [142]
  232. 20500 [153]"(NULL)n the screen or printer ((NULL)/(NULL)) <(NULL)> ";
  233. 20600 [161] p2$:[139] p2$[178]"" [167]20600
  234. 20700 [153] p2$
  235. 20800 [139] p2$[178]"p" [167]21000
  236. 20900 [137]21100
  237. 21000 [159]4,4:[157]4
  238. 21100 [129]al[178]1[164]et
  239. 21200 [153]fo$(al);[166]24[171][195](fo$(al)));cal$(al)
  240. 21300 [130]
  241. 21400 [139] p2$[178]"p" [167] [152]4:[160]4
  242. 21500 [142]
  243. 21600 [141]25100
  244. 21700 l[178]0
  245. 21800 tx[178]0:[153]""
  246. 21900 [129] zz[178]1 [164] 11
  247. 22000 [153]"                      on"
  248. 22100 [141]24400
  249. 22200 [130]
  250. 22300 [143] do not reprint command line
  251. 22400 [143] color 14
  252. 22500 [137]22700:[143]-- sub to get input of arrow keys or esc to stop search
  253. 22600 [142]
  254. 22700 [161]i$:[139]i$[178]""[167]22700
  255. 22800 il[178][195](i$)
  256. 22900 ll[178][198](i$)
  257. 23000 [143] ll=asc(right$(i$,1))
  258. 23100 [139]ll[178]94[167]l[178]0:[143] ^homekey
  259. 23200 [139]ll[178]145[167]l[178]l[171]1:[143] upcrsrkey
  260. 23300 [139]ll[178]157[167]l[178]l[171]10:[143] leftcrsr
  261. 23400 [139]ll[178]42[175]l[177]et[167]24000
  262. 23500 [139]ll[178]42[167]l[178]et[170]1:[143] *endkey
  263. 23600 [139]ll[178]17[167]l[178]l[170]1:[143] downcrsrkey
  264. 23700 [139]ll[178]29[175]l[177]et[167]24000
  265. 23800 [139]ll[178]29[167]l[178]l[170]10:[143] pagedownkey
  266. 23900 [139]ll[178]95[167] [153]"";:[137]12000
  267. 24000 [143] end of list---go on
  268. 24100 l[178]l[171]11:[137]21800
  269. 24200 [143] ifll=92then print"load";:goto11000
  270. 24300 l[178]l[171]11:[137]21800
  271. 24400 [143] --start printing foods--look for end or beginning of list---
  272. 24450 [139] tx[178]1 [167] [153]"        ":[142]
  273. 24500 [139]l[178]et[170]1 [167] [153]"end of listsys":tx[178]1:[142]
  274. 24700 [139]l[179]0[167]l[178]0:[153]"head of listsys":[142]
  275. 24800 [153] ""fo$(l)
  276. 24900 l[178]l[170]1
  277. 25000 [142]
  278. 25100 [143] cursor 10,55
  279. 25200 [153] "":[143] blue box
  280. 25300 [153]"ortantantantantantanfood listtantantantantantantan^"
  281. 25400 [129] zz[178]1 [164] 11
  282. 25500 [153]"(NULL)                      (NULL)"
  283. 25600 [130]
  284. 25700 [153]"/tantantantantantantantantantantantantantantantantantantantantantanexp"
  285. 25800 [143]
  286. 25900 [153] "";:[143] white letters
  287. 26000 [153]"use cursor keys, and ^,*, to search for    foods.";
  288. 26100 [153]"  ---   _  to quit searchsys";
  289. 26200 [142]
  290. 26300 cd[178]1:[143]    hardcopy of days foods  cd must be reset to 1  ****
  291. 26400 [159]4,4,1:[160] 4:[139] st[179][177]0 [167] 28500
  292. 26410 [159] 4,4:[157]4
  293. 26500 [153]"---------------------------------------";
  294. 26600 [153]"---------------------------------------"
  295. 26700 [153]:[153]" ********  printout of the foods and calories for  ";
  296. 26800 [153]dl$;" ********"
  297. 26900 [153]:[153]
  298. 27000 [129]mt[178]1[164]ml[171]1
  299. 27100 [153]:[153]"  *** ";ml$(mt);" ***"
  300. 27200 [129]it[178]cd[164]mi(mt)[171]1
  301. 27300 [153]ft$(it);[166]20[171][195](ft$(it)));un(it);[166]4[171][195]([196](un(it))));
  302. 27400 [153]"unit(s) =";
  303. 27500 [153][163]1);ct(it);[166]5[171][195]([196](ct(it))));"calories"
  304. 27600 [130]it
  305. 27700 cd[178]mi(mt)
  306. 27800 [130]mt
  307. 27900 [153]
  308. 28000 [153]"======== total calories ========= ";c2;" ====="
  309. 28100 [153]"----------------------------------------";
  310. 28200 [153]"--------------------------------------"
  311. 28300 [153]:[153]
  312. 28400 [152]4
  313. 28500 [160]4
  314. 28600 [137]19500
  315. 28700 [151] 198,0
  316. 28900 [139]([194](53272)[175]2)[178]2[167]28950
  317. 28925 [153]"      < press return to continue >";:[137] 29000
  318. 28950 [153]"      < (NULL)ress (NULL)val(NULL)(NULL)(NULL)(NULL) to lenontinue >";
  319. 29000 [161]a$:[139]a$[179][177][199](13)[167]29000
  320. 29050 [153]"load"
  321. 29100 [153]"sys":[142]
  322. 29200 [153]"do you really want to quit now (y/n) [n]"
  323. 29300 [161]qe$:[139]qe$[178]""[167]29300
  324. 29500 [139]qe$[178]"(NULL)"[176]qe$[178]"y"[167]9600:[143]  end of program
  325. 29550 [139] qe$[179][177]"n" [175] qe$[179][177]"(NULL)" [175] qe$[179][177][199](13) [167] 29300
  326. 29600 [137]11900
  327. 29900 [128]
  328. 32000 [143]================================get input routine for questions ====
  329. 32005 oo$[178]"":o1$[178]""
  330. 32010 [151] 204,0
  331. 32020 [161] oo$:[151] 207,0:[139] oo$[178]"" [167]32010: [143] pokes make cursor
  332. 32030 [139] oo$[178][199](13) [167] [151] 204,1:[153]" ":[142]
  333. 32035 [139] oo$[178]"restore" [167] 9600
  334. 32040 [139] oo$[178][199](20)[167][141] 35000:[137] 32010
  335. 32045 [139] [195](o1$)[178]mx [167] 32020
  336. 32050 [139] oo$[179]" " [176] oo$[177]"z" [167] 32010
  337. 32055 [151]204,1:[153] oo$;:o1$[178]o1$[170]oo$
  338. 33000 [137] 32010
  339. 33999 [143]========= error/delete key===wipe input clean=======
  340. 35000 [139] o1$[178]"" [167] [142]
  341. 35010 o1$[178][200](o1$,[195](o1$)[171]1)
  342. 35020 [153]oo$;
  343. 35030 [151] 204,1
  344. 35040 [142]
  345.