;***************************************************************************; ; ; ; TeleVideo 925 Terminal Driver ; ; ; ; Author: David F. Pallmann ; ; Copyright (C) 1984 - LMS Technical Services, Inc. ; ; ; ;***************************************************************************; ;* this driver supports SuperVUE. ;* editing keys translate to the appropriate VUE/SuperVUE control characters. ;* ^V (down-arrow) is corrected to ^J (line feed). ;* Function keys generate codes 200-212 and 240-252 (shifted). OBJNAM TEL925.TDV SEARCH SYS SEARCH SYSSYM SEARCH TRM ESC=233 ; (lead-in code) ;Terminal driver communications area TEL925: WORD TD$NEW ;Terminal attributes BR JMPINP ;Input routine RTN ;Output routine BR ECHO ;Echo routine BR JMPCRT ;CRT control RTN ;No init routine WORD 0 ;No impure area BYTE 24. ;Row count BYTE 80. ;Column count LWORD TD$LID!TD$CID!TD$DIM!TD$EOS!TD$EOL!TD$BLN!TD$UND!TD$RVA!TD$MLT ;Following code makes driver SuperVUE compatible .TAW.0=0 .TAW.1=0 .TAW.2=0 .TAW.3=0 .TAW.4=0 .TAW.5=0 .TAW.6=0 .TAW.7=0 .TAW.8=0 .TAW.9=0 .NUM = 0 .TW0.=.TAW.0 .TW1.=.TAW.1 .TW2.=.TAW.2 .TW3.=.TAW.3 .TW4.=.TAW.4 .TW5.=.TAW.5 .TW6.=.TAW.6 .TW7.=.TAW.7 .TW8.=.TAW.8 .TW9.=.TAW.9 WORD .TW1.,.TW0.,.TW3.,.TW2.,.TW5.,.TW4.,.TW7.,.TW6.,.TW9.,.TW8. WORD 0,0,0,0,0,0 RAD50 /SUPER / RAD50 /VUE/ RAD50 /T925 / ;End SuperVUE compatibility area JMPINP: JMP INPUT ;Jump to input routine JMPCRT: JMP CRT ;Jump to CRT routine ;********** ;* ECHO * ;********** ;Special echo processing is performed here ;s will backspace and erase the previous character ;^U will erase the entire line by backspacing and erasing ECHO: CMPB D1,#'U-'@ ;^U BEQ CTRLU CMPB D1,#177 ; BNE ECHX ;Character deletions are handled by the old backspace-and-erase game ;Special handling must be performed if we are deleting out a ;D6 contains the character being deleted RUBOUT: CMPB D6,#'I-'@ ;was it a ? BEQ RBTB ; yes ;Delete was of a printable character - queue up the backspace sequence KRTG: MOV #3,D3 ;set character count LEA A6,ERUB ;set buffer address MOV A6,D1 ; into D1 TRMBFQ ;queue the backspace sequence RTN ERUB: BYTE 10,40,10,0 ;Deletion was of a - we must calculate how big the was and backup over it RBTB: CLR D3 ;preclear D3 MOVW T.POB(A5),D3 ;set beginning position count MOV T.ICC(A5),D2 ;set input character count MOV T.IBF(A5),A6 ;set input buffer base KRTS: DEC D2 ;done with scan? BMI KRTQ ; yes MOVB (A6)+,D1 ;scan forward calculating position CMPB D1,#11 ; BEQ KRTT CMPB D1,#15 ; BEQ KRTC CMPB D1,#33 ; BEQ KRTI CMPB D1,#40 ; control-char BLO KRTS CMPB D1,#172 BHI KRTS KRTI: INC D3 ;increment position for one character BR KRTS KRTT: ADD #10,D3 ;adjust position for AND #^C7,D3 BR KRTS KRTC: CLR D3 ;clear position for BR KRTS KRTQ: COM D3 ;calculate necessary backspaces AND #7,D3 INC D3 MOV #10,D1 ;set immediate backspace character TRMBFQ ;queue the backspaces ECHX: RTN ;Echo a ^U by erasing the entire line CTRLU: TST D6 ;no action if nothing to erase BEQ CTUX CLR D3 ;preclear D3 MOVW T.POO(A5),D3 ;calculate backspace number to erase the line SUBW T.POB(A5),D3 BEQ ECHX CMP D3,T.ILS(A5) ;insure not greater than terminal width BLOS CLUA MOV T.ILS(A5),D3 CLUA: MOV #10,D1 ;queue up backspaces TRMBFQ ASL D1,#2 ;queue up spaces TRMBFQ MOV #10,D1 ;queue up backspaces TRMBFQ CTUX: RTN ;*********** ;* INPUT * ;*********** ;Input character processing subroutine ;Return a negative flag to indicate possible multi-byte key codes ;Detect a negative flag which indicates the multi-byte processing return INPUT: BMI INMLT ;skip if multi-byte processing CMPB D1,#1 ;function code? BEQ INPM ; yes - could be multi-byte sequence CMPB D1,#33 ;escape? BEQ INPM ; yes - could be multi-byte sequence CMPB D1,#'V-'@ ;DOWN ARROW? BNE 10$ MOVB #'J-'@,D1 10$: LCC #0 ; no - normal processing RTN INPM: LCC #PS.N ;possible multi-byte - return N flag RTN ;Multi-byte processing is done here ;This occurs when TRMSER has accumulated all bytes of a multi-byte keystroke ;D0 contains the character count and A0 indexes the data string ;A5 indexes the terminal definition block and must be preserved ;The translated character must be returned in D1 for storage ;This routine may destroy only A0,A3,A6,D0,D6,D7 INMLT: MOVB (A0)+,D1 ;get the first character DECB D0 ;no translation if single character BEQ INMX CMPB D1,#1 ;function sequences start with SOH BEQ INMF ; function sequence - ;Escape sequences are translated directly by setting bit 7 on ;This will cause them to map to 240-377 MOVB (A0)+,D1 ;get the second character INMG: ORB #200,D1 ;set bit 7 on BIT #T$XLT,@A5 ;are we doing translation? BEQ INMNOT ; no - check for another translation INMX: LCC #0 ;reset the flags INMX2: RTN ;Function codes require additional translation so that they become 200-237 ;Unshifted function keys map to 200-212 ;Shifted function keys map to 240-252 INMF: MOVB (A0)+,D1 ;get the second character SUBB #'@,D1 ;offset so that F1 becomes 0 BR INMG ; and go finish up ;Come here if program is not doing translation and we must do our own INMNOT: LEA A6,XLTTBL ;index the translation table 10$: MOVB (A6)+,D7 ;get character BEQ INMX2 ; end of table - ignore the character CMPB D1,D7 ;is it in the table? BEQ 20$ ; yes - INC A6 ; no - bypass translation BR 10$ ;loop for more - ;Come here to translate the character 20$: MOVB @A6,D1 ;translate the character BR INMX ;Translation table XLTTBL: BYTE 321,'F-'@ ;CHAR INSERT -> ^F BYTE 327,'D-'@ ;CHAR DELETE -> ^D BYTE 305,'B-'@ ;LINE INSERT -> ^B BYTE 322,'Z-'@ ;LINE DELETE -> ^Z BYTE 324,'Y-'@ ;LINE ERASE -> ^Y BYTE 331,'P-'@ ;PAGE ERASE -> ^P BYTE 311,'A-'@ ;BACK TAB -> ^A BYTE 200,200 ;F1 = 200 BYTE 201,201 ;F2 = 201 BYTE 202,202 ;F3 = 202 BYTE 203,203 ;F4 = 203 BYTE 204,204 ;F5 = 204 BYTE 205,205 ;F6 = 205 BYTE 206,206 ;F7 = 206 BYTE 207,207 ;F8 = 207 BYTE 210,210 ;F9 = 210 BYTE 211,211 ;F10 = 211 BYTE 212,212 ;F11 = 212 BYTE 240,213 ;SHIFT F1 = 240 BYTE 241,214 ;SHIFT F2 = 241 BYTE 242,215 ;SHIFT F3 = 242 BYTE 243,216 ;SHIFT F4 = 243 BYTE 244,217 ;SHIFT F5 = 244 BYTE 245,220 ;SHIFT F6 = 245 BYTE 246,221 ;SHIFT F7 = 246 BYTE 247,222 ;SHIFT F8 = 247 BYTE 250,223 ;SHIFT F9 = 250 BYTE 251,224 ;SHIFT F10 = 251 BYTE 252,225 ;SHIFT F11 = 252 BYTE 000,000 PAGE ;********* ;* CRT * ;********* ;Special CRT control processing ;D1 contains the control code for X,Y positioning or special commands ;If D1 is positive we have screen positioning (row in hi byte, col in lo byte) ;If D1 is negative we have the special command in the low byte CRT: TSTW D1 ;is it cursor position? BMI CRTS ; no ;Cursor positioning - D1 contains X,Y coordinates TTYI ;send position command BYTE ESC,75,0,0 ADD #17437,D1 ;add position offsets ROR D1,#8. ;send row first TTY ROL D1,#8. ;send column second TTY RTN ;Special commands - D1 contains the command code in the low byte CRTS: AND #377,D1 ;strip the high byte BNE CRTU ; and branch unless clear screen TTYI ;special case for clear screen BYTE ESC,52,0 EVEN CRTZ: TTYL CRTNUL ; output some nulls RTN ;Command processing per director tables CRTU: PUSH A2 ;save A2 ASL D1 ; times 2 (word offset). CMP D1,#CRCB-CRCA ;check for valid code BHI CRTX ; and bypass if bad LEA A2,CRCA-2 ;index the table ADD D1,A2 ;add command code MOVW @A2,D1 ;pick up data field offset ADD D1,A2 ;make absolute data address TTYL @A2 ;print the data field CMPB @A2,#36 ;sleep if home command BEQ CRTXZ CMPB 1(A2),#'f ;no nulls if program status cmd BEQ CRTX CMPB 1(A2),#'G ;no nulls for attribute cmd BEQ CRTX CMPB 1(A2),#100 ;sleep if erase command BHI CRTXZ CRTX: POP A2 ;restore A2 RTN CRTXZ: POP A2 ;restore A2 BR CRTZ ; and go output nulls ;Null characters for long commands CRTNUL: BYTE 200,200,200,200,200,200,200,200,200,200,200,0 EVEN ;Byte offset and data tables follow for all commands CRCA: WORD C1-.,C2-.,C3-.,C4-.,C5-.,C6-.,C7-.,C8-.,C9-.,C10-. WORD C11-.,C12-.,C13-.,C14-.,C15-.,C16-.,C17-.,C18-.,C19-.,C20-. WORD C21-.,C22-.,C23-.,C24-.,C25-.,C26-.,C27-.,C28-.,C29-.,C30-. WORD C31-.,C32-.,C33-.,C34-.,C35-.,C36-.,C37-.,C38-.,C39-.,C40-. WORD C41-. CRCB: PAGE ;Macro CRT defines CRT codes and sets SuperVUE attribute bits DEFINE CRT CODE1,CODE2,CODE3 .NUM=.NUM+1 .TAW.=<.NUM/16.>&^H0F .TAWB.=.NUM-<.TAW.*16.> .TAW.\.TAW.=<1_.TAWB.>!.TAW.\.TAW. IF NB,CODE1,BYTE CODE1 IF NB,CODE2,BYTE CODE2 IF NB,CODE3,BYTE CODE3 BYTE 0 ENDM C0: CRT ;clear screen C1: CRT 30. ;Home cursor C2: CRT 200+13. ;Cursor to column 1 C3: CRT 11. ;Cursor up C4: CRT 10. ;Cursor down C5: CRT 8. ;Cursor left C6: CRT 12. ;Cursor right C7: CRT ESC,43 ;Lock keyboard C8: CRT ESC,42 ;Unlock keyboard C9: CRT ESC,'T ;Erase to end of line C10: CRT ESC,'Y ;Erase to end of screen C11: CRT ESC,') ;Low intensity C12: CRT ESC,'( ;High intensity C13: CRT ESC,'& ;Enable protected fields C14: CRT ESC,'' ;Disable protected fields C15: CRT ESC,'R ;Delete line C16: CRT ESC,'E ;Insert line C17: CRT ESC,'W ;Delete character C18: CRT ESC,'Q ;Insert character C19: CRT ESC,'? ;Read cursor address C20: CRT ESC,'1 ;Read character at current cursor position C21: CRT ESC,'G,'2 ;Blink on C22: CRT ESC,'G,'0 ;Blink off C23: CRT ;Start line drawing mode C24: CRT ;End line drawing mode C25: CRT ;Set horizontal position C26: CRT ;Set vertical position C27: CRT ESC,'. ;Set terminal attributes C28: CRT ESC,'.,'2 ;Cursor on C29: CRT ESC,'.,'0 ;Cursor off C30: CRT ESC,'G,'8 ;Underscore on C31: CRT ESC,'G,'0 ;Underscore off C32: CRT ESC,'G,'4 ;Reverse video on C33: CRT ESC,'G,'0 ;Reverse video off C34: CRT ESC,'G,'6 ;Reverse blink on C35: CRT ESC,'G,'0 ;Reverse blink off C36: CRT ESC,'o ;Screen off C37: CRT ESC,'n ;Screen on ;*** LMS DEFINED FUNCTIONS *** C38: CRT ESC,'f ;Program status line *** LMS C39: CRT 13. ;End status line *** LMS C40: CRT ESC,'g ;Status line on *** LMS C41: CRT ESC,'h ;Status line off *** LMS EVEN END .