Google
 

Trailing-Edge - PDP-10 Archives - bb-j710b-bm_tops20_v41_tools - tools/sed/sedv10.mac
There are 2 other files named sedv10.mac in the archive. Click here to see a list.
TITLE	SEDV10 - VT100 TERMINAL DEFINITION FILE 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: .LOAD SEDSYM,SEDV10,SED
;		     .SS 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:	OVT100	;ADDRESS OF THE TERMINAL TABLE TO USE

;VT100 TERMINAL OUTPUT TABLE
;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 TO END OF PAGE
	BYTE (7) 33,"[","K"	;CLEAR TO END OF 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
	VEXIT			;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 LINE (USES LIMITED SCROLLING REGION)

ILVT10:	PUSH	P,T2		;SAVE T2
	PUSHJ	P,LVT100	;SET UP THE SCROLLING REGION
	MOVSI	T1,(BYTE (7) 33,"[")
	PUSHJ	P,PUTSQ1
	PUSHJ	P,GETROW	;GET THE CURRENT ROW
	PUSHJ	P,PUTNUM	;AND OUTPUT DECIMAL IN ASCII
	MOVE	T1,[BYTE (7) ";","0","H",33,"M"]
	PUSHJ	P,PUTSQ1	;AND MAKE SURE WE ARE THERE
	JRST	RVT100		;NOW RESTORE THE INITIAL STATE

;DELETE 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
	PUSH	P,T2		;SAVE T2
	PUSHJ	P,LVT100	;SET UP THE SCROLLING REGION
	MOVEI	T1,[BYTE (7) 33,"[","2","4",";"
		    BYTE (7) "0","H",33,"D"]
	PUSHJ	P,PUTSTG

RVT100:	MOVEI	T1,[BYTE (7) 33,"[","0",";","2"
		    BYTE (7) "4","r",33,"8"]
	PUSHJ	P,PUTSTG
	POP	P,T2		;RESTORE T2
	JRST	PUTTYP		;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
	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:	MOVE	T1,[BYTE (7) 33,"=",33,"<"]
	PUSHJ	P,PUTSQ1	;ASSUME VT52, SET VT100 (+ ALTERNATE KEYPAD)
	JRST	PUTTYP

;ROUTINE CALLED ON VT100 EXIT: RESTORE KEYPAD TO NON-APPLICATION MODE

VEXIT:
;	MOVE	T1,[BYTE (7) 33,"[","?","2","l"]
;	PUSHJ	P,PUTSQ1	;RESET BACK TO A VT52
	MOVSI	T1,(BYTE (7) 33,">")
	PUSHJ	P,PUTSQ1	;GET OUT OF ALTERNATE KEYPAD MODE
	JRST	PUTTYP

;TERMINAL INPUT TABLE - TELLS WHICH CHARACTER SEQUENCES
;INVOKE WHICH COMMANDS

IFE FTFAST,<
		0			;CODE FOR RUBOUT (0==RESET)
IVT100:	EXP	40, 1, 2, 3, 4, 5, 6, 7 ;NOTHING SPECIAL
	EXP	42,11,50,13,14,15,16,17
	EXP	20,21,22,23,24,25,26,27
	EXP	30,31,32
	-SIZ.I1,,ISUBTB			;ESCAPE NEEDS A SUBTABLE
	EXP		 62,35,63,37
>
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

		 0			;COMMAND FOR RUBOUT (RESET)
IVT100:	EXP	40,21, 2, 3, 4, 5, 6, 7 ;NOTHING SPECIAL
	EXP	42,11,50, 1,23,15,16,17
	EXP	20, 0,22, 0,24,25,26,27
	EXP	30,31,32
	-SIZ.I1,,ISUBTB			;ESCAPE NEEDS A SUBTABLE
	EXP		 62,35,63,37
>
;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
	51,,"S" 	;ESCAPE S == SET-TABS
	51,,"s" 	;ESCAPE s == SET-TABS
IFN FTFAST,<
	13,,"L"		;ESCAPE L == SLIDE-LEFT
	14,,"T"		;ESCAPE T == SLIDE-RIGHT
	13,,"l"		;ESCAPE l == SLIDE-LEFT
	14,,"t"		;ESCAPE t == SLIDE-RIGHT
>
SIZ.I1==.-ISUBTB

XVT100:	36,,"A"		;ESCAPE [ A == UP
	34,,"B"		;ESCAPE [ B == DOWN
	35,,"C"		;ESCAPE [ C == RIGHT
	10,,"D"		;ESCAPE [ D == LEFT
	0

SVT100:	33,,"P"		;ESCAPE O P == ENTER
	37,,"R"		;ESCAPE O R == HOME
	40,,"Q"		;ESCAPE O Q == RECALL
	41,,"M"		;ESCAPE O M == INSERT-MODE
	55,,"S"		;ESCAPE O S == SAVE-FILE

	36,,"A"		;ESCAPE O A == UP
	34,,"B"		;ESCAPE O B == DOWN
	35,,"C"		;ESCAPE O C == RIGHT
	10,,"D"		;ESCAPE O D == LEFT

	57,,"t"		;ESCAPE O t == START-OF-LINE
	60,,"v"		;ESCAPE O v == END-OF-LINE
	52,,"x"		;ESCAPE O x == UP-TAB
	53,,"r"		;ESCAPE O r == DOWN-TAB
	61,,"n"		;ESCAPE O n == ERASE-WORD
	43,,"p"		;ESCAPE O p == REAL-TAB
	44,,"w"		;ESCAPE O w == MARK
	46,,"y"		;ESCAPE O y == CASE
	54,,"u"		;ESCAPE O u == REWRITE SCREEN
	47,,"q"		;ESCAPE O q == WINDOW
IFN FTFAST,<
	13,,"m"		;ESCAPE O m == SLIDE-LEFT
	14,,"l"		;ESCAPE O l == SLIDE-RIGHT
>
	56,,"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

	END