--- title: "Time / Distance" id: 56997 type: "computer_media" slug: "time-distance" url: "http://localhost/computer_media/time-distance/" markdown_url: "http://localhost/computer_media/time-distance.md" published_at: "2024-10-02T07:17:33+00:00" modified_at: "2026-03-30T21:20:22+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/21_TmDst.png" excerpt: "A no-frills trip-time calculator that divides hardcoded distance by speed — edit two lines and run to get your answer in hours." 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 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Home" slug: "home" taxonomy: "genre" url: "http://localhost/type/home/" media_contents: - id: 56732 title: "Timex Sinclair Public Domain Library Tape 1001" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1001/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/21_TmDst.png" media_type_tags: "Home" --- # Time / Distance This program calculates the time required for a trip given a fixed distance and rate (speed). It divides a hardcoded distance of 250 miles by a rate of 65 (miles per hour) and prints the result in hours. The values for distance and rate are set as constants in lines 20 and 30, and the REM comments instruct the user to modify those lines directly when different values are needed. Lines 65–80 appear to be utility lines for saving and listing the program, placed after the STOP statement so they do not execute during normal program flow. *** ## Program Analysis ### Program Structure The program is straightforward and linear. Execution begins at line 5 (a REM) and flows through to line 60 where a `STOP` halts execution. Lines 65–80 are utility lines that are never reached during a normal run. 1. **Lines 5–13:** REM documentation and output header 2. **Lines 20–30:** Constant assignment — `D=250` (distance), `R=65` (rate/speed) 3. **Line 40:** Core calculation — `T=D/R` 4. **Line 50:** Output of result 5. **Line 60:**`STOP` — normal program termination 6. **Lines 65–80:** Post-STOP utility lines (`CLEAR`, `SAVE`, `LIST`) ### Variables | Variable | Purpose | Value | | --- | --- | --- | | `D` | Distance | 250 | | `R` | Rate (speed) | 65 | | `T` | Time (result) | `D/R` ≈ 3.84615… | ### Key BASIC Idioms and Notable Techniques The program uses a purely hardcoded approach to input: the REM at line 11 explicitly tells the user to modify `D` and `R` in lines 20 and 30 directly, rather than using `INPUT` statements. This was a common technique in early hobbyist programs to keep code minimal and avoid input-handling overhead. The result `T` is printed with surrounding spaces in the `PRINT` statement on line 50 (`" ";T;" HOURS."`) to visually separate the numeric value from the surrounding label text. ### Post-STOP Utility Lines Lines 65–80 are placed deliberately after `STOP` and are never executed during a normal run. They represent a developer workflow pattern: `CLEAR` at line 65 would reset variables, `SAVE` at line 70 saves the program, and `LIST` at line 80 would display the listing — useful commands to have accessible by editing the `STOP` line or jumping to them manually via `GO TO`. ### Bugs and Anomalies - There is no `INPUT` prompt, so each new calculation requires the user to manually edit lines 20 and 30 — functional but not user-friendly. - No units are enforced or labelled for distance or rate; the output says “HOURS” but the correctness depends entirely on the user supplying consistent units. - Line 65 (`CLEAR`) follows `STOP` immediately in line numbering but would reset all variables if reached, which could be confusing if a user attempts to resume execution after a `STOP`. ## Source Code ``` 5 REM TIME/DISTANCE CALCULATION 10 REM KNOW DISTANCE/RATE 11 REM DISTANCE/RATE MOD AS REQURED 12 PRINT "TIME REQUIRED FOR TRIP WHEN DISTANCE/TIME KNOWN" 13 PRINT 20 LET D=250 30 LET R=65 40 LET T=D/R 50 PRINT "THE TIME REQUIRED IS ";T;" HOURS." 60 STOP 65 CLEAR 70 SAVE "1002%1" 80 LIST ```