Message lights.
Blinking lights have been used on computers for years. What they mean varies from system to system.Manuals for the systems will hae documention on what all the variations mean. Even on the home computer they most all have an led that signifies whether the power is turned on to the machine
Maybe we could attach led to a local computer and then they are lit could mean one of ervera things depending on how ht e system is programmed.. You could start off with just two leds that you give you four possibilities. Back then there were no computer screens to get information.
You could even add even more light for more possibilities.The traditional way was to add led]s to the parallel port. Eight leds would give you 2^8 or 256 possibilities. Possibly more than you would ever need. First setup we did like this was for the Atari ST computer. The picture is using a 32 bit computer.
One could go a step further and instead of lights being on or off, a message could be sent in one form or another. A traditional choice might be to use something like the Morse code. You could use just use one led to get out the message. the message would be consecutive flashing of long and short lights. Since there is more than one version of the code yo would have to decide ahead of time which version to use.
Once that is decide you sould have to decide how long for a dit (short flash( and a dah (long flash). or n alternative could be using two leds either one lamp lit for a dit and two lamps lit for a dah.
Though I might prefer the traditional method as it would lend it self to using. infrared signal between two systems. Then two systems could use the infrared as a backup if all other communication lines were not active.This is really true if your monitor fails.
- .... .. ... / .. ... / .- / -- . ... ... .- --. . / .. -. / -- --- .-. ... . / -.-. --- -.. . .-.-.-
------------------------------------------------------------------
DECLARE SUB hexit ()
DECLARE SUB morse ()
DECLARE SUB phone ()
DECLARE SUB ccitt ()
' * codeit.bas
' *******************************************************
C$ = "999"
First.flag = 0
DO UNTIL VAL(C$) = 0
IF First.flag > 0 THEN
PRINT "press a key to continue: ";
zz$ = INPUT$(1)
END IF
First.flag = 1
CLS
PRINT
PRINT
PRINT
PRINT " LIzzy code"
PRINT " Conversion tool"
PRINT
PRINT " (1) Morse code."
PRINT " (2) CCITT."
PRINT " (3) Hex."
PRINT " (4) Phone."
PRINT " (0) Quit for the day."
PRINT
PRINT "Please enter choice: ";
DO WHILE VAL(C$) < 0 OR VAL(C$) > 4
C$ = ""
DO WHILE C$ = ""
C$ = INKEY$
LOOP
LOOP
PRINT C$
C = VAL(C$)
SELECT CASE C
CASE 1
CALL morse
CASE 2
CALL ccitt
CASE 3
CALL hexit
CASE 4
CALL phone
END SELECT
LOOP
END
SUB ccitt
CLS
troo = -1
WHILE troo
CLS
PRINT
PRINT "CCITT converter!"
PRINT
PRINT " 1 - Convert ascii to ccitt"
PRINT " 2 - Convert ccitt to ascii"
PRINT " q - quit"
PRINT
A$ = ""
WHILE A$ = ""
A$ = INKEY$
WEND
SELECT CASE UCASE$(A$)
CASE "1"
GOSUB Ascii
CASE "2"
GOSUB ccitt
CASE "Q"
END
END SELECT
WEND
EXIT SUB
Ascii:
REM Start
GOSUB Init
DO
GOSUB Usefilea
LOOP UNTIL Done = 1
GOSUB Over
RETURN
Init:
CLOSE
Oldcase$ = ""
Nextline$ = CHR$(13)
Nil$ = CHR$(0)
Flag = 0
WRU$ = CHR$(5)
Linefeed$ = CHR$(10)
Bell$ = CHR$(7)
Quote$ = CHR$(34)
Escape$ = CHR$(27)
Backspace$ = CHR$(8)
Blank$ = CHR$(32)
True = NOT 0
Done = 0
Flagcase$ = "0"
RETURN
Translate:
GOSUB Checkcase
IF Flagcase$ <> Oldcase$ THEN
Oldcase$ = Flagcase$
PRINT #2, Flagcase$; ccittdat$;
ELSE
IF Flagcase$ <> ccittdat$ THEN
PRINT #2, ccittdat$;
END IF
END IF
RETURN
Checkcase:
SELECT CASE Character$
CASE Nil$
Flagcase$ = "11111"
ccittdat$ = "00000"
CASE "E"
Flagcase$ = "11111"
ccittdat$ = "00001"
CASE Linefeed$
Flagcase$ = "11111"
ccittdat$ = "00010"
CASE "A"
Flagcase$ = "11111"
ccittdat$ = "00011"
CASE Blank$
Flagcase$ = Oldcase$
ccittdat$ = "00100"
CASE "S"
Flagcase$ = "11111"
ccittdat$ = "00101"
CASE "I"
Flagcase$ = "11111"
ccittdat$ = "00110"
CASE "U"
Flagcase$ = "11111"
ccittdat$ = "00111"
CASE Nextline$
Flagcase$ = "11111"
ccittdat$ = "01000"
CASE "D"
Flagcase$ = "11111"
ccittdat$ = "01001"
CASE "R"
Flagcase$ = "11111"
ccittdat$ = "01010"
CASE "J"
Flagcase$ = "11111"
ccittdat$ = "01011"
CASE "N"
Flagcase$ = "11111"
ccittdat$ = "01100"
CASE "F"
Flagcase$ = "11111"
ccittdat$ = "01101"
CASE "C"
Flagcase$ = "11111"
ccittdat$ = "01110"
CASE "K"
Flagcase$ = "11111"
ccittdat$ = "01111"
CASE "T"
Flagcase$ = "11111"
ccittdat$ = "10000"
CASE "Z"
Flagcase$ = "11111"
ccittdat$ = "10001"
CASE "L"
Flagcase$ = "11111"
ccittdat$ = "10010"
CASE "W"
Flagcase$ = "11111"
ccittdat$ = "10011"
CASE "H"
Flagcase$ = "11111"
ccittdat$ = "10100"
CASE "Y"
Flagcase$ = "11111"
ccittdat$ = "10101"
CASE "P"
Flagcase$ = "11111"
ccittdat$ = "10110"
CASE "Q"
Flagcase$ = "11111"
ccittdat$ = "10111"
CASE "O"
Flagcase$ = "11111"
ccittdat$ = "11000"
CASE "B"
Flagcase$ = "11111"
ccittdat$ = "11001"
CASE "G"
Flagcase$ = "11111"
ccittdat$ = "11010"
CASE Shift$
Flagcase$ = "11111"
ccittdat$ = "11011"
CASE "M"
Flagcase$ = "11111"
ccittdat$ = "11100"
CASE "X"
Flagcase$ = "11111"
ccittdat$ = "11101"
CASE "V"
Flagcase$ = "11111"
ccittdat$ = "11110"
CASE Unshift$
Flagcase$ = "11111"
ccittdat$ = "11111"
CASE Nil$
Flagcase$ = "11011"
ccittdat$ = "00000"
CASE "3"
Flagcase$ = "11011"
ccittdat$ = "00001"
CASE Linefeed$
Flagcase$ = "11011"
ccittdat$ = "00010"
CASE "-"
Flagcase$ = "11011"
ccittdat$ = "00011"
CASE Blank$
Flagcase$ = Oldcase$
ccittdat$ = "00100"
CASE Quote$, "'"
Flagcase$ = "11011"
ccittdat$ = "00101"
CASE "8"
Flagcase$ = "11011"
ccittdat$ = "00110"
CASE "7"
Flagcase$ = "11011"
ccittdat$ = "00111"
CASE Nextline$
Flagcase$ = "11011"
ccittdat$ = "01000"
CASE WRU$
Flagcase$ = "11011"
ccittdat$ = "01001"
CASE "4"
Flagcase$ = "11011"
ccittdat$ = "01010"
CASE Bell$
Flagcase$ = "11011"
ccittdat$ = "01011"
CASE ","
Flagcase$ = "11011"
ccittdat$ = "01100"
CASE "Reserved1"
Flagcase$ = "11011"
ccittdat$ = "01101"
CASE ":"
Flagcase$ = "11011"
ccittdat$ = "01110"
CASE "("
Flagcase$ = "11011"
ccittdat$ = "01111"
CASE "5"
Flagcase$ = "11011"
ccittdat$ = "10000"
CASE "+"
Flagcase$ = "11011"
ccittdat$ = "10001"
CASE ")"
Flagcase$ = "11011"
ccittdat$ = "10010"
CASE "2"
Flagcase$ = "11011"
ccittdat$ = "10011"
CASE "Reserved2"
Flagcase$ = "11011"
ccittdat$ = "10100"
CASE "6"
Flagcase$ = "11011"
ccittdat$ = "10101"
CASE "0"
Flagcase$ = "11011"
ccittdat$ = "10110"
CASE "1"
Flagcase$ = "11011"
ccittdat$ = "10111"
CASE "9"
Flagcase$ = "11011"
ccittdat$ = "11000"
CASE "?"
Flagcase$ = "11011"
ccittdat$ = "11001"
CASE "Reserved3"
Flagcase$ = "11011"
ccittdat$ = "11010"
CASE Shift$
Flagcase$ = "11011"
ccittdat$ = "11011"
CASE "."
Flagcase$ = "11011"
ccittdat$ = "11100"
CASE "/"
Flagcase$ = "11011"
ccittdat$ = "11101"
CASE "="
Flagcase$ = "11011"
ccittdat$ = "11110"
CASE Unshift$
Flagcase$ = "11011"
ccittdat$ = "11111"
CASE ELSE
Flagcase$ = "11011"
ccittdat$ = "||||" + Character$
END SELECT
RETURN
Usefilea:
CLS
PRINT
PRINT " CCITT code translator"
PRINT
INPUT "Enter file to translate: ", Asciifile$
INPUT " destination file: ", Destfile$
PRINT
IF Asciifile$ = "" OR Destfile$ = "" THEN
Done = 1
ELSE
OPEN Asciifile$ FOR INPUT AS #1
OPEN Destfile$ FOR OUTPUT AS #2
WHILE NOT EOF(1)
Character$ = UCASE$(INPUT$(1, #1))
IF Character$ <> Nextline$ THEN
IF Character$ <> Linefeed$ THEN
PRINT Character$;
END IF
ELSE
PRINT
END IF
GOSUB Translate
WEND
CLOSE #1
CLOSE #2
END IF
RETURN
ccitt:
REM Start
GOSUB Init
DO
GOSUB Usefileb
LOOP UNTIL Done = 1
GOSUB Over
RETURN
Over:
CLOSE
RETURN
Convert2lower:
SELECT CASE Character$
CASE "00000"
ccittdat$ = Nil$
CASE "00001"
ccittdat$ = "E"
CASE "00010"
ccittdat$ = Linefeed$
CASE "00011"
ccittdat$ = "A"
CASE "00100"
ccittdat$ = Blank$
CASE "00101"
ccittdat$ = "S"
CASE "00110"
ccittdat$ = "I"
CASE "00111"
ccittdat$ = "U"
CASE "01000"
ccittdat$ = Nextline$
CASE "01001"
ccittdat$ = "D"
CASE "01010"
ccittdat$ = "R"
CASE "01011"
ccittdat$ = "J"
CASE "01100"
ccittdat$ = "N"
CASE "01101"
ccittdat$ = "F"
CASE "01110"
ccittdat$ = "C"
CASE "01111"
ccittdat$ = "K"
CASE "10000"
ccittdat$ = "T"
CASE "10001"
ccittdat$ = "Z"
CASE "10010"
ccittdat$ = "L"
CASE "10011"
ccittdat$ = "W"
CASE "10100"
ccittdat$ = "H"
CASE "10101"
ccittdat$ = "Y"
CASE "10110"
ccittdat$ = "P"
CASE "10111"
ccittdat$ = "Q"
CASE "11000"
ccittdat$ = "O"
CASE "11001"
ccittdat$ = "B"
CASE "11010"
ccittdat$ = "G"
CASE "11011"
Flagcase$ = "1": 'Shift$
ccittdat$ = ""
CASE "11100"
ccittdat$ = "M"
CASE "11101"
ccittdat$ = "X"
CASE "11110"
ccittdat$ = "V"
CASE "11111"
Flagcase$ = "0": 'Unshift$
ccittdat$ = ""
CASE ELSE
ccittdat$ = "xxxxx"
END SELECT
RETURN
Convert2upper:
SELECT CASE Character$
CASE "00000"
ccittdat$ = Nil$
CASE "00001"
ccittdat$ = "3"
CASE "00010"
ccittdat$ = Linefeed$
CASE "00011"
ccittdat$ = "-"
CASE "00100"
ccittdat$ = Blank$
CASE "00101"
ccittdat$ = Quote$
CASE "00110"
ccittdat$ = "8"
CASE "00111"
ccittdat$ = "7"
CASE "01000"
ccittdat$ = Nextline$
CASE "01001"
ccittdat$ = WRU$
CASE "01010"
ccittdat$ = "4"
CASE "01011"
ccittdat$ = Bell$
CASE "01100"
ccittdat$ = ","
CASE "01101"
ccittdat$ = "Reserved1"
CASE "01110"
ccittdat$ = ":"
CASE "01111"
ccittdat$ = "("
CASE "10000"
ccittdat$ = "5"
CASE "10001"
ccittdat$ = "+"
CASE "10010"
ccittdat$ = ")"
CASE "10011"
ccittdat$ = "2"
CASE "10100"
ccittdat$ = "Reserved2"
CASE "10101"
ccittdat$ = "6"
CASE "10110"
ccittdat$ = "0"
CASE "10111"
ccittdat$ = "1"
CASE "11000"
ccittdat$ = "9"
CASE "11001"
ccittdat$ = "?"
CASE "11010"
ccittdat$ = "Reserved3"
CASE "11011"
Flagcase$ = "1": 'Shift$
ccittdat$ = ""
CASE "11100"
ccittdat$ = "."
CASE "11101"
ccittdat$ = "/"
CASE "11110"
ccittdat$ = "="
CASE "11111"
Flagcase$ = "0": 'Unshift$
ccittdat$ = ""
CASE ELSE
ccittdat$ = "XXXXX"
END SELECT
RETURN
Usefileb:
CLS
PRINT
PRINT " CCITT code translator"
PRINT
INPUT "Enter file to translate: ", Asciifile$
INPUT " destination file: ", Destfile$
PRINT
IF Asciifile$ = "" THEN
Done = 1
ELSE
OPEN Asciifile$ FOR INPUT AS #1
OPEN Destfile$ FOR OUTPUT AS #2
WHILE NOT EOF(1)
Character$ = UCASE$(INPUT$(5, #1))
IF LEFT$(Character$, 1) = "|" THEN
PRINT #2, RIGHT$(Character$, 1);
ELSE
IF Flagcase$ = "1" THEN
GOSUB Convert2upper
ELSEIF Flagcase$ = "0" THEN
GOSUB Convert2lower
END IF
PRINT #2, ccittdat$;
END IF
WEND
CLOSE #1
CLOSE #2
END IF
RETURN
END SUB
SUB hexit
CLS
troo = -1
WHILE troo
PRINT
PRINT "Hexit converter!"
PRINT
PRINT " 1 - Convert ascii to hex"
PRINT " 2 - Convert hex to ascii"
PRINT " q - quit"
PRINT
A$ = ""
WHILE A$ = ""
A$ = INKEY$
WEND
SELECT CASE UCASE$(A$)
CASE "1"
GOSUB Asc2hex
CASE "2"
GOSUB Hex2asc
CASE "Q"
END
END SELECT
WEND
EXIT SUB
Asc2hex:
CLS
PRINT
PRINT " Ascii to hex maker!"
PRINT
INPUT "Enter source file: ", S$
INPUT " output file: ", O$
PRINT
OPEN S$ FOR INPUT AS #1
OPEN O$ FOR OUTPUT AS #2
DO WHILE NOT EOF(1)
A$ = INPUT$(1, #1)
IF LEN(HEX$(ASC(A$))) < 2 THEN
B$ = "0" + HEX$(ASC(A$))
ELSE
B$ = HEX$(ASC(A$))
END IF
PRINT #2, B$;
PRINT B$;
LOOP
CLOSE 1
CLOSE 2
RETURN
Hex2asc:
CLS
PRINT
PRINT " Hex to ascii maker!"
PRINT
INPUT "Enter source file: ", S$
INPUT " output file: ", O$
PRINT
OPEN S$ FOR INPUT AS #1
OPEN O$ FOR OUTPUT AS #2
DO WHILE NOT EOF(1)
A$ = INPUT$(2, #1)
'IF UCASE$(A$) <> "0A" THEN
PRINT #2, CHR$(VAL("&H" + A$));
'END IF
LOOP
CLOSE 1
CLOSE 2
RETURN
END SUB
SUB morse
CLS
troo = -1
WHILE troo
PRINT
PRINT "Morse code converter!"
PRINT
PRINT " 1 - Sound morse code to screen"
PRINT " 2 - Write morse code to file with 01's"
PRINT " 3 - Write morse code to file with -.'s"
PRINT " 4 - Write hardcopy of code."
PRINT " q - quit"
PRINT
A$ = ""
WHILE A$ = ""
A$ = INKEY$
WEND
SELECT CASE UCASE$(A$)
CASE "1"
GOSUB Soundmorse
CASE "2"
GOSUB Morse01
CASE "3"
GOSUB Morse02
CASE "4"
GOSUB Hardcopy
CASE "Q"
END
END SELECT
WEND
EXIT SUB
Soundmorse:
GOSUB Init1
DO
GOSUB Usefilea1
LOOP UNTIL Done = 1
RETURN
Init1:
' begin morse code
CLOSE
' 5 = BEGINNER
' 14 = NOVICE
' 25 = COMMERCIAL OPERATOR
' 40 = SPEED DEMON
True = NOT 0
Wpm = 99
Nextline$ = CHR$(13)
Linefeed$ = CHR$(10)
Quote$ = CHR$(34)
Escape$ = CHR$(27)
Backspace$ = CHR$(8)
True = NOT 0
Done = 0
RETURN
Usefilea1:
VIEW PRINT
CLS
PRINT
PRINT
PRINT TAB(15); "MORSE CODE INTERPRETER"
PRINT
WHILE Wpm < 5 OR Wpm > 40
LOCATE 7, 1
INPUT "Enter speed to use (5 - 40): ", Wpm
WEND
Duration = 21 / Wpm
LOCATE 8, 1
INPUT "Enter file to translate: ", Asciifile$
PRINT
VIEW PRINT 10 TO 25
IF Asciifile$ = "" THEN
Done = 1
RETURN
END IF
OPEN Asciifile$ FOR INPUT AS #1
WHILE NOT EOF(1)
LINE INPUT #1, Linestring$
FOR z = 1 TO LEN(Linestring$)
Character$ = MID$(Linestring$, z, 1)
PRINT Character$;
GOSUB Translatea
NEXT z
PRINT
WEND
CLOSE #1
RETURN
Translatea:
GOSUB Selectit
'IF morsedat$ <> " " THEN
' PRINT morsedat$; " ";
'END IF
GOSUB Sendit:
RETURN
Selectit:
SELECT CASE UCASE$(Character$)
CASE "A"
morsedat$ = ".-"
CASE "B"
morsedat$ = "-..."
CASE "C"
morsedat$ = "-.-."
CASE "D"
morsedat$ = "-.."
CASE "E"
morsedat$ = "."
CASE "F"
morsedat$ = "..-."
CASE "G"
morsedat$ = "--."
CASE "H"
morsedat$ = "...."
CASE "I"
morsedat$ = ".."
CASE "J"
morsedat$ = ".---"
CASE "K"
morsedat$ = "-.-"
CASE "L"
morsedat$ = ".-.."
CASE "M"
morsedat$ = "--"
CASE "N"
morsedat$ = "-."
CASE "O"
morsedat$ = "---"
CASE "P"
morsedat$ = ".--."
CASE "Q"
morsedat$ = "--.-"
CASE "R"
morsedat$ = ".-."
CASE "S"
morsedat$ = "..."
CASE "T"
morsedat$ = "-"
CASE "U"
morsedat$ = "..-"
CASE "V"
morsedat$ = "...-"
CASE "W"
morsedat$ = ".--"
CASE "X"
morsedat$ = "-..-"
CASE "Y"
morsedat$ = "-.--"
CASE "Z"
morsedat$ = "--.."
CASE "1"
morsedat$ = ".----"
CASE "2"
morsedat$ = "..---"
CASE "3"
morsedat$ = "...--"
CASE "4"
morsedat$ = "....-"
CASE "5"
morsedat$ = "....."
CASE "6"
morsedat$ = "-...."
CASE "7"
morsedat$ = "--..."
CASE "8"
morsedat$ = "---.."
CASE "9"
morsedat$ = "----."
CASE "0"
morsedat$ = "-----"
CASE "."
morsedat$ = ".-.-.-"
CASE "?"
morsedat$ = "..--.."
CASE ","
morsedat$ = "--..--"
CASE "-"
morsedat$ = "-...-"
CASE "/"
morsedat$ = "-..-."
CASE " "
morsedat$ = " "
CASE Backspace$, CHR$(29)
morsedat$ = "...-.-"
CASE Escape$
morsedat$ = ".-.-."
CASE Quote$, CHR$(39)
morsedat$ = ".-..-."
CASE ":"
morsedat$ = "---..."
CASE ";"
morsedat$ = "-.-.-."
CASE "(", ")"
morsedat$ = "-.--.-"
CASE "+", "&"
morsedat$ = ".-..."
CASE ELSE
morsedat$ = " "
END SELECT
RETURN
Sendit:
FOR y = 1 TO LEN(morsedat$)
SELECT CASE MID$(morsedat$, y, 1)
CASE "."
SOUND 800, Duration
CASE "-"
SOUND 800, Duration * 3
CASE ELSE
SOUND 32767, Duration * 1
END SELECT
SOUND 32767, Duration
NEXT y
SOUND 32767, Duration * 1.5
RETURN
Morse01:
GOSUB Init1
DO
GOSUB Usefileb2
LOOP UNTIL Done = 1
RETURN
Usefileb2:
CLS
PRINT
PRINT " Morse code translator"
PRINT
INPUT "Enter file to translate: ", Asciifile$
INPUT " destination file: ", Destfile$
PRINT
IF Asciifile$ = "" OR Destfile$ = "" THEN
Done = 1
RETURN
END IF
OPEN Asciifile$ FOR INPUT AS #1
OPEN Destfile$ FOR OUTPUT AS #2
WHILE NOT EOF(1)
Character$ = INPUT$(1, #1)
IF Character$ <> Nextline$ THEN
IF Character$ <> Linefeed$ THEN
PRINT Character$;
END IF
ELSE
PRINT
END IF
GOSUB Translateb
WEND
CLOSE #1
CLOSE #2
RETURN
Usefilec:
CLS
PRINT
PRINT " Morse code translator"
PRINT
INPUT "Enter file to translate: ", Asciifile$
INPUT " destination file: ", Destfile$
PRINT
IF Asciifile$ = "" OR Destfile$ = "" THEN
Done = 1
RETURN
END IF
OPEN Asciifile$ FOR INPUT AS #1
OPEN Destfile$ FOR OUTPUT AS #2
WHILE NOT EOF(1)
Character$ = INPUT$(1, #1)
IF Character$ <> Nextline$ THEN
IF Character$ <> Linefeed$ THEN
PRINT Character$;
END IF
ELSE
PRINT
END IF
GOSUB Translatec
WEND
CLOSE #1
CLOSE #2
RETURN
Translateb:
GOSUB Selectit:
GOSUB Printit:
RETURN
Morse02:
' begin morse code
GOSUB Init1
DO
GOSUB Usefilec
LOOP UNTIL Done = 1
END
Translatec:
SELECT CASE UCASE$(Character$)
CASE "A"
morsedat$ = "01"
CASE "B"
morsedat$ = "1000"
CASE "C"
morsedat$ = "1010"
CASE "D"
morsedat$ = "100"
CASE "E"
morsedat$ = "0"
CASE "F"
morsedat$ = "0010"
CASE "G"
morsedat$ = "110"
CASE "H"
morsedat$ = "0000"
CASE "I"
morsedat$ = "00"
CASE "J"
morsedat$ = "0111"
CASE "K"
morsedat$ = "101"
CASE "L"
morsedat$ = "0100"
CASE "M"
morsedat$ = "11"
CASE "N"
morsedat$ = "10"
CASE "O"
morsedat$ = "111"
CASE "P"
morsedat$ = "0110"
CASE "Q"
morsedat$ = "1101"
CASE "R"
morsedat$ = "010"
CASE "S"
morsedat$ = "000"
CASE "T"
morsedat$ = "1"
CASE "U"
morsedat$ = "001"
CASE "V"
morsedat$ = "0001"
CASE "W"
morsedat$ = "011"
CASE "X"
morsedat$ = "1001"
CASE "Y"
morsedat$ = "1011"
CASE "Z"
morsedat$ = "1100"
CASE "1"
morsedat$ = "01111"
CASE "2"
morsedat$ = "00111"
CASE "3"
morsedat$ = "00011"
CASE "4"
morsedat$ = "00001"
CASE "5"
morsedat$ = "00000"
CASE "6"
morsedat$ = "10000"
CASE "7"
morsedat$ = "11000"
CASE "8"
morsedat$ = "11100"
CASE "9"
morsedat$ = "11110"
CASE "0"
morsedat$ = "11111"
CASE "."
morsedat$ = "010101"
CASE "?"
morsedat$ = "001100"
CASE ","
morsedat$ = "110011"
CASE "1"
morsedat$ = "10001"
CASE "/"
morsedat$ = "10010"
CASE " "
morsedat$ = " "
CASE Backspace$, CHR$(29)
morsedat$ = "000101"
CASE Escape$
morsedat$ = "01010"
CASE Quote$, CHR$(39)
morsedat$ = "010010"
CASE ":"
morsedat$ = "111000"
CASE ";"
morsedat$ = "101010"
CASE "(", ")"
morsedat$ = "101101"
CASE "+", "&"
morsedat$ = "01000"
CASE ELSE
morsedat$ = " "
END SELECT
GOSUB Printit
RETURN
Hardcopy:
OPEN "sample.cod" FOR INPUT AS #1
WHILE NOT EOF(1)
A$ = INPUT$(1, #1)
IF A$ <> CHR$(255) AND A$ <> CHR$(10) THEN
LPRINT A$;
ELSE
LPRINT " ";
END IF
WEND
LPRINT CHR$(12)
CLOSE #1
RETURN
Printit:
IF Character$ = Nextline$ THEN
PRINT #2, ""
ELSE
PRINT #2, morsedat$; CHR$(255);
END IF
RETURN
END SUB
SUB phone
n$ = "1234567890"
l$ = "ABCDEFGHIJKLMNOPRSTUVWXY"
nl$ = n$ + l$
WHILE LEN(pn$) <> 7
CLS
INPUT "Enter phone number: (XXXXXXX) ", pn$
WEND
FOR pn = 1 TO LEN(pn$)
C$ = UCASE$(MID$(pn$, pn, 1))
SELECT CASE C$
CASE "0" TO "9"
LOCATE 20, pn
PRINT C$;
CASE "A", "B", "C"
LOCATE 20, pn
PRINT "2";
CASE "D", "E", "F"
LOCATE 20, pn
PRINT "3";
CASE "G", "H", "I"
LOCATE 20, pn
PRINT "4";
CASE "J", "K", "L"
LOCATE 20, pn
PRINT "5";
CASE "M", "N", "O"
LOCATE 20, pn
PRINT "6";
CASE "P", "R", "S"
LOCATE 20, pn
PRINT "7";
CASE "T", "U", "V"
LOCATE 20, pn
PRINT "8";
CASE "W", "X", "Y"
LOCATE 20, pn
PRINT "9";
CASE ELSE
LOCATE 20, pn
PRINT "?";
END SELECT
NEXT pn
z$ = ""
WHILE z$ = ""
z$ = INPUT$(1)
WEND
END SUB
Maybe we could attach led to a local computer and then they are lit could mean one of ervera things depending on how ht e system is programmed.. You could start off with just two leds that you give you four possibilities. Back then there were no computer screens to get information.
You could even add even more light for more possibilities.The traditional way was to add led]s to the parallel port. Eight leds would give you 2^8 or 256 possibilities. Possibly more than you would ever need. First setup we did like this was for the Atari ST computer. The picture is using a 32 bit computer.
One could go a step further and instead of lights being on or off, a message could be sent in one form or another. A traditional choice might be to use something like the Morse code. You could use just use one led to get out the message. the message would be consecutive flashing of long and short lights. Since there is more than one version of the code yo would have to decide ahead of time which version to use.
Though I might prefer the traditional method as it would lend it self to using. infrared signal between two systems. Then two systems could use the infrared as a backup if all other communication lines were not active.This is really true if your monitor fails.
- .... .. ... / .. ... / .- / -- . ... ... .- --. . / .. -. / -- --- .-. ... . / -.-. --- -.. . .-.-.-
------------------------------------------------------------------
DECLARE SUB hexit ()
DECLARE SUB morse ()
DECLARE SUB phone ()
DECLARE SUB ccitt ()
' * codeit.bas
' *******************************************************
C$ = "999"
First.flag = 0
DO UNTIL VAL(C$) = 0
IF First.flag > 0 THEN
PRINT "press a key to continue: ";
zz$ = INPUT$(1)
END IF
First.flag = 1
CLS
PRINT " LIzzy code"
PRINT " Conversion tool"
PRINT " (1) Morse code."
PRINT " (2) CCITT."
PRINT " (3) Hex."
PRINT " (4) Phone."
PRINT " (0) Quit for the day."
PRINT "Please enter choice: ";
DO WHILE VAL(C$) < 0 OR VAL(C$) > 4
C$ = ""
DO WHILE C$ = ""
C$ = INKEY$
LOOP
LOOP
PRINT C$
C = VAL(C$)
SELECT CASE C
CASE 1
CALL morse
CASE 2
CALL ccitt
CASE 3
CALL hexit
CASE 4
CALL phone
END SELECT
LOOP
END
SUB ccitt
CLS
troo = -1
WHILE troo
CLS
PRINT "CCITT converter!"
PRINT " 1 - Convert ascii to ccitt"
PRINT " 2 - Convert ccitt to ascii"
PRINT " q - quit"
A$ = ""
WHILE A$ = ""
A$ = INKEY$
WEND
SELECT CASE UCASE$(A$)
CASE "1"
GOSUB Ascii
CASE "2"
GOSUB ccitt
CASE "Q"
END
END SELECT
WEND
EXIT SUB
Ascii:
REM Start
GOSUB Init
DO
GOSUB Usefilea
LOOP UNTIL Done = 1
GOSUB Over
RETURN
Init:
CLOSE
Oldcase$ = ""
Nextline$ = CHR$(13)
Nil$ = CHR$(0)
Flag = 0
WRU$ = CHR$(5)
Linefeed$ = CHR$(10)
Bell$ = CHR$(7)
Quote$ = CHR$(34)
Escape$ = CHR$(27)
Backspace$ = CHR$(8)
Blank$ = CHR$(32)
True = NOT 0
Done = 0
Flagcase$ = "0"
RETURN
Translate:
GOSUB Checkcase
IF Flagcase$ <> Oldcase$ THEN
Oldcase$ = Flagcase$
PRINT #2, Flagcase$; ccittdat$;
ELSE
IF Flagcase$ <> ccittdat$ THEN
PRINT #2, ccittdat$;
END IF
END IF
RETURN
Checkcase:
SELECT CASE Character$
CASE Nil$
Flagcase$ = "11111"
ccittdat$ = "00000"
CASE "E"
Flagcase$ = "11111"
ccittdat$ = "00001"
CASE Linefeed$
Flagcase$ = "11111"
ccittdat$ = "00010"
CASE "A"
Flagcase$ = "11111"
ccittdat$ = "00011"
CASE Blank$
Flagcase$ = Oldcase$
ccittdat$ = "00100"
CASE "S"
Flagcase$ = "11111"
ccittdat$ = "00101"
CASE "I"
Flagcase$ = "11111"
ccittdat$ = "00110"
CASE "U"
Flagcase$ = "11111"
ccittdat$ = "00111"
CASE Nextline$
Flagcase$ = "11111"
ccittdat$ = "01000"
CASE "D"
Flagcase$ = "11111"
ccittdat$ = "01001"
CASE "R"
Flagcase$ = "11111"
ccittdat$ = "01010"
CASE "J"
Flagcase$ = "11111"
ccittdat$ = "01011"
CASE "N"
Flagcase$ = "11111"
ccittdat$ = "01100"
CASE "F"
Flagcase$ = "11111"
ccittdat$ = "01101"
CASE "C"
Flagcase$ = "11111"
ccittdat$ = "01110"
CASE "K"
Flagcase$ = "11111"
ccittdat$ = "01111"
CASE "T"
Flagcase$ = "11111"
ccittdat$ = "10000"
CASE "Z"
Flagcase$ = "11111"
ccittdat$ = "10001"
CASE "L"
Flagcase$ = "11111"
ccittdat$ = "10010"
CASE "W"
Flagcase$ = "11111"
ccittdat$ = "10011"
CASE "H"
Flagcase$ = "11111"
ccittdat$ = "10100"
CASE "Y"
Flagcase$ = "11111"
ccittdat$ = "10101"
CASE "P"
Flagcase$ = "11111"
ccittdat$ = "10110"
CASE "Q"
Flagcase$ = "11111"
ccittdat$ = "10111"
CASE "O"
Flagcase$ = "11111"
ccittdat$ = "11000"
CASE "B"
Flagcase$ = "11111"
ccittdat$ = "11001"
CASE "G"
Flagcase$ = "11111"
ccittdat$ = "11010"
CASE Shift$
Flagcase$ = "11111"
ccittdat$ = "11011"
CASE "M"
Flagcase$ = "11111"
ccittdat$ = "11100"
CASE "X"
Flagcase$ = "11111"
ccittdat$ = "11101"
CASE "V"
Flagcase$ = "11111"
ccittdat$ = "11110"
CASE Unshift$
Flagcase$ = "11111"
ccittdat$ = "11111"
CASE Nil$
Flagcase$ = "11011"
ccittdat$ = "00000"
CASE "3"
Flagcase$ = "11011"
ccittdat$ = "00001"
CASE Linefeed$
Flagcase$ = "11011"
ccittdat$ = "00010"
CASE "-"
Flagcase$ = "11011"
ccittdat$ = "00011"
CASE Blank$
Flagcase$ = Oldcase$
ccittdat$ = "00100"
CASE Quote$, "'"
Flagcase$ = "11011"
ccittdat$ = "00101"
CASE "8"
Flagcase$ = "11011"
ccittdat$ = "00110"
CASE "7"
Flagcase$ = "11011"
ccittdat$ = "00111"
CASE Nextline$
Flagcase$ = "11011"
ccittdat$ = "01000"
CASE WRU$
Flagcase$ = "11011"
ccittdat$ = "01001"
CASE "4"
Flagcase$ = "11011"
ccittdat$ = "01010"
CASE Bell$
Flagcase$ = "11011"
ccittdat$ = "01011"
CASE ","
Flagcase$ = "11011"
ccittdat$ = "01100"
CASE "Reserved1"
Flagcase$ = "11011"
ccittdat$ = "01101"
CASE ":"
Flagcase$ = "11011"
ccittdat$ = "01110"
CASE "("
Flagcase$ = "11011"
ccittdat$ = "01111"
CASE "5"
Flagcase$ = "11011"
ccittdat$ = "10000"
CASE "+"
Flagcase$ = "11011"
ccittdat$ = "10001"
CASE ")"
Flagcase$ = "11011"
ccittdat$ = "10010"
CASE "2"
Flagcase$ = "11011"
ccittdat$ = "10011"
CASE "Reserved2"
Flagcase$ = "11011"
ccittdat$ = "10100"
CASE "6"
Flagcase$ = "11011"
ccittdat$ = "10101"
CASE "0"
Flagcase$ = "11011"
ccittdat$ = "10110"
CASE "1"
Flagcase$ = "11011"
ccittdat$ = "10111"
CASE "9"
Flagcase$ = "11011"
ccittdat$ = "11000"
CASE "?"
Flagcase$ = "11011"
ccittdat$ = "11001"
CASE "Reserved3"
Flagcase$ = "11011"
ccittdat$ = "11010"
CASE Shift$
Flagcase$ = "11011"
ccittdat$ = "11011"
CASE "."
Flagcase$ = "11011"
ccittdat$ = "11100"
CASE "/"
Flagcase$ = "11011"
ccittdat$ = "11101"
CASE "="
Flagcase$ = "11011"
ccittdat$ = "11110"
CASE Unshift$
Flagcase$ = "11011"
ccittdat$ = "11111"
CASE ELSE
Flagcase$ = "11011"
ccittdat$ = "||||" + Character$
END SELECT
RETURN
Usefilea:
CLS
PRINT " CCITT code translator"
INPUT "Enter file to translate: ", Asciifile$
INPUT " destination file: ", Destfile$
IF Asciifile$ = "" OR Destfile$ = "" THEN
Done = 1
ELSE
OPEN Asciifile$ FOR INPUT AS #1
OPEN Destfile$ FOR OUTPUT AS #2
WHILE NOT EOF(1)
Character$ = UCASE$(INPUT$(1, #1))
IF Character$ <> Nextline$ THEN
IF Character$ <> Linefeed$ THEN
PRINT Character$;
END IF
ELSE
END IF
GOSUB Translate
WEND
CLOSE #1
CLOSE #2
END IF
RETURN
ccitt:
REM Start
GOSUB Init
DO
GOSUB Usefileb
LOOP UNTIL Done = 1
GOSUB Over
RETURN
Over:
CLOSE
RETURN
Convert2lower:
SELECT CASE Character$
CASE "00000"
ccittdat$ = Nil$
CASE "00001"
ccittdat$ = "E"
CASE "00010"
ccittdat$ = Linefeed$
CASE "00011"
ccittdat$ = "A"
CASE "00100"
ccittdat$ = Blank$
CASE "00101"
ccittdat$ = "S"
CASE "00110"
ccittdat$ = "I"
CASE "00111"
ccittdat$ = "U"
CASE "01000"
ccittdat$ = Nextline$
CASE "01001"
ccittdat$ = "D"
CASE "01010"
ccittdat$ = "R"
CASE "01011"
ccittdat$ = "J"
CASE "01100"
ccittdat$ = "N"
CASE "01101"
ccittdat$ = "F"
CASE "01110"
ccittdat$ = "C"
CASE "01111"
ccittdat$ = "K"
CASE "10000"
ccittdat$ = "T"
CASE "10001"
ccittdat$ = "Z"
CASE "10010"
ccittdat$ = "L"
CASE "10011"
ccittdat$ = "W"
CASE "10100"
ccittdat$ = "H"
CASE "10101"
ccittdat$ = "Y"
CASE "10110"
ccittdat$ = "P"
CASE "10111"
ccittdat$ = "Q"
CASE "11000"
ccittdat$ = "O"
CASE "11001"
ccittdat$ = "B"
CASE "11010"
ccittdat$ = "G"
CASE "11011"
Flagcase$ = "1": 'Shift$
ccittdat$ = ""
CASE "11100"
ccittdat$ = "M"
CASE "11101"
ccittdat$ = "X"
CASE "11110"
ccittdat$ = "V"
CASE "11111"
Flagcase$ = "0": 'Unshift$
ccittdat$ = ""
CASE ELSE
ccittdat$ = "xxxxx"
END SELECT
RETURN
Convert2upper:
SELECT CASE Character$
CASE "00000"
ccittdat$ = Nil$
CASE "00001"
ccittdat$ = "3"
CASE "00010"
ccittdat$ = Linefeed$
CASE "00011"
ccittdat$ = "-"
CASE "00100"
ccittdat$ = Blank$
CASE "00101"
ccittdat$ = Quote$
CASE "00110"
ccittdat$ = "8"
CASE "00111"
ccittdat$ = "7"
CASE "01000"
ccittdat$ = Nextline$
CASE "01001"
ccittdat$ = WRU$
CASE "01010"
ccittdat$ = "4"
CASE "01011"
ccittdat$ = Bell$
CASE "01100"
ccittdat$ = ","
CASE "01101"
ccittdat$ = "Reserved1"
CASE "01110"
ccittdat$ = ":"
CASE "01111"
ccittdat$ = "("
CASE "10000"
ccittdat$ = "5"
CASE "10001"
ccittdat$ = "+"
CASE "10010"
ccittdat$ = ")"
CASE "10011"
ccittdat$ = "2"
CASE "10100"
ccittdat$ = "Reserved2"
CASE "10101"
ccittdat$ = "6"
CASE "10110"
ccittdat$ = "0"
CASE "10111"
ccittdat$ = "1"
CASE "11000"
ccittdat$ = "9"
CASE "11001"
ccittdat$ = "?"
CASE "11010"
ccittdat$ = "Reserved3"
CASE "11011"
Flagcase$ = "1": 'Shift$
ccittdat$ = ""
CASE "11100"
ccittdat$ = "."
CASE "11101"
ccittdat$ = "/"
CASE "11110"
ccittdat$ = "="
CASE "11111"
Flagcase$ = "0": 'Unshift$
ccittdat$ = ""
CASE ELSE
ccittdat$ = "XXXXX"
END SELECT
RETURN
Usefileb:
CLS
PRINT " CCITT code translator"
INPUT "Enter file to translate: ", Asciifile$
INPUT " destination file: ", Destfile$
IF Asciifile$ = "" THEN
Done = 1
ELSE
OPEN Asciifile$ FOR INPUT AS #1
OPEN Destfile$ FOR OUTPUT AS #2
WHILE NOT EOF(1)
Character$ = UCASE$(INPUT$(5, #1))
IF LEFT$(Character$, 1) = "|" THEN
PRINT #2, RIGHT$(Character$, 1);
ELSE
IF Flagcase$ = "1" THEN
GOSUB Convert2upper
ELSEIF Flagcase$ = "0" THEN
GOSUB Convert2lower
END IF
PRINT #2, ccittdat$;
END IF
WEND
CLOSE #1
CLOSE #2
END IF
RETURN
END SUB
SUB hexit
CLS
troo = -1
WHILE troo
PRINT "Hexit converter!"
PRINT " 1 - Convert ascii to hex"
PRINT " 2 - Convert hex to ascii"
PRINT " q - quit"
A$ = ""
WHILE A$ = ""
A$ = INKEY$
WEND
SELECT CASE UCASE$(A$)
CASE "1"
GOSUB Asc2hex
CASE "2"
GOSUB Hex2asc
CASE "Q"
END
END SELECT
WEND
EXIT SUB
Asc2hex:
CLS
PRINT " Ascii to hex maker!"
INPUT "Enter source file: ", S$
INPUT " output file: ", O$
OPEN S$ FOR INPUT AS #1
OPEN O$ FOR OUTPUT AS #2
DO WHILE NOT EOF(1)
A$ = INPUT$(1, #1)
IF LEN(HEX$(ASC(A$))) < 2 THEN
B$ = "0" + HEX$(ASC(A$))
ELSE
B$ = HEX$(ASC(A$))
END IF
PRINT #2, B$;
PRINT B$;
LOOP
CLOSE 1
CLOSE 2
RETURN
Hex2asc:
CLS
PRINT " Hex to ascii maker!"
INPUT "Enter source file: ", S$
INPUT " output file: ", O$
OPEN S$ FOR INPUT AS #1
OPEN O$ FOR OUTPUT AS #2
DO WHILE NOT EOF(1)
A$ = INPUT$(2, #1)
'IF UCASE$(A$) <> "0A" THEN
PRINT #2, CHR$(VAL("&H" + A$));
'END IF
LOOP
CLOSE 1
CLOSE 2
RETURN
END SUB
SUB morse
CLS
troo = -1
WHILE troo
PRINT "Morse code converter!"
PRINT " 1 - Sound morse code to screen"
PRINT " 2 - Write morse code to file with 01's"
PRINT " 3 - Write morse code to file with -.'s"
PRINT " 4 - Write hardcopy of code."
PRINT " q - quit"
A$ = ""
WHILE A$ = ""
A$ = INKEY$
WEND
SELECT CASE UCASE$(A$)
CASE "1"
GOSUB Soundmorse
CASE "2"
GOSUB Morse01
CASE "3"
GOSUB Morse02
CASE "4"
GOSUB Hardcopy
CASE "Q"
END
END SELECT
WEND
EXIT SUB
Soundmorse:
GOSUB Init1
DO
GOSUB Usefilea1
LOOP UNTIL Done = 1
RETURN
Init1:
' begin morse code
CLOSE
' 5 = BEGINNER
' 14 = NOVICE
' 25 = COMMERCIAL OPERATOR
' 40 = SPEED DEMON
True = NOT 0
Wpm = 99
Nextline$ = CHR$(13)
Linefeed$ = CHR$(10)
Quote$ = CHR$(34)
Escape$ = CHR$(27)
Backspace$ = CHR$(8)
True = NOT 0
Done = 0
RETURN
Usefilea1:
VIEW PRINT
CLS
PRINT TAB(15); "MORSE CODE INTERPRETER"
WHILE Wpm < 5 OR Wpm > 40
LOCATE 7, 1
INPUT "Enter speed to use (5 - 40): ", Wpm
WEND
Duration = 21 / Wpm
LOCATE 8, 1
INPUT "Enter file to translate: ", Asciifile$
VIEW PRINT 10 TO 25
IF Asciifile$ = "" THEN
Done = 1
RETURN
END IF
OPEN Asciifile$ FOR INPUT AS #1
WHILE NOT EOF(1)
LINE INPUT #1, Linestring$
FOR z = 1 TO LEN(Linestring$)
Character$ = MID$(Linestring$, z, 1)
PRINT Character$;
GOSUB Translatea
NEXT z
WEND
CLOSE #1
RETURN
Translatea:
GOSUB Selectit
'IF morsedat$ <> " " THEN
' PRINT morsedat$; " ";
'END IF
GOSUB Sendit:
RETURN
Selectit:
SELECT CASE UCASE$(Character$)
CASE "A"
morsedat$ = ".-"
CASE "B"
morsedat$ = "-..."
CASE "C"
morsedat$ = "-.-."
CASE "D"
morsedat$ = "-.."
CASE "E"
morsedat$ = "."
CASE "F"
morsedat$ = "..-."
CASE "G"
morsedat$ = "--."
CASE "H"
morsedat$ = "...."
CASE "I"
morsedat$ = ".."
CASE "J"
morsedat$ = ".---"
CASE "K"
morsedat$ = "-.-"
CASE "L"
morsedat$ = ".-.."
CASE "M"
morsedat$ = "--"
CASE "N"
morsedat$ = "-."
CASE "O"
morsedat$ = "---"
CASE "P"
morsedat$ = ".--."
CASE "Q"
morsedat$ = "--.-"
CASE "R"
morsedat$ = ".-."
CASE "S"
morsedat$ = "..."
CASE "T"
morsedat$ = "-"
CASE "U"
morsedat$ = "..-"
CASE "V"
morsedat$ = "...-"
CASE "W"
morsedat$ = ".--"
CASE "X"
morsedat$ = "-..-"
CASE "Y"
morsedat$ = "-.--"
CASE "Z"
morsedat$ = "--.."
CASE "1"
morsedat$ = ".----"
CASE "2"
morsedat$ = "..---"
CASE "3"
morsedat$ = "...--"
CASE "4"
morsedat$ = "....-"
CASE "5"
morsedat$ = "....."
CASE "6"
morsedat$ = "-...."
CASE "7"
morsedat$ = "--..."
CASE "8"
morsedat$ = "---.."
CASE "9"
morsedat$ = "----."
CASE "0"
morsedat$ = "-----"
CASE "."
morsedat$ = ".-.-.-"
CASE "?"
morsedat$ = "..--.."
CASE ","
morsedat$ = "--..--"
CASE "-"
morsedat$ = "-...-"
CASE "/"
morsedat$ = "-..-."
CASE " "
morsedat$ = " "
CASE Backspace$, CHR$(29)
morsedat$ = "...-.-"
CASE Escape$
morsedat$ = ".-.-."
CASE Quote$, CHR$(39)
morsedat$ = ".-..-."
CASE ":"
morsedat$ = "---..."
CASE ";"
morsedat$ = "-.-.-."
CASE "(", ")"
morsedat$ = "-.--.-"
CASE "+", "&"
morsedat$ = ".-..."
CASE ELSE
morsedat$ = " "
END SELECT
RETURN
Sendit:
FOR y = 1 TO LEN(morsedat$)
SELECT CASE MID$(morsedat$, y, 1)
CASE "."
SOUND 800, Duration
CASE "-"
SOUND 800, Duration * 3
CASE ELSE
SOUND 32767, Duration * 1
END SELECT
SOUND 32767, Duration
NEXT y
SOUND 32767, Duration * 1.5
RETURN
Morse01:
GOSUB Init1
DO
GOSUB Usefileb2
LOOP UNTIL Done = 1
RETURN
Usefileb2:
CLS
PRINT " Morse code translator"
INPUT "Enter file to translate: ", Asciifile$
INPUT " destination file: ", Destfile$
IF Asciifile$ = "" OR Destfile$ = "" THEN
Done = 1
RETURN
END IF
OPEN Asciifile$ FOR INPUT AS #1
OPEN Destfile$ FOR OUTPUT AS #2
WHILE NOT EOF(1)
Character$ = INPUT$(1, #1)
IF Character$ <> Nextline$ THEN
IF Character$ <> Linefeed$ THEN
PRINT Character$;
END IF
ELSE
END IF
GOSUB Translateb
WEND
CLOSE #1
CLOSE #2
RETURN
Usefilec:
CLS
PRINT " Morse code translator"
INPUT "Enter file to translate: ", Asciifile$
INPUT " destination file: ", Destfile$
IF Asciifile$ = "" OR Destfile$ = "" THEN
Done = 1
RETURN
END IF
OPEN Asciifile$ FOR INPUT AS #1
OPEN Destfile$ FOR OUTPUT AS #2
WHILE NOT EOF(1)
Character$ = INPUT$(1, #1)
IF Character$ <> Nextline$ THEN
IF Character$ <> Linefeed$ THEN
PRINT Character$;
END IF
ELSE
END IF
GOSUB Translatec
WEND
CLOSE #1
CLOSE #2
RETURN
Translateb:
GOSUB Selectit:
GOSUB Printit:
RETURN
Morse02:
' begin morse code
GOSUB Init1
DO
GOSUB Usefilec
LOOP UNTIL Done = 1
END
Translatec:
SELECT CASE UCASE$(Character$)
CASE "A"
morsedat$ = "01"
CASE "B"
morsedat$ = "1000"
CASE "C"
morsedat$ = "1010"
CASE "D"
morsedat$ = "100"
CASE "E"
morsedat$ = "0"
CASE "F"
morsedat$ = "0010"
CASE "G"
morsedat$ = "110"
CASE "H"
morsedat$ = "0000"
CASE "I"
morsedat$ = "00"
CASE "J"
morsedat$ = "0111"
CASE "K"
morsedat$ = "101"
CASE "L"
morsedat$ = "0100"
CASE "M"
morsedat$ = "11"
CASE "N"
morsedat$ = "10"
CASE "O"
morsedat$ = "111"
CASE "P"
morsedat$ = "0110"
CASE "Q"
morsedat$ = "1101"
CASE "R"
morsedat$ = "010"
CASE "S"
morsedat$ = "000"
CASE "T"
morsedat$ = "1"
CASE "U"
morsedat$ = "001"
CASE "V"
morsedat$ = "0001"
CASE "W"
morsedat$ = "011"
CASE "X"
morsedat$ = "1001"
CASE "Y"
morsedat$ = "1011"
CASE "Z"
morsedat$ = "1100"
CASE "1"
morsedat$ = "01111"
CASE "2"
morsedat$ = "00111"
CASE "3"
morsedat$ = "00011"
CASE "4"
morsedat$ = "00001"
CASE "5"
morsedat$ = "00000"
CASE "6"
morsedat$ = "10000"
CASE "7"
morsedat$ = "11000"
CASE "8"
morsedat$ = "11100"
CASE "9"
morsedat$ = "11110"
CASE "0"
morsedat$ = "11111"
CASE "."
morsedat$ = "010101"
CASE "?"
morsedat$ = "001100"
CASE ","
morsedat$ = "110011"
CASE "1"
morsedat$ = "10001"
CASE "/"
morsedat$ = "10010"
CASE " "
morsedat$ = " "
CASE Backspace$, CHR$(29)
morsedat$ = "000101"
CASE Escape$
morsedat$ = "01010"
CASE Quote$, CHR$(39)
morsedat$ = "010010"
CASE ":"
morsedat$ = "111000"
CASE ";"
morsedat$ = "101010"
CASE "(", ")"
morsedat$ = "101101"
CASE "+", "&"
morsedat$ = "01000"
CASE ELSE
morsedat$ = " "
END SELECT
GOSUB Printit
RETURN
Hardcopy:
OPEN "sample.cod" FOR INPUT AS #1
WHILE NOT EOF(1)
A$ = INPUT$(1, #1)
IF A$ <> CHR$(255) AND A$ <> CHR$(10) THEN
LPRINT A$;
ELSE
LPRINT " ";
END IF
WEND
LPRINT CHR$(12)
CLOSE #1
RETURN
Printit:
IF Character$ = Nextline$ THEN
PRINT #2, ""
ELSE
PRINT #2, morsedat$; CHR$(255);
END IF
RETURN
END SUB
SUB phone
n$ = "1234567890"
l$ = "ABCDEFGHIJKLMNOPRSTUVWXY"
nl$ = n$ + l$
WHILE LEN(pn$) <> 7
CLS
INPUT "Enter phone number: (XXXXXXX) ", pn$
WEND
FOR pn = 1 TO LEN(pn$)
C$ = UCASE$(MID$(pn$, pn, 1))
SELECT CASE C$
CASE "0" TO "9"
LOCATE 20, pn
PRINT C$;
CASE "A", "B", "C"
LOCATE 20, pn
PRINT "2";
CASE "D", "E", "F"
LOCATE 20, pn
PRINT "3";
CASE "G", "H", "I"
LOCATE 20, pn
PRINT "4";
CASE "J", "K", "L"
LOCATE 20, pn
PRINT "5";
CASE "M", "N", "O"
LOCATE 20, pn
PRINT "6";
CASE "P", "R", "S"
LOCATE 20, pn
PRINT "7";
CASE "T", "U", "V"
LOCATE 20, pn
PRINT "8";
CASE "W", "X", "Y"
LOCATE 20, pn
PRINT "9";
CASE ELSE
LOCATE 20, pn
PRINT "?";
END SELECT
NEXT pn
z$ = ""
WHILE z$ = ""
z$ = INPUT$(1)
WEND
END SUB
Comments
Post a Comment