TITLE BLANKT -- blank terminal screen code for mailsystem
       SUBTTL Written by Mark Crispin /MRC 5-Apr-85

       SEARCH MACSYM,MONSYM    ; system definitions
       SALL                    ; suppress macro expansions
       .DIRECTIVE FLBLST       ; sane listings for ASCIZ, etc.

;  This module contains code to blank the terminal screen.  This is
; site-dependent and should be edited for each individual site as
; appropriate.

A=:1                            ; JSYS AC's
B=:2

       .PSECT CODE

$BLANK::SAVEAC <A,B>
       STKVAR <TTYPE,OLDMOD>
       MOVEI A,.PRIOU          ; get terminal type index
       GTTYP%
       MOVEM B,TTYPE           ; save for later
       CAIGE B,NCLRSC          ; more than the number supported?
        SKIPN CLRSCN(B)        ; yes, able to blank on this type?
         RET                   ; no, return
       RFMOD%                  ; get current terminal mode
       MOVEM B,OLDMOD          ; save for later
       TRZ B,TT%DAM            ; change to binary mode
       SFMOD%
       MOVE B,TTYPE            ; get type index back again
       MOVE A,CLRSCN(B)        ; get blanking sequence or address
       TXOE A,.LHALF           ; was it an address (LH=0)?
        HRROI A,CLRSCN(B)      ; no, sequence 4 chars or less, set up address
       PSOUT%                  ; output the sequence
       MOVEI A,.PRIOU          ; wait for it to get out
       DOBE%
       SETZ B,                 ; tell monitor we are at top of page
       SFPOS%
       MOVEI A,^D500           ; give terminal a chance to do it
       DISMS%
       MOVEI A,.PRIOU          ; restore former terminal mode
       MOVE B,OLDMOD
       SFMOD%
       RET                     ; now return

DEFINE CLRASCII <BYTE (7) .CHESC,"H",.CHESC,"J",0> ; ASCII screen clear
DEFINE CLRANSI <[BYTE (7) .CHESC,"[","H",.CHESC,"[","J",0]> ; ANSI standard
DEFINE FORMFEED <BYTE (7) .CHFFD,0>     ;Traditional screen clear

CLRSCN: 0                       ; 0 TTY33
       0                       ; 1 TTY35
       0                       ; 2 TTY37
       0                       ; 3 TI
       BYTE (7) .CHCNZ,0       ; 4 ADM-3A
       BYTE (7) .CHCRB,.CHCCF,0 ; 5 Datamedia 2500
       CLRANSI                 ; 6 VT132
       FORMFEED                ; 7 Concept 100
       0                       ; 8 default
       0                       ; 9 PTY, NVT (aka "ideal")
       BYTE (7) .CHCRB,.CHCUN,.CHCUN,.CHCUN,0 ; 10 VT05
       CLRASCII                ; 11 VT50
       0                       ; 12 LA30
       BYTE (7) .CHCRB,.CHCUN,0 ; 13 GT40
       0                       ; 14 LA36
       CLRASCII                ; 15 VT52
       CLRANSI                 ; 16 VT100
       0                       ; 17 LA38
       0                       ; 18 LA120
       BYTE (7) 176,.CHCBS,0   ; 19 Hazeltine 1500
       FORMFEED                ; 20 C108
       FORMFEED                ; 21 CG108
       BYTE (7) .CHCNY,.CHVTB,0 ; 22 Datamedia 1520
       BYTE (7) .CHESC,"+",0   ; 23 Soroc 120
       CLRASCII                ; 24 HP264x
       BYTE (7) .CHCNX,.CHCNW,0 ; 25 VC404
       CLRANSI                 ; 26 WICAT/T7000
       CLRANSI                 ; 27 ANSI
       BYTE (7) .CHCNZ,0       ; 28 ADM-5
       CLRANSI                 ; 29 Selanar VT100
       CLRANSI                 ; 30 Retrographics V1 VT100
       CLRANSI                 ; 31 Retrographics V2 VT100
       FORMFEED                ; 32 ADDS Viewpoint
       [BYTE (7) "`","E","R","A",";",0] ; 33 Tektronix 4025
       BYTE (7) .CHESC,"*",0   ; 34 Televideo 912
       CLRANSI                 ; 35 VT125
       CLRANSI                 ; 36 VK100 (GIGI)
       CLRANSI                 ; 37 VT102
       CLRASCII                ; 38 H19
       CLRANSI                 ; 39 VT131
       CLRANSI                 ; 40 VT200
       FORMFEED                ; 41 Glass Teletype
       BYTE (7) .CHESC,.CHFFD  ; 42 Tektronix 4014
       0                       ; 43 reserved for customer definition
       0                       ; 44 reserved for customer definition
       0                       ; 45 reserved for customer definition
       0                       ; 46 reserved for customer definition
       0                       ; 47 reserved for customer definition
       0                       ; 48 reserved for customer definition
       0                       ; 49 reserved for customer definition
       0                       ; 50 reserved for customer definition
       0                       ; 51 reserved for customer definition
       CLRANSI                 ; 52 VT300
       0                       ; 53 reserved for Digital defintion
       0                       ; 54 reserved for Digital defintion
       0                       ; 55 reserved for Digital defintion
       0                       ; 56 reserved for Digital defintion
       0                       ; 57 reserved for Digital defintion
       0                       ; 58 reserved for Digital defintion
       0                       ; 59 reserved for Digital defintion
       0                       ; 60 reserved for Digital defintion
       0                       ; 61 reserved for Digital defintion
       0                       ; 62 reserved for Digital defintion
NCLRSC==.-CLRSCN                ; maximum # of terminal types

       END