Morse Code Sounder

By Steven Flintham

Originally published in EUG #48

Morse is a program that sounds out a message in morse code. To use it, just type:

      *MORSE (Message)

For example, *MORSE SOS would produce "... --- ..." from the speaker.

For interest, the sequence of dots and dashes for each letter is stored in one byte. The coding is as follows.

Take the letter C. It is stored as 26 which, if written in binary, is 00011010. The program uses an algorithm similar to the one below to 'scan' the binary of the number until it finds a 1. From then on, the program sounds a dash when it encounters a 1 and a dot when a 0 is encountered, until the end of the number.

Algorithm
 
Load byte to acumulatorLDA table,X
Shift it to the left ASL A
Load accumulator with 0LDA #0
Add with carry to 0 ADC #0
If accumulator contains 1 then dash else dotBEQ dot:.dash

MORSE CODE SOUNDER Published EUG #48