Msg: 127 *Conference*

06-27-91 19:17:04

From: JAMES FIELDS

To : ALL

Subj: REMOTE OPERATION OF THE M-100

    HELP!  I want to operate my Model 100 by remote but I don't know how.  I
can write a Telcom program in BASIC, but it will not do what I want.  That is,
a program that will replace both the keyboard and LCD drivers (not using the
OPEN statement).  This is so that any program written in BASIC can use the
INPUT, INKEY$, and PRINT commands in the same way (if the new drivers are not
running all actions are from the Model 100 keyboard and to the screen, if they
are; all INPUT's, INKEY$'s, and PRINT's are received from/to the RS232 line.
Below, I have included a program that does this for the Model III and Model 4
(in III mode).  If any one has done this or knows someone that has, I would
greatly appreciate any help that can be given.
  
                          James Fields
  
PS:  The main reason I want to do this is that I have a Prime PST-100 Data
terminal.  I would like to use it because it has a full keyboard and an 80 x 25
line display.
  
Note: The following program is meant to be ran from the TRSDOS prompt and
written in Z80 machine code.
 ;********************************************************
 ;* Remote Control TRS-80       (REMOTE/SRC, REMOTE/CMD) *
 ;* By Craig Chaiken                                     *
 ;* This utility allows the TRS-80 Model III or Model 4  *
 ;* (in Model III mode) to be controlled by a remote     *
 ;* terminal over an RS232 line. XON/XOFF protocol       *
 ;* is supported.                                        *
 ;*                                                      *
 ;* Example #1:                                          *
 ;*     REMOTE                                           *
 ;*     (Remote I/O enabled, local I/O disabled        *
 ;*      for security purposes)                          *
 ;*                                                      *
 ;* Example #2:                                          *
 ;*     REMOTE LOCAL                                     *
 ;*     (Remote I/O enabled, Local I/O enabled           *
 ;*      allows local user and remote user to              *
 ;*      interact)                                        *
 ;*********************************************************
 ;--------------- CONSTANTS -------------------------------
 RSINIT  EQU      005AH ;initial RS232
 CLS     EQU      01C9H ;clear Screen
 PRINT   EQU      021BH ;Print line to screen, HL points to line, 03 or 13 ends
 KEYDCB  EQU      4016H ;Keyboard Device Control Block
 VIDDCB  EQU      401EH ;Video Device Control Block
 HIMEM   EQU      4411H ;HIMEM pointer
 START   EQU      0FF5BH;Assembly start
 CONTRL  EQU      0EAH ;RS232 control port
 DATA    EQU      0EBH ;RS232 data port
 XOFF    EQU      11H  ;CONTROL-S
 XON     EQU      0DH  ;CONTROL-Q
 ;_______________ INSTALL NEW DRIVERS ---------------------
         ORG      START
         LD       A,(HL)
         PUSH     AF
         CALL     CLS
         LD       HL,MESS
         CALL     PRINT
         POP      AF
         CP       'L'
         CALL     NZ,NOLOC
         CALL     Z,LOCAL
         LD       HL,(KEYDCB)
         LD       (PATCH1+1),HL
         LD       HL,NEWKEY
         LD       (KEYDCB),HL
         LD       HL,(VIDDCB)
         LD       (PATCH2+1),HL
         LD       HL,NEWVID
         LD       (VIDDCB),HL
         LD       HL,NEWKEY-1
         LD       (HIMEM),HL
         JP       RSINIT
 NOLOC   PUSH     AF
         LD       HL,DISABL
         CALL     PRINT
         LD       A,0C9H
         LD       (PATCH1),A
         LD       (PATCH2),A
         POP      AF
         RET
 LOCAL   LD       HL,ENABLE
         JP       PRINT
 ;--------------- MESSAGE AREA ----------------------------
 MESS    DEFB     10
         DEFM     'Remote I/O Enabled'
         DEFB     10
         DEFM     'Local  I/O '
         DEFB     03
 DISABL  DEFM     'Disabled'
         DEFB     10
         DEFB     13
 ENABLE  DEFM     'Enabled'
         DEFB     10
         DEFB     13
 ;--------------- NEW I/O DRIVERS --------------------------
 NEWKEY  IN       A,(CONTROL)
         RLA
         JR       C,GETBYT
         XOR      A
         JR       PATCH1
 GETBYT  IN       A,(DATA)
         CP       XOFF
         JP       Z,WAITX
         RET
 PATCH1  JP       0
 NEWVID  IN       A,(CONTRL)
         BIT      6,A
         JR       Z,NEWVID
         LD       A,C
         OUT      (DATA),A
 PATCH2  JP       0
 WAITX   CALL     NEWKEY
         CP       XON
         RET Z
         JR       WAITX
 ;----------------------------------------------------------
         END      START