.TITLE CONIO ... consol i/o module .IDENT /300783/ .ENABL LC ; ; ; ; Written by Ray Di Marco ; 27-Feb-81. ; ; ; Version 200482/07 ; ; ;------------------------------------------------------------------------ ; ; ; This module contains a number of entry points to allow byte and string ; I/O to be performed to the console, and to envoke special operations. The ; module uses a number of terminal specific modules to perform I/O via the ; terminal; it sets up internal jump vectors to ensure that the correct ; driver is used for all tty I/O. The entry points are ; ; CON.ST must be called to startup module. Carries out initialization. ; CON.CI returns a character in R0. ; CON.CO outputs character in R0. ; CON.LI returns .asciz string in buffer @R0. ; CON.LO performs a .PRINT on string @R0. ; CON.XY positions cusor on coordinates X:Y passed in R0 (X=lob) ; CON.EL erases CRT line. Line number is Y coordinate passed to HOB R0. ; CON.ES erases all CRT screen and places cusor at home (ie X,Y=0,0) ; CON.EX exits program. ; ; The following tables gives the equivalent RT11 function performed by ; the various routines. ; ; CON.CI ... .TTYIN ; CON.CO ... .TTYOUT ; CON.LI ... .GTLIN R0 ; CON.LO ... .PRINT R0 ; CON.ES ... none ; CON.EL ... none ; CON.XY ... none ; CON.EX ... either .EXIT or .CHAIN ; (see core common command sect) ; ; Note that external modules must be supplied with appropriate entry points ; to do the terminal specific I/O operations. These entry points use ; identical calling conventions to the eqivalent routines in this module. ; ; Note *** supported terminal types VT100 VT52 ISC TVI912 ADM3A ; supported operating systems TSX-p RT11 RSTS ; .SBTTL Modifications ; ; 1-Oct-82 issue error message instead of aborting on invalid TTY type ; 5-Jan-83 support ADM3A ; 2-Feb-83 move tables into ASECT to allow module to be overlayed ; and support MEMMNG module's entry point. CON$LI and CON$EX ; routines moved into CONIOS module to support overlaying! ; 23-Mar-83 Perform a .SRESET at startup time to insure all channels free ; For TSX-plus MNTYPE routine resets TTY I/O characteristics ; For TSX-plus MNTYPE enable Transperant I/O mode ; Add in support for VC404 (see VC4IO.MAC module) terminal ; 30-May-83 Add in RSTS/E initialization code ; 30-Jul-83 RSTS/E does not reset location 50 when perform a .CHAIN, and ; will not expand memory if chaining to a larger program. To ; simplify RSTS/E operation reset location 50 with program ; high limit and use MEMMNR instead of MEMMNE! ; .SBTTL Documentation - Core Common Usage ; ; This module uses the memory area 500!8 onwards to hold important data ; that must be passed between chained programs. This area is called the core ; common area. This module automatically moves the stack to location 1200!8 ; to increase the amount of memory available to pass data between programs. ; The following memory organization is used ; ; Address Name Function ; 540 CC.FLG Holds ^RCRT if locations 542/544 set up ; 542 CC.TYP Holds ^R CRT type identifier string ; 544 CC.ARG Holds arument needed by TVI driver ; 546 CC.CMD Holds ^RCMD iff core common holds commands ; 550 CC.PNT Points to next command in core common ; 552+ Holds .asciz strings/commands ; ; These locations are reserved for the usage of this module. The 540 to 544 ; locations are used so that the CRT type can be remembered accross chains. ; The 546+ locations are used to allow a MENU program to communicate with its ; CUSPs. This is done by the menu program setting up .ASCIZ strings in ; memory, setting CC.CMD=^RCMD and pointing CC.PNT to the first .ASCIZ string ; prior to chaining to the CUSP. This results in these memory .ASCIZ strings ; being returned to the cusp when CON.LI is called. ; ; If the first byte of a core common string has bit 7 set, it is treated as a ; command to the CON.LI routine. The special commands recognized are ; ; 301 -> no more data in core common ; 302 -> no more data in core common for this program. While ; there may still be more core common commands, these are ; not for this program. ; 303 -> end of core common data for program. The next 8 bytes ; hold the rad50 name of the program to chain to when ; CON.EX is called. ; .SBTTL MACRO - 'CMDTAB' ... CREATE A COMMAND TABLE ; ; ; ; THIS MACRO IS USED TO CREATE A COMMAND TABLE WHICH CAN BE USED ; BY 'TBLKUP' FOR COMMAND DECODING. TO USE IT DO THE FOLLOWING- ; ; CMDTAB NAME ; CREATE AND LABLE TABLE ; CMDENT COMMAND,ROUTINE ; COMMAND --> ROUTINE ; ....... ; CMDEND ; TERMINATE TABLE ; ; 'TBLKUP' IS CALLED WITH THE COMMAND STRING IN 'R0' AND THE TABLE ; ADDRESS (NAME) IN 'R1'. IT RETURNS WITH THE ROUTINE ADDRESS IN ; 2(R1) IF IT FINDS THE COMMAND IN THE TABLE. ; ; ; ; .MACRO CMDTAB TABLE TABLE: .MACRO CMDENT NAME,VAL1,VAL2=0,VAL3=0 .SAVE .PSECT MESSAGE ZZZZZ1 = . .ASCIZ /NAME/ .RESTORE .WORD ZZZZZ1,VAL1,VAL2,VAL3 .ENDM CMDENT ; .MACRO CMDEND .WORD 0,0,0,0 .MACRO CMDTAB .ENDM CMDTAB .MACRO CMDENT .ENDM CMDENT .ENDM CMDEND ; .ENDM CMDTAB ; .SBTTL DECLARATIONS ; ; .MCALL .GTLIN,.PRINT,.TTYOUT,.CHAIN ; RT-11 .MCALL .EXIT,.GVAL,.SERR,.HERR,.SRESET ; RT-11 .MCALL .PUSH,.POP,ABORT ; DBSLIB ; ; .GLOBL CON.ST ; initialization entry .GLOBL CON$LI,CON$EX ; CONIOS ; .GLOBL TBLKUP ; TBLKUP .GLOBL ASCNUM ; ASCNUM .GLOBL MEMMNT,MEMMNR,MEMMNE ; MEMMNG ; JSW = 44 ; address of RT-11 JSW J.LC = 40000 ; LC enabled flag J.SM = 10000 ; Special mode TTY input J.CHN = 00400 ; Job cahined to flag ; ; CC.FLG = 540 ; If = ^RCRT -> type set up CC.TYP = 542 ; holds CRT type ID in ^R CC.ARG = 544 ; used to hold TVI argument CC.CMD = 546 ; If = ^RCMD -> commands in memory CC.PNT = 550 ; points to commands ; ; .SBTTL ASECT tables and data structures ; ; insure that have lots of stack room as locations 500-1000 may hold ; chain data ; .ASECT ; open absolute section . = 42 ; stack location .WORD 2000 ; more up top of stack to leave .... . = 2000 ; .... more room in core common ; ; MEMMNG is called to obtain more memory. The MEMMNG module contains the ; routines to manage memory. Under TSX-plus the initialization code ; patchs location MEMMNG to a 'NOP'. ; MEMMNG::BR 1000$ ; assume under RT-11 BR 1100$ ; assume under TSX-plus JMP MEMMNE ; RSTS/E entry 1000$: JMP MEMMNR ; RT-11 entry 1100$: JMP MEMMNT ; TSX-plus entry ; ; setup the CON.?? entry points; these entry points cause execution to be ; passed to the corresponding routine in the CONVTB table. Note that the ; CON.LI entry is different in case have Core-command Commands ; CON.CI::JMP @CONVCI ; input one chracter from the console CON.CO::JMP @CONVCO ; output one chracter to the console CON.LO::JMP @CONVLO ; output a line to the console CON.ES::JMP @CONVES ; erase the console screen CON.EL::JMP @CONVEL ; erase a line on the console screen CON.XY::JMP @CONVXY ; position the cusor on the screen CON.LI::JMP CON$LI ; entry to input line of text ****** CON.EX::JMP CON$EX ; entry to exit program ; ; CONVTB holds entry points for the terminal driver to be used. The table ; is modified by the initialization code. ; CONVTB::.RAD50 /V10/ ; identifies terminal type CONVCI::.WORD V10.CI ; input one chracter from the console CONVCO::.WORD V10.CO ; output one chracter to the console CONVLI::.WORD V10.LI ; input a line from the console CONVLO::.WORD V10.LO ; output a line to the console CONVES::.WORD V10.ES ; erase the console screen CONVEL::.WORD V10.EL ; erase a line on the console screen CONVXY::.WORD V10.XY ; position the cusor on the screen ; ; .SBTTL Initialization Code ; ; ; The initialiaztion code performs two functions. The first is to set ; up the I/O vectors to pass control to the desired TTY driver module, ; while the second is to perform special initialization needed for ; the different operating systems. ; ; ; .PSECT INITLZ ; open initialization area ; ------ ------ ; CALL CON.ST ; SETUP TIME ; .PSECT CODE ; open code area ; ------ ---- ; ; CON.ST: .SRESET ; insure all channels free CALL TTTYPE ; set up for terminal type CALL MNTYPE ; set up for monitor RETURN ; exit ; ; .SBTTL Initialization code - "TTTYPE" ... set up for TT type ; ; ; If location CC.FLG holds ^RCRT then location CC.TYP holds CRT ; type identifer. If CRT type set up skip to 1000$. ; TTTYPE: CMP @#CC.FLG,#^RCRT ; type in core common? BEQ 1000$ ; yes -> 1000$ ; ; Don't know CRT type, so must ask user for type and then ; lookup entry for type in table. Abort if cannot find type. ; 100$: .GTLIN #BUF,#PRMT ; prompt for CRT type MOV #BUF,R0 ; get ready for decode MOV #T.TYPE,R1 ; .................... CALL TBLKUP ; Decode time BCS 7000$ ; fail -> abort ; ; Set up CRT type in core command incase needed by next program. ; 200$: MOV #^RCRT,@#CC.FLG ; idicate that have setup .... MOV 2(R1),@#CC.TYP ; .... CRT id in core common CALL @4(R1) ; carry out special init ; ; ; Use CRT type code stored in CC.TYP to find entry for CRT in device ; table. ; 1000$: MOV @#CC.TYP,R0 ; R0 = CRT type MOV #DVCTAB,R1 ; R1 -> Table of drivers 1100$: TST (R1) ; EOT? BEQ 7000$ ; yes -> exit CMP R0,(R1) ; found entry? BEQ 2000$ ; yes -> skip ADD #20,R1 ; point next entry BR 1100$ ; loop ; ; ; Setup I/O vectors to pass control to the I/O routines for the ; desired terminal. ; 2000$: MOV #CONVTB,R0 ; R0 -> CONVTB MOV #10,R2 ; R2 = COUNTER 2100$: MOV (R1)+,(R0)+ ; Set up I/O vectors SOB R2,2100$ ; for TTY type ; ; RETURN ; all done ; 7000$: .PRINT #ERRMES ; tell failed BR 100$ ; try again ; .SBTTL Initialization code - "MNTYPE" ... set up for monitor type ; ; See if under RSTS/E by checking USR size. If are enable MEMMNE. ; MNTYPE: MOV @#54,R0 ; R0 -> RMON TST 374(R0) ; USR size = 0? BNE 100$ ; no --> under RSTS/E ;; MOV #NOP,MEMMNG ; yes -> enable ;; MOV #NOP,MEMMNG+2 ; MEMMNE MOV LIMIT+2,@#50 ; reset MEMTOP BR 1000$ ; done ; ; See if running under TSX-plus by trying to obtain job number. If ; under TSX-plus enable single character input and patch MEMMNG so ; that TSX-plus memory management routine is used. ; 100$: .SERR ; no abort **** MOV #6000$,R0 ; R0 -> request EMT 375 ; running under TSX-plus? BCS 1000$ ; no --> skip .GVAL #6000$,#-4 ; yes -> get leading character MOV R0,R1 ; save leadin character .IRPC X, ; setup .TTYOUT R1 ; TTY .TTYOUT #''X ; I/O .ENDR ; characteristics MOV #NOP,MEMMNG ; enable MEMMNT ; ; RT-11, TSX and RSTS initialization for enabling LC. ; 1000$: .HERR ; allow error abort BIS #J.LC!J.SM,@#JSW ; ALLOW LC and special mode ; ; If no Core-common Commands available disable CON.LI call to CON$LI ; BIT #J.CHN,@#JSW ; chained to? BEQ 2000$ ; no --> skip CMP @#CC.CMD,#^RCMD ; any Core-common commands? BEQ 3000$ ; yes -> skip 2000$: MOV 7000$+0,@#CON.LI ; no --> disable **** MOV 7000$+2,@#CON.LI+2 ; call to GTLIN **** 3000$: RETURN ; all done ; 6000$: .BYTE 0,110 ; RQST - return TSX line number .WORD 0 ; extra word for .GTVAL 7000$: JMP @.+ ; replaces CALL CON$LI ; .SBTTL TABLE - 'T.TYPE' ... LIST OF VALID CRT TYPES ; ; The following table is used to decode the ascii name of the CRT ; type input by the user. The table consists of the valid CRT names ; (as ascii strings), the CRT type identification code (rad50 string), ; and the address of the routine to which control is to be passed to ; carry out any special initialization for the terminal type. ; ; CMDTAB T.TYPE ; start table ; ; name id init ; CMDENT <^RV52>,T.NOI ; terminal=VT52 CMDENT <^RV10>,T.NOI ; terminal=VT100 CMDENT <^RISC>,T.NOI ; terminal=INTECOLOR CMDENT <^RISC>,T.NOI ; terminal=INTECOLOR CMDENT <^RADM>,T.NOI ; terminal=ADM3A CMDENT <^RVC4>,T.NOI ; terminal=VC404 CMDENT <^RTVI>,T.TVI ; terminal=TVI-912 CMDENT ; end table ; ; This code carries out special initialization needed by the TVI ; driver. It stores a delay counter in location CC.ARG needed to stop ; the terminal lossing chracters at higher buad rates. ; T.TVI: .GTLIN #BUF,#TVIPMT ; ask for delay MOV #BUF,R1 ; R1 -> answer CALL ASCNUM ; get answer MOV R0,@#CC.ARG ; save delay INC @#CC.ARG ; ensure non-zero T.NOI: RETURN ; all done ; ; .SBTTL TABLE - DVCTAB ... LEGAL DEVICE DRIVERS ; ; ; THIS TABLE CONTAINS A LIST OF ENTRY POINTS FOR EACH LEGAL ; DEVICE DRIVER. ; ; .MACRO ENTRY NAME NAME: .RAD50 /NAME/ .GLOBL NAME'.CI ; INPUT ONE CHRACTER FROM THE CONSOLE .WORD NAME'.CI ; INPUT ONE CHRACTER FROM THE CONSOLE .GLOBL NAME'.CO ; OUTPUT ONE CHRACTER TO THE CONSOLE .WORD NAME'.CO ; OUTPUT ONE CHRACTER TO THE CONSOLE .GLOBL NAME'.LI ; INPUT A LINE FROM THE CONSOLE .WORD NAME'.LI ; INPUT A LINE FROM THE CONSOLE .GLOBL NAME'.LO ; OUTPUT A LINE TO THE CONSOLE .WORD NAME'.LO ; OUTPUT A LINE TO THE CONSOLE .GLOBL NAME'.ES ; ERASE THE CONSOLE SCREEN .WORD NAME'.ES ; ERASE THE CONSOLE SCREEN .GLOBL NAME'.EL ; ERASE A LINE ON THE CONSOLE SCREEN .WORD NAME'.EL ; ERASE A LINE ON THE CONSOLE SCREEN .GLOBL NAME'.XY ; POSITION THE CUSOR ON THE SCREEN .WORD NAME'.XY ; POSITION THE CUSOR ON THE SCREEN .ENDM ENTRY ; ; ; DVCTAB: ENTRY V52 ; VT52 ENTRY ENTRY V10 ; VT100 ENTRY ISC ; ISC ENTRY ENTRY ADM ; ADM ENTRY ENTRY VC4 ; VC404 ENTRY TVI ; TVI-912 .WORD 0,0 ; ; .SBTTL MESSAGES/BUFFERS ; ; LIMIT: .LIMIT BUF: .BLKB 30 .NLIST BIN .ENABL LC PRMT: .ASCII /CRT type: /<200> ERRMES: .ASCII /CON.ST-error-invalid terminal type!/<12><15>