;*; Updated on 06-Dec-91 at 8:46 AM by Michele Tonti; edit time: 0:00:24
;*************************** AMUS Program Label ******************************
; Filename: CTSOFF.M68                                      Date: 12/6/91
; Category: UTIL         Hash Code: 344-354-566-073      Version:
; Initials: KUNI/AM      Name: RENE S. HOLLAN
; Company: UDISCO LTD.                             Telephone #: 5144818107
; Related Files: CTSON.M68
; Min. Op. Sys.:                               Expertise Level:
; Special: Only for AM2000, only tested on AM355 board
; Description: Turns off CTS (pin 5) line on the specified terminal.  This is
; an upgrade of an older CTSOFF program.
;
;*****************************************************************************
;************************************************************************
;                                                                       *
;                       CTSOFF COMMAND PROGRAM                          *
;                                                                       *
;************************************************************************
;
;                                   NOTICE
;
;All    rights   reserved.  This software is the property of UDISCO LTD.  and
;the material contained herein is  the   proprietary   property   and   trade
;secrets    of    UDISCO  LTD.,  embodying  substantial  creative efforts and
;confidential information, ideas and expressions, no part of  which  may   be
;reproduced   or  transmitted  in  any  form  or  by  any  means, electronic,
;mechanical,  or  otherwise,  including  photocopying  or  input  into    any
;information   storage  or  retrieval  system  without  the  express  written
;permission of UDISCO LTD.
;
;Permission to copy and use is granted to AMUS members for non commercial
;purposes only.
;
;       Author:         Rene S. Hollan
;
;       Date Written:   May 26, 1984
;
;               This program turns off the CTS line (pin five) on
;       the specified terminal. This is an upgrade of the old CTSOFF program.
;       This program works only on AM-2000 systems and has only been tested     are currently supported.
;       with an AM-355 interface board.
;
;               Syntax is CTSOFF trmdef-name.
;
;       COPYRIGHT (C) - 1989 - UDISCO LTD.
;
; [103] 15 January 1989
;       Upgrade to AM-2000. /RSH
;
; [102] 7 March 1986
;       Reenable AM-300 interrupts at exit. /RSH
;
; [101] 19 February 1986
;       Lock out critical section. /RSH
;
; [100] 26 May 1984
;       Coding starts /RSH
;

VMAJOR  =       1                       ; MAJOR VERSION
VMINOR  =       0                       ; MINOR VERSION
VSUB    =       0                       ; SUB VERSION
VEDIT   =       103                     ; EDIT LEVEL

       SEARCH  SYS
       SEARCH  SYSSYM
       SEARCH  TRM

SETPIN  =       6                       ; interface driver setpin routine

RS.RTS  =       ^H04                    ; request to send pin
RS.DTR  =       ^H14                    ; data terminal ready pin

OFINI
OFDEF   DDBTRM,D.DDB                    ; terminal name DDB
OFSIZ   IMPSIZ                          ; inpure size

CTSOFF: PHDR    -2,PV$WSM,PH$REE!PH$REU ; program header

       GETIMP  IMPSIZ,A5               ; get local memory

       BYP                             ; skip blanks
       LIN                             ; anything entered?
       BNE     GET1

HELP1:  TYPECR  <CTSOFF: syntax error, CTSOFF trmdef-name>
       EXIT

GET1:   FSPEC   DDBTRM(A5),MAC          ; get terminal name
       CALL    TRMSRH                  ; find trmdef(A5)
       MOV     A3,D7
       BEQ     HELP1                   ; terminal area not found

       MOV     A3,A5                   ; A5 -> TDV for SETPIN call
       MOV     T.IDV(A5),A3            ; A3 -> interface driver
       CLR     D0                      ; leave DTR on
;       BSET    #RS.DTR,D0              ; ...pin 5 CPU
       BSET    #RS.RTS,D0              ; replace above with this to control
                                       ; DTR instead of CTS
       CALL    SETPIN(A3)              ; call interface driver SETPIN rtn.
       EXIT

; locate a terminal definition
; exit - A3 --> terminal definition block
;           = 0 if not found
TRMSRH: MOV     TRMDFC,A3               ; A3 --> terminal definition chain
TMSA:   MOV     DDBTRM+D.FIL(A5),D7             ; compare terminal names
       CMP     D7,4(A3)
       BNE     TMSB                    ; not equal
       ADD     #10,A3                  ; advance to terminal definition base
       RTN

TMSB:   MOV     0(A3),A3                ; go to next terminal in chain
       MOV     A3,D7
       BNE     TMSA                    ; unless there are no more
       RTN

       END