;***************************************************************************; ; ; ; ; ; VUECOM ; ; VUE-like File Compare ; ; ; ; ; ;***************************************************************************; ;1.0 01-Nov-84 DFP written by D. Pallmann. ; ;1.1 04/11/86 - D. Eichbauer - MBS Data Systems - Merrill, MI ; Corrected invalid filespec error when filenames separated ; by commas (as per help message). ; Forced cursor to line 24 at exit after display. ; Modified the reverse count so that pages backward same ; number of lines as forward. ; Prevented display past end of file. ; Added Home Key processing. ; Added ^E (Bottom of File) processing. ; Corrected line counting errors for files > 80 characters long. ; Corrected display at file switch so that it starts at ; beginning of line (backs up to first character in line if ; necessary). ; Still needs removal of slop in positioning. VMAJOR=1 VMINOR=1. SEARCH SYS SEARCH SYSSYM SEARCH TRM SEARCH CRT IMP=A5 TAB=11 LF=12 CR=15 ESC=33 .OFINI .OFDEF FILE1,D.DDB ;DDB for 1st file .OFDEF FILE2,D.DDB ;DDB for 2nd file .OFDEF BASE1,4 ;base of 1st file .OFDEF BASE2,4 ;base of 2nd file .OFDEF SIZE1,4 ; SIZE OF FIRST FILE [1.1] .OFDEF SIZE2,4 ; SIZE OF SECOND FILE [1.1] .OFSIZ IMPSIZ START: PHDR -1,0,PH$REE!PH$REU ;program header GETIMP IMPSIZ,IMP ;allocate impure area CHKLIN: BYP LIN BNE GETFLS HELP: TYPECR JMP EXIT GETFLS: FSPEC FILE1(IMP),M68 ;load DDB w/spec INIT FILE1(IMP) ;fetch driver, allocate buffer SPEC: BYP ; Bypass any spaces [1.1] LIN ; Check for end of line [1.1] BEQ HELP ; [1.1] TRM ; Check for field terminator [1.1] BNE SPEC.1 ; [1.1] INC A2 ; [1.1] BR SPEC ; [1.1] SPEC.1: FSPEC FILE2(IMP),M68 ;load DDB w/spec [1.1] INIT FILE2(IMP) ;fetch driver, allocate buffer LOAD: FETCH FILE1(IMP),A4 ;load file 1 JNE EXIT ;branch on error MOV A4,BASE1(IMP) ;save base MOV -14(A4),D0 ; Get the size of first file. [1.1] SUB #14,D0 ; Adjust for module size. [1.1] MOV D0,SIZE1(IMP) ; [1.1] FETCH FILE2(IMP),A4 ;load file 2 JNE EXIT ;branch on error MOV A4,BASE2(IMP) ;save base MOV -14(A4),D0 ; Get the size of second file. [1.1] SUB #14,D0 ; Adjust for module size. [1.1] MOV D0,SIZE2(IMP) ; [1.1] SETUP: CLS LOW TTYL DASHES CRT #12.,#1 TTYL DASHES CRT #23.,#1 TTYL DASHES CRT #1,#25. ; [1.1] TTYL MESAG ; [1.1] CRT #1,#67. PFILE FILE1(IMP) CRT #23.,#25. ; [1.1] TTYL MESAG ; [1.1] CRT #23.,#67. PFILE FILE2(IMP) MOV BASE1(IMP),A4 MOV SIZE1(IMP),D4 ; [1.1] CLR D5 CRT #2,#1 CALL DISPLAY MOV BASE2(IMP),A4 MOV SIZE2(IMP),D4 ; [1.1] CLR D5 CRT #13.,#1 CALL DISPLAY MOV BASE1(IMP),A4 MOV SIZE1(IMP),D4 ; [1.1] CLR D5 JOBIDX A0 MOV JOBTRM(A0),A1 ORW #T$IMI!T$ECS,T.STS(A1) READY: HIGH ; [1.1] CMM BASE1(IMP),A4 BNE 10$ CRT #2,#1 BR 20$ 10$: CRT #13.,#1 20$: KBD EXIT.1 ; [1.1] EVAL: LEA A0,CMDTBL MOV #-2,D0 10$: TSTB @A0 BEQ READY ADDW #2,D0 CMMB (A0)+,D1 BNE 10$ BRANCH: MOVW JMPTBL[~D0],D0 JMP JMPTBL[~D0] CMDTBL: BYTE 'J-'@ BYTE 'K-'@ BYTE 'R-'@ BYTE 'T-'@ BYTE '^-'@ ; [1.1] BYTE 'E-'@ ; [1.1] BYTE TAB BYTE ESC BYTE 0 EVEN JMPTBL: WORD DOWN-JMPTBL WORD UP-JMPTBL WORD BACK-JMPTBL WORD FWD-JMPTBL WORD HOME-JMPTBL ; [1.1] WORD BOTTOM-JMPTBL ; [1.1] WORD SWITCH-JMPTBL WORD EXIT.1-JMPTBL PAGE SWITCH: CMM BASE1(IMP),A4 BEQ 10$ MOV BASE1(IMP),A4 MOV SIZE1(IMP),D4 ; [1.1] CRT #2,#1 BR 20$ ; [1.1] 10$: MOV BASE2(IMP),A4 MOV SIZE2(IMP),D4 ; [1.1] CRT #13.,#1 20$: CMP D4,D5 ; Make sure not past end. [1.1] JLE BOTTOM ; [1.1] 24$: TST D5 ; See if at top. [1.1] BEQ 30$ ; [1.1] CMPB -1(A4)[D5],#LF ; See if at beginning of line. [1.1] BEQ 30$ ; [1.1] DEC D5 ; [1.1] BR 24$ ; [1.1] 30$: CALL DISPLAY ; [1.1] JMP READY PAGE BACK: TST D5 ; Move 10 lines backward at one time. JEQ READY MOV A4,A0 MOV #11.,D0 ; [1.1] 5$: CLR D3 ; [1.1] 10$: INC D3 ; [1.1] CMP D3,#80. ; [1.1] BGT 15$ ; [1.1] DEC D5 BEQ 30$ CMPB 0(A0)[D5],#LF ; [1.1] BNE 10$ 15$: SOB D0,5$ ; [1.1] INC D5 30$: CALL DISPLAY JMP READY PAGE FWD: MOV A4,A0 ; Move 10 lines forward at one time. ADD D5,A0 MOV #10.,D2 10$: MOV #80.,D0 20$: CMP D4,D5 ; SEE IF PAST END [1.1] BLT 35$ ; [1.1] INC D5 ; [1.1] CMPB (A0)+,#LF BEQ 30$ SOB D0,20$ 30$: SOB D2,10$ 35$: CALL DISPLAY ; [1.1] JMP READY PAGE DOWN: MOV A4,A0 ; Move one line forward at one time. ADD D5,A0 MOV #80.,D0 10$: CMP D4,D5 ; Make sure not past end. [1.1] BLT 20$ ; [1.1] INC D5 ; [1.1] CMPB (A0)+,#LF BEQ 20$ SOB D0,10$ 20$: CALL DISPLAY JMP READY PAGE UP: TST D5 ; Move one line backward at one time. JEQ READY MOV A4,A0 ADD D5,A0 SUB #2,A0 SUB #2,D5 10$: DEC D5 BEQ 30$ CMPB -(A0),#LF BNE 10$ 20$: INC D5 30$: CALL DISPLAY JMP READY HOME: CLR D5 ; Go to top of file. [1.1] CALL DISPLAY ; [1.1] JMP READY ; [1.1] BOTTOM: MOV D4,D5 ; Go to bottom of file. [1.1] DEC D5 ; Point one past end. [1.1] TST D5 ; [1.1] JLE READY ; [1.1] MOV A4,A0 ; [1.1] MOV #10.,D0 ; [1.1] 5$: CLR D3 ; [1.1] 10$: INC D3 ; [1.1] CMP D3,#80. ; [1.1] BGT 15$ ; [1.1] DEC D5 ; [1.1] BEQ 30$ ; [1.1] CMPB 0(A0)[D5],#LF ; [1.1] BNE 10$ ; [1.1] 15$: SOB D0,5$ ; [1.1] INC D5 ; [1.1] 30$: CALL DISPLAY ; [1.1] JMP READY ; [1.1] PAGE EXIT.1: CRT #24.,#1 ; Force to bottom. [1.1] EXIT ; [1.1] EXIT: CRLF EXIT DISPLAY: HIGH MOV #CR,D1 TTY MOV #10.,D0 MOV A4,A0 ADD D5,A0 MOV D4,D3 ; [1.1] SUB D5,D3 ; [1.1] 10$: CLR D2 ; [1.1] 12$: CTRLC EXIT.1 ; [1.1] MOVB (A0)+,D1 DEC D3 ; Check for end-of-file. [1.1] JLE EOF ; [1.1] CMPB D1,#CR BNE 20$ SAVE D1 CLREOL REST D1 20$: TTY INC D2 CMPB D1,#LF BNE 30$ 24$: SOB D0,10$ 26$: CALL POSIT RTN 30$: CMPB D1,#CR BEQ 10$ ; [1.1] CMPB D2,#80. BEQ 24$ BR 12$ ; [1.1] EOF: CMM BASE1(IMP),A4 ; See if on file 1 or 2. [1.1] BNE 2$ ; If 2, go around. [1.1] CRT #2,#1 ; Position cursor for file 1. [1.1] BR 4$ ; [1.1] 2$: CRT #13.,#1 ; Position cursor for file 2. [1.1] 4$: HIGH ; [1.1] MOV #CR,D1 ; Get back to beginning of line. [1.1] TTY ; [1.1] MOV D4,D5 ; Point to bottom of file. [1.1] TST D5 ; Make sure not 0 length. [1.1] BLE 56$ ; If so, all done. [1.1] MOV A4,A0 ; Point to top of file. [1.1] ADD D5,A0 ; Add the offset. [1.1] MOV #11.,D0 ; Look back 10 lines. [1.1] 5$: CLR D3 ; Set up line length counter. [1.1] 10$: INC D3 ; Bump our line length counter [1.1] CMP D3,#80. ; No more than 80 characters per line. [1.1] BGT 15$ ; If we exceeded length, same as LF. [1.1] DEC D5 ; Decrement the offset. [1.1] BEQ 30$ ; Don't go back past top of file. [1.1] CMPB -(A0),#LF ; See if at beginning of line. [1.1] BNE 10$ ; If not, keep going backwards. [1.1] 15$: SOB D0,5$ ; Else loop for another line until 10 found. [1.1] 20$: INC D5 ; Adjust for one too many. [1.1] 30$: MOV D4,D3 ; Get our total file length. [1.1] SUB D5,D3 ; And now our total display length. [1.1] MOV A4,A0 ; Point to top of file again. [1.1] ADD D5,A0 ; Add the offset for start. [1.1] MOV #10.,D0 ; Display 10 lines at most. [1.1] 40$: CLR D2 ; Set up our line length counter. [1.1] 42$: CTRLC EXIT.1 ; Bomb out of program on control-c. [1.1] MOVB (A0)+,D1 ; Get the next character. [1.1] DEC D3 ; Make sure not past end of file. [1.1] BLT EOF.1 ; If so, short file, so just clear rest. [1.1] CMPB D1,#CR ; If CR, then we clear rest of line. [1.1] BNE 50$ ; [1.1] SAVE D1 ; [1.1] CLREOL ; [1.1] REST D1 ; [1.1] 50$: TTY ; Output the current character. [1.1] INC D2 ; Bump our line counter. [1.1] CMPB D1,#LF ; See if at end of line. [1.1] BNE 60$ ; If not, continue. [1.1] 54$: SOB D0,40$ ; Else loop back for more lines if there. [1.1] 56$: CLR D3 ; [1.1] CALL POSIT ; [1.1] RTN ; [1.1] 60$: CMPB D1,#CR ; [1.1] BEQ 40$ ; [1.1] CMPB D2,#80. ; See if 80 characters on this line. [1.1] BEQ 54$ ; If so, treat same as LF. [1.1] BR 42$ ; Else just continue on. [1.1] EOF.1: CLREOL ; If short file, then blank lines. [1.1] TYPECR ; [1.1] SOB D0,EOF.1 ; Till ten lines on screen. [1.1] CLR D3 ; [1.1] CALL POSIT ; [1.1] RTN ; [1.1] POSIT: LOW ; [1.1] CMM BASE1(IMP),A4 ; See if on file 1 or 2. [1.1] BNE 20$ ; If 2, go around. [1.1] CRT #1.,#37. ; Position cursor for file 1. [1.1] MOV D5,D1 ; [1.1] BNE 2$ ; [1.1] TTYL TOF ; [1.1] BR 3$ ; [1.1] 2$: DCVT 7,OT$TRM!OT$ZER!OT$TSP ; [1.1] 3$: CRT #1.,#55. ; [1.1] TST D3 ; [1.1] BGT 4$ ; [1.1] TTYL BOT ; [1.1] RTN ; [1.1] 4$: MOV A0,D1 ; Get last character position [1.1] SUB A4,D1 ; And calculate length. [1.1] DEC D1 ; Adjust for offset. [1.1] DCVT 7,OT$TRM!OT$ZER!OT$TSP ; [1.1] RTN ; [1.1] 20$: CRT #23.,#37. ; Position cursor for file 2. [1.1] MOV D5,D1 ; [1.1] BNE 25$ ; [1.1] TTYL TOF ; [1.1] BR 30$ ; [1.1] 25$: DCVT 7,OT$TRM!OT$ZER!OT$TSP ; [1.1] 30$: CRT #23.,#55. ; [1.1] TST D3 ; [1.1] BGT 35$ ; [1.1] TTYL BOT ; [1.1] RTN ; [1.1] 35$: MOV A0,D1 ; Get last character position [1.1] SUB A4,D1 ; And calculate length. [1.1] DEC D1 ; Adjust for offset. [1.1] DCVT 7,OT$TRM!OT$ZER!OT$TSP ; [1.1] RTN ; [1.1] DASHES: ASCIZ /-------------------------------------------------------------------------------/ EVEN MESAG: ASCIZ /Start Off. End Off. / EVEN TOF: ASCIZ /File Top/ EVEN BOT: ASCIZ /File End/ EVEN END .