Trailing-Edge
-
PDP-10 Archives
-
bb-j710b-bm_tops20_v41_tools
-
tools/sed/sedv2.mac
There are 2 other files named sedv2.mac in the archive. Click here to see a list.
TITLE SEDV2 - VT52 AND VT100 TERMINAL DEFINITIONS FOR SED
SUBTTL A CHRISTOPHER HALL FECIT
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1981,1982 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
;LOAD THE EDITOR BY: .COM SED,SEDV2
; .LOAD SEDV2,SED
SEARCH SEDSYM
IFE TOPS10,<SEARCH MONSYM>
EXTERN CPOPJ,PUTSQ1,PUTNUM,PUTTYP,PUTSTG,TRMNAM,HOMPOS
INTERN TERMNL
FTFAST==1 ;SET THIS IF TERMINAL SENDS OUT XON-XOFF'S
TERMNL: OVT52 ;ADDRESSES OF THE TERMINAL TABLES TO USE
OVT100
OVT52: BYTE (7) 33,"A" ;CURSOR UP
BYTE (7) 33,"B" ; DOWN
BYTE (7) 33,"C" ; RIGHT
BYTE (7) 10 ; LEFT
BYTE (7) 33,"H" ; HOME
BYTE (7) 33,"J" ;CLEAR PAGE
BYTE (7) 33,"K" ;CLEAR LINE
BYTE (7) 12 ;ROLL UP AND CLEAR LINE
BYTE (7) 33,"I" ;ROLL DOWN AND CLEAR LINE
CPOPJ ;PROTECT ON (NONE FOR A VT52)
CPOPJ ;PROTECT OFF
0 ;INSERT LINE (NONE)
0 ;INSERT SPACE (NONE)
0 ;DELETE LINE (NONE)
0 ;DELETE SPACE (NONE)
BYTE (7) 33,"Y","7"," " ;MOVE TO BOTTOM
BYTE (7) 33,"H",33,"J" ;HOME AND CLEAR PAGE
VT5PSC ;ROUTINE TO POSITION TO CHARACTER
VT5PSL ;ROUTINE TO POSITION TO START OF LINE
^D24 ;LINES PER PAGE
^D80 ;CHARACTERS PER LINE
IFE FTFAST,<
MRK!TBS!SLW ;FLAGS (NO PROTECT, HARD TABS)
>
IFN FTFAST,<
MRK!TBS!NPG!SLW ;FLAGS (NO PROTECT, HARD TABS, KEEP TTY PAGE)
>
TENTRY ;ROUTINE TO CALL ON ENTRY
TEXIT ;ROUTINE TO CALL ON EXIT
0 ;NO NULLS NEEDED
IVT52 ;ADDRESS OF INPUT CHARACTER TABLE
"~" ;MARK TO DISPLAY ON ENTER
IFE FTFAST,<
EXP $RESET ;RUBOUT
IVT52: EXP $RECAL, $INSSP, $SETFI ; 0, A, B
EXP $ABORT, $INSLN, $SRCBK, $DELLN ;C, D, E, F
EXP $PUT, $DELCH, $TAB, $ERSLN ;G, H, I, J
EXP $SLDLF, $SLDRT, $RETRN, $SWTCH ;K, L, M, N
EXP $ENTCC, $GOTO, $RLBKP, $SRCFW ;O, P, Q, R
EXP $DELSP, $RLFWL, $BKTAB, $PICK ;S, T, U, V
EXP $RLBKL, $EXEC, $RLFWP, $EXIT ;W, X, Y, Z
EXP -SIZ.IS,,I.VT52 ;ESCAPE
EXP $PUSH, $CURRT, $SUBST, $SAVE ;\, ], ^, _
>
IFN FTFAST,<
;THIS TABLE SETS UP THE KEYBOARD ARRANGEMENT FOR WHEN YOU NEED TO KEEP
;TTY PAGE IN EFFECT BECAUSE THE TERMINAL SENDS OUT ITS OWN CONTROL S AND Q'S
;THOSE TWO CHARACTERS CANNOT BE COMMANDS SINCE SED DOES NOT KNOW WHETHER THE
;USER HAS TYPED THEM OR THEY WERE SENT BY THE TERMINAL.
;SO Q GOES TO A, A AND S GO TO K AND L, K TO ESCAPE-L, AND L TO ESCAPE-T
EXP $RESET ;RUBOUT
IVT52: EXP $RECAL, $RLBKP, $SETFI ; 0, A, B
EXP $ABORT, $INSLN, $SRCBK, $DELLN ;C, D, E, F
EXP $PUT, $DELCH, $TAB, $ERSLN ;G, H, I, J
EXP $INSSP, $DELSP, $RETRN, $SWTCH ;K, L, M, N
EXP $ENTCC, $GOTO, 0, $SRCFW ;O, P, Q, R
EXP 0, $RLFWL, $BKTAB, $PICK ;S, T, U, V
EXP $RLBKL, $EXEC, $RLFWP, $EXIT ;W, X, Y, Z
-SIZ.IS,,I.VT52 ;ESCAPE
EXP $PUSH, $CURRT, $SUBST, $SAVE ;\, ], ^, _
>
I.VT52: $ENTER,,"P" ;ESCAPE P == ENTER
$CURHM,,"R" ;ESCAPE R == HOME
$CURUP,,"A" ;ESCAPE A == UP
$CURDN,,"B" ;ESCAPE B == DOWN
$CURRT,,"C" ;ESCAPE C == RIGHT
$CURLF,,"D" ;ESCAPE D == LEFT
$RECAL,,"Q" ;ESCAPE Q == RECALL
IAVT52,,"?" ;ESCAPE ? == CHECK SOME MORE
$TBSET,,"S" ;ESCAPE S == SET-TABS
$TBSET,,"s" ;ESCAPE s == SET-TABS
IFN FTFAST,<
$SLDLF,,"L" ;ESCAPE L == SLIDE-LEFT
$SLDRT,,"T" ;ESCAPE T == SLIDE-RIGHT
$SLDLF,,"l" ;ESCAPE l == SLIDE-LEFT
$SLDRT,,"t" ;ESCAPE t == SLIDE-RIGHT
>
SIZ.IS=.-I.VT52
IAVT52: $BLINE,,"t" ;ESCAPE ? t == START-OF-LINE
$ELINE,,"v" ;ESCAPE ? v == END-OF-LINE
$DNTAB,,"r" ;ESCAPE ? r == DOWN-TAB
$UPTAB,,"x" ;ESCAPE ? x == UP-TAB
$CASE ,,"y" ;ESCAPE ? y == CASE
$ERSWD,,"n" ;ESCAPE ? n == ERASE-WORD
$RLTAB,,"p" ;ESCAPE ? p == REAL-TAB
$MARK ,,"w" ;ESCAPE ? w == MARK
$INMOD,,"M" ;ESCAPE ? M == INSERT-MODE
$REWRT,,"u" ;ESCAPE ? u == REWRITE SCREEN
$WINDW,,"q" ;ESCAPE ? q == WINDOW
$HELP ,,"s" ;ESCAPE ? s == HELP
0
;ROUTINE CALLED ON ENTRY: DECIDE WHETHER IT'S A VT52 OR VT100
;IF VT52, SET UP KEYPAD IN APPLICATION MODE; DONE
IFN TOPS10,<
TENTRY: MOVE T1,[2,,TRMBLK] ;READ SIXBIT TERMINAL TYPE INTO T1
TRMOP. T1,
JFCL
CAMN T1,[SIXBIT /VT100/]
JRST VENTRY ;IF IT'S A VT100 HANDLE SEPARATELY
CAME T1,[SIXBIT /VT52/]
JRST TENERR ;ELSE IF NOT A VT52 THERE'S A PROBLEM
>
IFE TOPS10,<
TENTRY: MOVEI T1,.PRIIN ;READ TERMINAL TYPE
GTTYP
CAIN T2,20 ;VT100?
JRST VENTRY ;YES - SET UP SPECIALLY
CAIE T2,17 ;VT52?
JRST TENERR ;NO - DON'T KNOW WHAT TO DO
>
MOVSI T1,(BYTE (7) 33,"=")
PUSHJ P,PUTSQ1
JRST PUTTYP
IFN TOPS10,<
TENERR: OUTSTR [ASCIZ /Terminal is not a VT52 or VT100
/]
EXIT ;VERY HOSTILE IF ILLEGAL TERMINAL
>
IFE TOPS10,<
TENERR: MOVEI T1,[ASCIZ /Terminal is not a VT52 or VT100
/]
PSOUT
HALTF ;VERY HOSTILE IF ILLEGAL TERMINAL
>
;ROUTINE CALLED ON EXIT: RESTORE KEYPAD TO NON-APPLICATION MODE
TEXIT: MOVSI T1,(BYTE (7) 33,">")
PUSHJ P,PUTSQ1
JRST PUTTYP
;POSITIONING ALGORITHMS
VT5PSC: MOVSI T1,(BYTE (7) 33,"Y")
PUSHJ P,PUTSQ1 ;START IT OFF
MOVEI T1,40(RW) ;GET ROW POSITION
IDPB T1,TY
MOVEI T1,40(CM) ;GET COLUMN POSITION
IDPB T1,TY
POPJ P, ;DONE
VT5PSL: MOVSI T1,(BYTE (7) 33,"Y")
PUSHJ P,PUTSQ1 ;START IT OFF
MOVEI T1,40(T4) ;GET ROW POSITION
IDPB T1,TY
MOVEI T1,40 ;MOVE TO COLUMN ZERO
IDPB T1,TY
POPJ P,
;TERMINAL TABLES FOR THE VT100
;NOTE: THE WRP FLAG SHOULD NOT BE SET WHETHER OR NOT THE VT100 HAS WRAPAROUND
OVT100: BYTE (7) 33,"[","A" ;CURSOR UP
BYTE (7) 33,"[","B" ; DOWN
BYTE (7) 33,"[","C" ; RIGHT
BYTE (7) 33,"[","D" ; LEFT
BYTE (7) 33,"[","H" ; HOME
BYTE (7) 33,"[","J" ;CLEAR PAGE
BYTE (7) 33,"[","K" ;CLEAR LINE
BYTE (7) 33,"D" ;ROLL UP AND CLEAR LINE
BYTE (7) 33,"M" ;ROLL DOWN AND CLEAR LINE
BYTE (7) 33,"[","7","m" ;PROTECT ON
BYTE (7) 33,"[","0","m" ;PROTECT OFF
ILVT10 ;INSERT LINE
0 ;INSERT SPACE (NONE)
DLVT10 ;DELETE LINE
0 ;DELETE SPACE (NONE)
3777,,[BYTE (7) 33,"[","2","4",";","1","H"] ;MOVE TO BOTTOM
HVT100 ;HOME AND CLEAR PAGE
POSCUR ;ROUTINE TO POSITION TO CHARACTER
POSLIN ;ROUTINE TO POSITION TO START OF LINE
^D24 ;LINES PER PAGE
^D80 ;CHARACTERS PER LINE
IFE FTFAST,<
SLW!TBS ;FLAGS (SLOW TTY,TTY WRAPS,HARDWARE TABS)
>
IFN FTFAST,<
NPG!SLW!TBS ;FLAGS (KEEP TTY PAGE AND ONES ABOVE)
>
VENTRY ;ROUTINE TO CALL ON ENTRY
TEXIT ;ROUTINE TO CALL ON EXIT
0,,0 ;NO NULLS NEEDED
IVT100 ;ADDRESS OF INPUT CHARACTER TABLE
HVT100: MOVEI T1,[BYTE (7) 33,"[","H",33,"[" ;HOME AND CLEAR PAGE
BYTE (7) "J"]
PUSHJ P,PUTSTG
PUSHJ P,PUTTYP ;OUTPUT IT NOW
MOVEI T1,^D0100 ;DELAY JUST A LITTLE
IFN TOPS10,<
HIBER T1,
JFCL
>
IFE TOPS10,<
DISMS
>
POPJ P, ;THEN RETURN
;INSERT (T4) LINES (USES LIMITED SCROLLING REGION)
ILVT10: PUSHJ P,LVT100 ;SET UP THE SCROLLING REGION
MOVSI T1,(BYTE (7) 33,"[")
PUSHJ P,PUTSQ1
PUSHJ P,GETROW ;GET THE CURRENT ROW IN T1
PUSHJ P,PUTNUM ;AND OUTPUT DECIMAL IN ASCII
MOVE T1,[BYTE (7) ";","0","H"]
PUSHJ P,PUTSQ1 ;AND MAKE SURE WE ARE THERE
PUSH P,T4
ILVT1A: MOVE T1,[BYTE (7) 33,"M"]
PUSHJ P,PUTSQ1 ;INSERT A LINE
SOJG T4,ILVT1A ;LOOP TO INSERT ALL THE LINES
PUSHJ P,RVT100 ;NOW RESTORE THE INITIAL STATE
POP P,T4
SOJLE T4,RVT100 ;JUMP IF ONLY ONE LINE
ILVT1B: MOVE T1,[BYTE (7) 33,"[","B"]
PUSHJ P,PUTSQ1 ;ELSE MOVE DOWN ONE LESS TIME THAN LINES
SOJG T4,ILVT1B ;LOOP TO INSERT ALL THE LINES
POPJ P, ;DONE
;DELETE ONE LINE (USES LIMITED SCROLLING REGION)
DLVT10: MOVE T1,LPP(TM) ;ON THE BOTTOM LINE?
CAIN T1,1(RW)
JRST [MOVE T1,[BYTE (7) 33,"[","K"]
JRST PUTSQ1] ;YES - JUST CLEAR IT OUT AND RETURN
PUSHJ P,LVT100 ;SET UP THE SCROLLING REGION
MOVEI T1,[BYTE (7) 33,"[","2","4",";"
BYTE (7) "0","H",33,"D"]
PUSHJ P,PUTSTG
PUSHJ P,RVT100
JRST PUTTYP ;OUTPUT AND RETURN
RVT100: MOVEI T1,[BYTE (7) 33,"[","0",";","2"
BYTE (7) "4","r",33,"8"]
JRST PUTSTG ;OUTPUT AND RETURN
;SET UP SCROLLING REGION FOR INSERT OR DELETE LINES
LVT100: MOVE T1,[BYTE (7) 33,"7",33,"["]
PUSHJ P,PUTSQ1
PUSHJ P,GETROW ;GET THE CURRENT ROW IN T1
PUSHJ P,PUTNUM ;OUTPUT DECIMAL NUMBER IN ASCII
MOVE T1,[BYTE (7) ";","2","4","r"]
JRST PUTSQ1
GETROW: MOVEI T1,1(RW) ;GET THE CURRENT ROW
ADD T1,HOMPOS ;ADD WINDOW OFFSET, IF ANY
JUMPE CM,CPOPJ ;IS THE CURSOR AT THE START OF THE ROW?
AOJA T1,CPOPJ ;NO - START ONE ROW FARTHER DOWN AND RETURN
;ROUTINE CALLED ON VT100 ENTRY: SET UP KEYPAD IN APPLICATION MODE
VENTRY: HRR TM,TERMNL+1 ;SET UP THE VT100'S TABLES
MOVE T1,[BYTE (7) 33,"=",33,"<"]
PUSHJ P,PUTSQ1 ;ASSUME VT52, SET VT100 (+ ALTERNATE KEYPAD)
SKIPN T1,TRMNAM ;DID THE USER TYPE A /Z SWITCH?
JRST PUTTYP
CAMN T1,[SIXBIT /G/] ;WANT A GIGI INSTEAD OF A VT100?
JRST VENTR1 ;YES - SET UP FOR IT
CAME T1,[SIXBIT /GIGI/]
JRST PUTTYP ;NO - LEAVE IT A VT100
VENTR1: SETZM OVT100+ILN ;YES - VT100 CAN'T INSERT AND DELETE LINES
SETZM OVT100+DLN ; SO SAY IT CAN'T BE DONE
MOVE T1,[3777,,[BYTE (7) 33,"[","3","1",";","4","4","m"]]
MOVEM T1,OVT100+PON ;CHANGE DISPLAY OF PROTECT-ON
JRST PUTTYP ;OUTPUT EVERYTHING AND RETURN
;TERMINAL INPUT TABLE - TELLS WHICH CHARACTER SEQUENCES
;INVOKE WHICH COMMANDS
IFE FTFAST,<
EXP $RESET ;RUBOUT
IVT100: EXP $RECAL, $INSSP, $SETFI ; 0, A, B
EXP $ABORT, $INSLN, $SRCBK, $DELLN ;C, D, E, F
EXP $PUT, $DELCH, $TAB, $ERSLN ;G, H, I, J
EXP $SLDLF, $SLDRT, $RETRN, $SWTCH ;K, L, M, N
EXP $ENTCC, $GOTO, $RLBKP, $SRCFW ;O, P, Q, R
EXP $DELSP, $RLFWL, $BKTAB, $PICK ;S, T, U, V
EXP $RLBKL, $EXEC, $RLFWP, $EXIT ;W, X, Y, Z
-SIZ.I1,,ISUBTB ;ESCAPE
EXP $PUSH, $CURRT, $SUBST, $CURHM ;\, ], ^, _
>
IFN FTFAST,<
;THIS TABLE SETS UP THE KEYBOARD ARRANGEMENT FOR WHEN YOU NEED TO KEEP
;TTY PAGE IN EFFECT BECAUSE THE TERMINAL SENDS OUT ITS OWN CONTROL S AND Q'S
;THOSE TWO CHARACTERS CANNOT BE COMMANDS SINCE SED DOES NOT KNOW WHETHER THE
;USER HAS TYPED THEM OR THEY WERE SENT BY THE TERMINAL.
;SO Q GOES TO A, A AND S GO TO K AND L, K TO ESCAPE-L, AND L TO ESCAPE-T
EXP $RESET ;RUBOUT
IVT100: EXP $RECAL, $RLBKP, $SETFI ; 0, A, B
EXP $ABORT, $INSLN, $SRCBK, $DELLN ;C, D, E, F
EXP $PUT, $DELCH, $TAB, $ERSLN ;G, H, I, J
EXP $INSSP, $DELSP, $RETRN, $SWTCH ;K, L, M, N
EXP $ENTCC, $GOTO, 0, $SRCFW ;O, P, Q, R
EXP 0, $RLFWL, $BKTAB, $PICK ;S, T, U, V
EXP $RLBKL, $EXEC, $RLFWP, $EXIT ;W, X, Y, Z
-SIZ.I1,,ISUBTB ;ESCAPE
EXP $PUSH, $CURRT, $SUBST, $CURHM ;\, ], ^, _
>
;SUBTABLE. PUT THE MOST FREQUENTLY-USED SEQUENCES FIRST
;ENTER IS PROBABLY THE MOST COMMON OF ALL
ISUBTB: XVT100,,"[" ;ESCAPE [ == READ NEXT CHAR
SVT100,,"O" ;ESCAPE O == READ NEXT CHAR
$TBSET,,"S" ;ESCAPE S == SET-TABS
$TBSET,,"s" ;ESCAPE s == SET-TABS
SIZ.I1==.-ISUBTB
XVT100: $CURUP,,"A" ;ESCAPE [ A == UP
$CURDN,,"B" ;ESCAPE [ B == DOWN
$CURRT,,"C" ;ESCAPE [ C == RIGHT
$CURLF,,"D" ;ESCAPE [ D == LEFT
0
SVT100: $ENTER,,"P" ;ESCAPE O P == ENTER
$CURHM,,"R" ;ESCAPE O R == HOME
$RECAL,,"Q" ;ESCAPE O Q == RECALL
$INMOD,,"M" ;ESCAPE O M == INSERT-MODE
$SAVE,,"S" ;ESCAPE O S == SAVE-FILE
$CURUP,,"A" ;ESCAPE O A == UP
$CURDN,,"B" ;ESCAPE O B == DOWN
$CURRT,,"C" ;ESCAPE O C == RIGHT
$CURLF,,"D" ;ESCAPE O D == LEFT
$BLINE,,"t" ;ESCAPE O t == START-OF-LINE
$ELINE,,"v" ;ESCAPE O v == END-OF-LINE
$DNTAB,,"r" ;ESCAPE O r == DOWN-TAB
$UPTAB,,"x" ;ESCAPE O x == UP-TAB
$ERSWD,,"n" ;ESCAPE O n == ERASE-WORD
$RLTAB,,"p" ;ESCAPE O p == REAL-TAB
$MARK,,"w" ;ESCAPE O w == MARK
$CASE,,"y" ;ESCAPE O y == CASE
$REWRT,,"u" ;ESCAPE O u == REWRITE SCREEN
$WINDW,,"q" ;ESCAPE O q == WINDOW
$SLDLF,,"m" ;ESCAPE O m == SLIDE-LEFT
$SLDRT,,"l" ;ESCAPE O l == SLIDE-RIGHT
$HELP,,"s" ;ESCAPE O s == HELP
0
;MOVE TO ROW (RW), COLUMN (CM)
POSCUR: MOVSI T1,(BYTE (7) 33,"[")
PUSHJ P,PUTSQ1 ;START IT OFF
MOVEI T1,1(RW) ;GET ROW POSITION
PUSHJ P,PUTNUM
MOVEI T1,";" ;THEN A SEMICOLON
IDPB T1,TY
MOVEI T1,1(CM) ;GET COLUMN POSITION
PUSHJ P,PUTNUM
MOVEI T1,"H" ;THEN AN H
IDPB T1,TY
POPJ P, ;DONE
;MOVE TO START OF LINE (T4)
POSLIN: MOVSI T1,(BYTE (7) 33,"[")
PUSHJ P,PUTSQ1 ;START IT OFF
MOVEI T1,1(T4) ;GET ROW POSITION
PUSHJ P,PUTNUM
MOVE T1,[ASCII /;0H/]
JRST PUTSQ1 ;MOVE TO FIRST COLUMN; DONE
IFN TOPS10,<
TRMBLK: 1041 ;BLOCK FOR READING THE TOPS10 TERMINAL TYPE
-1
>
END