Communications in a Flash

Signalman with searchlight on a ship
Signalman with searchlight on a ship

(Editor’s NOTE: this program could easily be adapted to the ZX81/TS1000 computer. Would anyone like to try?)

Blinker Signaling

This program simulates a blinker signalling device. Nowadays, when radio communicators are constantly trying to use ever-higher ultra frequencies, we tend to forget that blinkers have been using, for centuries, frequencies higher than any radio signal yet generated.

Running Flash

When the program is RUN, night descends. You then tell your “instructor” how fast to send your test messages, and how many characters to send in each group.

You can then choose any one of three options:

1. A printed letter followed by the signal

2. The signal first, then the letter

3. Your own choice of letters

If you choose 1. or 2., the choice of letters is random; if you choose 3., then you (or the instructor) INPUT the message you want.

Coding Illuminated

The program, LISTed in Figure 1, is pretty straightforward. Line 1 makes sure that your inputs will all be in capital letters. Lines 70 to 340 set initial conditions, and establish the searchlight as User-Designed Graphic “S”. As an interesting sidelight: you can see the pattern of the light if you look sidewise at the LISTing of lines 220 to 290.

The “works” of the program are in array M, which is loaded with the data given in lines 650 to 1070. If you’re familiar with Morse code, you’ll be able to make out the letters within the DATA statements: 6 means a DIT, and 4 a DAH. The 3’s are NOPs (do-nothings), inserted to preserve the symmetry of the array.

The searchlight was designed to produce a very small pattern, to simulate the appearance of an actual ship at a distance. If you want to pretend that you have binoculars powerful enough to produce a larger display, you can use the statement in Figure 2 to replace lines 20, 40, 70, and 90. In this case, lines 220 through 290 can be left out.

(Editor’s NOTES:) You may find that the fast speeds attainable by this program are unrealistic. In real life, blinkers can not begin to approach the speeds of radio code, because of the mass of the mechanical shutter involved in modulating the light beam.

It is possible to shorten materially the initialization delay by the following steps:

Change line 120 to DIM M$(43,5) changed to a string array, size is not changed

Change line 170 to GO SUB 650

DELETE lines 180 through 210

Change line 530 to: GO SUB VAL M$(CODE J$(K)-47,I)

Change lines 650 to 1070 to the following form:

 650 LET M$(1)="44444"
660 LET M$(2)="64444"
660 LET M$(3)="66444"
670 LET M$(4)="66644"
* * * * *
1070 LET M$(43)="44663"

Add line 1080 RETURN

   1 POKE 23658,8: GO TO 110: REM POKE sets capital letters
3 RETURN
4 GO TO 70
10 REM DIT
20 PRINT AT 10,13;"▒": REM graphics "S"--also at lines 40,70, and 90
30 PAUSE DIT
40 PRINT AT 10,13;"▒"
50 RETURN
60 REM DAH
70 PRINT AT 10,13;"▒"
80 PAUSE DAH
90 PRINT AT 10,13;"▒"
100 RETURN
110 DIM J$(60)
120 DIM M(43,5)
130 INK 7
140 PAPER 0
150 BORDER 0
160 CLS
170 FOR I=1 TO 43
180 FOR J=1 TO 5
190 READ M(I,J)
200 NEXT J
210 NEXT I
220 POKE USR "S" ,BIN 00000000
230 POKE USR "S"+1,BIN 00000000
240 POKE USR "S"+2,BIN 00011000
250 POKE USR "S"+3,BIN 00111100
260 POKE USR "S"+4,BIN 00111100
270 POKE USR "S"+5,BIN 00011000
280 POKE USR "S"+6,BIN 00000000
290 POKE USR "S"+7,BIN 00000000
300 OVER 1
310 PRINT "INPUT SPEED (1-9)": INPUT LPM
320 IF LPM>10 THEN PRINT "ERROR: NUMBER TOO HIGH": GO TO 310
330 PRINT "GROUPING (1-60)": INPUT GRP
340 PRINT "ENTER :";,,"1 FOR SIGNAL THEN LETTER";,"2 FOR LETTER THEN SIGNAL";,"3 YOU GIVE LETTER"
350 INPUT O
360 LET DIT=10/LPM
370 LET DAH=30/LPM
380 LET WP=60/LPM
390 CLS
400 PRINT AT 1,1;"LETTERS/SECOND = ";LPM*.335
410 IF O=3 THEN PRINT AT 3,1;"ENTER LETTER(S)"
420 FOR K=1 TO GRP
430 IF O<>3 THEN LET J$(K)=CHR$ INT (RND*43+48): IF J$(K)<"A" AND J$(K)>"9" THEN GO TO 430
440 IF O<>3 THEN GO TO 480
450 PAUSE 0
460 LET J$(K)=INKEY$
465 IF J$(K)<"A" AND J$(K)<"0" OR J$(K)>"Z" THEN GO TO 450
470 PRINT J$(K);
480 NEXT K
490 PAUSE 30
500 IF O=2 THEN PRINT AT 12,13;J$: PAUSE 60*GRP
510 FOR K=1 TO GRP
520 FOR I=1 TO 5
530 GO SUB M(CODE J$(K)-47,I)
540 PAUSE WP/2
550 NEXT I
560 PAUSE WP
570 NEXT K
580 IF O<>3 THEN PRINT AT 12,13;J$
590 IF GRP>2 THEN PRINT AT 20,1;"ENTER ANY KEY TO CONTINUE": PAUSE 0: LET K$=INKEY$: GO TO 390
600 PAUSE 60
640 GO TO 390
650 DATA 4,4,4,4,4
660 DATA 6,4,4,4,4
670 DATA 6,6,4,4,4
680 DATA 6,6,6,4,4
690 DATA 6,6,6,6,4
700 DATA 6,6,6,6,6
710 DATA 4,6,6,6,6
720 DATA 4,4,6,6,6
730 DATA 4,4,4,6,6
740 DATA 4,4,4,4,6
750 DATA 3,3,3,3,3
760 DATA 3,3,3,3,3
770 DATA 3,3,3,3,3
780 DATA 3,3,3,3,3
790 DATA 3,3,3,3,3
800 DATA 3,3,3,3,3
810 DATA 3,3,3,3,3
820 DATA 6,4,3,3,3
830 DATA 4,6,6,6,3
840 DATA 4,6,4,6,3
850 DATA 4,6,6,3,3
860 DATA 6,3,3,3,3
870 DATA 6,6,4,6,3
880 DATA 4,4,6,3,3
890 DATA 6,6,6,6,3
900 DATA 6,6,3,3,3
910 DATA 6,4,4,4,3
920 DATA 4,6,4,3,3
930 DATA 6,4,6,6,3
940 DATA 4,4,3,3,3
950 DATA 4,6,3,3,3
960 DATA 4,4,4,3,3
970 DATA 6,4,4,6,3
980 DATA 4,4,6,4,3
990 DATA 6,4,6,3,3
1000 DATA 6,6,6,3,3
1010 DATA 4,3,3,3,3
1020 DATA 6,6,4,3,3
1030 DATA 6,6,6,4,3
1040 DATA 6,4,4,3,3
1050 DATA 4,6,6,4,3
1060 DATA 4,6,4,4,3
1070 DATA 4,4,6,6,3

Fig. 1 LISTing for FLASH

  20 PRINT AT 10,12;"▒▒▒";AT 11,12;"▒▒▒";AT 12,12;"▒▒▒"

NOTE: Graphics are as follows:

1st line: Shifted 2, Shifted 8, Shifted 1
2nd line: Shifted 8 (three times)
3d line: UNshifted 7, Shifted 8, Shifted 4

Fig. 2 A larger searchlight

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.