This program calculates the physical dimensions of two common amateur radio antenna types — the half-wave dipole and the quarter-wave vertical — for any user-specified frequency in megahertz. After inputting the centre frequency, it computes total and per-arm dipole lengths plus vertical and radial lengths, all in both feet and metres, using integer truncation via INT to yield results to two decimal places. The magic numbers 49200 and 15000 encode the speed-of-light velocity factor constants for feet and metres respectively (with a 0.95 shortening factor already baked in), while 23400 and 7130 provide the quarter-wave equivalents. A short FOR/NEXT delay loop (lines 250–260) substitutes for a PAUSE statement between data entry and results display. Results are displayed with inverse-video labels, and the program loops back on a Y/N prompt.
Program Analysis
Program Structure
The program follows a straightforward linear flow divided into four functional phases:
- Title screen (lines 10–130): clears screen, prints banner with inverse-video heading.
- Input & calculation (lines 140–240): accepts frequency
Fin MHz, computes eight length variables. - Delay & results display (lines 250–450): a busy-wait loop, a CLS, then formatted output of all dimensions.
- Loop / exit (lines 460–560): Y/N continuation prompt; on exit prints memory usage and STOPs.
Antenna Dimension Formulae
Eight variables are computed from the input frequency F (in MHz). The pattern (INT(constant/F))/100 computes a value to two decimal places without using floating-point rounding, relying instead on integer truncation:
| Variable | Formula | Meaning |
|---|---|---|
L1 | INT(49200/F)/100 | Half-wave dipole total length, feet |
L2 | INT(15000/F)/100 | Half-wave dipole total length, metres |
L3 | INT(23400/F)/100 | Quarter-wave vertical length, feet |
L4 | INT(7130/F)/100 | Quarter-wave vertical length, metres |
L5 | INT(102.5*L3)/100 | Radial length, feet (≈5% longer than vertical) |
L6 | INT(102.5*L4)/100 | Radial length, metres |
L7 | INT(L2*50)/100 | Each dipole arm, metres (half of L2) |
L8 | INT(L1*50)/100 | Each dipole arm, feet (half of L1) |
The constant 49200 derives from the standard dipole formula 468/F(MHz) scaled to feet×100 (468×100 = 46800), but here 49200 is used, implying a slightly less aggressive velocity/end-effect shortening factor (~0.951 rather than the commonly used 0.95). Similarly, 23400 ÷ 2 = 11700 ≈ 234, the quarter-wave feet constant. The radial multiplier of 102.5 makes radials approximately 2.5% longer than the vertical element, a common amateur radio guideline.
Delay Loop Idiom
Lines 250–260 implement a simple busy-wait delay:
250 FOR N=1 TO 70 / 260 NEXT N
This is a common ZX81/TS1000 technique used in the absence of a reliable mid-program PAUSE, giving the user a brief moment before the screen clears and results appear.
Inverse-Video Labels
All antenna labels and unit strings (e.g. % %H%A%L%F%-%W%A%V%E% %D%I%P%O%L%E%) use the %X escape notation for inverse-video characters. This was a popular technique to make headings and labels visually distinct without any POKE-based attribute manipulation, producing a highlighted block-letter effect on the display.
Memory Usage Diagnostic
Line 520 uses a well-known ZX81 idiom to calculate program memory consumption:
PEEK 16396 + 256*PEEK 16397 - 16509
This reads the system variable E_LINE (address 16396–16397), which points to the end of the BASIC program area, and subtracts the start address of user RAM (16509), yielding the number of bytes used by the program.
Notable Anomalies
- Line 350 is missing from the listing (the sequence jumps from 340 to 360), suggesting a line was deleted at some point without renumbering.
- Lines 540–560 (
CLEAR,SAVE,RUN) appear afterSTOPat line 530 and are therefore unreachable during normal execution; they exist as a convenient way to save and re-run the program from the editor. - The Y/N test at line 500 only checks for uppercase
"Y"; entering lowercaseywill fall through to the STOP rather than looping, which may catch users unaware. - No input validation is performed on
F; entering zero or a negative value would cause a division-by-zero error at line 170.
Content
Source Code
10 REM "ANTCOMP"
20 CLS
30 PRINT
40 PRINT "********************************"
50 PRINT " % %A%N%T%E%N%N%A% %D%I%M%E%N%S%I%O%N% %P%R%O%G%R%A%M% "
60 PRINT "********************************"
70 PRINT
80 PRINT
90 PRINT
100 PRINT "TO DETERMINE SIZE OF A DIPOLE"
110 PRINT "AND VERTICAL ANTENNA FOR ANY"
120 PRINT "BAND, ENTER THE CENTER FREQUENCY"
130 PRINT "IN MEGAHERTZ:"
140 INPUT F
150 PRINT
160 PRINT " ";F;"% %M%H%Z% "
170 LET L1=(INT (49200/F))/100
180 LET L2=(INT (15000/F))/100
190 LET L3=(INT (23400/F))/100
200 LET L4=(INT (7130/F))/100
210 LET L5=(INT (102.5*L3))/100
220 LET L6=(INT (102.5*L4))/100
230 LET L7=(INT (L2*50))/100
240 LET L8=(INT (L1*50))/100
250 FOR N=1 TO 70
260 NEXT N
270 CLS
280 PRINT
290 PRINT "********************************"
300 PRINT " % %A%N%T%E%N%N%A%S% %F%O%R% ";F;" % %M%H%Z% "
310 PRINT "********************************"
320 PRINT
330 PRINT
340 PRINT "% %H%A%L%F%-%W%A%V%E% %D%I%P%O%L%E% "
360 PRINT
370 PRINT "% %L%E%N%G%T%H","% %E%A%C%H% %A%R%M% "
380 PRINT L1;"% %F%E%E%T% ",L8;" % %F%E%E%T% "
390 PRINT L2;"% %M%E%T%E%R%S% ",L7;" % %M%E%T%E%R%S% "
395 PRINT
400 PRINT "% %Q%U%A%R%T%E%R%-%W%A%V%E% %V%E%R%T%I%C%A%L% "
410 PRINT
420 PRINT "% %V%E%R%T%I%C%A%L% ","% %R%A%D%I%A%L% "
430 PRINT L3;"% %F%E%E%T% ",L5;" % %F%E%E%T% "
440 PRINT L4;"% %M%E%T%E%R%S% ",L6;" % %M%E%T%E%R%S% "
450 PRINT
460 PRINT
470 PRINT
480 PRINT "ENTER % %Y%/%N% TO CONTINUE"
490 INPUT Y$
500 IF Y$="Y" THEN GOTO 20
520 PRINT "MEMORY USED; ";PEEK 16396+256*PEEK 16397-16509
530 STOP
540 CLEAR
550 SAVE "1025%0"
560 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
