Apsuvax.1031
net.micro
utcsrgv!utzoo!decvax!ucbvax!ihnss!mhtsa!allegra!psuvax!mansfiel
Thu Mar 11 16:08:56 1982
Basic terminal program
                                           11 march 1982

   I have a BASIC program which operates my TRS-80 as a full
duplex terminal at 300 Bd.  The idea is contained in this trivial
program.

         10 OUT 232,0: OUT 233,85: OUT 234,165; PRINT CHR$(14)
         20 ON ERROR GOTO 30
         30 RESUME 40
         40 IF INP(234) AND 128 PRINT CHR$(INP(235));
         50 IF INP(234) AND 64 OUT 235,ASC(INKEY$)
         60 GOTO 40
   The first line sets 300 Bd. even parity ASCII with one stop bit
and seven data bits.

   This program and an RS232 board makes a model I or III TRS-80 into
a reliable full duplex terminal.  Owing to the eccentricities of the
keyboard, however, it has some deficiencies. e.g. can't send BREAK or DEL,
the shift key is needed for lower case, etc., etc.  My solution is to
vector both in and out.  I initialize vectors A and V and change INP(235)
to V(INP(235)) and change ASC(INKEY$) to A(ASC(INKEY$)).  Line 55
would make shift @ into BREAK.  However UNIX doesn't need BREAK so
I decided to save the key.  Here is the program.
          10 GOTO 65
          30 RESUME 40
          40 IF INP(234) AND 128 PRINT CHR$(V(INP(235)));
          50 IF INP(234) AND 64 OUT 235,A(ASC(INKEY$))
          55 REM IF PEEK(14337) AND PEEK(14464) OUT 234,161:
             FOR I=1 TO 250: NEXT I: OUT 234,165
          60 GOTO 40
          65 DEFINT A-Z
          70 OUT 232,0: OUT 233,85: OUT 234,165: PRINT CHR$(14)
          80 DIM A(127),V(127)
          90 FOR I=1 TO 23: V(I)=0: NEXT I
          100 V(8)=8: V(13)=13
          110 FOR I=24 TO 127: V(I)=I: NEXT I
          120 V(94)=141: V(124)=91: V(123)=174: V(125)=157: V(91)=183:
              V(93)=187: V(96)=130
          130 FOR I=0 TO 127: a(I)=I: NEXT I
          140 A(26)=0
          150 FOR I=65 TO 90: A(I)=I+32: NEXT I
          160 FOR I=97 TO 122: A(I)=I-32: NEXT I
          170 A(2)=26: A(24)=127: A(25)=94: A(91)=124: A(10)=92:
              A(9)=126
          180 ON ERROR GOTO 30
          200 GOTO 40


   I have used control B to mean control Z, right arrow to mean ~,
up arrow to mean |, down arrow to mean \, shift left arrow to mean DEL,
and with ASCII codes 1,2,9,10,24,25,28,29,30,and the characters [,],{,
} not capable of being sent.  As the FORTRAN language does not use these
symbols, they will not be missed.  Several incoming characters are
represented by graphics codes and several incoming control signals
are NULLed.

   The TERMCAP entry should be

        trs|am:bs:cd=^/:ce=^.:ho=^,:do=^Z:nd=^Y:up=\33:li#16:co#64


                              Richard Mansfield
                              1000 W. Beaver Ave.
                              State College, Pa.
                              16801

-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <[email protected]>
of http://communication.ucsd.edu/A-News/


This Usenet Oldnews Archive
article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.