.TITLE CAT .ENABL LC ; ; Catchall routine executed by MCR after it fails to match ; input command. CAT first tries to match one of its special ; commands; if it doesn't succeed, it passes the command to ; DCL. ; ; CAT should be installed as ...CA. ; .MCALL GMCR$,ISTAT$,STATE$,TRAN$,EXIT$S,QIOW$S,DIR$,RPOI$ ; .GLOBL CA.DBG ;Debug parameter - CA.DBG=1 ; if typeout required .GLOBL CA.UIC ;UIC for indirect ; command file library ;(Format as in [1,24]ICMFSLBLD) ; CA.LUN = 1 ;TI: output CA.EFL = 1 ;Event flag for CA. ; ; CAT:: ; ; Pick up the command: ; DIR$ #GMCR ;Get command line BCS EXIT ; ; Set up table-driven parser ; MOV OPTION,R1 MOV #KEYTAB,R2 MOV #GMCR+G.MCRB,R4 ;Start of MCR command MOV $DSW,R3 ;Length of command MOV #START,R5 CLR DCLCMD+R.POBL ; ; Call parser ; CALL .TPARS MOV DCLCMD+R.POBL,R0 BEQ EXIT CMP #MAXL,R0 ;Make sure length <= 79. BGT 1$ MOV #MAXL,DCLCMD+R.POBL 1$: ; ; Debugging output ; TST #CA.DBG ;Debugging? BEQ 2$ ;No QIOW$S #IO.WVB,#CA.LUN,#CA.EFL,,,, ; ; Send command to DCL ; 2$: MOVB #RP.OEX!RP.ONX,DCLCMD+R.POSC ;Pass 1st conn & force exit DIR$ #DCLCMD EXIT: EXIT$S ; ; Data: ; GMCR: GMCR$ ;Get command line ; MAXL = 79. IOSB: .BLKW 2 ;Status for QIO$ ; DCLCMD: RPOI$ ...DCL ;Spawn DCL and pass connection ; EXST: .BLKW 8. ;Exit status block ; ; ; Table-driven parser: ; ; See the I/O operations reference manual for full details. ; ; Generate the tables: ; ISTAT$ STATAB,KEYTAB ; OPTION: .BYTE 0,3 ;Match 3 characters ; ; Check for special command: ; STATE$ START TRAN$ "CLR",$EXIT,CLR ;CLR - Clear screen TRAN$ '$,$EXIT,IND ;$ - Indirect from library TRAN$ "CHD",CHD ;CHD - SET/SHO DEFAULT TRAN$ $LAMDA,$EXIT,DCL ;No match - Pass to DCL ; ; Process CHD: ; STATE$ CHD TRAN$ $EOS,$EXIT,SHD ;No argument - SHO DEF TRAN$ $LAMDA,$EXIT,SED ;SET DEF ; STATE$ ; ; CLR - Clear screen ; CLRBUF: .BYTE 0 .EVEN CLR: QIOW$S #IO.WVB,#CA.LUN,#CA.EFL,,,,<#CLRBUF,#1,#100401> RETURN ; ; $ - Indirect from library UIC ; ; $XXX becomes @LB:[ggg,mmm]XXX ; CAUIC: .WORD CA.UIC ;CA.UIC defined in task build INDCMD: .ASCII /@LB:[ggg,mmm]/ INDCML = .-INDCMD .EVEN ; IND: CALL UIC ;Set up library UIC MOV #INDCML,R1 MOV #INDCMD,R2 CALL JOIN RETURN ; ; Convert GLOBAL CA.UIC from octal to [ggg,mmm] ; UIC: JSR R2,$SAVVR ;Save registers MOV #INDCMD+5.,R0 TSTB CAUIC+1 ;Look at group no BNE 1$ ;Use SYSUIC if zero MOV #454,CAUIC ;[1,54] 1$: MOVB CAUIC+1,R1 ;Convert high byte to ggg MOV #1,R2 CALL $CBTMG MOV #INDCMD+9.,R0 MOVB CAUIC,R1 ;Convert low byte to mmm MOV #1,R2 CALL $CBTMG RETURN ; ; CHD - Set or show default ; ; CHD [DEV][UIC] - both DEV and UIC are optional ; ; DEV has the form DDn: ; UIC has the form [ggg,mmm] or ggg,mmm ; ; SHD - Show default DEV and UIC ; SHDCMD: .ASCII /SHO DEF/ SHDCML = .-SHDCMD .EVEN ; SHD: MOV #SHDCML,DCLCMD+R.POBL MOV #SHDCMD,DCLCMD+R.POBF RETURN ; ; CHD - Set default UIC ; SEDCMD: .ASCII /SET DEF / SEDCML = .-SEDCMD .EVEN ; SED: MOV #SEDCML,R1 MOV #SEDCMD,R2 CALL JOIN RETURN ; ; CAT default - Pass command to DCL ; DCL: MOV R4,DCLCMD+R.POBF MOV R3,DCLCMD+R.POBL RETURN ; ; JOIN - Subroutine to paste command strings together ; ; During execution of transition processing routine, ; R3 contains the length of the remainder of the ; input string, and R4 points to this remainder. ; ; Call (Within a transition processing routine): ; ; MOV #BUF,R2 ;Address of first part ; MOV #LEN,R1 ;Length of first part ; CALL JOIN ; ; JOIN will move the first part of the command to the ; output buffer, and will add the remainder of the input ; line. It will also set up the RPOI$ buffer address and ; length parameters. ; JOIN: MOV #CMDBUF,R0 ;Output command buffer MOV R0,DCLCMD+R.POBF ;Set up RPOI$ address MOV R1,DCLCMD+R.POBL ;Set up RPOI$ length 1$: MOVB (R2)+,(R0)+ ;Copy first part of command SOB R1,1$ ADD R3,DCLCMD+R.POBL 2$: MOVB (R4)+,(R0)+ ;Copy second part of command SOB R3,2$ 3$: RETURN ; ; CMDLN = 30. ;Max size of special command CMDBUF: .BLKB MAXL+CMDLN ;Output command buffer ; .END CAT