Morse Code


Back

MORSE  2006-02-04

Does your mobile phone emit sound like ...--... when it receives text? ...--... means SMS. Here is the basic of morse application.

Files in MORSE.ZIP:
MORSE.COM    basic morse application
MORSE.PET    PET4TH source of morse.com
MORSE.TXT     this file

To hear "sms" in morse code, run MORSE.COM, type:
morse sms
You may type "SMS" or "sms". Or to hear "I love you", type:
morse i love you
You have to unzip MORSE.ZIP first, and enter "DOS PROMPT" mode from Windows.

To hear the morse character by character, type:
morse forth playkey
Then every key pressed will produce corresponding morse code. Press <esc> to exit. "forth" is a special word to execute forth instructions instead of emitting the morse code. "playkey" is the instruction.

If you want to see morse code table, type:
morse forth morsetable.
Do not ignore the "."

You may use MORSE.PET as the building block of your application. You may customize MORSE.PET. You may add the table. You may define your own code. You may even use MORSE.PET for creating your own table for other Forth, type:
morse forth mtsource
MORSE.PET also contains program test instructions.

Below is the glossary:
dos_to_tib
    copy dos command line buffer to tib
vms55
    double variable, keep time in 55ms unit
starttimer  ( -- )
    start counting
55ms  ( 55ms -- )
    55ms delay unit
>upper  ( char1 -- char2 )
    convert to uppercase
note55  ( Hz 55ms -- )
    sound note
morsetable
    7bit morse code table, 0 for undefined
>code  ( addr u -- code )
    convert morse string to code
mt!  ( char addr u -- )
    define char as morse code
mt@  ( char -- code )
    retrieve morse code from morsetable
morse.  ( char -- )
    display character as morse string
char.  ( char -- )
    print 7bit character, non graphic as hex number
morsetable.
    display morse table
mtsource
    create morse table source
morses.  ( addr u -- )
    display string as morse, map lower case to upper case
code>  ( code -- char)
    convert code to character, return 256 if not found
morse>  ( addr u -- char)
    convert morse string to character, return 256 if not found
elements  ( n -- )
    display characters with n elements morse code, n<8
freq
    value frequency Hz
unit
    value dot time unit in 55ms
dotwait
    wait for a dot time
2dotwait
    wait for 2 dot time
playdot
    play dot
playdash
    play dash
playc  ( char -- )
    play character as morse code
play  ( addr u -- )
    play string as morse code
playkey
    type and play, press <esc> to exit
help
    display help
findspace  ( c-addr1 u1 -- c-addr2 u2 c-addr3 u3 )
    discard leading spaces, return string after space and before space
docmd  ( c-addr u -- )
    process command line
main
    main entry point
$end
    end compile

Back