.TITLE CATCHALL TASK .IDENT /V2.08/ .ENABL LC .NLIST CND,BEX ;+ .IF DF R$$MPL ; Catchall task for RSX-11M-PLUS V2.1C .IFF ; Catchall task for RSX-11M V4.1B .ENDC ; ; COPYRIGHT (C) 1981,1982,1983,1984,1985 Sira Ltd. ; South Hill, Chislehurst, Kent, BR7 5EH, England. ; ; Author: C J Doran ; ; This task is invoked by MCR whenever it gets a command it doesn't recognise. ; This may be a call to a task which is not currently installed, and must be, ; or a "pseudo-command" which must be replaced by, or expanded to, a standard ; MCR or PIP instruction. Examples of the latter are: ; ; HOLD becomes SET /HOLD=TI: ; DELete becomes PIP /DE ; ; Assemble as: ; ; >MAC CATCHALL,CATCHALL=LB:[200,200]RSXMC/PA:1,[1,1]RUNMAC/ML,SY:[ggg,mmm]CATCHALL ; ; Task-build as: ; ; >TKB ; TKB>CATCHALL/PR/-FP/-EA/MM/MU,CATCHALL=CATCHALL ; TKB>LB:[1,1]EXELIB/LB,[1,54]RSX11M.STB/SS ; TKB>/ ; ENTER OPTIONS: ; TKB>UNITS=3 ; TKB>ASG=TI:1,MT:2,SY:3 ; TKB>ACTFIL=1 ; TKB>STACK=48 ; TKB>TASK=...CA. ; TKB>PAR=GEN ; TKB>PRI=150 ; TKB>SUPLIB=FCSFSL:SV ! or as available ; TKB>// ; ; MODIFICATIONS RECORD: ; ********************* ; ; V2.06 13-Apr-84 CJD ; General revision for RSX V4.1B:- ; Add: B11, S96, S99, FTR, X99, HFE, SRT, FCB, DES, IFL, CNV, DSP, ; BCK, RST, DEF, XON=CCS, PCA, LSP, DSM, VMR, VT2xx. ; Make DIR=SRD /1L:68 for slow wide things (LA36). ; Allow TTn{:} device option for CLG, CLK, CLS, for CCS compatibility. ; Make BRI do /3L, even if to file (BRI LP/SP=...). ; ; V2.07 14-Aug-84 CJD ; Make PUN = PCH. ; Add EMB, P20, P24, LOG(OUT)=BYE, PCC, PCG, DTC, Dxx for debuggers, ; LST = LISTRS, RWU = rewind & offline. ; Return warning status on CLS and CLG if not a VDU (like TDX). ; Last-ditch lookup is user's, or system, CATCHALL.CMD. ; General revision for RSX-11M-PLUS V2.1C, conditionalised on R$$MPL ; where appropriate:- ; Require GIN$ to find whether a task is installed, USTP$ doesn't ; seem to work on prototype tasks. ; Under M+, catchall runs as xxxTnn, where xxx is the first three characters on ; the command line. This gives two problems:- ; 1. Only 3-letter Radix-50 names are allowed. Hence delete all ; 1&2-letter ones, and non-Radix-50 symbols. ; 2. Name of Catchall will clash with the task we want to spawn on ; autoinstall. Have to use RPOI (which is better anyway) instead. ; Having catchall at a priority (150) > that of INS (100) enables ; us to get out before INS finds the clash. ; 3. For same reason, use a DCL-like flying install (RUN /CMD=...) ; for things that should be REMoved on exit. ; 4. Only Tektronix runaway that can be detected is 0xx... or 7xx... . ; 5. Because of above, delete 7221. ; 6. Add SEM and SED, SET /MCR, and SET /DCL, since < and > forbidden. ; ; V2.08 6-Feb-85 CJD ; Add LJ3, LJ4, LJ5, LJ6 LaserJet print commands. ; Add XOF to X-off a terminal (mainly LaserJet on startup). ; Add SHB = show batch. ; Correct SHP to QUE PP:/FU:P, so as NOT to display batch. ; Auto-install D80, T68, F7D, ABS, MAS (as A68), LST, MOU. ; Change task file names for ANT, P68, P80, Hxx. ; Add SPD, treated as a special case of file=file. ;- ; Define the following symbol to display SPWNs with terminal QIOs for testing: ;DEBUG=0 .MCALL DIR$,SPWN$,SPWN$M,SPWN$R,QIOW$,QIOW$M,QIOW$R,GMCR$ .MCALL STSE$,SETF$,FCSMC$,SREX$,SREX$S,ASTX$S,USTP$,USTP$R .MCALL ALUN$,ALUN$M,ALUN$R,GIN$,RPOI$,GLUN$ FCSMC$ ESC=33 ; Escape character SI=17 ; Shift in T.2648=200 ; Local terminal type for 2648a TILUN=1 ; LUN for TI: MTLUN=2 ; LUN for default magtape device SYLUN=3 ; LUN for SY: .PSECT CODE,I,RO,CON ; Get command line. START: DIR$ #GMCR ; Get command line BCC 10$ ; Continue of OK 1$: JMP ERROR ; Exit if error 10$: MOV $DSW,%0 ; Get command line length BGT 30$ ; Continue if there is one JMP EXIT ; Do nothing if blank or error ; Anything starting 0 or 7 is assumed to be a Tektronix runaway 30$: CMPB GMCR+G.MCRB,#'0 ; '0'? BEQ 40$ ; Yes, stop it CMPB GMCR+G.MCRB,#'7 ; '7'? BNE 50$ ; No, continue 40$: JMP TEKRUN ; Yes, issue error message and exit 50$: CLRB GMCR+G.MCRB(%0) ; Make sure buffer terminates with 0 MOV %0,CMDLEN ; Save length for install-and-run ; Case 1: Pseudo-commands which are simply replaced. ; Macro M0 sets up the table. Parameters are: ; CMD 3-letter command name, ; REPLCE replacement command line. .MACRO M0 CMD,REPLCE .NCHR N, .ASCIZ "CMD""REPLCE" .ENDM M0 ; Macro TABLE changes to PSECT TABLES and defines the table name. .MACRO TABLE LAB .PSECT TABLES,D,RO,CON LAB: .ENDM TABLE ; Macro ENDTAB ends table with '#', and changes back to CODE PSECT. .MACRO ENDTAB .BYTE '# .PSECT CODE,I,RO,CON .ENDM ENDTAB ; Search TABLE, and branch to NOTFND if no match. .MACRO SEARCH,TABLE,NOTFND JSR %5,SEARCH ; Search TABLE TABLE BCS NOTFND ; Branch if not found .ENDM SEARCH TABLE REPTAB M0 HLD, M0 NOH, M0 WRA, M0 NOW, M0 SHB, M0 SHO, M0 SHQ, M0 SHW, M0 SHP, M0 SH0, M0 SH1, ; M0 SH2, M0 DLG, M0 POO, M0 SYS, M0 DSK, M0 DSL, M0 DSY, M0 DSM, M0 LA3, M0 VT5, M0 VT1, M0 VT2, M0 264, M0 TER, M0 ERF, M0 ERO, M0 LOG,BYE ; LOGOUT, like DCL M0 SEM, M0 SED, ENDTAB SEARCH REPTAB,ONEPAR ; Search table. Try 1 parameter if not found MOVB (%1)+,%0 ; Found, next byte in table is cmd length MOV %1,RPOI+R.POBF ; Load address MOV %0,RPOI+R.POBL ; and length into RPOI DPB JMP RPEXIT ; Execute spawn and exit ; Case 2: Read one (mandatory) parameter, insert in string, and resubmit command. ; Use FRETAB-type processing if parameter is optional (see below). ; Macro M1 has the following parameters: ; CMD 3-letter command name, (or 1 letter+space) ; PREFIX 3-letter MCR command name, e.g. PIP, ASN ..., ; SUFFIX string to be appended to end of line, e.g. PIP switch. .MACRO M1 CMD,PREFIX,SUFFIX .ASCII "CMD" .IIF IDN,PREFIX,PIP, .ASCII "*" ; * means "PIP" .IIF DIF,PREFIX,PIP, .ASCII "PREFIX " .ASCIZ "SUFFIX" .ENDM M1 TABLE ONETAB M1 DEL,SRD, M1 ERA,SRD, M1 PUR,SRD, M1 TRU,SRD, M1 CRE,PIP,<=TI:> M1 EMP,PIP,<=NL:> M1 SYD,ASN,<=SY:> M1 PRO,PIP, ; /PR/OW:R/GR:R/WO:R/SY:R M1 UNP,PIP, ; /PR/OW:RWED/GR:RWED/WO:RWED/SY:RWED M1 OWN,PIP, M1 ULK,SRD, ; (Can't be UNL as that's UNLoad) M1 EOF,SRD, M1 RMV,PIP, M1 KIL,QUE, ; QUE dev:/KILL ENDTAB ONEPAR: SEARCH ONETAB,ONEALL ; Search table. Try special 1-parameter case if not found TSTB @%0 ; Is there a parameter? BEQ MISIN ; No, error JSR PC,PREFIX ; Found, load prefix BR INSON ; Go insert ; Case 3: As above, but need not be an argument. TABLE ALLTAB M1 BRI,SRD, M1 DIR,SRD, M1 OLD,SRD, M1 FUL,SRD, M1 SDE,SRD, M1 TOT,SRD, ENDTAB ONEALL: SEARCH ALLTAB,TWOPAR ; Search table. Try 2-parameter case if not found JSR PC,PREFIX ; Found, load prefix TSTB @%0 ; Any filename? BEQ ADSUF ; No, just add suffix INSON: JMP INSONE ; Yes, insert before suffix .REM ! ; Old code for PIP -- append ;* if no explicit version (e.g. to list all ; files not just latest). Not required for SRD. ; Copy file name(s), noting if a ';' occurs. If not, insert ';*' before ; a comma, or end-of-line. DEC %2 ; Dummy statement to simplify branches 4$: CLR %4 ; %4 counts semicolons 5$: INC %2 ; Advance output pointer 6$: MOVB (%0)+,@%2 ; Copy a character BEQ 30$ ; End if null CMPB @%2,#'; ; Semi-colon? BNE 10$ ; No, branch INC %4 ; Yes, note it BR 5$ ; and go for next character 10$: CMPB @%2,#'[ ; Start of UIC? BNE 20$ ; No, branch 11$: INC %2 ; Yes, advance pointer MOVB (%0)+,@%2 ; and copy CMPB @%2,#'] ; until closing bracket BNE 11$ ; to bypass the comma BR 5$ ; Then restart normal copying 20$: CMPB @%2,#', ; Comma? BNE 5$ ; No, continue copying 30$: TST %4 ; Yes, has there been a semi-colon? BNE 35$ ; Yes, check for end CMPB -1(%2),#': ; No, make sure not just disk BEQ 35$ CMPB -1(%2),#'] ; and/or directory BEQ 35$ MOVB #';,(%2)+ ; Files given, put in ; MOVB #'*,(%2)+ ; * 35$: MOVB -1(%0),@%2 ; Put back terminating character BNE 4$ ; Back for more if it was a comma BR ADSUF ; Complete with suffix if it was the null ! ; Case 4: Two parameters. ; Used for DCL-like PIP commands. Swap the parameters inserting an = sign. ; e.g. REName file1 file2 becomes PIP file2=file1/RE TABLE TWOTAB M1 COP,PIP, ; Note: Cxx may be Copy ONLY M1 REN,PIP, M1 APP,PIP, M1 MER,PIP, M1 ENT,PIP, ENDTAB TWOPAR: SEARCH TWOTAB,REPEAT ; Search table. Try cmd file=file if not JSR PC,PREFIX ; Load prefix MOV %0,-(SP) ; Save first file pointer 10$: TSTB @%0 ; Skip first, testing for null BNE 20$ ; Must be two CMPB GMCR+G.MCRB,#'C ; except for COPy command which can have null dest BNE MISIN ; Error otherwise 20$: CMPB (%0)+,#<' > ; Look for space BNE 10$ ; Keep looking JSR PC,INSERT ; Insert second string if found 30$: MOVB #'=,(%2)+ ; Put in an equals sign MOV (SP)+,%0 ; Restore pointer to first file JSR PC,INSERT ; and insert it TSTB -(%0) ; Terminating null (COPy with 1 parameter)? BEQ ADSUF ; Yes, just add suffix DEC %2 ; No, trim blank ADSUF: JMP ADDSUF ; Add suffix and spawn ; Case 4a: If only one parameter, it must be repeated around an '=', ; e.g. LIN file becomes LIN file=file ; Allow for case of two arguments, which is just like TWOPAR, and for ; command file invocation, which doesn't need the repeat (or =). ; Also includes SPD command, but use : instead of =. TABLE RPTTAB M1 LIN,FTB M1 SPD, ENDTAB REPEAT: SEARCH RPTTAB,SPECL ; In table? Try special commands if not TSTB @%0 ; Must have an argument BEQ MISIN ; Error if not JSR PC,PREFIX ; Found, insert prefix MOV %0,%5 ; Save parameter pointer JSR PC,INSERT ; Copy file MOVB #':,(%2)+ ; Put in a colon, in case CMPB GMCR+G.MCRB,#'S ; SPD command? BEQ 6$ ; Yes, can't have @ DEC %2 ; No, delete ':' CMPB @%5,#'@ ; Indirect file reference? .IF NDF R$$MPL BNE 5$ ; No, need second file CMPB GMCR+G.MCRB,#'{ ; Yes, unless this is CORAL BNE JCLXIT ; Spawn if not JMP ERROR ; Else error -- CORAL doesn't take indirect files .IFF BEQ JCLXIT ; That's all if so. Go spawn .ENDC 5$: MOVB #'=,(%2)+ ; Put in an '=' sign 6$: TSTB @%0 ; Second file? BNE 10$ ; Yes, just load it MOV %5,%0 ; No, re-load first 10$: JSR PC,INSERT ; Put in file BR ADSUF ; Add suffix and spawn ; Case 5: Special commands. TABLE FRETAB M1 FRE,PIP, M1 BEF, M1 DAY, M1 AFT, M1 WID, ENDTAB TABLE TYPTAB M1 TYP, M1 LP0, M1 LP1, ; M1 LP2, M1 LJ3, M1 LJ4, M1 LJ5, M1 LJ6, M1 PCH, M1 PUN, ENDTAB TABLE CHDTAB M1 CHD,,<]> ENDTAB TABLE ATSTAB M1 ATS, ENDTAB TABLE CLSTAB .ASCIZ "CLS" ENDTAB TABLE CLGTAB .ASCIZ "CLG" ENDTAB TABLE REWTAB .ASCIZ "REW" .ASCIZ "RWU" ENDTAB TABLE XONTAB .ASCIZ "XOF" .ASCIZ "XON" .ASCIZ "CCS" ENDTAB ; TYP file becomes PIP TI:=file ; LP0 file becomes PRI LP0:=file etc ; ; These are the same as ONETAB, but no space is inserted after the prefix. SPECL: SEARCH TYPTAB,FRE ; Use table search. Try FRE if absent TSTB @%0 ; Is there a parameter? BNE JTYPE ; Yes, continue MISIN: JMP MISSIN ; No, error ; FRE {device} becomes PIP {device}/FR ; DAY {date} becomes SRD /DA:{date}, BEFore, AFTer similarly. FRE: SEARCH FRETAB,CHD ; Search table. Try CHD if not found. JSR PC,PREFIX ; Put in the prefix JMP INSONE ; and join common code to finish ; CHD becomes SET /UIC ; CHD [g,m] becomes SET /UIC=[g,m] ; The brackets around g,m are optional. CHD: SEARCH CHDTAB,ATS ; Try "CHD". Try ATS if not CHD JSR PC,PREFIX ; Load "SET /UIC=[" DEC %2 ; Trim terminating blank TSTB @%0 ; See if a parameter given BEQ 10$ ; No, go send "SET /UIC" CMPB @%0,#'[ ; Was an opening bracket given? BNE 5$ ; No, continue INC %0 ; Yes, skip '[' in input 5$: JSR PC,INSERT ; Insert rest of UIC CMPB -1(%2),#'] ; Was the terminating ']' given? BEQ JCLXIT ; Yes, finished JMP ADDSUF ; No, append it 10$: CMPB -(%2),-(%2) ; No parameter, step pointer back 2 bytes JCLXIT: JMP CLXIT ; Join common code ; ATS becomes ACT /ALL ; ATS TTn: becomes ACT /TERM=TTn: ATS: SEARCH ATSTAB,CLS ; Try "ATS". Try CLS if not TSTB @%0 ; Any parameter? BEQ ACTAL ; No, branch JTYPE: JMP TYPE ; Yes, use TYPe code ACTAL: MOV #ACTALL,RPOI+R.POBF ; No, use "ACT /ALL" MOV #ACTLEN ,RPOI+R.POBL RPXIT: JMP RPEXIT ; Request and exit ; Clear alphabetic screen by sending out escape sequence appropriate to terminal. CLS: SEARCH CLSTAB,CLG ; Search table. Try CLG if not JSR PC,ASNLUN ; Assign required LUN if not TI: QIOW$R QIOW,#SF.GMC,,,,,,<#GETTYP,#4,#100401> ; Get terminal type MOV #1,%1 ; If a DEC terminal, will need one QIOW$M QIOW,,,,,,,<#NULBYT> ; null byte TSTB TERTYP ; DEC device? BPL CLGO ; Yes, device-independent clear allowed MOV #CLEARA-3,%0 ; No, address list of strings BR CLGQ ; and look up like CLG ; Clear graphics screen by sending out escape sequence appropriate to terminal. ; On non-graphics terminals, just disable special keypad/alternate character ; set (if applicable). CLG: SEARCH CLGTAB,XON ; Search table. Try XON if not JSR PC,ASNLUN ; Assign required LUN if not TI: MOV #CLEARG-3,%0 ; Address list of clear-screen strings QIOW$R QIOW,#SF.GMC,,,,,,<#GETTYP,#4> ; Get terminal type CLGQ: ADD #3,%0 ; Point to next entry TSTB @%0 ; Null? BEQ JEXIT ; No string if not in list CMPB TERTYP,(%0)+ ; Else is it this entry? BNE CLGQ ; No, try for next or end MOVB (%0)+,%1 ; Yes, fetch string length as a word QIOW$M QIOW,,,,,,,<@%0,,#53> ; Output in append mode CLGO: QIOW$M QIOW,#IO.WLB,,,,,,<,%1> ; Set to output string MOVB SCPBIT,%0 ; Is this a scope? BNE QEXIT ; Yes, do QIO and exit JMP $EXST ; No, exit with warning status (0) from SCPBIT ; Cancel control-S and control-O on named terminal. Note: writing TC.CTS ; doesn't work if there is anything in the type-ahead buffer, or something is ; being output (task attached?), so do a break-through write instead. XON: SEARCH XONTAB,REW ; Search table. Try REWind if not JSR PC,ASNLUN ; Assign required LUN if not TI: BCS JERR ; Error message if it fails QIOW$M QIOW,#IO.WBT,,,,,,<#NULBYT,#1,#0> ; Set for a null bk-through write CMPB GMCR+G.MCRB+2,#'F ; But is this XOF? BNE QEXIT ; No, that's it ; Can't IO.anything for X-off. Set TC.CTS and hope it works. QIOW$M QIOW,#SF.SMC,,,,,,<#XOFTAB,#2> QEXIT: JMP QIOXIT ; Do QIO and exit JERR: JMP ERROR ; Output and return with error JEXIT: JMP EXIT ; Standard exit ; REWind {Mmn:} ; Rewind, leave online ; RWU {Mm:} ; Rewind and turn offline REW: SEARCH REWTAB,INSTAL ; Try install if not REWind MOV #IO.RWD,%5 ; Leave online if REW CMP %1,#REWTAB+4 ; But if RWU BLOS 10$ MOV #IO.RWU,%5 ; Turn offline afterwards 10$: INC ALUN+A.LULU ; LUN 2 is default magtape device JSR PC,ASNLUN ; Reassign if device named BCS 20$ ; Error if it fails DIR$ #MAGTAP ; Assign OK, get tape characteristics BCS 20$ ; Trap error BIT #21000,IOSTAT+2 ; At BOT, or rewinding already? BNE JEXIT ; Yes, redundant operation, just exit BIT #400,IOSTAT+2 ; No, select error? BNE 20$ ; Yes, failed CMPB GMCR+G.MCRB+1,#'W ; Was it RWU? BNE 15$ ; No, default RWD QIOW$M MAGTAP,#IO.RWU ; Yes, change to rewind and offline 15$: QIOW$R MAGTAP,%5 ; All OK, try the actual rewind BCS 20$ ; Trap error in directive TSTB IOSTAT ; and its execution BGT JEXIT ; Else success 20$: QIOW$M QIOW,,,,,,,<#RWFAIL,#RWFLLN> ; Load error message JMP ERROR ; and fail ; Common completion code. TYPE: JSR PC,PREFIX ; Copy prefix DEC %2 ; Trim terminating blank INSONE: JSR PC,INSERT ; Insert parameter ADDSUF: JSR PC,SUFFIX ; Copy in suffix CLXIT: JMP CLEXIT ; Spawn and exit ; Case 6: Install a utility and resubmit command to MCR. ; Macro MI parameters: ; CMD 3-letter command name, ; INSCMD Command given to INS, including task filename and any special ; switches. May be blank if it is just of the form INS $CMD. .MACRO MI CMD,INSCMD .ASCII "CMD" .ASCIZ "INSCMD" .ENDM MI TABLE INSTAB ; Order tasks by frequency of use MI UND MI EDT MI BAS,BASIC MI STO,STOP MI CWD MI F77 MI F7D MI TKB MI TEC MI MAK, MI EDI MI S80, MI S68, MI S69, MI S65, MI H80, MI H68, MI H69, MI H65, MI PRM MI PCC MI DTC MI RMD MI INP,INPUT MI PLO MI SRD MI COR,CORAL34 MI COC,COCO34 MI TEK MI RNO ; Local RUNOFF MI DSR ; Digital (DECUS) Standard RUNOFF MI SPE,SPELL MI GRE,GREP MI LST,LISTRS MI LBR MI MAC MI FTB MI BRO MI PWD, MI WHO MI SNT,SIRANET MI HPX MI LSP,LISP MI FTR MI FCB MI XMT MI HFE MI KWC MI SRT MI DMP MI FLX MI CMP MI CAL,CALC ; Whitesmith's Pascal/C: MI PTC MI CPP MI CP1 MI CP2 MI P68 MI P80 MI A68, MI MAS MI A80 MI LKR MI HEX MI LBY MI REL MI LOR MI ANT MI CPM MI X99 MI D80 MI T68 MI ABS ; End of Whitesmith's & RTS stuff. MI BOB,BOBO34 MI LD1 MI ORC MI BPL,BCPL MI MAG MI MTL,MAGTAPE MI FMT MI IOX MI ERR,ERROR MI LST MI S48, MI S41, MI S18, MI Z80, MI S62, MI S51, MI SCM, MI S22, MI S96, MI S99, MI H48, MI H41, MI H18, MI HZ8, MI H62, MI H51, MI H22, MI H96, MI H99, MI MDU MI MDD MI TEX MI TMU,TEXEMU MI TXR MI LNK,LINKER MI MVI MI IDX MI P20,PAL20 MI P24,PAL24 MI EMB MI RNU,RENUM MI EXC MI HEY MI WHE,WHEN MI BOO MI PCG MI ELI MI INI MI FRC MI MUN, MI PAT MI SLP ; RMS utilities MI DES,RMSDES MI IFL,RMSIFL MI CNV,RMSCNV MI DSP,RMSDSP MI BCK,RMSBCK MI RST,RMSRST MI DEF,RMSDEF MI DEF,RMSRES ; End of RMS MI ZAP, MI STK MI RAT,RATFOR ; Following are normally installed permanently; include in case REM'd MI PIP MI MOU MI DMO ENDTAB INSTAL: SEARCH INSTAB,SYSTSK ; Search table. Try system task if not there MOV %1,-(SP) ; Save pointer MOV #INS$,%1 ; Address INS prefix JSR PC,PREFIX ; Load install prefix MOV (SP)+,%1 ; Get task name pointer back JSR PC,ADDNAM ; Add name 20$: SUB #CMDBUF,%2 ; Compute command length JSR PC,PRIV ; Set privileged to install .IIF DF DEBUG, QIOW$R QIOW,,,,,,,<#CMDBUF,%2> ; Repeat to TI: if debugging SPWN$R INSPWN,,,,,,,,,,,%2 ; Spawn INS DIR$ #STSE1 ; Wait for INStall JSR PC,USRPRV ; Then restore user status CMP EXSTAT,#EX$SUC ; Make sure INS worked BEQ 25$ ; Yes, can send command now JMP LOST ; No, INS failed 25$: MOV #GMCR+G.MCRB,RPOI+R.POBF ; Load user command MOV CMDLEN,RPOI+R.POBL JMP RPEXIT ; Go request it ; Case 7: System tasks which should be removed on exit, so RUN/CMD=/TASK= TABLE SYSTAB MI DSC MI VMR MI CON MI HOM,INI MI BAD MI UFD MI ACS MI BRU MI VFY MI CDA MI RPT MI LOA MI UNL MI GET,GETBIN ENDTAB SYSTSK: SEARCH SYSTAB,USRTSK ; Try user task if not system MOV %1,-(SP) ; Save task filename pointer MOV #RUN$,%1 ; Address "RUN $" JSR PC,PREFIX ; prefix MOV (SP)+,%1 ; Restore filename pointer JSR PC,ADDNAM ; Add name TSTB @%0 ; Command line given? BEQ RUNNOC ; No BR RUNCMD ; Yes ; Case 8: See if a .TSK file of the specified name exists, and RUN it if so USRTSK: FINIT$ ; Initialise FCS JSR PC,CMDWO$ ; Address first character BNE 10$ ; Branch unless starts '$' = try LB:[1,54]. MOV #"LB,DEFFIL+N.DVNM ; $, change device name MOV (PC)+,%1 ; Load library UIC .BYTE 54,1 ; Binary format [1,54] JSR PC,.WDFUI ; and make it the default 10$: MOV #DEFFIL+N.FNAM,%4 ; Address space for name in filename block MOV #3,%3 ; Load a counter 15$: CLR %1 ; Flag "don't include periods" JSR PC,$CAT5 ; in Radix-50 conversion MOV %1,(%4)+ ; Store converted 3 chars BCS 20$ ; Done if end of string SOB %3,15$ ; Else convert up to 9 chars 20$: JSR PC,LOOKUP ; See if file exists BCC 30$ ; Use it if found CMPB GMCR+G.MCRB,#'$ ; Not found, looking in library directories? BNE USRCMD ; No, try .CMD instead .IF DF R$$MPL MOV (PC)+,%1 ; Yes, also try .BYTE 54,3 ; [3,54] JSR PC,LOOKUI ; Look for it there BCS JERROR ; Not found, error .IFF BR JERROR ; Yes, not there is error .ENDC 30$: BITB #FD.REC,FDB+F.RCTL ; Record-orientated device? BNE JERROR ; Yes, can't RUN MOV #RUN,%1 ; Address "RUN " JSR PC,PREFIX ; as prefix MOV #GMCR+G.MCRB,%0 ; Re-load command line address JSR PC,INSERT ; Add command name given TSTB -(%0) ; Terminated on null? BEQ RUNNOC ; Yes, no command line DEC %2 ; No, must be space, lose it RUNCMD: MOV #SLHCMD,%0 ; Insert /CMD=" JSR PC,INSERT JSR PC,CMDWO$ ; Then, except for a starting $, 25$: MOVB (%0)+,(%2)+ ; the whole of the line BNE 25$ ; until terminating null MOVB #'",-1(%2) ; which must be replaced by trailing quote RUNNOC: MOV #SLHTSK,%0 ; Address /TASK= JSR PC,INSERT ; Add that JSR PC,CMDWO$ ; Back to start of line, except $ .REPT 3 ; 1st 3 chars give name MOVB (%0)+,(%2)+ ; to run under .ENDR DIR$ #GLUN ; Get info on our terminal MOVB DIRBUF+G.LUNA,(%2)+ ; 1st char is same as device (T or V) CLR %1 BISB DIRBUF+G.LUNU,%1 ; for unit number CMPB %1,#77 ; OK if < 77 BLOS 40$ ASH #-3,%1 ; Else calculate high order character ADD #'A-10,%1 ; as a letter MOVB %1,(%2)+ ; -- the first MOVB DIRBUF+G.LUNU,%1 ; Get value back for second BIC #^C7,%1 ; which is a single digit 40$: CLR %0 ; Sign extend DIV #10,%0 ; Split %1 into hi & lo octal digits BEQ 50$ ; Don't output leading zero ADD #'0,%0 ; But do output a digit MOVB %0,(%2)+ 50$: ADD #'0,%1 ; Always output 2nd digit MOVB %1,(%2)+ CLRB @%2 ; add a trailing null BR CLEXIT ; Request and exit JERROR: JMP ERROR ; Long branch to ERROR ; Case 8, look for a .CMD file in the user's or library directory USRCMD: MOV #^RCMD,DEFFIL+N.FTYP ; Filetype required is .CMD JSR PC,LOOKUP ; Look up file BCC 20$ ; Use if found JSR PC,.RDFUI ; Fetch default UIC MOV %1,-(SP) ; Save it JSR PC,LOOKLB ; Look up again, in library directory MOV (SP)+,%1 ; Get back default UIC in case needed BCC 20$ ; Use library @ file if found MOV #"SY,DEFFIL+N.DVNM ; Else users: SY: MOV #^RCAT,DEFFIL+N.FNAM ; CAT MOV #^RCHA,DEFFIL+N.FNAM+2 ; CHA MOV #^RLL ,DEFFIL+N.FNAM+4 ; LL.CMD JSR PC,LOOKUI ; Look that up BCC 10$ ; Found, go use it JSR PC,LOOKLB ; Look up again, in library UIC BCS JERROR ; Command not recognised if not found 10$: MOV #CATCMD,%1 ; Found, address "@CATCHALL " BR 30$ ; as prefix 20$: MOV #AT,%1 ; User or library command file put in an '@' 30$: JSR PC,PREFIX ; as prefix MOV #GMCR+G.MCRB,%0 ; Re-load command line address ADDALL: MOVB (%0)+,(%2)+ ; Copy rest of command BNE ADDALL ; until terminating null DEC %2 ; which is not required ; Common exit code, compute length of command, request and exit. CLEXIT: SUB #CMDBUF,%2 ; Compute string length MOV %2,RPOI+R.POBL ; Complete DPB (default buffer CMDBUF) ; Command line ready. Certain commands invoke utilities which may not be ; installed. This could result in a recursive call of CA., which just gives ; an error from MCR. To prevent this, check for the special cases in the ; following table, and if found, copy CMDBUF to the MCR buffer and go ; back to INSTAL. Lookup table is just 3-letter Radix-50 task names. ; Note that we can't check everything, because MCR commands like SET aren't ; installed tasks. RPEXIT: MOV RPOI+R.POBF,%0 ; Get command line address MOV %0,%5 ; Save pointer, MOV RPOI+R.POBL,%3 ; and also line count, in case copy needed MOV %3,CMDLEN CLR %1 ; No '.'s JSR PC,$CAT5 ; Fetch task name to Radix-50 MOV #CHKINS,%0 ; Address table of tasks to check 10$: CMP %1,(%0)+ ; In table? BEQ 20$ ; Yes, must check TST @%0 ; Reached end of table? BNE 10$ ; No, try next BR RPOIIT ; Yes, no check required .IF NDF R$$MPL 20$: USTP$R USTP,,%1 ; Found, try an unstop to see if installed .IFF 20$: MOV #^R...,GIN+G.IP03 ; Found, load ... MOV %1,GIN+G.IP03+2 ; xxx into GIN$ DPB DIR$ #GIN ; to see if installed .ENDC CMP $DSW,#IE.INS ; Returns IE.INS if not BNE RPOIIT ; Anything else means task is installed MOV #GMCR+G.MCRB,%0 ; Not installed, address GMCR buffer 30$: MOVB (%5)+,(%0)+ ; Put new command line in buffer SOB %3,30$ MOVB (%5)+,(%0)+ ; Not forgetting terminator JMP INSTAL ; Go install and send command RPOIIT: .IIF DF DEBUG, QIOW$R QIOW,,,,,,, ; Repeat to TI: if debugging DIR$ #RPOI ; Execute request, and exit BCS RPFAIL ; Command lost if not accepted ; Abort trap ABOTRP: DIR$ #SETF1 ; Cancel stop for spawn by setting flag ADD @SP,SP ; Purge stack of SREX arguments MOV #10$,2(SP) ; Return to message printout ASTX$S 10$: QIOW$M QIOW,,,,,,,<#ABOMSG,#ABOLEN> ; CA. -- Aborting MOV #EX$SEV,EXSTAT ; Severe error exit status BR QIOXIT ; Exit ; Error Traps. TEKRUN: QIOW$M QIOW,,,,,,,<#TEKMSG,#TEKMGL> ; //CA. -- Tektronix runaway BR ERROR RPFAIL: QIOW$R QIOW,,,,,,,<#RPOFLD,#RPOFLN> ; CA. -- Request failed ; BR LOST LOST: QIOW$M QIOW,,,,,,,<#CMDLST,#LSTLEN> ; CA. -- Command lost BR ERROR MISSIN: QIOW$M QIOW,,,,,,,<#PARMSG,#PARMSL> ; CA. -- Parameter missing ERROR: MOV #EX$SEV,EXSTAT ; Severe error QIOXIT: DIR$ #QIOW ; Output message and exit EXIT: MOV EXSTAT,%0 ; Load exit status EXIT1: JMP $EXST ; Exit with it .SBTTL SUBROUTINES ; Compare first 3 characters of string in MCR buffer with each table entry. ; If a match is found, update %0 past the command string, and return with %0 ; pointing to the first character of the command (or terminating null if none), ; and %1 pointing to the next character in the table. Carry is clear if a match ; is found, and set if not (in which; case %0 and %1 are undefined). ; On entry, by JSR %5,SEARCH, the table address is in the word following ; the call. SEARCH: MOV (%5)+,%1 ; Get table address 10$: MOV #GMCR+G.MCRB,%0 ; Address start of command line CMPB @%1,#'# ; End of table? SEC ; Set flag in case BEQ 20$ ; Exit, carry set, at end of table CMPB (%0)+,(%1)+ ; Compare first pair of characters BNE 30$ ; Exit search if mismatch CMPB (%0)+,(%1)+ ; Repeat for second pair BNE 30$ ; Exit if mismatch CMPB (%0)+,(%1)+ ; Must match on three BNE 30$ ; Exactly ; Match found, advance %0 to first space, /, or null. 15$: TSTB @%0 ; Null? BEQ 20$ ; Yes, done CMPB @%0,#'/ ; '/', starting argument? BEQ 20$ ; Yes, exit, keeping it CMPB (%0)+,#<' > ; Space? BNE 15$ ; No, keep looking 20$: RTS %5 ; Return when found (carry clear on BEQ) ; Match not found. Advance to next table entry -- end of entry flagged ; with a null. 30$: TSTB (%1)+ ; Null? BNE 30$ ; No, keep skipping BR 10$ ; Yes, start again ; PREFIX -- Load prefix addressed by %1 into CMDBUF, setting %2 to address ; next character position, terminating on null or space. ; Check for first character of insert = '*', and use "PIP " if so. ; ; SUFFIX -- Append text addressed by %1, where %2 points. ; ; A '#' in the input string will be replaced by a space. PREFIX: MOV #CMDBUF,%2 ; %2 -> destination buffer MOVB (%1)+,@%2 ; Copy 1st char BEQ 10$ ; Exit on null CMPB (%2)+,#'* ; Was it '*'? BNE SUFFIX ; No, continue copying MOVB #'P,-1(%2) ; Yes, load P MOVB #'I,(%2)+ ; I MOVB #'P,(%2)+ ; P MOVB #' ,(%2)+ ; space 10$: RTS PC ; and return ; Insert (task) filename addressed by %1. Same as table entry if none. ADDNAM: TSTB @%1 ; Is it null? BNE SUFFIX ; No, continue reading string SUB #3,%1 ; Yes, filename same as task name SUFFIX: MOVB (%1)+,@%2 ; Copy string BEQ 10$ ; Exit on null CMPB @%2,#'# ; Trap '#' BNE 5$ MOVB #' ,(%2)+ ; Converting to a space BR SUFFIX 5$: CMPB (%2)+,#<' > ; Also exit on space BNE SUFFIX 10$: RTS PC ; Return ; INSERT -- Copy text addressed by %0 to where %2 points, terminating on ; null or space. INSERT: MOVB (%0)+,@%2 ; Copy character BEQ RTSPC ; Exit if null CMPB (%2)+,#<' > ; or space BNE INSERT RTSPC: RTS PC ; Exit point (also used by PRIV/USRPRV) ; Point back to the start of the command line, skipping an initial $. ; Return z set if there was, else nz. CMDWO$: MOV #GMCR+G.MCRB,%0 ; Then the whole of the line CMPB (%0)+,#'$ ; Except for a starting $ BEQ 10$ DEC %0 ; Wasn't one, go back to start (clears z) 10$: RTS PC ; If anything follows on command line, assume it to be an (actual) device name ; and assign LUN to it. Return cs if error, else cc from DIR$. ASNLUN: TSTB @%0 ; Device given? BEQ 20$ ; No, default MOVB (%0)+,ALUN+A.LUNA ; Yes, copy 2 bytes of device name MOVB (%0)+,ALUN+A.LUNA+1 ; Copy second JSR PC,$COTB ; Convert unit number TSTB %2 ; Must end on null BEQ 10$ CMPB %2,#': ; or colon SEC ; Return cs for BNE 20$ ; invalid otherwise 10$: ALUN$R ALUN,,,%1 ; OK, load unit number and do assign 20$: RTS PC ; Set terminal to privileged (and slaved) status. On exit, TICW2 addresses ; the (modified) terminal status word, and OLDST2 contains its original value ; so that user status can be restored by MOV OLDST2,@TICW2 . PRIV: CALL $SWSTK,RTSPC ; Switch to system state MOV $TKTCB,%4 ;; Get task TCB address MOV T.UCB(%4),%4 ;; to get UCB address ADD #U.CW2,%4 ;; Address terminal status word MOV @%4,OLDST2 ;; Save terminal status word 2 MOV %4,TICW2 ;; and its address BIS #U2.SLV!U2.PRV,@%4 ;; Slave and privilege terminal RETURN ; Exit system state & return to caller ; Restore user's normal privilege status. USRPRV: CALL $SWSTK,RTSPC ; Switch to system state MOV OLDST2,@TICW2 ;; Restore user privilege RETURN ; Exit system state & return to caller ; See if a file exists. Return cc if so, else cs. Default filename block at ; At LOOKUP, DEFFIL must contain expected filename, and UIC set by .WDFUI. ; At LOOKUI, %1 must contain new default binary UIC. ; At LOOKLB, device and UIC are set to the command library directory. LOOKLB: MOV #"LB,DEFFIL+N.DVNM ; @ files on LB: MOV (PC)+,%1 ; Load library UIC .BYTE 203,200 ; Binary format [200,203] LOOKUI: JSR PC,.WDFUI ; and make it the default LOOKUP: MOV #FDB,%0 ; Address FDB MOV #FDB+F.FNB,%1 ; and its filename block CLR %2 ; No dataset descriptor MOV #DEFFIL,%3 ; But a default filename block JSR PC,.PARSE ; Load FDB BCS 10$ ; Try library command if that fails JSR PC,.FIND ; Look for file 10$: RTS PC ; Return with carry flag .SBTTL MISCELLANEOUS DATA .PSECT DATA,RW,D,CON GETTYP: .BYTE TC.TTP ; Buffer for get terminal type TERTYP: .BYTE 0 ; Type no returned here .BYTE TC.SCP ; Get scope bit SCPBIT: .BYTE 0 ; to here XOFTAB: .BYTE TC.CTS,1 ; X-off terminal CMDLEN: 0 ; Store command length GMCR: GMCR$ ; Get MCR line DPB and buffer RPOI: RPOI$ MCR...,,,,,,CMDBUF,,RP.OEX!RP.ONX ; General request command INSPWN: SPWN$ MCR...,,,1,1,1,,EXSTAT,CMDBUF,,0,TT ; Spawn for INS STSE1: STSE$ 1 ; Stop for spawn to complete SETF1: SETF$ 1 ; Set flag on abort to cancel stop .IF NDF R$$MPL USTP: USTP$ ...XXX ; Unstop ...xxx to see if installed .IFF GIN: GIN$ GI.TSK,DIRBUF,8.,0,0 ; GIN directibe, to see if task installed .ENDC QIOW: QIOW$ IO.CCO,TILUN,TILUN,,,, ; Terminal QIO ALUN: ALUN$ 1 ; Reassign LUN GLUN: GLUN$ TILUN,DIRBUF ; Get LUN info DIRBUF: .BLKW 8. ; to here IOSTAT=DIRBUF ; Also used as I/O status block MAGTAP: QIOW$ IO.SEC,MTLUN,MTLUN,,IOSTAT ; For REWind command. First get characteristics SREX: SREX$ ABOTRP ; Enable abort trap EXSTAT: .WORD EX$SUC ; Exit status, assume success EXSTA2: .WORD 0 ; Dummy for spawn of REM etc. .NLIST BEX ; FCS area for task file check. .EVEN FSRSZ$ 0,0,DATA ; No buffers needed .EVEN FDB: FDBDF$ ; Define FDB FDRC$A FD.RWM ; Open in block mode FDBK$A 0,0,,SYLUN ; No data ever read FDOP$A SYLUN,,DEFFIL,FO.RD ; LUN SYLUN, Def name, read only DEFFIL: NMBLK$ ,TSK,0,SY,0 ; Default device SY0:, filetype .TSK TICW2: 0 ; TI: status word 2 address OLDST2: 0 ; TI: status word 2 original (user's) value CMDBUF: .BLKB 110. ; Command line buffer -- .EVEN ; enough room for /CMD= & /TASK= .PSECT TABLES,RO,D,CON ACTALL: .ASCII "ACT /ALL" ACTLEN=.-ACTALL INS$: .ASCIZ "INS#$" RUN$: .ASCIZ "RUN#$" RUN: .ASCIZ "RUN#" SLHCMD: .ASCIZ '/CMD="' SLHTSK: .ASCIZ '/TASK=' AT: .ASCIZ "@" CATCMD: .ASCIZ "@CATCHALL#" .MACRO ERMESG NAME,LENGTH,MESSAG NAME: .IIF IDN NAME,TEKMSG, .ASCII "//" .ASCII "CA. -- MESSAG" LENGTH=.-NAME .ENDM ERMESG ERMESG INSFLD,INSFLN, ERMESG CMDLST,LSTLEN, ERMESG TEKMSG,TEKMGL, ERMESG NOTINS,NOTLEN, ERMESG RPOFLD,RPOFLN, ERMESG PARMSG,PARMSL, ERMESG ABOMSG,ABOLEN,Aborting ERMESG RWFAIL,RWFLLN, CL2648: .BYTE ESC,'H,ESC,'J ; Clear screen for HP2648a CL264L=.-CL2648 ; Length CG105: .ASCII "1""I0""2" ; Clear (real) VT-105 graphics CG200: CG125: CG120: CG100: .ASCII ">""(B" ; Numeric keypad, USA character set CG120L=.-CG120 ; That's all for LA120 .BYTE SI ; Select it by shift-in in VTxxx terminals CG100L=.-CG100 CG105L=.-CG105 .ASCII "Pps(m0(l0)i0,e)""\" ; Clear graphics on VT125 CG125L=.-CG125 CG200L=.-CG200 CG2648: .ASCII "*dA" ; Clear graphics on 2648a CG264L=.-CG2648 CG52: .ASCII "G"">" ; VT-52 special chars off, numeric keypad CG52L=.-CG52 ; Lookup tables for clear alpha and clear graphics strings: ; Entry is: ; .BYTE terminal type ; or null for end-of-table ; .BYTE string length ; .WORD string address .MACRO C TYPE,LENGTH,ADDR .BYTE TYPE,LENGTH .WORD ADDR .ENDM C .EVEN ; Make sure we are at a word boundary CLEARA: C T.2648,CL264L,CL2648 ; 2648a NULBYT: .BYTE 0 ; is only entry at present .EVEN CLEARG: C T.VT52,CG52L,CG52 ; VT52 -- keypad + alt char set C T.L120,CG120L,CG120 ; LA120 ditto C T.V100,CG100L,CG100 ; VT100 ditto C T.V105,CG105L,CG105 ; VT100 does real graphics too C T.V125,CG125L,CG125 ; VT125 ditto C T.V2XX,CG200L,CG200 ; VT200-series ditto (may be VT24x) C T.2648,CG264L,CG2648 ; 2648a graphics only .BYTE 0 .EVEN ; Following tasks may be required by catchall, so make sure they are installed, ; and install them if not. CHKINS: .RAD50 /SRD/ .RAD50 /ELI/ .RAD50 /PIP/ ; Just in case it gets REMoved .WORD 0 ; End of table .END START