.TITLE STB .IDENT /01/ ;For History Comments .ENABLE LC ; ; This is a program to examine various table offsets, which does ; not have to be rebuilt for each Executive (I hope!) ; ; History: ; 01 P.A. Stephensen-Payne 18-Jul-80 ; .PAGE .SBTTL Macros .MACRO FERR,X,P1,P2,P3,P4 .IIF NB , MOV P1,ARGBLK ;Arguments for insertion .IIF NB , MOV P2,ARGBLK+2 .IIF NB , MOV P3,ARGBLK+4 .IIF NB , MOV P4,ARGBLK+6 MOV #I.'X,R1 ;Address of Error String JMP FERR .ENDM .MACRO DIAG,X,P1,P2,P3,P4 .IIF NB , MOV P1,ARGBLK .IIF NB , MOV P2,ARGBLK+2 .IIF NB , MOV P3,ARGBLK+4 .IIF NB , MOV P4,ARGBLK+6 MOV #I.'X,R1 CALL DIAG .ENDM ; .MCALL CSI$,CSI$1,CSI$2,CSI$SW,CSI$SV,CSI$ND ; for CSI .MCALL GCMLB$,GCMLD$,GCML$ ; for GCML .MCALL FSRSZ$,FINIT$,FDBDF$,FDOP$A,FDAT$A ; for FILES-11 .MCALL FDRC$A,FDBK$A,FDBF$A,NMBLK$ ; .MCALL OPEN$,CLOSE$,GET$,PUT$,READ$,WRITE$ ; .MCALL QIOW$S,EXIT$S,ALUN$S ;general use .PAGE .SBTTL Offset Definitions ; ; If you are going to use symbolic offsets of your own, ; define them here ; ; It is often a good idea to use symbolic names for your luns ; CMDLUN=1 INPLUN=2 OUTLUN=3 ERRLUN=5 .PAGE .SBTTL Data - Error Messages .NLIST BEX ; ; This section should contain the error messages in a format suitable ; for $EDMSG. In particular they should be terminated by a zero byte. ; Key directives for $EDMSG are:- ; %D - Signed Decimal Word ; %M - Unsigned Decimal Word (Zeroes Suppressed) ; %N - CR/LF ; %O - Signed Octal Word ; %P - Unsigned Octal Word ; %R - Three RAD50 characters ; %U - Unsigned Decimal Word (No Zero Suppression) ; OUTBLK: .BLKB 80. ; To build error message in ARGBLK: .BLKW 4 ; Argument block for $EDMSG I.GIND: .ASCIZ /STB - Invalid Indirect Command File/<7> I.GCME: .ASCIZ /STB - Command Read Error = %D/<7> I.CSI1: .ASCIZ /STB - Command Line Parse Failure at Offset %D/<7> I.CS2O: .ASCIZ /STB - Invalid Syntax in Output Filespec/<7> I.CS2I: .ASCIZ /STB - Invalid Syntax in Input Filespec/<7> I.OPNO: .ASCIZ /STB - Open Error = %D on Output File/<7> I.OPNI: .ASCIZ /STB - Open Error = %D on Input File/<7> I.MORO: .ASCIZ /STB - Too Many Output Files Specified/<7> I.MORI: .ASCIZ /STB - Too Many Input Files Specified/<7> I.ADDR: .ASCIZ /STB - Address of %R%R is %P/ I.NSYM: .ASCIZ /STB - Symbol not Defined/<7> .EVEN .PAGE .SBTTL Data - CSI & GCML Tables ; ; First we define the system buffers for CSI and GCML ; ; ; The GCMLB$ macro must be modified for user requirements. The ; format is:- ; GCMLB$ command-file depth,prompt,lun GCMBLK: GCMLB$ 1,STB,,CMDLUN CSI$ CSIBLK: .BLKB C.SIZE ; CSI control block .EVEN ; ; First we must define the CSI Switch and data tables, as follows:- ; ; 1. Define any symbolic mask names, ; LISW = 1 ; 2. Define the switch tables themselves. Each entry is of the form:- ; ; CSI$SW sw,mask,maskwd,SET/CLEAR,[NEG],valuetab[,LONG/EXACT] ; ; e.g. CSI$SW LI,LISW,SWMSK$,SET,,LTBL ; OSWTAB: ; Output switches CSI$ND ISWTAB: ; Input switches CSI$SW LI,LISW,SWMSK$,SET,,LTBL CSI$ND LISW=1 ; ; 3. Define any switch value tables. Each entry is of the form:- ; ; CSI$SV ASCII/OCTAL/DECIMAL,address,length (ASCII only) ; ; e.g. LTBL: CSI$SV DECIMAL,LINLEN ; CSI$ND LTBL: CSI$SV ASCII,SYMB,6 CSI$ND ; ; 4. Define any locations for switch values or mask words. ; SWMSK$: .WORD ; Default mask word ; .PAGE .SBTTL Data - File Definitions ; ; Obviously the user must set up his own file blocks, as this will ; vary per program. The important macros, which cover most eventualities are:- ; ; FSRSZ$ n - n files with record I/O ; FRED: FDBDF$ - define an FDB ; FDAT$A R.FIX/R.VAR,FD.CR/FD.BLK,record length ; type of recordrd ; FDRC$A FD.RAN/FD.RWM,recbuf add,recbuf len ; type of access ; FDBK$A blkbuf add,blkbuf len ; block buffers ; FDOP$A lun,dspt,dfnb,FO.RD/FO.WRT/FO.UPD ; open type ; ; The following code defines an existing input file and a new, variable-length, ; output file. Both will be referenced by record I/O. ; ; FSRSZ$ 1 ; INPFDB: FDBDF$ FDOP$A INPLUN,,INPDFN,FO.RD INPDFN: NMBLK$ RSX11M,STB,0,SY,0 ; ;OUTFDB: FDBDF$ ; FDAT$A R.VAR,FD.CR,80. ; FDOP$A OUTLUN,,OUTDFN,FO.WRT ;OUTDFN: NMBLK$ ,,0,SY,0 .PAGE .SBTTL Data - User's Areas .LIST BEX BUFF: .BLKB 256. ; Buffer for input SYMB: .BLKW 3 ; .PAGE .SBTTL Mainline Code ; ; This section of code governs the mainline operation of the program. ; START: ALUN$S #CMDLUN,#"TI,#0 ; Assign prompt lun to TI: FINIT$ ; Initialise the file section MOV #454,R1 ; Set Default UIC to [1,54] CALL .WDFUI ; ; GETCMD: CLR SYMB ; Initailise input buffer CLR SYMB+2 ; CLR SYMB+4 ; CLR SWMSK$ ; Clear Options Mask GCML$ #GCMBLK ; Get Command Line BCC 20$ ; If CC OK - carry on CMPB #GE.EOF,G.ERR(R0) ; Was it an end-of-file? BEQ 10$ ; If EQ yes - terminate program CMPB #GE.OPR,G.ERR(R0) ; Invalid command file? BNE 5$ ; If NE no - carry on DIAG GIND ; yes - log the message BR GETCMD ; and try again ; 5$: MOVB G.ERR(R0),R0 ; Sign-extend the error FERR GCME,R0 ; Else log error ; 10$: EXIT$S ; That's all ; 20$: MOV G.CMLD+2(R0),R1 ; Command start MOV G.CMLD(R0),R2 ; And length BEQ GETCMD ; If not there, Re-Prompt ; ; Now parse the command - this will depend a lot on whether you ; are allowing multiple input and output files, but the following ; might be a useful guideline. ; PARSE: ; CALL CMDFIX ; You might want a routine here to convert ; the input line to something CSI will allow CSI$1 #CSIBLK,R1,R2 ; Check the syntax BCC 10$ ; If CC OK - carry on MOV CSIBLK+C.FILD+2,R0 ; Get Address of Error SUB R1,R0 ; And hence offset INC R0 ; Starting at 1 DIAG CSI1,R0 ; Log the error BR GETCMD ; And get another command line ; 10$: ; MOV #OUTDFN,R3 ; Get Address of Default Name Block for Output ; CLR R2 ; Assume no output name specified ; MOV #"TI,N.DVNM(R3) ; Default output to TI: if not given CLR R4 ; Set Equals Sign flag BIT #CS.EQU*400,(R0) ; Was an "=" specified? BEQ 40$ ; If EQ no - assumptions were correct INC R4 ; Show there was an equals sign ; MOV #"SY,N.DVNM(R3) ; Name given - therefore change default to SY: CSI$2 #CSIBLK,OUTPUT,#OSWTAB ; Parse real output name BCC 20$ ; If CC OK - carry on DIAG CS2O ; Output error message BR GETCMD ; And get next command line ; 20$: ; ; You might want to check here to see if there was more than one ; output file specified, as follows. ; BITB #CS.MOR,C.STAT(R0) ; See if more output files BEQ 30$ ; If EQ OK - carry on DIAG MORO ; Else log error BR GETCMD ; And get next line ; 30$: MOV #,R2 ; Get DSD address for filename ; 40$: ; OPEN$ #OUTFDB,,,R2 ; Open the output file ; BCC 50$ ; If CC OK - carry on ; MOVB F.ERR(R0),R0 ; Sign-extend error ; DIAG OPNO,R0 ; Log error ; BR 90$ ; Get next command ; 50$: MOVB #CS.INP,CSIBLK+C.TYPR ; Default to input file TST R4 ; Was there an equals sign? BNE 55$ ; If NE yes - carry on MOVB #CS.OUT,CSIBLK+C.TYPR ; No - pretend it's an output file ; 55$: CSI$2 #CSIBLK,,#ISWTAB ; Parse the input file BCC 60$ ; If CC OK - carry on DIAG CS2I ; No - Log Error BR 90$ ; and get next line ; 60$: ; ; You might want to check here to see if there was more than one ; input file specified, as follows. ; BITB #CS.MOR,C.STAT(R0) ; See if more input files BEQ 70$ ; If EQ OK - carry on DIAG MORI ; Else log error BR 90$ ; And get next line ; 70$: OPEN$ #INPFDB,,,#CSIBLK+C.DSDS ; Open the input file BCC 80$ ; If CC OK - carry on MOVB F.ERR(R0),R0 ; Sign-extend error code DIAG OPNI,R0 ; Else log an error BR 90$ ; ; 80$: CALL PROCESS ; Now process the command ; 90$: ; CLOSE$ #OUTFDB ; Close the files CLOSE$ #INPFDB ; JMP GETCMD ; Get the next line .PAGE .SBTTL Process Routines PROCESS: MOV #SYMB,R0 ; Convert symbol to RAD50 MOV #1,R1 ; Period is valid CALL $CAT5 ; Convert a word MOV R1,SYMB MOV #1,R1 ; Period is valid CALL $CAT5 ; MOV R1,SYMB+2 ; BIT #LISW,SWMSK$ ; /LI specified? BEQ 20$ ; If EQ no - geive up CALL GETSYM ; Get the symbol's address BCS 10$ ; If CS error DIAG ADDR,SYMB,SYMB+2,R0 ; OK - output result BR 20$ ; Exit ; 10$: DIAG NSYM ; Output error message ; 20$: RETURN ; GETSYM: MOV #INPFDB,R0 ; Rewind the input file CLR R1 ; MOV #1,R2 ; CLR R3 ; CALL .POINT ; ; 10$: GET$ #INPFDB,#BUFF,#256. BCS 90$ ; If error exit CMP BUFF,#1 ; Right type? BNE 90$ ; If ne no - exit MOV #BUFF+2,R0 ; Look for symbol MOV #15.,R1 ; ; 20$: CMP SYMB,(R0) ; This one BNE 30$ ; If ne no - try next CMP SYMB+2,2(R0) ; Sure? BEQ 40$ ; Yes - process it ; 30$: ADD #8.,R0 ; Set to next one SOB R1,20$ ; Keep trying BR 10$ ; Get next record ; 40$: MOV 6(R0),R0 ; Get the result CLC ; Show success RETURN ; 90$: SEC ; Show failure RETURN .PAGE .SBTTL Output Routines ; FERR: CALL DIAG ; Output the Message ; CLOSE$ #OUTFDB ; Close any files CLOSE$ #INPFDB ; EXIT$S ; Terminate the program ; DIAG: CALL OUT ; Output QIOW$S #IO.WLB,#ERRLUN,#1,,,,<#OUTBLK,R1,#40> ; Output to TI: RETURN ; Return ; OUT: MOV #OUTBLK,R0 ; Get Buffer for Output MOV #ARGBLK,R2 ; Get Address of any Parameters CALL $EDMSG ; Edit the Message RETURN .END START