;**************************************************************************; ; ; ; TELEVIDEO 910+ TERMINAL DRIVER ; ; ; ;**************************************************************************; ; ASL-00152-00 ; NOTICE ; ;All rights reserved. This software is the property of Alpha Microsystems ;and the material contained herein is the proprietary property and trade ;secrets of Alpha Microsystems, embodying substantial creative efforts and ;confidential information, ideas and expressions, no part of which may be ;reproduced or transmitted in any form or by any means, electronic, ;mechanical, or otherwise, including photocopying or input into any ;information storage or retrieval system without the express written ;permission of Alpha Microsystems. ; ;CAUTION: Unauthorized distribution or reproduction of this material may ;subject you to legal action. ; ;Copyright (C) 1982 - Alpha Microsystems ; ;Edit History: ; ;[111] 27 Mar 1987 ; Converted to drive Televideo 910+ and added routines to give it ; a status line of sorts. /JLM ;[110] 8 May 1985 ; Correct my boo-boo in edit 109. /RJH ;[109] 2 May 1985 ; Fixed problem with rubbing out control characters. /RJH ;[108] 26 Nov 1984 ; Update to conform the new standard: Update the TRMCHR routine to support ; new fields and bitmap. /bys ;[107] 24 April 1984 ; Add new TCRT codes to support new video attributes. /RBC ;[106] 22 December 1983 ; Correct cursor read code, add scroll on and off to protect on and ; off, don't output initialization if PSEUDO interface driver or ; not enough queue blocks. /RBC ;[105] 14 June 1983 ; change clear screen to use the clear unprotected sequence. /JP ;[104] 11 April 1983 ; Add code to save/restore D3 in delay routine. /RBC ;[103] 27 December 1982 ; Add split segment codes ; SEARCH SYS SEARCH SYSSYM SEARCH TRM OBJNAM 0,0,[TDV] ;Define capability flags ; TDVFLG = TD$BLN!TD$CID!TD$DIM!TD$EOL!TD$EOS!TD$LID!TD$MLT!TD$PRT!TD$RVA!TD$UND [111] ;TDVFLG = TDVFLG!TD$STS ; VER messes things up when set. [111] ;******************** ;* TVI910 * ;******************** ;Terminal driver communications area TVI910: WORD TD$NEW!TD$TCH ; terminal attributes BR JMPINP ; input routine RTN ; output routine BR ECHO ; echo routine BR JMPCRT ; crt control BR JMPINI ; INIT routine WORD 4 ; impure area of one longword. ROWCNT: BYTE 24. ; number of rows COLCNT: BYTE 80. ; number of columns LWORD TDVFLG ; terminal has: BR JMPTCH JMPINP: JMP INP ; go handle input characters JMPCRT: JMP CRT ; go handle TCRT codes JMPINI: JMP INI ; go handle initialization JMPTCH: JMP TCH ; go handle TRMCHR call PAGE ;******************** ;* ECHO * ;******************** ;Special echo processing is performed here ;Rubouts will backspace and erase the previous character ;Control-U will erase the entire line by backspacing and erasing ECHO: CMPB D1,#25 ; control-U BEQ CTRLU CMPB D1,#177 ; rubout BNE ECHX ;Rubouts are handled by the old backspace-and-erase game ;Special handling must be performed if we are rubbing out a tab ;D6 contains the character being rubbed out RUBOUT: CMPB D6,#11 ; was it a tab? BEQ RBTB ; yes - CMPB D6,#40 ; no, is it a control char. ? [109] BLO RBX ; yes - [109][110] ;Rubout 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 RBX: RTN ; [109] ERUB: BYTE 210,40,210,0 ;Rubout was of a tab - we must calculate how big the tab 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 ; tab - BEQ KRTT CMPB D1,#15 ; carriage return - BEQ KRTC CMPB D1,#33 ; escape - 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 tab AND #^C7,D3 BR KRTS KRTC: CLR D3 ; clear position for cr 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 control-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 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 PAGE ;******************** ;* INP * ;******************** ;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 INP: BMI INMLT ; skip if multi-byte processing CMPB D1,#1 ; function code? BEQ INPM ; yes - could be multi-byte sequence 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 ;Function codes translation INMF: MOVB (A0)+,D1 ; get the second character MOV T.IBF(A5),A6 ADD T.ICC(A5),A6 MOVB #7,@A6 ; force ^G ahead of this char INC T.ICC(A5) INC T.BCC(A5) INMX: LCC #0 ; reset the flags RTN PAGE ;******************** ;* INI * ;******************** ;Handle initialization of the terminal INI: MOV T.IDV(A5),A6 ; index the interface driver [106] CMP -(A6),#<[PSE]_16.>+[UDO]; is it the pseudo interface driver? [106] BEQ 5$ ; yes - no initialization wanted [106] CMP QFREE,#12. ; are there at least 12 queue blocks? [106] BLO 5$ ; no - skip the initialization [106] SAVE D1,D2 ; save registers MOV #INIS1,D3 ; get size of string to send LEA A6,INISTR ; index the string MOV A6,D1 TRMBFQ ; output the string REST D1,D2 ; restore registers 5$: MOV T.IMP(A5),A6 ; index impure area MOVW #80.,@A6 ; preset to 80 columns RTN INISTR: BYTE 233,'X ; turn off monitor mode BYTE 233,'* ; clear screen, home cursor BYTE 233,'# ; disable keyboard BYTE 233,'A ; stop printing BYTE 233,'.,'0 ; turn off cursor BYTE 233,'3 ; clear all tabs BYTE 217 ; reset xon/xoff mode BYTE 212,212 ; position cursor ASCII /System booting . . ./ INIS1=.-INISTR EVEN PAGE ;******************** ;* TCH * ;******************** ;Handle TRMCHR call ;A1 points to argument block, A2 indexes this TDV, D2 contains flags ;Can only use A1,A2,A6,D1,D2,D6,D7 TCH: MOV TD.FLG(A2),TC.FLG(A1) ; transfer flags ; MOV JOBCUR,A6 ; index job ; MOV JOBTRM(A6),A6 ; index terminal control area ; MOV T.IMP(A6),A6 ; index impure area CLR D6 ; preclear register MOVB ROWCNT(A2),D6 ; get row count MOVW D6,TC.ROW(A1) ; transfer row count MOVB COLCNT(A2),D6 ; Get column count [103] MOVW D6,TC.COL(A1) ; transfer column count. [103] ; MOVW @A6,TC.COL(A1) ; transfer column count [103] CLRW TC.CLR(A1) ; no colors MOVW #0.,TC.TSL(A1) ; set length of top status line [108] MOVW #0.,TC.SSL(A1) ; set length of shifted status line [108] MOVW #80.,TC.USL(A1) ; set length of unshifted status line [108] MOV D2,D7 ; get TRMCHR argument flags [108] AND #TC$BMP,D7 ; does user want bitmap [108] BEQ 20$ ; no - skip transfer code [108] ; user has requested bitmap -- return to him PUSH A1 ; save argument block index [108] ADDW #TC.BMP,A1 ; index bitmap return area [108] LEA A6,TCHBMP ; index our bitmap [108] MOV #<256./16.>-1,D7 ; get amount to transfer [108] 10$: MOVW (A6)+,(A1)+ ; transfer to user DBF D7,10$ ; loop until done POP A1 ; restore register 20$: RTN ; return to TRMCHR monitor routine ; Define feature bitmap TCHBMP: BYTE ^B11111111 ; 0 - 7 BYTE ^B11111111 ; 8 - 15 BYTE ^B01101111 ; 16 - 23 BYTE ^B11110000 ; 24 - 31 (no horiz or vertical pos) BYTE ^B11001111 ; 32 - 39 BYTE ^B11111111 ; 40 - 47 BYTE ^B00001111 ; 48 - 55 BYTE ^B10000000 ; 56 - 63 BYTE ^B11111111 ; 64 - 71 BYTE ^B01111111 ; 72 - 79 BYTE ^B00000000 ; 80 - 87 (no alternate page ) BYTE ^B00000000 ; 88 - 95 (no smooth scroll) BYTE ^B11110000 ; 96 - 103 BYTE ^B00000011 ; 104 - 111 (no non-space attributes) BYTE ^B00000000 ; 112 - 119 (no non-space attributes) BYTE ^B00000000 ; 120 - 127 (cursor blink & steady) BYTE ^B00000011 ; 128 - 135 (130 let's SV into the act) BYTE ^B00000000 ; 136 - 143 (no AM-70 style color) BYTE ^B00000000 ; 144 - 151 BYTE ^B00000000 ; 152 - 159 BYTE ^B00000000 ; 160 - 167 BYTE ^B00000000 ; 168 - 175 BYTE ^B00000000 ; 176 - 183 BYTE ^B00000000 ; 184 - 191 BYTE ^B00000000 ; 192 - 199 BYTE ^B00000000 ; 200 - 207 BYTE ^B00000000 ; 208 - 215 BYTE ^B00000000 ; 216 - 223 BYTE ^B00000000 ; 224 - 231 BYTE ^B00000000 ; 232 - 239 BYTE ^B00000000 ; 240 - 247 BYTE ^B00000000 ; 248 - 255 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 - ; ; Special XY routine to prevent cursor loads beyond line 24 ; ; Cursor positioning - D1 contains x,y coordinates ; For ADM style terminals (also Soroc, Televideo, etc) ; TTYI ; send position command BYTE 233,75,0,0 ADDW #^H1F1F,D1 ; add position offsets RORW D1,#8. ; send row first CMPB D1,#'7 ; test against row 24 code BLOS 1$ MOVB #'7,D1 ; if larger than row 24 make it 24 1$: TTY ROLW 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 CRTU1 ; and branch unless clear screen TTYI ; special case for clear screen BYTE 233,':,0,0 ; ...clear only the unprotected if on. [105] JMP WAIT ;Special processing for status line. [111] CRTU1: CMPB D1,#63. BEQ CRTU3 CMPB D1,#128. BEQ CRTU3 CMPB D1,#130. BEQ CRTU3 CMPB D1,#129. BNE CRTU ; finish up the status line received terminate code. [111] CRTU2: ; SAVE A2,A6 ; MOV T.IMP(A5),A2 PUSH A6 SLEEP #10000. ; give'm a second to read it TTYI ; send cursor position command BYTE 233,75,66,40,0,0 ; MOVB (A2)+,D1 ; get row ; TTY ; send it ; MOVB (A2)+,D1 ; get col ; TTY ; send it ; REST A2,A6 POP A6 RTN ; start up the status line & save where we were. [111] CRTU3: ; MOVW @A5,D1 ; save terminal status ; SAVE A2,D1 ; ORW #T$IMI!T$ECS,@A5 ; set terminal status ; MOV T.IMP(A5),A2 ; TTYI ; BYTE 233,'?,0,0 ; KBD ; get row ; MOVB D1,(A2)+ ; store it ; KBD ; get col ; MOVB D1,(A2)+ ; store it ; KBD ; get rtn and toss it TTYL C128 ; REST A2,D1 ; ANDW D1,@A5 ; reset terminal status RTN ;Command processing per director tables CRTU: PUSH D1 PUSH 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 CRTX: POP A2 ; restore A2 POP D1 ; Restore TCRT code CMPB D1,#9. ; If a clear to end of line, do wait BEQ WAIT CMPB D1,#10. ; If a clear to end of screen, do wait BEQ WAIT ; CMPB D1,#16. ; if a insert line, do wait ; BEQ WAIT RTN ; Anything else, wait not required WAIT: SSTS -(SP) ; stack status 1$: SVLOK ; lock so things can't change MOVW @A5,D7 ANDW #T$OIP,D7 ; is output in progress? BNE 2$ ; YES - wait TST T.OQX(A5) ; is output queued? BNE 2$ ; YES - wait LSTS (SP)+ ; restore status RTN ; return to user 2$: JWAIT J.TOW ; let TRMSER wake us (UNLOCK's) BR 1$ ; re-test DEFINE OFFTAB A1,A2,A3,A4,A5,A6,A7,A8,A9,A10 IF NB, A1, WORD A1-. IF NB, A2, WORD A2-. IF NB, A3, WORD A3-. IF NB, A4, WORD A4-. IF NB, A5, WORD A5-. IF NB, A6, WORD A6-. IF NB, A7, WORD A7-. IF NB, A8, WORD A8-. IF NB, A9, WORD A9-. IF NB, A10, WORD A10-. ENDM ;Byte offset and data tables follow for all commands ; CRCA: OFFTAB C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 OFFTAB C11,C12,C13,C14,C15,C16,C17,C18,C19,C20 OFFTAB C21,C22,C23,C24,C25,C26,C27,C28,C29,C30 OFFTAB C31,C32,C33,C34,C35,C36,C37,C38,C39,C40 OFFTAB C41,C42,C43,C44,C45,C46,C47,C48,C49,C50 OFFTAB C51,C52,C53,C54,C55,C56,C57,C58,C59,C60 OFFTAB C61,C62,C63,C64,C65,C66,C67,C68,C69,C70 OFFTAB C71,C72,C73,C74,C75,C76,C77,C78,C79,C80 OFFTAB C81,C82,C83,C84,C85,C86,C87,C88,C89,C90 OFFTAB C91,C92,C93,C94,C95,C96,C97,C98,C99,C100 OFFTAB C101,C102,C103,C104,C105,C106,C107,C108,C109,C110 OFFTAB C111,C112,C113,C114,C115,C116,C117,C118,C119,C120 OFFTAB C121,C122,C123,C124,C125,C126,C127,C128,C129,C130 OFFTAB C131,C132,C133,C134,C135,C136,C137,C138,C139,C140 OFFTAB C141,C142,C143,C144,C145,C146,C147 CRCB: PAGE ;CRT code tables ; C1: BYTE 236,0 ; cursor home (move to column 1,1) C2: BYTE 215,0 ; cursor return (move to column 1) C3: BYTE 213,0 ; cursor up C4: BYTE 212,0 ; cursor down C5: BYTE 210,0 ; cursor left C6: BYTE 214,0 ; cursor right C7: BYTE 233,'#,0 ; lock keyboard C8: BYTE 233,'",0 ; unlock keyboard C9: BYTE 233,'t,0 ; erase to end of line C10: BYTE 233,'y,0 ; erase to end of screen C11: BYTE 233,'),0 ; reduced intensity C12: BYTE 233,'(,0 ; normal intensity C13: BYTE 233,'&,0 ; enable protected fields [106] C14: BYTE 233,'',0 ; disable protected fields [106] C15: BYTE 233,'R,0 ; delete line C16: BYTE 233,'E,0 ; insert line C17: BYTE 233,'W,0 ; delete character C18: BYTE 233,'Q,0 ; insert character C19: BYTE 233,'?,0 ; read cursor address [106] C20: BYTE 0 ; read character at current cursor position C21: BYTE 233,'G,'2,0 ; start blink field C22: BYTE 233,'G,'0,0 ; end blink field C23: ; start line drawing mode (enable alternate character set) C24: ; end line drawing mode (disable alternate character set) C25: ; set horizontal position C26: ; set vertical position C27: BYTE 0 ; set terminal attributes C28: BYTE 233,'.,'1,0 ; cursor on C29: BYTE 233,'.,'0,0 ; cursor off C30: BYTE 233,'G,'8,0 ; start underscore C31: BYTE 233,'G,'0,0 ; end underscore C32: BYTE 233,'G,'4,0 ; start reverse video C33: BYTE 233,'G,'0,0 ; end reverse video C34: BYTE 233,'G,'6,0 ; start reverse blink C35: BYTE 233,'G,'0,0 ; end reverse blink C36: ; turn off screen display C37: BYTE 0 ; turn on screen display C38: ; top left corner C39: ; top right corner C40: ; bottom left corner C41: ; bottom right corner C42: ; top intersect C43: ; right intersect C44: ; left intersect C45: BYTE '+,0 ; bottom intersect C46: BYTE '-,0 ; horizontal line C47: BYTE '|,0 ; vertical line C48: BYTE '+,0 ; intersection C49: ; solid block C50: BYTE ' ,0 ; slant block C51: BYTE '#,0 ; cross-hatch block C52: ; double line horizontal C53: ; double line vertical C54: ; send message to function key line C55: ; send message to shifted function key line C56: ; set normal display format C57: ; set horizontal split (follow with row code) C58: ; set vertical split (39 char columns) C59: ; set vertical split (40 char columns) C60: ; set vertical split column to next char C61: ; activate split segment 0 C62: ; activate split segment 1 C63: BYTE 0 ; send message to host message field C64: BYTE '^,0 ; up-arrow C65: BYTE 'v,0 ; down-arrow C66: ; raised dot C67: ; end of line marker C68: ; horizontal tab symbol C69: ; paragraph C70: ; dagger C71: ; section C72: ; cent sign C73: ; one-quarter C74: ; one-half C75: ; degree C76: ; trademark C77: ; copyright C78: BYTE ' ,0 ; registered C79: ; print screen C80: ; reserved for set to wide mode C81: BYTE 0 ; reserved for set to normal mode C82: BYTE 233,'`,0 ; enter transparent print mode C83: BYTE 233,'A,0 ; exit transparent print mode C84: ; begin writing to alternate page C85: ; end writing to alternate page C86: ; toggle page C87: ; copy to alternate page C88: ; insert column C89: ; delete column C90: ; block fill with attribute C91: ; block fill with character C92: ; draw a box C93: ; scroll box up one line C94: ; scroll box down one line C95: ; select jump scroll C96: ; select fast smooth scroll C97: ; select med-fast smooth scroll C98: ; select med-slow smooth scroll C99: BYTE 0 ; select slow smooth scroll C100: BYTE 233,'G,':,0 ; start underscore/blink C101: BYTE 233,'G,'0,0 ; end underscore/blink C102: BYTE 233,'G,'<,0 ; start underscore/reverse C103: BYTE 233,'G,'0,0 ; end underscore/reverse C104: BYTE 233,'G,'>,0 ; start underscore/reverse/blink C105: BYTE 233,'G,'0,0 ; end underscore/reverse/blink C106: ; start underscore w/o space C107: ; end underscore w/o space C108: ; start reverse w/o space C109: ; end reverse w/o space C110: ; start reverse/blinking w/o space C111: ; end reverse/blinking w/o space C112: ; start underscore/blinking w/o space C113: ; end underscore/blinking w/o space C114: ; start underscore/reverse w/o space C115: ; end underscore/reverse w/o space C116: ; start underscore/reverse/blinking w/o space C117: ; end underscore/reverse/blinking w/o space C118: ; start blink w/o space C119: BYTE 0 ; end blink w/o space C120: BYTE 233,'.,'1,0 ; set cursor to blinking block C121: BYTE 233,'.,'2,0 ; set cursor to steady block C122: BYTE 233,'.,'3,0 ; set cursor to blinking underline C123: BYTE 233,'.,'4,0 ; set cursor to steady underline C124: ; spare C125: ; spare C126: ; spare C127: BYTE 0 ; spare C128: BYTE 233,75,67,40,233,'t,0 ; select top status line C129: BYTE 0 ; end of all status line C130: ; select unshifted status line C131: ; select shifted status line C132: ; select black text C133: ; select white text C134: ; select blue text C135: ; select magneta text C136: ; select red text C137: ; select yellow text C138: ; select green text C139: ; select cyan text C140: ; select black reverse text C141: ; select white reverse text C142: ; select blue reverse text C143: ; select magneta reverse text C144: ; select red reverse text C145: ; select yellow reverse text C146: ; select green reverse text C147: BYTE 0 ; select cyan reverse text EVEN END .