Morse (Morse Keyer and CW Trainer)

Type
Education
Category
Morse code sender and practice program
Published in
Flop (Czech disk magazine for 8-bit Atari), issue 7
Language
Atari BASIC
Requirements
Any 8-bit Atari with Atari BASIC; keyboard in upper-case mode
Text screen showing the practice set ETAIMN and rows of random five-letter groups

About the program

Morse ("CW") practice programs were a staple for radio amateurs with home computers. This compact one from the Czech disk magazine Flop 7 has two modes. A (Automat. klíč, "automatic key") plays back whatever you type as Morse code. V (Výuka CW, "CW lessons") is a copying drill. You choose which characters to practise, and the program sends them in random order while printing them in neat groups of five on the screen, so you can check what you wrote down.

Prompts in English

Czech English
Automat.klic...A / Vyuka CW.......V Automatic key: A / CW lessons: V
Prosim dalsi text Next text, please
Jake znaky chces procvicovat? Which characters do you want to practise?

Typing it in

The listing is plain ASCII except for {CLEAR} (ESC then SHIFT-CLEAR, the clear-screen character) and {ESC} in lines 18 and 125. Type {ESC} inside the quotes by pressing ESC twice: the first ESC tells the editor to take the next key literally. The variable LENGHT is spelt that way in the original, so keep it consistent.

The DATA lines are the fragile part. Each line number is 2000 + the ATASCII code of a character: 2065 is A, 2048 is 0, 2032 is the space between words. The first number on each line says how many values follow. Lines 2065 and 2086 end with a stray comma, which is harmless. Line 2053 (the digit 5) has been corrected here (see "Changes from the published listing").

How to use it

RUN, then answer A or V.

  • A: type a line of text in capitals and press RETURN to hear it. Answer {ESC} at the next prompt to repeat the last text.
  • V: type the set of characters to practise, e.g. ETAINMS. Five rows of five-character groups are sent and printed, five blocks across the screen, before you're asked again. {ESC} repeats the previous set.

Only the characters that have a DATA line can be sent: capitals, digits, space and ! + , . / = ?. Anything else makes RESTORE land on the next DATA line, and you get the wrong sound.

How it works

Morse timing is built on one unit. A dot is one unit on, a dash is three, and the gaps inside a letter are one unit off. Each DATA line spells that out directly as 1s (tone on) and 0s (tone off). For example, A (·−) is 1,0,1,1,1,0. Subroutine 1000 uses the computed RESTORE 2000+ASC(char), which Atari BASIC allows, reads the pattern and switches SOUND 0,80,10,8 on or off for each unit. A short delay loop sets the speed (FOR D=1 TO 15 per unit, FOR W=1 TO 60 between letters). To send faster or slower, change those two loop limits.

Changes from the published listing

Line As published Now Why
2053 DATA 10,1,0,1.0,1,0,1,0,1,0 DATA 10,1,0,1,0,1,0,1,0,1,0 1.0 was a slip for 1,0. The line held one value too few, so a 5 was sent as dot, long tone, dot, dot (with the count of line 2054 read as a final silent element) instead of five dots.

Listing

0 REM ***MORSE***
1 ? "{CLEAR}"
5 DIM N$(1),TEXT$(256),MEM$(256),OUTPUT$(1)
7 ? "Automat.klic...A":? "Vyuka CW.......V"
8 INPUT N$
9 IF N$="V" THEN 100
10 REM
11 ?:? "OK":?
13 ? "Prosim dalsi text"
15 INPUT TEXT$
18 IF TEXT$="{ESC}" THEN TEXT$=MEM$
19 MEM$=TEXT$
20 FOR POS=1 TO LEN(TEXT$)
25 GOSUB 1000
30 NEXT POS
40 GOTO 10
100 REM ***VYUKA***
110 ?:? " Jake znaky chces procvicovat?"
115 INPUT TEXT$
120 ? "{CLEAR}"
125 IF TEXT$="{ESC}" THEN TEXT$=MEM$:? "{CLEAR}"
130 MEM$=TEXT$
135 ?:? TEXT$
140 N=LEN(TEXT$)
150 FOR R=5 TO 9
155 FOR WR=1 TO 2*W:NEXT WR
160 FOR S=2 TO 6
170 POS=INT(RND(0)*N)+1
180 GOSUB 1000
190 POSITION PS+S,R:? OUTPUT$;
200 NEXT S
210 NEXT R
220 PS=PS+6
230 IF PS<30 THEN 150
240 ?:PS=0:GOTO 100
1000 REM ***MORSE BEGIN***
1020 OUTPUT$=TEXT$(POS,POS)
1030 RESTORE 2000+ASC(OUTPUT$)
1035 READ LENGHT
1040 FOR A=1 TO LENGHT
1045 FOR D=1 TO 15:NEXT D
1050 READ MCODE
1060 IF MCODE=1 THEN SOUND 0,80,10,8:NEXT A
1070 SOUND 0,0,0,0:NEXT A
1080 FOR W=1 TO 60:NEXT W
1100 RETURN
2032 DATA 4,0,0,0,0
2033 DATA 20,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0
2043 DATA 14,1,0,1,1,1,0,1,0,1,1,1,0,1,0
2044 DATA 18,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0
2046 DATA 12,1,0,1,0,1,0,1,0,1,0,1,0
2047 DATA 14,1,1,1,0,1,0,1,0,1,1,1,0,1,0
2048 DATA 20,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0
2049 DATA 18,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0
2050 DATA 16,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0
2051 DATA 14,1,0,1,0,1,0,1,1,1,0,1,1,1,0
2052 DATA 12,1,0,1,0,1,0,1,0,1,1,1,0
2053 DATA 10,1,0,1,0,1,0,1,0,1,0
2054 DATA 12,1,1,1,0,1,0,1,0,1,0,1,0
2055 DATA 14,1,1,1,0,1,1,1,0,1,0,1,0,1,0
2056 DATA 16,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0
2057 DATA 18,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0
2061 DATA 14,1,1,1,0,1,0,1,0,1,0,1,1,1,0
2063 DATA 16,1,0,1,0,1,1,1,0,1,1,1,0,1,0,1,0
2065 DATA 6,1,0,1,1,1,0,
2066 DATA 10,1,1,1,0,1,0,1,0,1,0
2067 DATA 12,1,1,1,0,1,0,1,1,1,0,1,0
2068 DATA 8,1,1,1,0,1,0,1,0
2069 DATA 2,1,0
2070 DATA 10,1,0,1,0,1,1,1,0,1,0
2071 DATA 10,1,1,1,0,1,1,1,0,1,0
2072 DATA 8,1,0,1,0,1,0,1,0
2073 DATA 4,1,0,1,0
2074 DATA 14,1,0,1,1,1,0,1,1,1,0,1,1,1,0
2075 DATA 10,1,1,1,0,1,0,1,1,1,0
2076 DATA 10,1,0,1,1,1,0,1,0,1,0
2077 DATA 8,1,1,1,0,1,1,1,0
2078 DATA 6,1,1,1,0,1,0
2079 DATA 12,1,1,1,0,1,1,1,0,1,1,1,0
2080 DATA 12,1,0,1,1,1,0,1,1,1,0,1,0
2081 DATA 14,1,1,1,0,1,1,1,0,1,0,1,1,1,0
2082 DATA 8,1,0,1,1,1,0,1,0
2083 DATA 6,1,0,1,0,1,0
2084 DATA 4,1,1,1,0
2085 DATA 8,1,0,1,0,1,1,1,0
2086 DATA 10,1,0,1,0,1,0,1,1,1,0,
2087 DATA 10,1,0,1,1,1,0,1,1,1,0
2088 DATA 12,1,1,1,0,1,0,1,0,1,1,1,0
2089 DATA 14,1,1,1,0,1,0,1,1,1,0,1,1,1,0
2090 DATA 12,1,1,1,0,1,1,1,0,1,0,1,0

Credits