home *** CD-ROM | disk | FTP | other *** search
/ Amoszine 4 / Amoszine 4 (Disk 1 of 3).adf / READERS_SOURCE.LHA / READERS_SOURCE / ED_CLAY / morse.amos / morse.amosSourceCode
Encoding:
AMOS Source Code  |  1992-02-26  |  1.4 KB  |  39 lines

  1. '
  2. 'Morse code translator 
  3. 'This version by Edmund Clay 
  4. 'Oct 94
  5. '
  6. 'I found the original program on an F1 source disk. I don't know whether 
  7. 'it was the programs fault or just that I'm useless at morse code but I
  8. 'couldn't get it to work at all. The idea is that you tap out the message
  9. 'on the mouse key. I don't think it will ever replace the keyboard but 
  10. 'after some reprogramming it is at least possible to send a HELLO message
  11. '(.... . .-.. .-.. ---)  
  12. 'with the original this comes out as ZOGOD or something. 
  13. '
  14. Dim MORSE$(36)
  15. For LOP=1 To 36
  16.    Read MORSE$(LOP)
  17. Next LOP
  18. While Mouse Key=0 : Wend 
  19. Do 
  20.    TIME=0 : While Mouse Key=1 : Inc TIME : Wend 
  21.    CHECK=0 : Repeat : Inc CHECK : Until Mouse Key=1 or CHECK>700
  22.    If TIME<800
  23.       WORD$=WORD$+"."
  24.    Else 
  25.       WORD$=WORD$+"-"
  26.    End If 
  27.    If CHECK>700
  28.       For LOP=1 To 36
  29.          If WORD$=MORSE$(LOP)
  30.             Print Chr$(64+LOP); : Exit 
  31.          End If 
  32.       Next 
  33.       WORD$=""
  34.       CHECK=0 : Repeat : Inc CHECK : Until Mouse Key=1
  35.       If CHECK>3000 : Print " "; : End If 
  36.    End If 
  37. Loop 
  38. Data ".-","-...","-.-.","-..",".","..-","--","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--..","-----",".----","..---","...--","....-",".....","-....","--...","---..","----."
  39. '     a    b      c      d     e   f     g    h      i    j      k     l      m    n    o     p      q      r     s     t   u     v      w     x      y      z