{This program calculates the correct f-stop aperture setting for flash photography using the guide number method. It prompts the user to enter the film/flash guide number and the flash-to-subject distance in feet, then divides the guide number by the distance to produce the required f-stop (F = G/D). After displaying the result, pressing any key clears the screen and restarts the calculation loop, allowing repeated use without reloading. The program structure is minimal and linear, making it a practical pocket-reference tool for photographers.
Program Analysis
Program Structure
The program is a tight, single-loop utility. Lines 10–100 handle input, calculation, and output; line 110 waits for a keypress; lines 120–130 clear the screen and restart. The flow is entirely linear with no subroutines.
- Lines 10–20: Title and decorative heading.
- Lines 30–80: Input prompts and echo for guide number (
G) and distance (D). - Line 90: Core calculation:
LET F=G/D. - Line 100: Displays the recommended aperture.
- Line 110: Busy-wait keypress loop using
INKEY$. - Lines 120–130: Clear screen and loop back to start.
The Flash Guide Number Formula
The guide number (GN) method is a standard photographic relationship: f-stop = GN / distance. The program implements this directly at line 90. No unit conversion is performed; the prompt at line 60 specifies feet, so the result is only correct when the guide number is rated for feet rather than metres.
Key BASIC Idioms
- Keypress wait (line 110):
IF INKEY$="" THEN GOTO 110is a standard busy-wait loop, holding the result on screen until the user presses any key before cycling back. - Input echo (lines 50, 80): After each
INPUT, the entered value is immediatelyPRINTed back, confirming what was typed — a common pattern to provide visual feedback. - Restart via
GOTO 10(line 130): Rather than usingRUN(which would re-initialise variables),GOTO 10re-enters the display/input sequence while preserving any variable state, though in this case all variables are re-assigned on each pass anyway.
Notable Anomalies
- Line numbering gap: Lines jump from 130 to 150, skipping 140. This is cosmetically unusual but functionally harmless.
- Line 200 (
RUN): ARUNstatement stored as a program line is never reached during normal execution; it exists as a convenience for manually typed execution or as a remnant of editing. - No input validation: If the user enters
0for distanceD, line 90 will produce a division-by-zero error. A guard such asIF D=0 THEN GOTO 60would make the program more robust. - Result not rounded:
Fis printed as a raw floating-point value (e.g.,F/6.666...), which may not map cleanly to standard f-stop markings (f/2, f/2.8, f/4, etc.). A rounding or lookup step would improve practical usability.
Variable Summary
| Variable | Purpose |
|---|---|
G | Flash guide number (user input) |
D | Flash-to-subject distance in feet (user input) |
F | Calculated f-stop aperture (G/D) |
Content
Source Code
5 REM PHOTOGRAPHY
10 PRINT "FLASH EXPOSURE"
20 PRINT "**************"
30 PRINT "FILM GUIDE NUMBER: ";
40 INPUT G
50 PRINT G
60 PRINT "FLASH/SUBJECT DISTANCE: ";
70 INPUT D
80 PRINT D;" FEET"
90 LET F=G/D
100 PRINT "SHOOT AT F/";F
110 IF INKEY$="" THEN GOTO 110
120 CLS
130 GOTO 10
150 SAVE "1005%6"
200 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
