Google
 

Trailing-Edge - PDP-10 Archives - BB-M836A-BM - 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

;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

COMMENT \
                      THE TERMINAL INPUT TABLE

     The terminal input table maps sequences of  characters  arriving
from  the  terminal  into  the  internal editor commands.  The editor
commands are described below.  The commands are organized with regard
to  their position on the typewriter keyboard, and not alphabetically.

     Note:  all  values pertaining to characters are in octal in this
listing.

  INTERNAL                    "USUAL"
    CODE       COMMAND       SEQUENCE  FUNCTION
\
$CURUP== 36 ; CURSOR UP               Move the cursor up
$CURDN== 34 ; CURSOR DOWN             Move the cursor down
$CURLF== 10 ; CURSOR-LEFT      ^H     Move the cursor to the left
$CURRT== 35 ; CURSOR RIGHT            Move the cursor to the right
$CURHM== 37 ; CURSOR HOME             Move the cursor to the upper left
$RETRN== 15 ; CARRIAGE-RETURN  ^M     Good ol' ASCII carriage return
$TAB==   11 ; TAB              ^I     Move cursor to the next tab stop
$BKTAB== 25 ; BACKTAB          ^U     Move cursor to the previous tab stop
$UPTAB== 52 ; UP-TAB                  Up-tab (6 cursor-ups)
$DNTAB== 53 ; DOWN-TAB                Down-tab (6 cursor-downs)
$LINE==  45 ; LINE                    Move to beginning or end of line
$BLINE== 57 ; BEGIN-LINE              Move to beginning of line
$ELINE== 60 ; END-LINE                Move to end of line

$RLFWP== 31 ; ROLL-FORW-PAGES  ^Y     Move window forward some pages
$RLFWL== 24 ; ROLL-FORW-LINES  ^T     Move window forward some lines
$RLBKP== 21 ; ROLL-BACK-PAGES  ^Q     Move window back some pages
$RLBKL== 27 ; ROLL-BACK-LINES  ^W     Move window back some lines
$SLDLF== 13 ; SLIDE-LEFT       ^K     Move viewing window to the left
$SLDRT== 14 ; SLIDE-RIGHT      ^L     Move viewing window to the right

$INSSP==  1 ; INSERT-SPACES    ^A     Add some spaces at the cursor
$DELSP== 23 ; DELETE-SPACES    ^S     Remove some characters from a line
$INSLN==  4 ; INSERT-LINES     ^D     Add some blank lines at the cursor
$DELLN==  6 ; DELETE-LINES     ^F     Remove some lines at the cursor
$PICK==  26 ; PICK             ^V     Load buffer with text from the file
$PUT==    7 ; PUT              ^G     Add text to the file

$ERSLN== 50 ; ERASE-LINE       ^J     Erase from cursor to end of the line
$CLRLN== 12 ; CLEAR-LINE       ^J     Erase the line below the cursor
$DELCH== 42 ; DELETE-PREV-CHAR        Delete char to left of cursor
$ERSWD== 61 ; ERASE-WORD              Erase previous word

$SRCFW== 22 ; SEARCH-FORWARD   ^R     Search from cursor to end of file
$SRCBK==  5 ; SEARCH-BACK      ^E     Search from cursor to start of file
$SUBST== 63 ; SUBSTITUTE	      Search for a string & substitute another

$SETFI==  2 ; SET-FILE         ^B     Set up a new file for editing
$EXIT==  32 ; EXIT             ^Z     Save file and exit
$ABORT==  3 ; ABORT            ^C     Exit, forgetting changes

$ENTER== 33 ; ENTER            ESCAPE Set up an argument for a command
$RECAL== 40 ; RECALL                  Recall latest argument
$MARK==  44 ; MARK                    Mark position for PICK or CLOSE

$SWTCH== 16 ; SWITCH           ^N     Set operating switches, etc.
$ENTCC== 17 ; ENTER-CTRL-CHAR  ^O     Make the next char typed a ctrl chr
$GOTO==  20 ; PERCENT-GOTO     ^P     Move window to a percent of the line
$RESET==  0 ; RESET            RUBOUT Rewrite cursor, line, or screen
$INMOD== 41 ; INSERT-MODE             Insert/replace toggle
$RLTAB== 43 ; REAL-TAB                Insert a real tab (Same as E-C-C I)
$CASE==  46 ; CASE                    Change case of letter at cursor
$WINDW== 47 ; WINDOW                  Set or clear windowing
$REWRT== 54 ; REWRITE                 Rewrite screen (Same as $^RESET)
$SAVE==  55 ; SAVE-FILE               Save file
$HELP==  56 ; HELP                    Give help (Same as ENTER ENTER)
$PUSH==  62 ; PUSH                    Push to EXEC (TOPS-20 only)
$EXEC==  30 ; EXECUTE          ^X     Execute a sequence of commands

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
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
>
	MOVE	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:	MOVE	T1,[BYTE (7) 33,">"]
	PUSHJ	P,PUTSQ1
	JRST	PUTTYP

;POSITIONING ALGORITHMS

VT5PSC:	MOVE	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:	MOVE	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
	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:	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",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:	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
	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 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

;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,<
	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
	EXP	-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
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.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