;* TELEVIDEO 925 Terminal Unit Routine * ;* 68000 VERSION MARCH 28, 1981 * ;* ;* Barry S Weingart 4/10/81 ;* * ;**************************************************************** ; OBJNAM .TDV ; ; SEARCH SYS SEARCH TRM TRUE$ =0 FALSE$ =^CTRUE$ ; not true FUNCT$ =TRUE$ ; for using 'FUNCT' key OUT$ =TRUE$ ; Special output processing SPCL$ =FALSE$ ; first command after #27 is #spl SPL =100. ; spl commands start @ 100. LPP =24. ; Lines/ page CPL =80. ; 80 columns/ line NEWFMT =^O2000 ; New terminal driver format ; IMPURE AREA EQS ESCNT= 0 FNCPRC= 2 CH2 =^H2000 ; d ; ch2 flags 'function char #2 ok' BSH =^H4000 ; e ; backslash flag (from teltyp.mac) FIP =BSH ; e ; bsh = function in progress flag ; Bitmap of defined functions (for new tdv format) FN.1 =^B1111111111111111 ; 0-15 ; Tel950 can do all 0-15 functions FN.2 =^B0000000001101111 ;16-31 ; some of fncts not yet defined FN.3 =^B0000000000001100 ;32-47 FN.4 =^B0000000000000000 ;48-63 FN.5 =^B0000000000000000 ;64-79 FN.6 =^B0000000000000000 ;80-95 FN.7 =^B0000000000000000 ;96-111 FN.8 =^B0000000000000000 ;112-127 FN.9 =^B0000000000000000 ;128-143 FN.10 =^B0000000000000000 ;144-159 FN.11 =^B0000000000000000 ;160-175 FN.12 =^B0000000000000000 ;176-191 $CTLA =^H01 ; control a $BS =^H08 ; backspace $TAB =^H09 ; tab $LF =^H0A ; line- feed $VT =^H0B ; vertical tab $FF =^H0C ; right- arrow, formfeed $CR =^H0D ; carriage return $CTLU =^H15 ; control u $CTLZ =^H1A ; control z $ESC =^H1B ; escape char $SPACE =^H20 $COMMA =^H2C ; comma $SEMC =^H3B ; semicolon $LB =^H3C ; < $RUB =^H7F ; rubout BIT7 =^H80 ; set bit 7 $CTLA7 =1+BIT7 ; ^A- don't strip first $CR7 =$CR+BIT7 ; carriage return $ESC7 =$ESC+BIT7 ; escape with bit7 set CTLMSK =^H1F ; for masking to control chars ; ; terminal status flags ; bit# IMI =1 ; 0 ; image mode ECS =2 ; 1 ; echo suppress EEM =4 ; 2 ; esc edit DAT =^H8 ; 3 ; data ??? ILC =^H10 ; 4 ; lower case conversion OIP =^H80 ; 7 ; output in progress HOG =^H200 ; 9 ; output hog LCL =^H400 ; a ; local (no echo) ;INT =^H1000 ; c ; driver wants next chars from idv ; POSOFF =^H1F1F ; position command offsets ; ; Word Layout used for command table ; ; --- ; 15. | | } ; 14. | | } ; 13. | | } Reserved ; 12. | | } ; 11. | | } ; --- 0=Control char 4=$ESC7,'Z,CHAR ; 10. | | } 1=$ESC7,CHAR 5=$ESC7,'\,CHAR ; 9. | | } FTYPE: 2=$ESC7,'.,CHAR 6=$ESC7,'e,CHAR ; 8. | | } 3=$ESC7,'G,CHAR 7=$ESC7,'!,CHAR ; ; --- ; 7. | | } ; 6. | | } ; 5. | | } ; 4. | | } ; 3. | | } CHAR: Ascii character ; 2. | | } (value bits 0-6 all 0 = fn not available) ; 1. | | } (bit 7 available as flag bit) ; 0 | | } ; --- ; DEFINE CNTRL CHAR WORD ^H0000+CHAR ENDM DEFINE LDIN CHAR WORD ^H0100+CHAR ENDM DEFINE TYPEP CHAR WORD ^H0200+CHAR ENDM DEFINE TYPEG CHAR WORD ^H0300+CHAR ENDM DEFINE TYPE4 CHAR WORD ^H0400+CHAR ENDM DEFINE TYPE5 CHAR WORD ^H0500+CHAR ENDM DEFINE TYPE6 CHAR WORD ^H0600+CHAR ENDM DEFINE TYPE7 CHAR WORD ^H0700+CHAR ENDM ; macro for defining single control characters via function keys. DEFINE CHTR ARG NCHR COUNT,ARG IF NE,COUNT-1,BYTE CHTR ; force assembler error if <> 1 byte BYTE ''ARG & CTLMSK,0 ENDM ; macro for defining commands such as dir/w, where is required. ; this macro accepts one command per function. DEFINE LINE ARG ASCII @ARG@ BYTE $CR,0 ENDM ; macro for defining multiple commands via one function key. ; LINE MUST be used as final command in series. ; i.e. MULTI xxx : MULTI yyy : LINE zzz. DEFINE MULTI ARG ASCII @ARG@ BYTE $CR ENDM ; Macro for defining commands where [command] is desired. DEFINE STRCMD ARG ASCII @ARG' @ BYTE 0 ENDM ; Macro for [command] DEFINE CHARS ARG ASCII @ARG@ ENDM ; Macro for defining commands to be used within vue ; where [command] is desired DEFINE ESCCMD ARG BYTE $ESC7 ; escape ASCII @ARG@ BYTE $CR,0 ENDM ; For those occasions when you want command DEFINE ESCESC ARG BYTE $ESC7 ASCII @ARG@ BYTE $CR,$ESC7,0 ENDM ;**************** ;* TEL950 * ;**************** ; Terminal Driver Communications Area ; TEL950: WORD NEWFMT ; 0. ; Terminal Attributes BR INPUTJ ; 2. ; Input Routine BR OUTPUT ; 4. ; Output Routine BR ECHOJ ; 6. ; Echo Routine BR CRTJMP ; 8. ; Crt Control RTN ; 10. ; Initialization routine ; WORD 10 ; 12. ; Impure area size BYTE LPP,CPL ; 14. ; Screen size NOTE VUE***** WORD FN.2 ; 16. ; " SCREWUP***** WORD FN.1 ; 18. ; Bitmap of defined functions WORD FN.4 ; 20. ; " WORD FN.3 ; 22. ; " WORD FN.5 ; 24. ; " ; INPUTJ: JMP INPUT CRTJMP: JMP CRT ; address error from tel950: ECHOJ: JMP ECHO ; ;************************ ;* OUTPUT * ;************************ ; ; This routine corrects improper screen scrolling in VUE or any other ; full screen input system. If the printer port is to be used, Data ; should be sent with IMAGE MODE OFF or else this routine will cause ; unnecessary FF in the printed output. ; ; OUTPUT: IF EQ,OUT$ SAVE A0,D6 MOV T.IMP(A5),A0 ;address the inpure area TSTB ESCNT(A0) ; ESC PROCESS? BEQ CKESC CKESC1: CMPB ESCNT(A0),#7 ; inprocess? BNE 2$ CMPB D1,#^H19 ; ^y is end? BNE NOOUT MOVB #'",D1 ; force fakeout[4.1c] 2$: CLRB ESCNT(A0) CMPB D1,#'| ; prg keys BNE OUTX MOVB #7,ESCNT(A0) NOOUT: CLR D1 REST A0,D6 LCC #4 RTN CKESC: CMPB D1,#^H1B ; ESC? BNE O.LF SETB ESCNT(A0) OUTX: REST A0,D6 LCC #10 ; Set N-Bit to process positioning RTN O.LF: CMPB D1,#$LF ; LINE FEED ? BNE OUTX ; No ! MOVW @A5,D6 AND #IMI,D6 BEQ OUTX ; IMAGE MODE ON DO Translate LEA A0,OUTMSG MOV A0,D1 DOINS: LEA A0,T.OQX(A5) QINS A0 CLR (A0)+ ; clear the command word MOV #MCHARS,(A0)+ MOV D1,@A0 ; move the address of literal BR NOOUT OUTMSG: BYTE $FF,$BS,$LF+BIT7,0 MCHARS =.-OUTMSG-1 ENDC EVEN PAGE ; ;**************** ;* INPUT * ;**************** ; INPUT: BIT #DAT,@A5 BEQ 0$ LCC #0 RTN 0$: SAVE A3,A6,D6 MOV T.IMP(A5),A3 ;ADDRESS THE IMPURE AREA CMPB D1,#$ESC ; is it an esc ? BEQ INE ; yes- set flag ; CMPB D1,#': ; flip flop : and ; BNE 1$ MOVB #';,D1 BR 4$ 1$: CMPB D1,#'; BNE 2$ MOVB #':,D1 BR 4$ 2$: CMPB D1,#^H16 ; replace ^v with lf BNE CKLESC MOVB #^H0A,D1 4$: JMP INX CKLESC: CMPB 6(A3),#$ESC ; LAST CHR ESC? JEQ PRCESC CLRB 6(A3) ;ZAP MOVW FNCPRC(A3),D6 AND #FIP,D6 ; is FIP (function in progress) flag on BNE FUNCTE ; yes- branch MOVW @A5,D6 AND #IMI,D6 BNE GR1 ; IMAGE MODE ON DONT TRAnslate CMPB D1,#^H08 ; is it back space key ? BNE GR ; no just return MOVB #^H7F,D1 GR: JMP INX GR1: CMPB D1,#01 ; CTL A? BNE GR CLRB D1 ; SET TO CTL G CLRB T.LCH(A5) ; ORW #FIP+CH2,FNCPRC(A3) ; SET BOTH CODES JMP INX INE: ; ESC FOUND MOVB D1,6(A3) ;SET ESC ON MOV #440.,D6 ; 1000 DELAY TIME 1$: NOP SUBW #1,D6 BNE 1$ JMP INX INER:; ADD #2,SP ;get rid of the return address CLR D1 LCC #4 REST A3,A6,D6 RTN ; return without telling system CHRS: ANDW #~CH2,FNCPRC(A3) ; clear BR INX FUNCTE: MOVW FNCPRC(A3),D7 ANDW #CH2,D7 ; MIDDLE OF FUNCT ? BNE FNTBS ; yes TIME TO TRANSLATE FUNCRC: ANDW #~FIP,FNCPRC(A3) ; reset sw CMPB D1,#$CR ; cr part of funct BNE 2$ CMPB T.LCH(A5),#07 ; ^G last chr BNE INER MOVB ESCNT+1(A3),D1 2$: CLRB ESCNT+1(A3) BR INX FNTBS: LEA A6,FNCTAB FNLP1: TSTB @A6 ; end BNE 1$ MOVB D1,ESCNT+1(A3) ; set for ^G BR SETCG 1$: CMPB D1,(A6)+ BEQ DOFNCT INC A6 BR FNLP1 ; loop DOFNCT: MOVB @A6,D1 ; pu real code BIT #^H80,D1 ; f5 or f8? BEQ CHRS ; no just doit MOVB D1,ESCNT+1(A3) ; save output SETCG: MOVB #07,D1 ; set ^g BR CHRS PRCESC: CLRB 6(A3) ;ZAP TST T.ICC(A5) JEQ GR1 ; esc alone - so tst this chr LEA A3,XLATB INLP1: TSTB @A3 ; end? JEQ GR1 ; yes null found - GO TST THIS CHR CMPB D1,(A3)+ ; test and incr BEQ INLP2 INC A3 ; bump past ans BR INLP1 ; go again INLP2: MOVB @A3,D1 ; set real code DEC T.ICC(A5) DEC T.BCC(A5) ; FOOL TRMSRV INX: REST A3,A6,D6 LCC #0 RTN ;**************** ;* ECHO * ;**************** ; Special echo processing is done here ; Rubouts will backspace and erase the previous character ; Control-U will erase the entire line by backspacing and erasing ECHO: CMP D1,#$CTLU ; Control-U JEQ CTRLU CMP D1,#$RUB ; Rubout JNE ECHX ; Rubouts are handled by the old backspace-and-erase game ; D6ecial handling must be performed if we are rubbing out a tab ; R3 contains the character being rubbed out RUBOUT: CMP D3,#$TAB ; Was it a TAB? BEQ RBTB ; Yes ; 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 TRMBFQ ; Queue the backspace sequence RTN ERUB: BYTE $BS,$SPACE,$BS,0 ; Rubout was of a TAB - we must calculate how big the TAB was and backup over it RBTB: CLR 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 CMP D1,#$TAB BEQ KRTT CMP D1,#$CR BEQ KRTC CMP D1,#$ESC BEQ KRTI CMP D1,#$SPACE ; Control-Char BLO KRTS CMP D1,#'y ; why doesn't it check for { | } ?? BHI KRTS KRTI: INC D3 ; Increment position for one character BR KRTS KRTT: ADD #10,D3 ; Adjust position for TAB AND #~7,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 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 #$BS,D1 ; Queue up backspaces TRMBFQ ASL D1,#2 TRMBFQ MOV #$BS,D1 TRMBFQ CTUX: RTN PAGE ;******************** ;* CRT * ;******************** ; Special CRT control processing ; R1 contains the control code for X,Y positioning or special commands ; If R1 is positive we have screen positioning (Row in Hi Byte, Col in Lo Byte) ; If R1 is negative we have the special commnd in the Low byte ; CRT: SAVE D3,A0 ROLW D1,#8. ; set flags according to hi byte TSTB D1 BEQ CRTU ; 00= test, verify range but ; inhibit output to terminal BMI CRTS ; neg = crt command ; Cursor Positioning - R1 contains X,Y coordinates ; ; Validate position commands ; CMPB D1,#LPP ; lines per page JGT RTN.ER ROLW D1,#8. CMPB D1,#CPL JGT RTN.ER ; Position command validated ROLW D1,#8. ;send row first TTYI ; Send position command BYTE $ESC7,'=,0 ; Send load cursor command EVEN ADD #^H1F1F,D1 ; Add position offsets BR TTBOTH ; ; Special Commands - R1 contains the command code in the Low byte ;CRTS: AND #^H0FF,R1 ; Strip the High byte CRTS: ; Command processing per directory tables ; CRTU: ROLW D1,#8. ; unswab (from crt:) AND #^H0FF,D1 ; Strip hi byte CMPB D1,#71. ; VALID? BHI RTN.ER ; RET IS ERROR CRTOK: LSL D1 ; multiply r1 * 2 ; BNE 1$ ; CLEAR SCREEN COMMAND IS SPECIAL ; TTYL CLRCMD ; JMP RTN.OK 1$: LEA A0,CMDTBL ; Index the table ADD D1,A0 ; Add command code MOVW @A0,D1 ; Pick up data field offset BEQ RTN.ER ; can't do it ROLW D1,#8. MOV D1,D3 ; save it in r2 AND #^H0FF00,D1 AND #7,D3 ; get rid of garbage ASL D3 LEA A6,OFFTBL[D3] ADDW @A6,A6 JMP @A6 OFFTBL: OFFSET FCNTRL OFFSET FLDIN OFFSET FTYPEP OFFSET FTYPEG ; OFFSET FTYPE4 ; OFFSET FTYPE5 ; OFFSET FTYPE6 ; OFFSET FTYPE7 ; ; LEADIN: MOV D1,D3 ; save char MOV #$ESC7,D1 ; ready escape for tty TTY ; sendit MOV D3,D1 ; retrieve char TTBOTH: TTY ; send low byte ROLW D1,#8. ; swap bytes hi- lo TTY1: TTY BTST #7,D1 ;is a wait requested ? BEQ RTN.OK ;no SLEEP #200. ;wait for a while RTN.OK: REST D3,A0 LCC #1 ; carry set RTN ; normal return to calling program RTN.ER: REST D3,A0 LCC #0 ; error return to calling program RTN ; FCNTRL: ; control character ROLW D1,#8. SUB #^H40,D1 BR TTY1 FLDIN: ; esc,char MOVB #$ESC7,D1 BR TTBOTH FTYPEP: ; esc,'.,char MOVB #'.,D1 BR LEADIN FTYPEG: ; esc,'G,char MOVB #'G,D1 BR LEADIN PAGE ; ; Byte offset and data tables follow for all commands ; RADIX 8 EVEN CMDTBL: LDIN '* ; O ; Cursor Home & reset h.i. & prot CNTRL '^ ; 1 ; Cursor Home (move to column 1,1) CNTRL 'M ; 2 ; Cursor Return (move to column 1) CNTRL 'K ; 3 ; Cursor Up CNTRL 'J ; 4 ; Cursor Down CNTRL 'H ; 5 ; Cursor Left CNTRL 'L ; 6 ; Cursor Right LDIN '# ; 7 ; Lock Keyboard LDIN '" ; 8 ; Unlock Keyboard LDIN 'T ; 9 ; Erase to End of Line LDIN 'Y+200 ; 10 ; Erase to End of Screen LDIN ') ; 11 ; Enter Background Display Mode (reduced intensity) LDIN '( ; 12 ; Enter Foreground Display mode (normal intensity) LDIN '& ; 13 ; Enable Protected fields LDIN '' ; 14 ; Disable Protected Fields LDIN 'R ; 15 ; Delete Line LDIN 'E ; 16 ; Insert Line LDIN 'W ; 17 ; Delete Character LDIN 'Q ; 18 ; Insert Character LDIN '? ; 19 ; Read Cursor Address CNTRL 0 ; 20 ; Read Character at Current Cursor Position TYPEG '2 ; 21 ; Start Blinking Field TYPEG '0 ; 22 ; End Blinking Field LDIN '$ ; 23 ; Start Line Drawing Mode (enable alternate character set) LDIN '% ; 24 ; End Line Drawing Mode (disable alternate character set) CNTRL 0 ; 25 ; TURN TERMINAL OFF LDIN 'd ; 26 ; Set Dark (White on black) LDIN 'b ; 27 ; Set Bright (Black on White) TYPEP '2 ; 28 ; turn cursor on to BLOCK TYPEP '0 ; 29 ; Turn cursor off CNTRL 'Z ; 30 ; Clear All to Spaces LDIN $SEMC ; 31 ; Clear Foreground to Spaces LDIN ': ; 32 ; Clear Unprotected to Nulls LDIN 'P ; 33 ; Print Page CNTRL 0 ; 34 ; Print Page Unformatted TYPEP '1 ; 35 ; Cursor = Blinking Block TYPEP '2 ; 36 ; Cursor = Steady Block TYPEP '3 ; 37 ; Cursor = Blinking Underline TYPEP '4 ; 38 ; Cursor = Steady Underline LDIN $LB ; 39 ; Key Click Off LDIN '> ; 40 ; Key Click On LDIN 'I ; 41 ; Backtab LDIN 'i ; 42 ; Tab TYPEG '1 ; 43 ; Start Blank Field Atribute TYPEG '8 ; 44 ; Set Underline Attibute TYPEG '0 ; 45 ; set normal Attribute TYPEG '4 ; 46 ; Set Reverse Attribute TYPEG '2 ; 47 ; Set Blink Attribute TYPEG ': ; 48 ; Set Blink/Underline Attribute TYPEG '0 ;N49 ; REVERSE OFF TYPEG $LB ; 50 ; Set Reverse/Underline Attribute TYPEG '6 ; 51 ; Set Reverse/Blink Attribute TYPEG '> ; 52 ; Set Reverse/Blink/Underline Attribute LDIN 'o ; 53 ; Turn DISPLAY OFF LDIN 'n ; 54 ; Turn Display ON WORD 0 ; 55 WORD 0 ; 56 WORD 0 ; 57 WORD 0 ; 58 WORD 0 ; 59 WORD 0 ; 60 TYPEP '0 ; 61 CURSOR OFF FOR SUPER VUE TYPEP '2 ; 62 Cursor On - Solid block WORD 0 ; 63 WORD 0 ; 64 WORD 0 ; 65 WORD 0 ; 66 WORD 0 ; 67 WORD 0 ; 68 WORD 0 ; 69 LDIN 'f ; 70 start 25th line CNTRL 'M ; 71 end 25th line ; EVEN NUMLST=.-CMDTBL ; total # commands ; XLATB: ; Input Translation Table BYTE 'Q,^H06 ; ins chr BYTE 'R,^H1A ; delete line BYTE 'W,^H04 ; del chr BYTE 'E,^H02 ; ins line BYTE 'q,^H11 ; ^Q set insert mode BYTE '7,^H1B ; esc(send key) BYTE 'Y,^H0E ; ^Y Erase eol BYTE 'y,^H16 ; ^V Erase word BYTE 'T,^H19 ; ^N Skip Eol BYTE 'P,^H17 ; ^W Word skip BYTE 'I,^H01 ; bs (backtab) ^A BYTE 'L,^H16 ; ^V Erase Word BYTE 't,^H1F ; full line erase ^_ BYTE 'j,^H0B ; shifted up arrow fix BYTE 0,0 ; end of table FNCTAB: ; function translate table BYTE '@,^H14 ; ^T BYTE 'A,^H12 ; ^R BYTE 'B,^H13 ; ^s BYTE 'C,^H05 ; ^E BYTE 'D,^H0B5 ; ^G5 BYTE 'E,^H0F ; ^O BYTE 'F,^H18 ; ^X BYTE 'G,^H0B8 ; ^G8 BYTE 'H,^H1C ; ^\ BYTE 'I,^H10 ; ^P BYTE 'J,^H11 ; ^Q BYTE 0,0 EVEN END .