CWRCV Program (BASIC)


10 CLEAR: CLS: KEY OFF: DIM A$(100): DEFINT D,I,A: FOR I=1 TO 100: READ A$(I): NEXT: FALSE=0: TRUE=NOT FALSE
15 FOR I= 1 TO 10: KEY I,"": NEXT
20 ON KEY(10) GOSUB 11000
30 ON KEY(9) GOSUB 11500
99 '-- decoding table. Placed here for speed in interpreted BASIC.
100 DATA E,T,I,A,N,M,S,U,R,W,D,K,G,O,H,V,F,-,L,aa,P,J,B,X,C
110 DATA Y,Z,Q,-,-,5,4,-,3,-,-,-,2,as,-,ar,-,-,-,-,1,6,bt,/,-
130 DATA -,-,-,-,7,-,-,-,8,-,9,0,-,-,-,-,-,sk,-,-,-,-,-,-,?
140 DATA -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-
141 '-- initialising routines.
1000 GOSUB 14000
1010 GOTO 12000
9000 C=250
9997 '
9998 ' This is the receive routine. 'B' is timer variable; 'C' is dah length; 'DA' is dash decode; 'DO' is dot decode.
9999 '
NOTES: The word 'DO' is a reserved word in QBasic/VBDos/QBX so 'DO' should be replaced with 'Dot'.
The port address (&H3FE) is a port used by the RS232 port Com1. From the 80486 onwards, this port has not supported ground potential as a data level. So the shorting to ground of the pin is unreliable. I suggest rather use the Joystick port or Printer port which use TTL 0.4V to 2.4V levels.
Both ports are TTL inputs/outputs and do support connection to 0Volts. Also most late model printer ports are CMOS devices and cannot supply sharp edges to long cables.
10000 KEY(10) ON
10005 A=INP(&H3FE) AND 128
10010 IF A=0 THEN 10005
10020 B=0
10030 A=INP(&H3FE) AND 128: B=B+10
10040 IF A=0 THEN DO=2*DO:DA=2*DA:DO=DO+1:IF F9 THEN 10100 ELSE C=((5*C)+(3*B))/6: GOTO 10100
10050 IF B<(.5*C) THEN 10030
10060 DO=2*DO:DA=2*DA:DA=DA+1
10070 A=INP(&H3FE) AND 128: B=B+10
10080 IF A THEN GOTO 10070
10090 C=((4*C)+B)/5
10100 B=0
10110 A=INP(&H3FE) AND 128
10120 B=B+10
10130 IF A THEN GOTO 10020
10140 IF B<(.5*C) THEN GOTO 10110
10145 KEY(10) OFF
10150 GOSUB 10220
10155 KEY(10) ON
10160 A=INP(&H3FE) AND 128
10170 B=B+10
10180 IF A THEN GOTO 10020
10190 IF B<(2*C) THEN GOTO 10160
10200 PRINT " ";
10210 GOTO 10005
10219 '
10220 DA=DA*2
10230 D=DA+DO
10240 IF D>100 THEN D=100
10250 PRINT A$(D);
10260 DA=0:DO=0
10270 RETURN
10997 '
10998 ' key(10) interrupt subroutine
10999 '
11000 KEY(10) OFF: KEY(9) OFF: F9 = FALSE: RETURN 12000
11497 '
11498 ' F9 subroutine
11499 '
11500 XSCR=POS(0): YSCR=CSRLIN: LOCATE 25,1,1
11510 IF F9 THEN 11600
11515 F9=TRUE
11520 COLOR 0,7: PRINT " active ";: COLOR 7,0: LOCATE YSCR,XSCR
11530 RETURN
11540 '
11600 F9=FALSE
11610 COLOR 0,7: PRINT " ";:COLOR 7,0: LOCATE YSCR,XSCR
11620 RETURN
11997 '
11998 ' Menu routine
11999 '
12000 CLS: PRINT" *** MENU ***": PRINT: PRINT
12010 PRINT" -- Receive"
12020 PRINT" -- Reserved"
12030 PRINT" -- Exit to BASIC"
12040 PRINT" -- Exit to DOS"
12050 PRINT" -- Help"
NOTES: Of course this was written in the days before the universal F1 for Help. So this Menu needs to change. F1 = Help, F5 = Receive.

12060 PRINT: PRINT: PRINT " Your choice ? ";: LOCATE ,,1
12070 CHOICE$=INKEY$
12080 IF LEN(CHOICE$) < 2 THEN 12070
12090 ROUTINE = INSTR(";<=>?",MID$(CHOICE$,2))
12095 PRINT ROUTINE
12100 ON ROUTINE GOTO 13000,12000,13100,13200,13300
12105 GOTO 12000

12110 '
12998 ' goto receive routine
12999 '
13000 CLS: LOCATE 25,1: COLOR 0,7: PRINT SPACE$(25);"**** RECEIVING ****";SPACE$(79-POS(0));: LOCATE ,60: PRINT" for Menu ";: COLOR 7,0: LOCATE 1,1: KEY(9) ON : GOTO 10000
13099 '
13100 CLS: END
13199 '
13200 CLS: SYSTEM
13299 '
13300 CLS

13310 OPEN "cwrcv.hlp" FOR INPUT AS #1
NOTES: Unfortunately the first thing to disappear is a path to the help file. So this needs to be corrected to look for the help file in the same directory as the executable (.EXE). This is not as easy as Visual Basic, as there is no App.EXEPath in BASIC/QBasic/QBX/VBDos.

13320 WHILE NOT EOF(1)
13330 LINE INPUT#1, HELP$
13340 PRINT HELP$
13350 WEND
13360 CLOSE
13365 PRINT: COLOR 31,0: PRINT"Any key": COLOR 7,0
13367 WAIT.$=INKEY$: IF WAIT.$="" THEN 13367
13370 GOTO 12000
13999 '
14000 PRINT: PRINT: PRINT
14005 COLOR 15,0
14010 PRINT" ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»"
14020 PRINT" º CW RECEIVE PROGRAM º"
14030 PRINT" º by AA4L º"
14040 PRINT" º Bob Johnson º"
14050 PRINT" º º"
14060 PRINT" º Version 1.0 º"
14070 PRINT" º 04/09/83 º"
14080 PRINT" º Public Domain º"
14090 PRINT" ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ"
14100 COLOR 7,0

BTW - the splash screen above will display properly in Windows etc, if you use the MSLINEDRAW font.
NOTES: The old way of doing a delay is using a loop. The time to execute this loop is very small on todays Pentium class PC's. It delays the program so little, that the user never sees the 'splash screen'! Rather use the Timer to wait for 3 seconds. Oh and remember to use 'DoEvents' in VBdos/VB to let other programs have the cpu...

14105 FOR I=1 TO 5000: NEXT
14110 RETURN


AA4L Bob Johnson (looked up on Google) also wrote:-

TTY VERSION 3.7 ... A HALF DUPLEX RADIOTELETYPE PROGRAM FOR THE IBM PC
Written by AA4L Bob Johnson 11305 Rums Hill, Raleigh NC 27614
919/847/5606..... April 5,1985

GO BACK