--- title: "Caloriburn" id: 55184 type: "computer_media" slug: "caloriburn-2" url: "http://localhost/computer_media/caloriburn-2/" markdown_url: "http://localhost/computer_media/caloriburn-2.md" published_at: "2024-06-20T11:49:56+00:00" modified_at: "2026-03-30T21:29:22+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/06/caloriburn.png" excerpt: "Enter an activity number and exercise duration to instantly calculate calories burned and the equivalent weight loss in both kilograms and pounds." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Home" slug: "home" taxonomy: "genre" url: "http://localhost/type/home/" media_contents: - id: 55220 title: "Long Island Sinclair Timex (LIST) User Group Library Tape #7" type: "computer_media" url: "http://localhost/computer_media/long-island-sinclair-timex-list-user-group-library-tape-7/" - id: 51214 title: "CATS Library Tape 8" type: "computer_media" url: "http://localhost/computer_media/cats-library-tape-8/" - id: 55923 title: "Timex Sinclair Public Domain Library Tape 2003" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-2003/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/Caloriburn%20%281985%29%28Smith%2C%20Joe%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "1985" images: - url: "http://localhost/wp-content/uploads/2024/06/caloriburn.png" article_media: - id: 62659 title: "Alert, Alert, Alert" type: "article" url: "http://localhost/article/alert-alert-alert/" media_type_tags: "Home" --- # Caloriburn This program is a calorie-burn calculator that estimates calories expended and equivalent weight loss for 20 common exercise activities. The user enters an activity number (1–20) and the duration in hours expressed as a decimal fraction; the program then prints calories burned and weight loss in both kilograms and pounds. Calorie rates for each activity are stored as numeric variables (F through R, E, O) in lines 198–199, and the computed weight-loss figures use a conversion factor of 7,000 calories per kilogram divided by 2.2 for pounds. Line 20 uses the computed GO SUB A+500 idiom to dispatch directly to the subroutine for the chosen activity number without a lookup table. The title screen uses POKE 23658,8 to enable inverse video mode and POKE 23609,30 to adjust the color burst timing, and a three-note ascending beep fanfare plays on entry. *** ## Program Analysis ### Program Structure The program is organized into several distinct functional regions: 1. **Lines 1–5:** Title screen with border/paper/ink setup, POKEs, beep fanfare, and string constant initialization. 2. **Lines 9–35:** Main input/control loop — calls the activity-list subroutine, accepts user input, dispatches to the activity handler, and offers a repeat prompt. 3. **Lines 100–200:** Activity-list subroutine — prints the numbered menu of 20 exercises, initializes calorie-rate variables, and returns. 4. **Lines 501–520:** Activity dispatch routines — one line per activity, each printing the calorie total and jumping to a weight-loss calculation block. 5. **Lines 1000–1062:** Weight-loss calculation blocks — paired lines computing kg and lb loss for each calorie rate. 6. **Lines 1900–1910:** Rounding subroutines. 7. **Lines 2000–2050:** Output subroutines for kg and lb display. 8. **Line 9998:** Save/autorun line. ### Key BASIC Idiom: Computed GO SUB Line 20 uses `GO SUB A+500` to jump directly to the subroutine corresponding to the user’s activity number. Because activity numbers run from 1 to 20, this resolves to `GO SUB 501` through `GO SUB 520`, one line per activity. This avoids a long IF/THEN chain or DATA-based lookup table and is an efficient dispatch technique for densely numbered line ranges. ### Calorie Rate Variables Lines 198–199 assign calorie-per-hour rates to single-letter variables. This compresses repeated literal constants and saves tokenized program space. The mapping is: | Variable | Cal/hr | Activities | | --- | --- | --- | | `E` | 100 | Sitting | | `F` | 230 | Table Tennis | | `G` | 250 | Golf | | `H` | 300 | Badminton, Dancing, Walking | | `I` | 350 | Volleyball | | `J` | 360 | Baseball | | `K` | 400 | Bicycling, Bowling, Skating | | `L` | 440 | Tennis | | `M` | 500 | Basketball | | `R` | 550 | Football, Soccer | | `O` | 560 | Jogging | | `P` | 600 | Handball, Racketball, Skiing | | `Q` | 900 | Running | Note that the variable `N` is intentionally skipped (presumably to avoid confusion with the keyword `NEXT`, where it is conventionally used as a loop counter). ### Weight Loss Calculation Each weight-loss block computes fat loss using the approximation that 7,000 calories equal one kilogram of body fat. The kilogram result is computed as `B * rate / 7000` and the pound result divides that by 2.2 (`(B * rate / 7000) / 2.2`). Both values are rounded to two decimal places by the subroutines at lines 1900 and 1910 using the standard `INT(100 * x + 0.5) / 100` idiom. ### Bugs and Anomalies - **Line 1020 — broken control flow for Football/Soccer:** The line reads `GO TO 1062: GO SUB 2000`. Because `GO TO 1062` is executed first, the `GO SUB 2000` (kg display) is never reached. Football and Soccer therefore skip printing the kilogram weight-loss figure and only show the pound value, unlike all other activities. This appears to be a typographical error — the intended code was probably `GO SUB 1900: GO SUB 2000` as used everywhere else. - **Line 1062 — shared by Volleyball kg block and Football/Soccer jump target:** The Football/Soccer path (via `GO TO 1062`) lands in the middle of the Volleyball calculation block, computing `Z=(B*I/7000)/2.2` (Volleyball’s rate) instead of `B*R/7000/2.2` (Football/Soccer’s rate). This means Football and Soccer report incorrect pound weight-loss values as a secondary consequence of the above bug. - **Variable `N` unused:** The calorie-rate variable sequence skips `N`, leaving a gap between `M` (500) and `R` (550). - **Line 4 typo:** “COMMNON” in line 100 is a misspelling of “COMMON”. - **Input validation:** Line 12 only checks `A>20`; entering 0 or a negative number would cause `GO SUB A+500` to jump to a non-existent or unintended line. ### Screen and System POKEs Line 3 uses two system variable POKEs: `POKE 23658,8` sets bit 3 of FLAGS2, enabling the caps-lock / inverse video mode; `POKE 23609,30` writes to BORDCR, setting the border color attribute used during printing. ### String Constant Optimization The string `C$=" CALORIES USED"` is assigned once at line 5 and appended to every activity PRINT statement in lines 501–520, avoiding repeated literal strings and saving tokenized storage space across the 20 dispatch lines. ## Source Code ``` 1 REM from CTM FOR JUNE '85 BY JOE SMITH JR.,BEGINS P.21. 2 BORDER 0: PAPER 6: INK 0: BEEP .05,20: BEEP .05,30: BEEP .05,40 3 POKE 23658,8: POKE 23609,30: PRINT AT 7,3;"C A L O R I E " 4 PRINT AT 10,7;"C O U N T E R ";AT 15,1;"BURNED BY EXERCISE,NOT SPURNED" 5 PAUSE 240: CLS : LET C$=" CALORIES USED" 9 GO SUB 100 10 INPUT "INPUT ACTIVITY # & TIME EXERCIS-ING. EXPRESS PARTS OF AN HOUR AS DECIMAL FRACTIONS. EX.:15 MIN.=.25 ";"ACTIVITY # ";A;" TIME ";B 12 IF A>20 THEN GO TO 10 20 GO SUB A+500 24 INPUT "GO AGAIN? Y/N?",A$ 30 IF A$="Y" THEN PRINT AT 14,0;" ": GO TO 10 35 IF A$="N" THEN PRINT ''"BYE,DOWNHEARTED.": STOP 100 PRINT "BELOW IS A LIST OF SOME COMMNON EXERCISE ACTIVITIES: " 103 PRINT "1-BADMINTON","11-RACKETBALL" 104 PRINT "2-BASEBALL","12-RUNNING" 105 PRINT "3-BASKETBALL","13-SITTING" 106 PRINT "4-BICYCLING","14-SKATING" 107 PRINT "5-BOWLING","15-SKIING" 108 PRINT "6-DANCING","16-SOCCER" 109 PRINT "7-FOOTBALL","17-TABLE TENNIS" 110 PRINT "8-GOLF","18-TENNIS" 111 PRINT "9-HANDBALL","19-VOLLEYBALL" 112 PRINT "10-JOGGING","20-WALKING" 115 PRINT : PRINT 198 LET F=230: LET G=250: LET H=300: LET I=350: LET J=360: LET K=400: LET L=440: LET M=500 199 LET R=550: LET O=560: LET P=600: LET Q=900: LET E=100 200 RETURN 501 PRINT AT 14,0;"BADMINTON ";B*H;C$: GO TO 1000 502 PRINT AT 14,0;"BASEBALL ";B*J;C$: GO TO 1005 503 PRINT AT 14,0;"BASKETBALL ";B*M;C$: GO TO 1010 504 PRINT AT 14,0;"BICYCLING ";B*K;C$: GO TO 1015 505 PRINT AT 14,0;"BOWLING ";B*K;C$: GO TO 1015 506 PRINT AT 14,0;"DANCING ";B*H;C$: GO TO 1000 507 PRINT AT 14,0;"FOOTBALL ";B*R;C$: GO TO 1020 508 PRINT AT 14,0;"GOLF ";B*G;C$: GO TO 1025 509 PRINT AT 14,0;"HANDBALL ";B*P;C$: GO TO 1030 510 PRINT AT 14,0;"JOGGING ";B*O;C$: GO TO 1035 511 PRINT AT 14,0;"RACKETBALL ";B*P;C$: GO TO 1030 512 PRINT AT 14,0;"RUNNING ";B*Q;C$: GO TO 1040 513 PRINT AT 14,0;"SITTING ";B*E;C$: GO TO 1045 514 PRINT AT 14,0;"SKATING ";B*K;C$: GO TO 1015 515 PRINT AT 14,0;"SKIING ";B*P;C$: GO TO 1030 516 PRINT AT 14,0;"SOCCER ";B*R;C$: GO TO 1020 517 PRINT AT 14,0;"TABLE TENNIS ";B*F;C$: GO TO 1050 518 PRINT AT 14,0;"TENNIS ";B*L;C$: GO TO 1055 519 PRINT AT 14,0;"VOLLEYBALL ";B*I;C$: GO TO 1060 520 PRINT AT 14,0;"WALKING ";B*H;C$: GO TO 1000 1000 LET C=B*H/7000: GO SUB 1900: GO SUB 2000 1002 LET Z=(B*H/7000)/2.2: GO SUB 1910: GO TO 2050 1005 LET C=B*J/7000: GO SUB 1900: GO SUB 2000 1007 LET Z=(B*J/7000)/2.2: GO SUB 1910: GO TO 2050 1010 LET C=B*M/7000: GO SUB 1900: GO SUB 2000 1011 LET Z=(B*M/7000)/2.2: GO SUB 1910: GO TO 2050 1015 LET C=B*K/7000: GO SUB 1900: GO SUB 2000 1017 LET Z=(B*K/7000)/2.2: GO SUB 1910: GO TO 2050 1020 LET C=B*R/7000: GO TO 1062: GO SUB 2000 1022 LET Z=(B*R/7000)/2.2: GO SUB 1910: GO TO 2050 1025 LET C=B*G/7000: GO SUB 1900: GO SUB 2000 1027 LET Z=(B*G/7000)/2.2: GO SUB 1910: GO TO 2050 1030 LET C=B*P/7000: GO SUB 1900: GO SUB 2000 1032 LET Z=(B*P/7000)/2.2: GO SUB 1910: GO TO 2050 1035 LET C=B*O/7000: GO SUB 1900: GO SUB 2000 1037 LET Z=(B*O/7000)/2.2: GO SUB 1910: GO TO 2050 1040 LET C=B*Q/7000: GO SUB 1900: GO SUB 2000 1042 LET Z=(B*Q/7000)/2.2: GO SUB 1910: GO TO 2050 1045 LET C=B*E/7000: GO SUB 1900: GO SUB 2000 1047 LET Z=(B*E/7000)/2.2: GO SUB 1910: GO TO 2050 1050 LET C=B*F/7000: GO SUB 1900: GO SUB 2000 1052 LET Z=(B*F/7000)/2.2: GO SUB 1910: GO TO 2050 1055 LET C=B*L/7000: GO SUB 1900: GO SUB 2000 1057 LET Z=(B*L/7000)/2.2: GO SUB 1910: GO TO 2050 1060 LET C=B*I/7000: GO SUB 1900: GO SUB 2000 1062 LET Z=(B*I/7000)/2.2: GO SUB 1910: GO TO 2050 1900 LET D=INT (100*C+.5)/100: RETURN 1910 LET D=INT (100*Z+.5)/100: RETURN 2000 PRINT "WEIGHT LOSS= ";D;" KG": RETURN 2050 PRINT D;" LB": RETURN 2080 STOP 9998 CLEAR : SAVE "CALORIBURN" LINE 1 ```