.TITLE TECINI - INITIALIZATION FOR TECOIO .IDENT "X0215" ; ; COPYRIGHT (C) 1976 BY DIGITAL EQUIPMENT CORPORATION, ; MAYNARD, MASSACHUSETTS ; ; THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY ON A ; SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH THE IN- ; CLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE, OR ; ANY OTHER COPIES THEREOF, MAY NOT BE PROVIDED OR OTHERWISE ; MADE AVAILABLE TO ANY OTHER PERSON EXCEPT FOR USE ON SUCH ; SYSTEM AND TO ONE WHO AGREES TO THESE LICENSE TERMS. TITLE ; TO AND OWNERSHIP OF THE SOFTWARE SHALL AT ALL TIMES REMAIN ; IN DIGITAL. ; ; THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITH- ; OUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ; DIGITAL EQUIPMENT CORPORATION. ; ; DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY FOR ; THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT WHICH IS ; NOT SUPPLIED BY DIGITAL. ; ; ANDREW C. GOLDSTEIN 9-APR-79 20:16 ; MARK H. BRAMHALL 10-APR-79 23:00 .MCALL GMCR$,FINIT$,GTSK$C,GLUN$C,GPRT$C,DIR$,EXIT$S,QIOW$C .PSECT IMPURE,D ; ; GET MCR COMMAND LINE BUFFER ; GMCR: GMCR$ .PSECT PURE,RO,D ; ; MESSAGE FOR NOT ENOUGH BUFFER SPACE TO INITIALIZE ; NOBF: .ASCII "Not enough buffer space" NOBFLN = .-NOBF ; ; CCL COMMAND LINE WON'T FIT IN THE FILENAME BUFFER. ; CMDLN: .ASCII "Command line won't fit"<15><12> CMDLNL = .-CMDLN ; ; COMMAND PROCESSING MACRO WON'T FIT IN THE TEXT BUFFER. ; CCLMP: .ASCII "Command processing macro won't fit" CCLMPL = .-CCLMP .EVEN ; "ET" (EDIT TYPEOUT) BITS ET$BIN == ET.IMG ; +1., OUTPUT IN BINARY (IMAGE) MODE ET$CRT == ET.CRT ; +2., DO SCOPE TYPE RUBOUT AND CONTROL/U ET$LC == ET.LOC ; +4., ACCEPT LOWER CASE INPUT ET$NCH == ET.NCH ; +8., NO ECHO DURING INPUT FOR CTRL/T ET$CCO == ET.CCO ; +16., CANCEL CONTROL/O ON OUTPUT ET$CKE == ET.CKE ; +32., RETURN -1 IF ERROR/NO INPUT ON CTRL/T ET$DET == ET.DET ; +64., DETACH AND DETACHED FLAG ET$XIT == ET.EXI ; +128., "NO PROMPT YET" FLAG ET$TRU == ET.TRN ; +256., TRUNCATE LONG OUTPUT LINES ET$IAS == ET.VT52 ; +512., INTERACTIVE SCOPE AVAILABLE FOR "WATCH" ET$RFS == ET.VT11 ; +1024., REFRESH SCOPE AVAILABLE FOR "WATCH" ; +2048., UNUSED ; +4096., UNUSED ; +8192., UNUSED ;+16384., UNUSED ET$CC == ET.CC ;-32768., ALLOW PROGRAM TO TRAP CONTROL/C ; "ED" (EDIT MODE) BITS ED$CTL == ED.CAR ; +1., DON'T ALLOW "^" AS MEANING CONTROL CHARACTER ED$YNK == ED.NPR ; +2., ALLOW YANKS, ETC. TO CLOBBER TEXT BUFFER ED$EXP == ED.SML ; +4., DON'T ALLOW ARBITRARY EXPANSION(S) ; +8., UNUSED ED$SRH == ED.SRH ; +16., DON'T RESET "DOT" ON SEARCH FAILURE ; +32., UNUSED ; +64., UNUSED ; +128., UNUSED ; +256., UNUSED ; +512., UNUSED ; +1024., UNUSED ; +2048., UNUSED ; +4096., UNUSED ; +8192., UNUSED ;+16384., UNUSED ;-32768., UNUSED ;+ ; ; *** - TECINI PRIMARY ENTRY POINT ; ; THIS IS WHERE TECO ITSELF STARTS TO RUN WHEN CALLED FROM MCR. THIS ; LEG OF CODE SETS UP THE DATA AREAS NEEDED BY TECO, INITIALIZES ; POINTERS AND COUNTS AS NECESSARY, AND THEN TRANSFERS TO TECO PROPER. ; ;- .PSECT CODE,RO .ENABL LSB TECINI:: FINIT$ ; INITIALIZE THE FILE STORAGE REGION MOV #ZBEGIN,R0 ; POINT TO START OF AREA TO CLEAR MOV #/2,R1 ; GET WORD COUNT 10$: CLR (R0)+ ; AND ZERO IT SOB R1,10$ GLUN$C TTYLUN,STRING,CODE ; GET INFO ABOUT TTYLUN MOV STRING+10.,TTLNSZ ; SAVE THIS TERMINAL'S LINE SIZE 20$: MOV #TYOBUF,BUFPT ; INIT TYPE OUT BUFFER POINTER GPRT$C ,STRING,CODE ; GET PARTITION PARAMETERS MOV @#$DSW,R4 ; IN ORDER TO GET TASK BASE ADDRESS GTSK$C GTSKBF,CODE ; GET TASK PARAMETERS ADD GTSKBF+G.TSTS,R4 ; IN ORDER TO GET "APPARENT" TASK SIZE MOV LOHI+2,R5 ; R5= BOTTOM OF DYNAMIC MEMORY, R4=TOP MOVB GTSKBF+G.TSSY,OPSYS ; SAVE OP-SYS INDICATION CMPB OPSYS,#5 ; IS OP-SYS VAX/VMS? BNE 30$ ; NO CLR ATTP3 ; YES, TERMINAL ATTACH QIO USES P1 FOR AST BR 40$ 30$: QIOW$C IO.RTT,TTYLUN,TTYEFN,,IOSTAT,,<>,CODE ; ATTEMPT NEW FUNCTION BCS 40$ ; BRANCH ON FAILURE CMPB IOSTAT,#IE.IFC ; IF ILLEGAL FUNCTION... BEQ 40$ ; IS OLD TERMINAL DRIVER CLR ATTP1 ; NEW 11M DRIVER USES P3 FOR TERMINAL AST ; OTHER SYSTEMS USE NEITHER 40$: CALL TTATT ; ATTACH THE TERMINAL MOV R5,R0 ; SAVE START OF STATIC ALLOCATIONS ADD #SCHSIZ+FILSIZ+TAGSIZ+PDLSIZ,R5 ; SKIP THE STATIC ALLOCATIONS MOV R5,SAVR5 ; SAVE IMPURE AREA POINTER MOV R4,R3 SUB R5,R3 ; R3=SIZE OF DYNAMIC MEMORY IN BYTES BLOS 50$ ; UNDERFLOW OR ZERO IS FATAL MOV #RWSIZE+MBFSIZ,R1 ; COMPUTE EXTRA SPACE NEEDED CMP R1,R3 ; IS IT ADEQUATE BLOS 60$ ; BRANCH IF YES 50$: JMP 160$ 60$: MOV R0,R1 ; GET BASE OF MEMORY TO CLEAR 70$: CLR (R1)+ ; ZERO IT CMP R1,R4 ; AT TOP? BLO 70$ ; NOT YET... ; ; INITIALIZE TECO'S STATE AREA, BASE ADDRESS IN R5, SIZE = RWSIZE ; R0 = BASE OF ALLOCATIONS ; R4 = TOP OF MEMORY ; R5 = BASE OF MEMORY ; MOV SP,TECOSP(R5) ; INIT BASE LEVEL STACK POINTER MOV R0,PDL(R5) ; ADDRESS OF PUSH DOWN LIST MOV R0,TECOPD(R5) ; BOTH OF THEM ADD #PDLSIZ,R0 ; FORM ADDRESS OF SEARCH BUFFER MOV R0,SCHBUF(R5) ; STORE SEARCH BUFFER POINTER ADD #SCHSIZ,R0 ; POINT TO FILE NAME BUFFER DECB -1(R0) ; -1 TERMINATES SEARCH BUFFER MOV R0,FILBUF(R5) ; POINTER TO FILE NAME BUFFER ADD #FILSIZ,R0 ; LENGTH OF FILE NAME BUFFER DECB -1(R0) ; TERMINATE WITH -1 MOV R0,TAGBUF(R5) ; POINTER TO TAG BUFFER ADD #TAGSIZ,R0 ; LENGTH OF TAG BUFFER DECB -1(R0) ; TERMINATE WITH -1 MOV #INFDB+F.BDB,INPNTR(R5) ; SET UP INPUT FILE FLAG PTR MOV #OUTFDB+F.BDB,OUPNTR(R5) ; SET UP OUTPUT FILE FLAG PTR MOV #TECOCH,TECOJP(R5) ; SET UP ADDRESS OF DISPATCH TABLE MOV #ET.EXI,ETYPE(R5) ; SET UP INITIAL ET FLAGS MOV #ED.CAR,EDIT(R5) ; SET ED FLAG TO NO "^" AS CTRL CMPB OPSYS,#5 ; IS OP-SYS VAX/VMS? BNE 75$ ; NO MOV #'_,SYMSPC(R5) ; YES, "_" IS ALSO A SYMBOL CHARACTER 75$: ; ; FIND OUT IF THE TERMINAL IS ENABLED FOR LOWER CASE ; MOV R4,-(SP) ; SAVE TOP OF MEMORY MOV #-1,OUTDNE(R5) ; SAY ALL SORTS OF OUTPUT WAS DONE CLR R4 ; GUESS AT NO "WATCH" (R/W SIZE=0) MOV #-1,CRTYPE(R5) ; SAY NO SCOPE INITIALLY QIOW$C SF.GMC,TTYLUN,TTYEFN,,IOSTAT,,,CODE BCS 100$ ; QUIT ON DIRECTIVE ERROR TSTB IOSTAT ; CHECK FOR I/O ERROR BLT 100$ ; SUCH AS UNSUPPORTED FUNCTION TSTB TTCHAR+1 ; OK - CHECK LOWER CASE MODE BEQ 80$ ; BRANCH IF NO BIS #ET.LOC,ETYPE(R5) ; YES - SET LOWER CASE TYPE-IN MOV #-1,EUFLAG(R5) ; AND TURN OFF CASE FLAGGING 80$: TSTB TTSCOP+1 ; CHECK FOR CRT TYPE TERMINAL BEQ 100$ ; BRANCH IF NO MOV #TTLNSZ,R4 ; YES, POINT TO THE SCOPE'S WIDTH CMPB OPSYS,#3 ; IS THIS IAS? BNE 90$ ; BRANCH IF NOT MOV #80.,(R4) ; IAS RETURNS GARBAGE WIDTH - ASSUME 80 90$: CALL @CRTRUB ; GO SET SCOPE TYPE, ETC. 100$: ADD #RWSIZE,R4 ; GO BEYOND TECO'S PRIVATE DATA ADD R5,R4 ; LEAVE R5 ALONE FOR TECO'S USE ; ; SPLIT THE REMAINING FREE SPACE 50-50 BETWEEN BUFFER AND Q-REGISTERS ; MOV (SP)+,R3 ; RECOMPUTE FREE SPACE REMAINING SUB R4,R3 BLOS 160$ ; NO SPACE... CMP R3,#MBFSIZ ; BELOW MINIMUM? BLO 160$ ; FATAL IF SO MOV R3,CORSIZ ; SAVE INITIAL AMOUNT OF MEMORY CLC ROR R3 ; COMPUTE HALF MOV R4,TXSTOR(R5) ; SET BASE OF TEXT BUFFER ADD R3,R4 ; ALLOCATE TEXT BUFFER MOV R3,ZMAX(R5) ; STORE SIZE IN STATE AREA MOV R4,QRSTOR(R5) ; SET ADDRESS OF Q-REGISTERS MOV R3,QMAX(R5) ; SET Q REGISTER AREA SIZE ; ; PICK UP THE MCR COMMAND LINE, IF ANY. THE COMMAND LINE IS STASHED IN ; THE FILENAME BUFFER, AND THE CCL PROCESSING MACRO IS MOVED TO THE TEXT ; BUFFER. THE INITIAL COMMAND STRING WILL MOVE THEM FROM THERE TO QZ AND QY, ; RESPECTIVELY. ; MOV #GMCR+G.MCRB,R0 ; GET ADDRESS OF COMMAND LINE CLR R1 ; ASSUME ZERO BYTE COUNT DIR$ #GMCR ; GET THE COMMAND LINE BCS 110$ ; BRANCH IF NONE MOV @#$DSW,R1 ; GET THE BYTE COUNT 110$: MOV FILBUF(R5),R2 ; GET ADDRESS OF FILENAME BUFFER CMP R1,#FILSIZ-1 ; SEE IF THE COMMAND LINE WILL FIT BHI 170$ ; BRANCH IF NOT 120$: DEC R1 ; COUNT CHARACTERS BLT 130$ MOVB (R0)+,(R2)+ ; COPY COMMAND LINE TO FILENAME BUFFER BR 120$ 130$: MOV #CCLCMD,R0 ; GET ADDRESS OF STORED CCL PROCESSING MACRO MOV #CCLCML,R1 ; AND BYTE COUNT MOV TXSTOR(R5),R2 ; GET ADDRESS OF TEXT BUFFER CMP R1,ZMAX(R5) ; SEE IF THE MACRO WILL FIT BHI 180$ ; BRANCH IF NOT MOV R1,ZZ(R5) ; SET TEXT BUFFER SIZE 140$: DEC R1 ; COUNT CHARACTERS BLT 150$ MOVB (R0)+,(R2)+ ; COPY MACRO INTO TEXT BUFFER BR 140$ 150$: DECB CCLFLG ; MARK COMMAND LINE PROCESSING PENDING MOV #INITL,CMDFDB+F.NRBD ; SET UP INITIAL COMMAND STRING MOV #INITC,CMDFDB+F.NRBD+2 MOV #CMDFDB,INDIR(R5) ; FAKE AN INDIRECT FILE JMP TECO ; ALL SET UP. ; ; NO BUFFER SPACE TO ALLOCATE MINIMUM TEXT SPACE ; 160$: MOV #NOBF,R3 ; GET MESSAGE MOV #NOBFLN,R4 BR 190$ ; ; COMMAND LINE DOESN'T FIT IN FILENAME BUFFER. ; 170$: MOV #CMDLN,R3 MOV #CMDLNL,R4 BR 190$ ; ; CCL MACRO DOESN'T FIT IN TEXT BUFFER. ; 180$: MOV #CCLMP,R3 MOV #CCLMPL,R4 190$: CALL PRINT ; TELL USER THERE IS NO ROOM EXIT$S ; AND EXIT FROM TECO .DSABL LSB .END