.MCALL .MODULE .MODULE LIBCOM,VERSION=03,COMMENT= ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion 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 Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .ENABL LC ;+ ; LIBCOM is a utility to compare macro or object libraries to determine ; if they are identical other than for the date and time of creation. ; If they are the same, success status is returned in USERRB. ; If they are not the same, warning status is returned in USERRB. ;- OLBDAT = 12 ;Offset to date and time in object library header MLBDAT = 6 ;Offset to date and time in macro library header BUFSIZ = 256. ;Read and compare 1 block at a time (for simple code) ERRBYT = 52 ;Address of programmed request error byte USERRB = 53 ;Address of user error status byte SUCCS$ = 1 ;Success flag bit in USERRB WARN$ = 2 ;Warning flag bit in USERRB ERROR$ = 4 ;Error flag bit in USERRB FATAL$ = 10 ;Fatal error flag bit in USERRB UNCON$ = 20 ;Unconditional error flag bit in USERRB .MCALL .PRINT,.CSIGEN,.READW,.EXIT START: .CSIGEN #DEVSPC,#DEFEXT,#0 ;Get library file names to compare BCS CSIERR ;Branch if error 10$: CLR EOF1 ;Indicate no EOF for file #1 yet CLR BLOCK ;Start with block 0 of files #1 and #2 20$: .READW #AREA,#3,#BUFF1,#256.,BLOCK ;Read a block from file #1 BCS RDERR1 ;Branch if error during read .READW #AREA,#4,#BUFF2,#256.,BLOCK ;Read a block from file #1 BCS RDERR2 ;Branch if error during read TST BLOCK ;Is this block 0 (the library header)? BNE 40$ ;Branch if not, else zero date and time words MOV #OLBDAT,DATOFF ;Assume we want to compare object libraries MOV #BUFF1,R0 ;R0 -> beginning of file #1 library header CMP @R0,#1 ;Is file #1 an object library? BEQ 30$ ;If equal yes MOV #MLBDAT,DATOFF ;Else, assume it's a macro library 30$: ADD DATOFF,R0 ;R0 -> date and time of file #1 CLR (R0)+ ;Clear out CLR (R0)+ ; date and CLR (R0)+ ; time MOV #BUFF2,R0 ;R0 -> beginning of file #2 library header ADD DATOFF,R0 ;R0 -> date and time of file #2 CLR (R0)+ ;Clear out CLR (R0)+ ; date and CLR (R0)+ ; time 40$: MOV #BUFF1,R0 ;R0 -> beginning of file #1 library header MOV #BUFF2,R1 ;R0 -> beginning of file #2 library header MOV #BUFSIZ,R2 ;R2 = size of buffer in words 50$: CMP (R0)+,(R1)+ ;Compare a word from file #1 and file #2 BNE COMERR ;If not equal, then files are different DEC R2 ;Count down for a full buffer comparison BNE 50$ ;Branch if more to compare INC BLOCK ;Done with current block, get ready for next BR 20$ ;Go try to get next block for files #1 and #2 COMERR: .PRINT #COMERM ;Files are different BISB #,@#USERRB ;Set warning bit to indicate difference BR EXIT ;Exit .ENABL LSB RDERR1: MOVB @#ERRBYT,R0 ;Get error byte for read from file #1 BNE 10$ ;Was it EOF for file #1 INC EOF1 ;Yes, so set file #1's EOF flag .READW #AREA,#4,#BUFF2,#256.,BLOCK ;Read block from file #2 BCS RDERR2 ;Branch if error during read BR COMERR ;Files are different due to length 10$: DEC R0 ;Was it a hard read error? BNE 20$ ;Branch if not .PRINT #HRDERM ;Print hard read error message BR 30$ ;FATAL exit 20$: .PRINT #CHNERM ;Channel not open 30$: BISB #,@#USERRB ;Set unconditional flag bit in USERRB BR EXIT ;Exit CSIERR: .PRINT #CSIERM ;Invalid CSI command BR 30$ ;FATAL exit RDERR2: MOVB @#ERRBYT,R0 ;Get error byte for read from file #2 BNE 10$ ;Was it EOF for file #2? TST EOF1 ;Yes, have we already got EOF for file #1? BEQ COMERR ;If not, files are different due to length BISB #,@#USERRB ;Set success bit in USERRB .PRINT #SUCERM ;There are no differences EXIT: CLR R0 ;Hard exit .EXIT .DSABL LSB COMERM: .ASCIZ /?LIBCOM-W-Files are different/ SUCERM: .ASCIZ /?LIBCOM-I-No differences found/ CSIERM: .ASCIZ /?LIBCOM-F-Invalid command line/ HRDERM: .ASCIZ /?LIBCOM-F-Hard read error/ CHNERM: .ASCIZ /?LIBCOM-F-Channel not open/ .EVEN AREA: .BLKW 5 ;Programmed request area DATOFF: .BLKW ;The byte offset value to the date and time BLOCK: .BLKW ;Current block of files being compared EOF1: .BLKW ;If not zero, EOF encountered for file #1 DEFEXT: .WORD 0,0,0,0 ;No default extensions BUFF1: .BLKB 512. ;1 block buffer for file #1 BUFF2: .BLKB 512. ;1 block buffer for file #1 DEVSPC: ;Space for handler fetches .END START