15300 !******************************************************************** & ! & ! FNTERM.B2S - Determine terminal type & ! & !-------------------------------------------------------------------- & ! & ! FN.TERM% uses non-privileged RSTS SYS calls & ! to determine the type of terminal opened & ! on channel KB%. & ! & ! & ! KB% - input - channel number for the keyboard & ! & ! FN.TERM% - output - type of terminal & ! & ! 0 = hard copy terminal & ! 1 = VT05B & ! 2 = VT50 & ! 3 = VT50H & ! 4 = VT52 or VT100 set as VT52 & ! 5 = VT55 & ! 6 = VT61 & ! 7 = VT61 w/printer & ! 8 = VT100 (ANSI mode) & ! & ! This routine will: & ! peek at JOBDA(1010(8) 520(10)) which points to & ! JDIOB( io block) which points to & ! IOB( io block) which points to & ! KB DDB(kb device data blk) & ! add 28 (10) which points to & ! TTCHAR. & ! bit 5 (40(8) 32 (10) will be & ! set for a VT TTY and & ! clear for a hard copy. & ! & ! then, if hard copy then exit, & ! & ! else, & ! We will look at the "interface type code" & ! (KB DDB plus 30(10)) which points to TTINTF) and & ! determine if we are running on a pseduo KB & ! (interface type code = 10(8)=8(10)). & ! & ! if not on pseudo KB, & ! send ESC "Z" to have TTY identify itself & ! and set appropiate flag. & ! if on pseudo KB, & ! check TTXON (in ttchar). & ! if set then VT100 family, & ! if not set then VT52 family. & ! & ! & ! & ! FIP$ temporary work variable & ! KB.INDX% keyboard index & ! TTXON% terminal XON number & ! ESC.SEQ$ identifier returned from the terminal & ! TERM$ terminal code & ! TERM% terminal type & ! & !**************************************************************** & 15310 DEF FN.TERM% (KB%) & 15315 FIP$ = CHR$(6%) ! FIP SYS call & + CHR$(16%) ! Set terminal function & + CHR$(0%) ! null & + CHR$(255%) ! This keyboard & + STRING$(17%,0%) & \ TERM% = ( PEEK(PEEK(PEEK(PEEK(520%)))+28%) AND 2%^5%) & \ GO TO 15360 IF TERM% = 0% & \ KB.INDX% = ( PEEK(PEEK(PEEK(PEEK(520%)))+30%) AND 255%) & \ TTXON% = ( PEEK(PEEK(PEEK(PEEK(520%)))+28%) AND 2%^12%) & \ TERM% = 4% IF TTXON% = 0% & \ TERM% = 8% IF TTXON% <>0% & \ GO TO 15360 IF KB.INDX% = 8% & ! Check for scope/hardcopy, exit if hardcopy. & ! Check if on pseudo kb, if so pick VT52/VT100 by state of XON bit. & 15318 WORK$ = SYS (FIP$ + CHR$(255%)) & \ ON ERROR GO TO 15340 & \ WORK$ = SYS (CHR$(11%) + CHR$(KB%)) & ! Cancel all type ahead characters. & & \ PRINT #KB%, CHR$(155%) + "Z" & \ WAIT 3% & \ INPUT #KB%, ESC.SEQ$ & ! Request identification from the terminal. & 15320 TERM$ = MID$ (ESC.SEQ$, 2%, 1%) & \ TERM% = 0% & \ TERM% = 2% IF TERM$ = "A" & OR TERM$ = "B" & \ TERM% = 3% IF TERM$ = "J" & OR TERM$ = "H" & \ TERM% = 4% IF TERM$ = "K" & OR TERM$ = "L" & OR TERM$ = "M" & OR TERM$ = "Q" & OR TERM$ = "R" & OR TERM$ = "S" & OR TERM$ = "T" & OR TERM$ = "Z" & \ TERM% = 5% IF TERM$ = "C" & OR TERM$ = "E" & \ TERM% = 6% IF TERM$ = CHR$(96%) & OR TERM$ = CHR$(97%) & \ TERM% = 7% IF TERM$ = CHR$(98%) & OR TERM$ = CHR$(99%) & \ TERM% = 8% IF TERM$ = "?" & !*\ TERM% = 8% IF SEG$( ESC.SEQ$, 2%, 3% ) = "62" & \ TERM% = 0% IF SEG$(ESC.SEQ$,1%,5%) = "[?15c" ! Correspondent? & \ WORK$ = SYS (FIP$ + CHR$(128%)) & \ PRINT #KB%, CHR$(155%) + "A"; & \ GO TO 15360 & 15340 RESUME 15360 & 15360 FN.TERM% = TERM% & \ WAIT 0% & ! ON ERROR GO TO 19000 & ! Set function value. & 15399 FNEND & &