Send/Receive (BAUDOT) in GWBASIC (was Ham Stats)

From: Kevin McQuiggin <mcquiggi_at_sfu.ca>
Date: Wed Feb 16 23:11:06 2000

Hi Gang:

Further to this discussion of 5 bit characters on a DL11, this was also
possible on the PCjr. I wrote a BASIC send/receive RTTY program for the
PCjr in 1985. It used an esoteric mode of the particular serial chip on the
PCjr, to support 5 data bits and 1.5 stop bits. The DTR pin of the serial
port was used to toggle the radio from transmit to receive. My modem was
homebrew, built around an XR2211 (IIRC) chip. I still have the modem buried
in the crawlspace somewhere.

I used this program/modem for many years, this was in the days before
all-mode TNCs.

Here's the source code, in GWBASIC. Use at will.

==============================================

10
'****************************************************************************
20 '* PCjr RTTY
   *
30 '* By
   *
40 '* Kevin McQuiggin
   *
50 '* VE7CPT
   *
60 '*
   *
70 '* Version 1.2 April 1985.
80 '* Copyright K. McQuiggin 1985.
   *
90
'****************************************************************************
100 '*
110 '* This package provides full transceive operation for RTTY on the IBM
PCjr.
120 '* Operation takes place through the use of function keys F1 --> F7
130 '* which provide full TX/RX switching, selection of data rate from 45
to 300
140 '* baud and choice of ASCII or BAUDOT modes.
150 '
160
'***************************************************************************
170 '
180 ' Initialization of constants and ASCII/BAUDOT conversion tables:
190 '
200 DIM MODE$(1), TXRX$(1), BAUD$(6), HEXBAUD(6), ATOB$(122),
            BTOA$(31,1), CHANGE$(2)
210 MODE$(0)="Ascii": MODE$(1)="Baudot"
220 TXRX$(0)="TX": TXRX$(1)="RX"
230 BAUD$(0)=" 45": BAUD$(1)=" 50": BAUD$(2)=" 57": BAUD$(3)=" 75"
240 BAUD$(4)=" 78": BAUD$(5)="110": BAUD$(6)="300"
250 HEXBAUD(0)=&H9B5: HEXBAUD(1)=&H8BD: HEXBAUD(2)=&H7AA: HEXBAUD(3)=&H5D3
260 HEXBAUD(4)=&H59A: HEXBAUD(5)=&H1A1: HEXBAUD(6)=&H175
270 CHANGE$(0)=CHR$(&H1F): CHANGE$(1)=CHR$(&H1B): CHANGE$(2)=CHR$(0)
280 '
290 ' Initialize BAUDOT to ASCII Conversion table (BTOA$).
300 FOR I=0 TO 1:FOR J=0 TO 31
310 READ BTOA$(J,I)
320 NEXT:NEXT
330 BTOA$(2,0)=CHR$(10): BTOA$(8,0)=CHR$(13)
340 BTOA$(2,1)=CHR$(10): BTOA$(8,1)=CHR$(13)
350 BTOA$(5,1)=CHR$(7)
360 '
370 ' Initialize ASCII to BAUDOT table (ATOB$).
380 ATOB$(0)=CHR$(&H40): ATOB$(7)=CHR$(&H24)
390 ATOB$(10)=CHR$(&H42): ATOB$(13)=CHR$(&H48)
400 RESTORE 2320: FOR I=32 TO 63: READ J: ATOB$(I)=CHR$(J): NEXT
410 RESTORE 2350: FOR I=65 TO 90: READ J: ATOB$(I)=CHR$(J): NEXT
420 RESTORE 2350: FOR I=97 TO 122: READ J: ATOB$(I)=CHR$(J): NEXT
430 '
440
'***************************************************************************
450 ASCII=0: BAUDOT=1
460 LTRS=31: FIGS=27
470 TX=0: RX=1
480 '
490 P=0 ' initial baud rate 45
500 TXRX=1 ' receive state
510 MODE=1 ' Baudot mode
520 SHIFT=0 ' LTRS shift
530 CANNED=0 ' No canned messages
540 OUT &H3FC,0 ' Rig to RX state
550 '
560
'**************************************************************************
570 '
580 ' Set initial screen conditions
590 KEY OFF: CLS
600 '
610 ' Trap F1 --> F7
620 KEY(1) ON: KEY(2) ON: KEY(3) ON: KEY(4) ON: KEY(5) ON: KEY(6) ON:
KEY(7) ON
630 ON KEY(1) GOSUB 1670
640 ON KEY(2) GOSUB 1780
650 ON KEY(3) GOSUB 1850
660 ON KEY(4) GOSUB 1930
670 ON KEY(5) GOSUB 2060
680 ON KEY(6) GOSUB 2130
690 ON KEY(7) GOSUB 2180
700 '
710 ' Error trapping routine
720 ON ERROR GOTO 2360
730 '
740
'**************************************************************************
750 '
760 ' Print User Introductory Messages.
770 PRINT TAB(10)"* * PCjr RTTY * *":PRINT TAB(12)"By K. McQuiggin":PRINT
TAB(17)"VE7CPT"
780 PRINT:PRINT: PRINT "This package offers full ASCII/BAUDOT"
790 PRINT "transceive operation on the IBM PCjr at"
800 PRINT "data rates from 45 to 300 Baud."
810 PRINT: PRINT "Function Keys operate as follows:"
820 PRINT: PRINT "F1:";TAB(10)"ASCII <--> BAUDOT": PRINT
"F2:";TAB(10)"Increase Baud Rate": PRINT "F3:";TAB(10)"Decrease Baud
Rate":PRINT "F4:";TAB(10)"TRANSMIT <--> RECEIVE": PRINT
"F5:";TAB(10)"EXIT":PRINT "F6:";TAB(10)"Force unshift"
830 PRINT "F7:";TAB(10)"Start/Stop Canned Messages": PRINT: PRINT
840 INPUT "Press ENTER to Continue ",A$
850 '
860
'***************************************************************************
870 '
880 ' Execution begins.
890 CLS
900 OPEN "scrn:" FOR OUTPUT AS #2 ' Init files and begin operation.
910 GOSUB 1520
920 GOSUB 1430
930 GOSUB 1350
940 GOTO 1120
950 '
960
'***************************************************************************
970 ' ASCII Transmit Routine.
980 GOSUB 1590
990 IF CHAR$ = "" THEN GOTO 980
1000 PRINT #1, CHAR$;
1010 PRINT #2, CHAR$;
1020 GOTO 980
1030 '
1040
'*************************************************************************
1050 ' ASCII Receive Routine.
1060 IF EOF(1) THEN GOTO 1060
1070 CHAR$=INPUT$(LOC(1),#1)
1080 PRINT #2, CHAR$;
1090 GOTO 1060
1100 '
1110
'***************************************************************************
1120 ' BAUDOT Receive Routine.
1130 IF EOF(1) THEN 1130
1140 CHAR=ASC(INPUT$(LOC(1),#1))
1150 IF CHAR > 31 THEN GOTO 1130
1160 IF CHAR = FIGS THEN SHIFT=1
1170 IF CHAR = LTRS THEN SHIFT=0
1180 IF CHAR <> FIGS AND CHAR <> LTRS THEN PRINT #2,BTOA$(CHAR,SHIFT);
1190 GOTO 1130
1200 '
1210
'**************************************************************************
1220 ' BAUDOT Transmit routine.
1230 SHIFT$=CHANGE$(0)
1240 GOSUB 1590
1250 IF CHAR$ = "" THEN GOTO 1240
1260 PRINT #2,CHAR$;
1270 IF ASC(CHAR$) > 122 THEN CHAR$=CHR$(0)
1280 CHAR$=ATOB$(ASC(CHAR$))
1290 S=(ASC(CHAR$) AND &H60)/32
1300 CHAR$=CHR$(ASC(CHAR$) AND &H1F)
1310 IF S=2 OR CHANGE$(S) = SHIFT$ THEN PRINT #1,CHAR$;
                                       ELSE PRINT #1,CHANGE$(S);CHAR$;:
SHIFT$=CHANGE$(S)
1320 GOTO 1240
1330 '
1340
'**************************************************************************
1350 ' Utility Routine to PRINT STATUS LINE.
1360 I=CSRLIN: J=POS(0)
1370 LOCATE 25,1
1380 PRINT "MODE: ";MODE$(MODE);TAB(14) "RATE: ";TAB(20) BAUD$(P);TAB(24)
"Baud";TAB(30) "STATE: ";TXRX$(TXRX);
1390 LOCATE I,J
1400 RETURN
1410 '
1420
'**************************************************************************
1430 ' Utility Routine to SET BAUD RATE TO HEXBAUD(P).
1440 I=INP(&H3FB)+128
1450 OUT &H3FB,I
1460 OUT &H3F8,(HEXBAUD(P) AND &HFF)
1470 OUT &H3F9,(((HEXBAUD(P) AND &HFF00)/256) AND &HFF)
1480 OUT &H3FB,(I-128)
1490 RETURN
1500 '
1510
'**************************************************************************
1520 ' Utility Routine to OPEN COM1 FOR CURRENT MODE.
1530 CLOSE #1
1540 IF MODE = ASCII THEN OPEN "com1:75,n,7,1,rs,cs,ds,cd" AS #1
            ELSE OPEN "com1:75,n,5,2,rs,cs,ds,cd" AS #1
1550 OUT &H3FC,(INP(&H3FC) AND &HFE)
1560 RETURN
1570 '
1580
'**************************************************************************
1590 ' Utility Routine to read characters from keyboard or process canned msg.
1600 CHAR$=INKEY$
1610 IF NOT CANNED THEN RETURN
1620 CHAR$=MID$(MSG$,NEXTCHAR,1)
1630 NEXTCHAR=NEXTCHAR+1: IF NEXTCHAR > LEN(MSG$) THEN NEXTCHAR=1
1640 RETURN
1650 '
1660
'**************************************************************************
1670 ' Routine "F1" Change Mode ASCII <--> BAUDOT.
1680 IF MODE = ASCII THEN GOTO 1730
1690 MODE=ASCII: GOSUB 1520: GOSUB 1350
1700 IF TXRX = TX THEN RETURN 970
1710 RETURN 1050
1720 '
1730 MODE=BAUDOT: GOSUB 1520: GOSUB 1350
1740 IF TXRX = TX THEN RETURN 1220
1750 RETURN 1120
1760 '
1770
'**************************************************************************
1780 ' Routine "F2" Increase Baud Rate.
1790 P=(P+1) MOD 7
1800 GOSUB 1430
1810 GOSUB 1350
1820 RETURN
1830 '
1840
'**************************************************************************
1850 ' Routine "F3" Decrease Baud Rate.
1860 P=P-1
1870 IF P < 0 THEN P=6
1880 GOSUB 1430
1890 GOSUB 1350
1900 RETURN
1910 '
1920
'**************************************************************************
1930 ' Routine "F4" Change Status TX <--> RX.
1940 I=INP(&H3FC) AND &H1
1950 IF I = 0 THEN OUT &H3FC,(INP(&H3FC) OR &H1)
                 ELSE OUT &H3FC,(INP(&H3FC) AND &HFE)
1960 IF TXRX = TX THEN GOTO 2010
1970 TXRX=TX: GOSUB 1350
1980 IF MODE = BAUDOT THEN RETURN 1220
1990 RETURN 970
2000 '
2010 TXRX=RX: GOSUB 1350
2020 IF MODE = BAUDOT THEN RETURN 1120
2030 RETURN 1050
2040 '
2050
'**************************************************************************
2060 ' Routine "F5" EXIT.
2070 CLOSE #1: CLOSE #2 ' Close all files
2080 OUT &H3FC,0 ' Make sure rig is left in RX mode
2090 ON ERROR GOTO: KEY OFF: WIDTH 80: CLS ' Restore standard states
2100 END
2110 '
2120
'**************************************************************************
2130 ' Routine "F6" Force "unshift" on Receive.
2140 SHIFT=0
2150 RETURN
2160 '
2170
'**************************************************************************
2180 ' Routine "F7" Start/Stop transmission of Canned Message.
2190 CANNED=NOT CANNED
2200 MSG$=CHR$(10)+"CQ CQ CQ CQ CQ"+CHR$(10)+"DE"+CHR$(10)+"VE7CPT VE7CPT
VE7CPT "
2210 NEXTCHAR=1
2220 RETURN
2230 '
2240
'**************************************************************************
2250
'**************************************************************************
2260 '* D A T A A R E A
   *
2270
'**************************************************************************
2280 '
2290 ' BAUDOT to ASCII Conversion Table
2300 DATA "",E,LF,A,"
",S,I,U,CR,D,R,J,N,F,C,K,T,Z,L,W,H,Y,P,Q,O,B,G,"",M,X,V,""
2310 DATA "",3,LF,-,"
",BELL,8,7,CR,$,4,"'",",","",":",(,5,"'",),2,#,6,0,1,9,?,&,"",.,/,;,""
2320 '
2330 ' ASCII to BAUDOT Conversion Table ( in Hexadecimal ).
2340 DATA
&h44,0,&h31,&h34,&h29,0,0,&h2b,&h2f,&h32,0,0,&h2c,&h23,&h3c,&h3d,&h36,&h37,&
h33,&h21,&h2a,&h30,&h35,&h27,&h26,&h38,&h2e,&h3e,0,0,0,&h39
2350 DATA
&h03,&h19,&h0e,&h09,&h01,&h0d,&h1a,&h14,&h06,&h0b,&h0f,&h12,&h1c,&h0c,&h18,&
h16,&h17,&h0a,&h05,&h10,&h07,&h1e,&h13,&h1d,&h15,&h11
2360 RESUME

==============================================

Kevin


At 04:31 PM 00/02/16 -0500, you wrote:
>On Wed, Feb 16, 2000 at 06:44:14PM +0000, Tony Duell wrote:
>> Hmmm.. I've tried to learn morse several times, and failed every single
>> time. I don't know why, but it just doesn't seem to 'click' with me.
>
>Well, having an actual use for it makes it a lot easier to remember. My
>best friend and I learned Morse code in 6th grade so that we could pass
>notes in class that no one could understand. Naturally that later fizzled,
>the 7th grade teacher was a ham and the 8th grade teacher was a radio
operator
>in the Norwegian underground in WW2, so much for that idea! But learning
>Morse code is a lot easier than memorizing the ASCII table, there are way
>fewer characters...
>
>> It would be considerably more entertaining to attmept to output data
>> packets directly from the 11/44 without using a TNC. A DUP11 might be
>> able to produce a suitable data format. A KMC11 + a suitable comms card
>> certainly could.
>
>I *always* wanted to do that, I actually bought a DUP11 years ago for this
>purpose but never dug up documentation on it until recently. You'd need to
>build some kind of external clock (PLL really I guess) that synchronized to
>the bit transitions of AX.25, shouldn't be a very big deal though.
>
>Stupid question: what comes out of the other side of a ham TNC these days?
>It used to be Bell 202 modem tones at 1200 baud HDX, over an FM voice signal,
>it *can't* still be that easy though can it? Some place I still have the
>202 style TU I built from a kit (hmm, Fletcher TU-1200 maybe, or did I just
>make that up?) to go with the DUP11 before I dropped the ball.
>
>> > to lash up an RTTY program for the PDP, to send and recieve Baudot
>> > in real time.
>>
>> DL11s can be jumpered for 5 bits and 1.5 stop bits IIRC.
>
>Hmm, any idea how well that really interacts with real TTYs? I thought they
>used 1.4xxx stop bits or something (really whatever scrap of a rotation is
>left over after all 5 bits get sampled and before the selector doodad hits
>the stop again). I suppose you're unlikely to type fast enough on a real
>TTY to cause framing errors... Anyway the *true* joy of Baudot is that
>ridiculous keyboard layout, and all that crap with FIGS and LTRS, using a
>computer would miss some of the wackiness. Geez, I miss my model 19...
>
>John Wilson
>D Bit
>
>

---
Kevin McQuiggin VE7ZD
mcquiggi_at_sfu.ca
Received on Wed Feb 16 2000 - 23:11:06 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:32:53 BST