.TITLE CCL .IDENT /Y01.3/ ; ; this program is converted from a fortran 4 plus assembly listing ; and therefore I apologise for the wierd names involved ; ; The main routine also requires GETMCR from F4POTS, PUTMCR, LOOKUP & FIXUP ; ; .MCALL GET$,OPEN$R,FDBDF$,FDRC$A,CLOSE$,EXIT$S,QIOW$S .MCALL FDOP$A,FSRSZ$,DIR$ .MCALL QIOW$C F0=%0 F1=%1 F2=%2 F3=%3 F4=%4 F5=%5 ; the program reads inturn the user file SY:USERCCL.CCL ; and then the system file (SY:) SYSCCL.CCL in a specific directory ; LUN 1 IS used for the files and lun 2 for error reporting and ; for asking for parameters FSRSZ$ 1 ; ONE FILE ONLY! ; note this was fortran common - this is shared by ALL routines .PSECT .$$$$.,rw,d,con,ovr,gbl PARAMS: .word 0 ;max # params to prompt for MCRL: .word 0 ;length of mcr line KEYL: .word 0 ;length of keyword MCR: .blkb 80. ;mcr buffer as input KEYB: .ASCII / / ;initial state of keyword buffer P: .blkb 416 ;30.*9. 9 parameters @ 30. chars @ CMD: .blkb 80. ;output new command line PMIN: .WORD 0 ;min # params to accept .PSECT $VARS,RW,D,CON,LCL ; error messages and prompts MSG1: .ASCIZ <15><12>/>/ ; given when system ccl file cannot be opened MSG2: .ASCIZ <15><12>/...CCL -- ERROR READING SYSTEM FILE/<15><12>/>/; JGD01 ; given when GMCR$ fails MSG3: .ASCIZ <15><12>/...CCL -- NO COMMAND LINE !/<15><12>/>/ ; JGD01 ; given when users command is not findable MSG4: .ASCII <15><12>/? ?/<15><12> ; JGD01 .ASCII /CCL -- MCR SYNTAX ERROR OR UNKNOWN COMMAND/<0> ; JGD01 ; should have an LB also LBdev: .ascii /LB:/ ;dev for system file SYDEV: .ASCII /SY:/ ;dev for userccl file SYUIC: .ASCII /[1,5]/ ;uic for my system file SYFIL: .ASCII /SYSCCL.CCL/ ;name of my system file USRFIL: .ASCII /USERCCL.CCL/ ;name of users files .EVEN ; fdb for out ccl spec file FDB:: FDBDF$ FDRC$A ,INBF,80. FDOP$A 1,,,FO.RD!FA.SHR ; input buffer for spec lines INBF:: .BLKB 80. FIXPRM: .WORD 2,I,J ;prl for calls of fixup INUIC: .WORD 0 L: .WORD 0 K: .WORD 0 J: .WORD 0 I: .WORD 0 N120: .WORD 117 PMCR: .WORD 2,N120,CMD ;prl for calls of PUTMCR QNMRK: .ASCII /? / ;buffer for error text $TEMPS: .WORD 0 SYSDST: .WORD 3,LBDEV,5,SYUIC,10.,SYFIL USRDST: .WORD 3,SYDEV,,,11.,USRFIL .PSECT $CODE1,RW,I,CON,LCL ; startup point for program ; get our startup command line CCL: MOV (PC)+,R1 .BYTE 127.,41. MOV R1,KEYL DIR$ #KEYL MOV @#$DSW,MCRL CLR KEYL ;was there any command line TST MCRL BGT .1000 ;here if there wasnt type 'NO COMMNAD LINE ' & exit MOV #MSG3,R0 JSR PC,MSG ; back in mainline ; and with real command line ; Search for spaces or CR, ie end of keyword .1000: MOV #1,R0 L$HAPL: CMPB MCR-1(R0),#40 BLE .1002 ;store in keyword buffer and in error print buffer ; as we loop MOVB MCR-1(R0),MSG4+2(R0) ; 0018 MOVB MCR-1(R0),KEYB-1(R0) INC R0 CMP R0,#10 BLE L$HAPL ; got to end of keyword or 8 chars which is enough for most people .1002: DEC R0 MOV R0,KEYL ; store correct keyword length .1003: ;now try for user file, if not found go 7$ to try system file MOV #7$,R2 MOV #USRDST,R1 JSR PC,OPEN ; found a user file , lookup the keyword in there JSR PC,LOOKUP TST R0 BMI .1005 ; -ve is fortran success so we found the keyword go 1005 ; in line if we didnt , close this file, then try ; the system file CALL CLOS 7$: ; back with was no userfile as well ; error message must appear if no system file MOV #OPNFL,R2 MOV #SYSDST,R1 JSR PC,OPEN JSR PC,LOOKUP TST R0 BMI .1005 ; if found in system file deal in exactly same way as user file ;.if not then close file and check was last char of keyword ; a "?" in which case see if "? name" is defined, cheats and uses ; error message buffer CALL CLOS MOV KEYL,R0 CMPB KEYB-1(R0),#77 ; deal with "?" BEQ .1010 MOV #MSG4,R0 JMP MSG ; above deal with unknown keyword go print "?NAME" ; here lookup error message on both files as a type of help request .1010: MOVB #40,MCR-1(R0) MOV #-1,KEYL ; use fpp to move 8 chars for us ( sorry its fortran!) SETD LDD QNMRK,F0 STD F0,KEYB BR .1003 ; here on being given a valid keyword found in file ; params,pmin are set up ; say at start of line for parameter 1 char 1 and not in a uic spec .1005: CLR INUIC MOV #1,J MOV #1,L MOV #1,I ; set all parameter strings empty ( clear 1st byte of each) L$EBIF: MOV I,R1 MUL #36,R1 CLRB P-36(R1) INC I CMP I,#11 BLE L$EBIF ; is it keyword alone , if so go to are there enough params MOV KEYL,R0 INC R0 CMP R0,MCRL BGE .2008 ; start after keyword +1 char MOV KEYL,R0 ADD #2,R0 MOV R0,I MOV MCRL,R0 INC R0 MOV R0,$TEMPS L$EBOH: ; if next character is "[" set INUIC MOV I,R0 CMPB MCR-1(R0),#133 BNE L$EBLJ MOV #-1,INUIC L$EBLJ: ; if it is "]" set not in uic CMPB MCR-1(R0),#135 BNE L$EBBK CLR INUIC L$EBBK: ; is character ' ', '=' or '<' '<-' or ',' ( allowed separators) ; if ',' then check if in uic CMPB MCR-1(R0),#40 BLE L$JBGH CMPB MCR-1(R0),#75 BEQ L$JBGH CMPB MCR-1(R0),#74 BEQ L$JBGH CMPB MCR-1(R0),#137 BEQ L$JBGH CMPB MCR-1(R0),#54 BNE L$EBHK TST INUIC BMI L$EBHK L$JBGH: ; here it is a separator set up next param BR .2002 L$EBHK: ; here char is not a separator, stuff in parameter MOV L,R1 MUL #36,R1 ADD J,R1 MOVB MCR-1(R0),P-37(R1) INC J ; go back for more BR .2001 .2002: ; here with a separator ; insert a null and add 1 to parameter # (in L) ; check I ( text pointer) still in mcr line text MOV L,R1 MUL #36,R1 ADD J,R1 CLRB P-37(R1) MOV #1,J INC L ; check if still in the line .2001: INC I CMP I,$TEMPS BLE L$EBOH .2008: ; check have we enough for min params yet? DEC L CMP L,PMIN BGE .2010 ; if yes skip asking for more .2009: ; have we the max asked for if so no more to do CMP PARAMS,L BLE .2010 .2004: ; get a parameter line ?n text ; give syserr message if not found since he guaranteed it GET$ #FDB BCC 1$ JMP OPNFL 1$: ; 0064 CMPB INBF,#77 ; if it doesnt start ? then its anither keyword line, go and try ; again for more BNE .2004 CALL PRMPT ; get a parameter in response BR .2009 .2010: ; here with sufficient parameters ; get an action or skeleton line ; which begins "*" MOV L,PARAMS ; 0076 GET$ #FDB ; 0078 CMPB INBF,#'* BNE .2010 MOV #120,R0 MOV #CMD,R2 MOV #MCR,R1 ; clear out work buffers 11$: MOVB #' ,(R1)+ MOVB #' ,(R2)+ SOB R0,11$ MOV FDB+F.NRBD,R0 DEC R0 MOV #INBF+1,R1 MOV #MCR,R2 ; copy skeleton into old MCR buffer 12$: MOVB (R1)+,(R2)+ SOB R0,12$ CALL CLOS ; we have now finished with all files MOV #1,I MOV #1,J .2030: ; scan skeleton transferring files, when hits "%" call fixup MOV I,R0 CMPB MCR-1(R0),#45 BEQ .2031 MOV J,R1 MOVB MCR-1(R0),CMD-1(R1) INC I INC J BR .2032 .2031: MOV #FIXPRM,R5 JSR PC,FIXUP .2032: ; done our 80 byte line CMP I,#120 BGE L$JBEG CMP J,#120 BLT .2030 ; run out of one or other buffer L$JBEG: MOVB #15,CMD+116 ;WAS 117 IF USE WITH PUTMCR DIRECTIVE ; JGD01 ; add a CR to end of buffer and send it MOV #PMCR,R5 JSR PC,PUTMCR JMP FINISH ; here when user types ctrl/Z for a prompt response as abort .4000: CALL CLOS MOV #MSG1,R0 MSG: CALL TYPEIT MOVB #';,CMD ; FIX PROBLEM WITH CCL HANGING AT. ; JGD01 BR L$JBEG ; BY SENDING DUMMY COMMAND TO MCR ; JGD01 FINISH: EXIT$S ; error message typer, error text ends in null TYPEIT: MOV R1,-(SP) MOV R0,R1 1$: TSTB (R1)+ BNE 1$ DEC R1 SUB R0,R1 QIOW$S #IO.WLB,#2,#1,,,, MOV (SP)+,R1 RTS PC ; close our 1 file CLOS: CLOSE$ #FDB RTS PC ; open a file on lun 1, dataset descriptor in R1, eror label in R2 OPEN: OPEN$R #FDB,#1,R1 BCC 1$ JMP @R2 1$: RTS PC ; print couldnt access system file & die OPNFL: MOV #MSG2,R0 JMP MSG IOSTS: .BLKW 2 PRMPT: ; THIS HAS TO FIND END OF INPUT LINE - ADD ? ; TYPE IT AND GET RESULT IN CORRECT 30 BYTE ARRAY CHUNK. MOVB INBF+1,R3 SUB #60,R3 CMP R3,L ; if the # for this line is lower than or equal to highest param ; we alreay have get the next one instead, this is settled already BLE NO MOV R3,L MUL #36,R3 ADD #P-36,R3 MOV #INBF,R1 MOV FDB+F.NRBD,R2 ADD R1,R2 ADD #2,R1 MOVB #'?,(R2)+ SUB R1,R2 QIOW$S #IO.RPR,#2,#1,,#IOSTS,, CMPB IOSTS,#1 BNE .4000 NO: RTS PC .END CCL