Trailing-Edge
-
PDP-10 Archives
-
steco_19840320_1er_E35
-
10,5676/teco/source/tectvi.mac
There are 3 other files named tectvi.mac in the archive. Click here to see a list.
SUBTTL Introduction
; Copyright (c) 1980 Stevens Institute of Technology, Hoboken, New Jersey
; 07030.
; This software may be used and copied provided that this copyright notice
;is included, and provided that copies of all modifications are sent to:
;
; TECO Project
; Computer Center
; Stevens Institute of Technology
; Castle Point Station
; Hoboken, New Jersey 07030
;
;
; The information in this software is subject to change without notice
; and should not be construed as a commitment by Stevens Institute of
; Technology.
; Search needed universals
SEARCH TECUNV ; TECO universal file
; Generate the prologue
TECVER==200 ; Major version number
TECMIN==1 ; Minor version number
TECEDT==1126 ; Edit level
TECWHO==0 ; Last editor
PROLOGUE(TVI,<TECO TeleVideo terminal support>) ; Generate the TITLE and other stuff
$CODE ; Put into code PSECT
SUBTTL Table of Contents
;+
;.pag.lit
; Table of Contents for TECTVI - TELEVIDEO terminal support
;
;
; Section Page
; 1. Introduction . . . . . . . . . . . . . . . . . . . . . 1
; 2. Revision History . . . . . . . . . . . . . . . . . . . 3
; 3. Tables
; 3.1. TeleVideo TVI-912 . . . . . . . . . . . . . . 5
; 3.2. Fill table for TVI-912. . . . . . . . . . . . 6
; 4. Support routines
; 4.1. TeleVideo (TVI-912)
; 4.1.1. Initialization routine . . . . . . . 7
; 4.1.2. XY positioning . . . . . . . . . . . 8
; 4.1.3. Control U. . . . . . . . . . . . . . 9
; 4.1.4. Delete a line feed . . . . . . . . . 10
; 4.1.5. Insert character . . . . . . . . . . 11
; 4.2. Teleray -10/1061
; 4.2.1. Delete N lines . . . . . . . . . . . 12
; 4.2.2. Insert N lines . . . . . . . . . . . 13
; 4.3. TeleVideo (TVI-912)
; 4.3.1. Delete a character . . . . . . . . . 14
; 4.3.2. Cost initialization routine. . . . . 15
; 4.3.3. Insert character cost calculation. . 16
; 4.3.4. delete character cost calculation. . 17
; 4.3.5. Insert line cost calculation . . . . 18
; 4.3.6. Delete line cost calculation . . . . 19
; 4.3.7. Move cost calculation. . . . . . . . 20
; 4.3.8. Delete to end of line. . . . . . . . 21
; 5. Low segment. . . . . . . . . . . . . . . . . . . . . . 22
; 6. End of TECTVI. . . . . . . . . . . . . . . . . . . . . 23
;.end lit.pag
;-
SUBTTL Revision History
COMMENT |
1000 Start of this version
Start of Version 200A(1126)
|
; Macro to define a word of five characters
DEFINE TB(A<.CHNUL>,B<.CHNUL>,C<.CHNUL>,D<.CHNUL>,E<.CHNUL>)
< BYTE (7)A,B,C,D,E>
SUBTTL Tables -- TeleVideo TVI-912
CRTINI VTVI
CRTENT WID,^D79 ; Number characters wide
CRTENT LIN,^D24 ; Number of lines long
CRTENT BCK,<TB(.CHCNH)>
CRTENT SPC,<TB(.CHFFD)> ; Move one space
CRTENT DBS,<TB(" ",.CHCNH)> ; Destructive backspace
CRTENT DLF,<PUSHJ P,TVIDLF> ; Routine to delete a line feed
CRTENT CRB,<TB(.CHCNH)> ; Cancel a rubout
CRTENT ERS,<TB(.CHCNZ)> ; Erase the screen
CRTENT DEL,<PUSHJ P,TVIDEL> ; Delete to end of line
CRTENT DCH,<PUSHJ P,TVIDCH> ; Routine to delete a character
CRTENT ICH,<PUSHJ P,TVIICH> ; Routine to insert a character
CRTENT DLL,<PUSHJ P,TVIDLL> ; Routine to delete n lines
CRTENT INL,<PUSHJ P,TVIINL> ; Routine to insert n lines
CRTENT CTU,<PUSHJ P,TVICTU> ; Handle Control U
CRTENT XYP,<PUSHJ P,TVIXY> ; Do XY positioning
CRTENT CIN,<MOVX T1,<INSVL.(0,CS$DEP)>!<INSVL.($OPACH,CS$OPR)>> ; Initial cost
CRTENT CIC,<PUSHJ P,TVICIC> ; Cost to insert a character
CRTENT CDC,<PUSHJ P,TVICDC> ; Cost to delete a character
CRTENT CRP,<MOVX T1,<INSVL.(CS$REP,CS$CST)>!<INSVL.($OPRCH,CS$OPR)>> ; Cost to replace a character
CRTENT CIL,<PUSHJ P,TVICIL> ; Cost to insert a line
CRTENT CDL,<PUSHJ P,TVICDL> ; Cost to delete a line
CRTENT CPP,<PUSHJ P,TVICPP> ; Cost to move from point A to B
CRTENT CDE,<MOVEI T1,2> ; Cost to delete to end of line
CRTEND
SUBTTL Tables -- Fill table for TVI-912
; This table gives the fill times for a TVI-912
TVIFTB: FILTBL(100,100,25,25) ; Generate the table
SUBTTL Support routines -- TeleVideo (TVI-912) -- Initialization routine
;+
;.HL1 TVIINT
;This routine will initialize the terminal handling routines for the
;specific terminal. It will also initialize the TeleVideo (TVI-912) terminal
;.literal
;
; Usage:
; MOVEI CRT,CRT.block.address
; XCT $CRINT(CRT)
; (Return)
;
;.end literal
;-
TVIINT==:.POPJ
SUBTTL Support routines -- TeleVideo (TVI-912) -- XY positioning
;+
;.HL TVIXY
;This routine will do the positioning for the TeleVideo (TVI-912) terminal.
;.literal
;
; Usage:
; MOVE X,X.postion
; MOVE Y,Y.postion
; MOVE CRT,CRT.block.index
; PUSHJ P,@$CRXYP(CRT)
; (Return)
;
;.end literal
;-
TVIXY: DMOVE T1,CURPOS ; Get the current position
DMOVEM X,CURPOS ; Save the current position
SUB T1+$OFSX,X ; Determine if it is an up/down/right/left by one
SUB T1+$OFSY,Y ; movement
SKIPE T1+$OFSX ; Is the X zero ?
SKIPN T1+$OFSY ; Or the Y ?
SKIPA ; Yes - Handle differently
JRST TVIXYA ; No - Handle normally
SKIPN T1+$OFSY ; No change in the Y offset ?
JUMPE X,TVIXYC ; Yes - Only need a CR
MOVM T3,T1+$OFSX ; Get the X offset
SOJE T3,TVIXYX ; Just X by one
MOVM T3,T1+$OFSY ; Get the Y offset
SOJE T3,TVIXYY ; Just the Y by one
TVIXYA: SKIPN X ; Is this non-zero ?
JUMPE Y,TVIXYH ; Just home it
ADDX X," " ; Convert to a position
ADDX Y," " ; Convert to a position
MOVEI T1,[$STRING(<_[=^8/Y/^8/X/>)]
PJRST SC$STR ; Output the string
; Here to just home the cursor
TVIXYH: $SAVE <CH> ; Save CH
MOVX CH,.CHCCF ; Get the home character
PJRST SC$IMG ; And do the function
; Here to just output a CR
TVIXYC: $SAVE <CH> ; Save the current character
MOVX CH,.CHCRT ; Just output a CR
PJRST SC$IMG ; . . .
; Here to move in the X direction by one
TVIXYX: $SAVE <CH> ; Save Ch
SKIPG T1+$OFSX ; Is this negative ?
SKIPA CH,[EXP .CHFFD] ; No - To the right
MOVX CH,.CHCNH ; Yes, To the left
PJRST SC$IMG ; Output the string
; Here to move in the Y direction by one
TVIXYY: $SAVE <CH> ; Save CH
SKIPL T1+$OFSY ; Is this negative ?
SKIPA CH,[EXP .CHVTB] ; No - Move up
MOVX CH,.CHLFD ; Yes - Move down
PJRST SC$IMG ; Output the string
SUBTTL Support routines -- TeleVideo (TVI-912) -- Control U
;+
;.HL1 TVICTU
;This routine will process the control U in the command parser. It
;may be called without CRT being set up.
;.literal
;
; Usage:
; MOVE CRT,CRT.block.address
; PUSHJ P,@$CRCTU(CRT)
; (Return)
;
;.end literal
;-
TVICTU: MOVX T1,<BYTE (7).CHCRT,.CHESC,"t">
PUSHJ P,SC$STR ; Output the string to the terminal
MOVX CH,.CHCRT ; Get the ending character
PJRST T$OCHR ; Output the character
SUBTTL Support routines -- TeleVideo (TVI-912) -- Delete a line feed
;+
;.HL1 TVIDLF
;This routine will send the character string to delete a line feed.
;.literal
;
; Usage:
; MOVE CRT,CRT.block.address
; PUSHJ P,@$CRDLF(CRT)
; (Return)
;.end literal
;-
TVIDLF: $SAVE <CH> ; Save CH
MOVX CH,.CHVTB ; Get the character
PJRST SC$IMG ; Output the string
SUBTTL Support routines -- TeleVideo (TVI-912) -- Insert character
;+
;.HL1 TVIICH
;This routine will cause a character to be inserted. It is called
;with the character. It is assumed that the positioning has been done
;before this routine is called.
;.literal
;
; Usage:
; MOVX CH,Character
; MOVEI CRT,CRT.block.address
; XCT $CRICH(CRT)
;
;.end literal
;-
TVIICH: MOVX T1,<BYTE (7).CHESC,"Q"> ; Get the string to send
PUSHJ P,SC$STR ; Send it
CAXN CH," " ; Outputting a space?
AOJA X,TVII.1 ; Yes, don't bother typing it
PUSHJ P,SC$CHR ; Output the character
TVII.1: LOAD. T1,FILINC,+TVIFTB ; Get the insert char fill
PJRST SC$FIL ; Fill time
SUBTTL Support routines -- Teleray -10/1061 -- Delete N lines
;+
;.HL1 TVIDLL
;This routine will cause N lines to be deleted from the screen. It is
;called with a repeat count.
;.literal
;
; Usage:
; MOVEI T1,Repeat.count
; MOVEI CRT,CRT.block.address
; XCT $CRDLL(CRT)
; (Return)
;
;.end literal
;-
TVIDLL: $SAVE <P1> ; Save a register
MOVE P1,T1 ; Copy the repeat count
TVIDL0: MOVX T1,<BYTE (7).CHESC,"R"> ; Get the string to send
PUSHJ P,SC$STR ; Output the string
LOAD. T1,FILDLL,+TVIFTB ; Get the fill time
PUSHJ P,SC$FIL ; And wait a little
SOJG P1,TVIDL0 ; Loop for all lines
POPJ P, ; Return to the caller
SUBTTL Support routines -- Teleray -10/1061 -- Insert N lines
;+
;.HL1 TVIINL
;This routine will cause N lines to be inserted on the screen. It is
;called with a repeat count.
;.literal
;
; Usage:
; MOVEI T1,Repeat.count
; MOVEI CRT,CRT.block.address
; XCT $CRINL(CRT)
; (Return)
;
;.end literal
;-
TVIINL: $SAVE <P1> ; Save a register
MOVE P1,T1 ; Copy the repeat count into the register
TVIIN0: MOVX T1,<BYTE (7).CHESC,"E"> ; Get the string for insert line
PUSHJ P,SC$STR ; Output the string
LOAD. T1,FILINL,+TVIFTB ; Get the fill time for this operation
PUSHJ P,SC$FIL ; And wait for the terminal to complete
SOJG P1,TVIIN0 ; Loop
POPJ P, ; Return
SUBTTL Support routines -- TeleVideo (TVI-912) -- Delete a character
;+
;.HL1 TVIDCH
;This routine will cause n characters to be deleted from the screen.
;It is assumed that all cursor positioning has been done before this
;routine is called.
;.literal
;
; Usage:
; MOVX T1,Number.of.character.to.delete
; MOVEI CRT,CRT.block.address
; XCT $CRDCH(CRT)
; (Return)
;
;.end literal
;-
TVIDCH: $SAVE <P1> ; Save a register
MOVE P1,T1 ; Copy the counter
TVIDC0: MOVX T1,<BYTE (7).CHESC,"W"> ; Get the string
PUSHJ P,SC$STR ; Send the string
LOAD. T1,FILDLC,+TVIFTB ; Get the fill time
PUSHJ P,SC$FIL ; And fill until the terminal finishes
SOJG P1,TVIDC0 ; Loop for the number of characters
POPJ P, ; Return to the caller
SUBTTL Support routines -- TeleVideo (TVI-912) -- Cost initialization routine
;+
;.hl 1 TVICIN
; This routine will return the initial cost word for the character
;by character comparison of a line.
;.b.lit
;
; Usage:
; MOVE CRT,CRTTYP
; XCT $CRCIN(CRT)
; (return, first array element in T1)
;
;.end literal
;-
; Cost parameters
CS$INS==3 ; Insert a character
CS$DEL==2 ; Delete a character
CS$REP==1 ; Replace cost
CS$DLL==2 ; Delete a line
CS$ILL==2 ; Insert a line
SUBTTL Support routines -- TeleVideo (TVI-912) -- Insert character cost calculation
;+
;.hl 1 TVICIC
; This routine will return the cost of inserting a character in the
;screen.
;.b.lit
;
; Usage:
; MOVE T1,CST entry
; MOVX X,[XWD -n,Column]
; MOVE Y,[XWD -n,Row]
; MOVE CRT,CRTTYP
; XCT $CRCIC(CRT)
; (return, T1=CST entry
;
;.end literal
;-
TVICIC: LOAD. T1,FILINC,+TVIFTB ; Get the fill time
PUSHJ P,SC$CFL ; Get the cost of the fill chars
ADDX T1,<INSVL.(CS$INS,CS$CST)>!<INSVL.($OPICH,CS$OPR)> ; Cost to insert a character
POPJ P, ; And return
SUBTTL Support routines -- TeleVideo (TVI-912) -- delete character cost calculation
;+
;.hl 1 TVICDC
; This routine will return the cost of deleting a character in the
;screen.
;.b.lit
;
; Usage:
; MOVE T1,CST entry
; MOVX X,[XWD -n,Column]
; MOVE Y,[XWD -n,Row]
; MOVE CRT,CRTTYP
; XCT $CRCDC(CRT)
; (return, T1=CST entry
;
;.end literal
;-
TVICDC: LOAD. T1,FILDLC,+TVIFTB ; Get the fill time
PUSHJ P,SC$CFL ; Get the cost of the fill chars
ADDX T1,<INSVL.(CS$DEL,CS$CST)>!<INSVL.($OPDCH,CS$OPR)> ; Cost to delete a character
POPJ P, ; And return
SUBTTL Support routines -- TeleVideo (TVI-912) -- Insert line cost calculation
;+
;.hl 1 TVICIL
; This routine will return the cost of inserting a line in the
;screen.
;.b.lit
;
; Usage:
; MOVE T1,CST entry
; MOVX X,[XWD -n,Column]
; MOVE Y,[XWD -n,Row]
; MOVE CRT,CRTTYP
; XCT $CRCIL(CRT)
; (return, T1=CST entry
;
;.end literal
;-
TVICIL: LOAD. T1,FILINL,+TVIFTB ; Get the fill time
PUSHJ P,SC$CFL ; Get the cost of the fill chars
ADDX T1,<INSVL.(CS$ILL,CS$CST)>!<INSVL.($OPICH,CS$OPR)> ; Cost to insert a line
POPJ P, ; And return
SUBTTL Support routines -- TeleVideo (TVI-912) -- Delete line cost calculation
;+
;.hl 1 TVICDL
; This routine will return the cost of deleting a line in the
;screen.
;.b.lit
;
; Usage:
; MOVE T1,CST entry
; MOVX X,[XWD -n,Column]
; MOVE Y,[XWD -n,Row]
; MOVE CRT,CRTTYP
; XCT $CRCDL(CRT)
; (return, T1=CST entry
;
;.end literal
;-
TVICDL: LOAD. T1,FILDLL,+TVIFTB ; Get the fill time
PUSHJ P,SC$CFL ; And convert to characters
ADDX T1,<INSVL.(CS$DLL,CS$CST)>!<INSVL.($OPDCH,CS$OPR)> ; Cost to delete a line
POPJ P, ; And return it
SUBTTL Support routines -- TeleVideo (TVI-912) -- Move cost calculation
;+
;.hl 1 TVICPP
; This routine will return the cost of moving the cursor from
;one point to another.
;.b.lit
;
; Usage:
; MOVE T1,[XWD X pos,Y pos] ; Source position
; MOVE T2,[XWD X pos,Y pos]
; MOVE CRT,CRTTYP
; XCT $CRCPP(CRT)
; (return, T1= cost in characters)
;
;.end literal
;-
TVICPP: MOVE T3,T2 ; Get a copy of where we are moving to
XOR T3,T1 ; Xor together
JUMPE T3,.RET0 ; Zero if no movement
TXNN T3,LH.ALF ; Same X position line ?
JRST TVICPY ; Yes - Check more
TXNN T3,RH.ALF ; Same Y position ?
JRST TVICPX ; Yes - Check more
JUMPE T1,.RET2 ; If moving home return cost of one
TVICPA: MOVX T1,4 ; Have to type four characters
POPJ P, ; Return
; Here if possible same column movement
TVICPY: MOVEI T2,(T2) ; Get just the Y position
SUBI T2,(T1) ; Determine if just one line movement
MOVM T1,T2 ; . . .
SOJG T1,TVICPA ; More than one - use four
JRST .RET1 ; Else return one
; Here if possible same line movement
TVICPX: HLRZ T2,T2 ; Get just the X position
JUMPE T2,.RET1 ; If moving to the beginning of the line
; then return one
HLRZ T1,T1 ; See if moving only one position
SUBI T1,T2 ; . . .
MOVM T2,T1 ; Get the magntude
SOJG T2,TVICPA ; If more than one - return four
JRST .RET1 ; Else return one
SUBTTL Support routines -- TeleVideo (TVI-912) -- Delete to end of line
;+
;.hl1 TVIDEL
;.literal
;
; Usage:
; MOVEI T1,#of characters to delete
; XCT $CRDEL(CRT)
;
;.end literal
;-
TVIDEL: MOVX T1,<BYTE (7) .CHESC,"t">
PJRST SC$STR ; Type out the string
SUBTTL Low segment
$IMPURE ; Put in correct place
TVIBEG:!
LOWVER(TVI,<.-TVIBEG>); Define the version number
SUBTTL End of TECTVI
END ; End of TECTVI