;****************************************************************************!
;
;       Double-D Software Services      Dave Drake
;       4924 Chantilly                  (702) 438-2173
;       Las Vegas, Nv. 89110
;
;       Double-D Software reserves the COPYRIGHT to this program and all
;       related materials.  However, due to the percieved importance of
;       this software to the AM community, I grant unlimited use of this
;       software to anyone and everyone as long as this notice is not
;       removed.  All I ask is that if you find this software useful,
;       please send a little money ($25.00?) to the address above to help
;       recover costs of development, continuing support and distribution.
;
;       If you create a driver for a printer not currently supported,
;       please upload it to the AMUS bulletin board or to me so it
;       can be added to the list of supported printers.
;
;       PROGRAM NAME: PX.M68
;
;       DATE CREATED: 08/01/88
;
;       DESCRIPTION: Query/Set Translation Status of DDSS Printer Drivers
;
;       CHANGE HISTORY:
;
;       DATE            BY      DESCRIPTION
;       08/01/88        ddss    Initial release
;****************************************************************************!
       search sys
       search syssym
       search trm
;       copy    Qtype.mac

       objnam  px.lit

VMAJOR = 1
VMINOR = 1

OFINI
OFDEF   TRMNAM,4        ; TEMP STORATE FOR TERMNAM (RAD50)
OFDEF   OPTION,1        ; OPTION FLAG
OFDEF   FILLER,1
OFSIZ   IMPSIZ

       PHDR    -1,0,PH$REE!PH$REU
START:  GETIMP  IMPSIZ,A3                       ; define impure
       TYPESP  <Double-D Software Services>    ; get the credit
       TYPECR  <Printer Translation Utility>   ;
       BYP                                     ; to first arg
       LIN                                     ; any arg?
       JEQ     USEAGE                          ; no, tell how to use
       LEA     A1,TRMNAM(A3)                   ; yes, index storage
       PACK                                    ; pack trmnam
       PACK                                    ;
       CLR     D1                      ; clear
       MOVB    #'S,D1                  ; preset status
       BYP                             ; next arg (option)
       LIN                             ; any there?
       BEQ     30$                     ; no, use default (status)
       CLR     D1                      ; yes, clear
       MOVB    @A2,D1                  ; get option
       CMPB    D1,#'Y                  ; is turn on?
       BEQ     30$                     ; yes, ok
       CMPB    D1,#'N                  ; is turn off?
       BEQ     30$                     ; yes, ok
       CMPB    D1,#'S                  ; is status?
       JNE     USEAGE                  ; no, bad option
30$:    MOVB    D1,OPTION(A3)           ; save option
       MOV     TRMNAM(A3),D2           ; get packed trmnam
       MOV     TRMDFC,A2               ; index trm list
40$:    MOV     A2,D3                   ; end of list?
       JEQ     NOTFND                  ; yes, didn't find it
       MOV     4(A2),D1                ; no, get trmnam
       CMP     D2,D1                   ; match?
       BEQ     FOUND                   ; yes, continue
       MOV     @A2,A2                  ; no, next entry in list
       BR      40$                     ; loop

FOUND:  ADD     #10,A2                  ; index tcb
       MOV     T.IMP(A2),A2            ; index Impure
       CLR     D1                      ; clear
       MOVW    0(A2),D1                ; get first word
       CMPW    D1,#[DDS]               ; match signature?
       JNE     BADDVR                  ; no, not using ddss driver
       MOVW    2(A2),D1                ; yes, get 2nd word
       CMPW    D1,#[SPX]               ; match signature?
       JNE     BADDVR                  ; no, not using ddss driver
       CMPB    OPTION(A3),#'Y          ; yes, is option to turn on?
       BEQ     TRNON                   ; yes, go turn on
       CMPB    OPTION(A3),#'N          ; no, is option to turn off?
       BEQ     TRNOFF                  ; yes, go turn off
STATUS: TSTB    6(A2)                   ; status, is on?
       BNE     10$                     ; yes, say so
       TYPECR  <Translation is currently OFF.> ; else off
       BR      99$                     ; exit
10$:    TYPECR  <Translation is currently ON.>
99$:    EXIT                            ; exit

TRNON:  CLRB    6(A2)                   ; turn on translation
       TYPECR  <Translation is set ON.>
       JMP     DONE

TRNOFF: SETB    6(A2)                   ; turn off translation
       TYPECR  <Translation is set OFF.>
       BR      DONE

NOTFND: TYPECR  <Terminal name not found.>
       BR      DONE

BADDVR: TYPECR  <Not DDSS Printer Driver.>
DONE:   EXIT

USEAGE: TYPECR  <Useage: PX Trmnam {Option}>
       TYPECR  <        Trmnam is Terminal Name.>
       TYPECR  <        Option is (Y)es,  Translations On>
       TYPECR  <                  (N)o,   Translations Off>
       TYPECR  <                  (S)how, Show Current Status>
       TYPECR  <        Option is Optional, Defaults to (S)  >
       EXIT

       END