]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/CMD/COMP/COMP1.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / CMD / COMP / COMP1.ASM
1 page ,132 ;\ f
2 title COMP.SAL - COMPARE A PAIR OF FILES
3 ;****************** START OF SPECIFICATIONS *****************************
4 ; MODULE NAME: COMP1.ASM
5 ;
6 ; DESCRIPTIVE NAME: Compare two files to show they are identical or not.
7 ;
8 ; FUNCTION: The paths and names of each pair of files is
9 ; displayed as the comparing process proceeds. An
10 ; error message will follow the names if:
11 ; (1) a file matching the second filename can't be found,
12 ; (2) the files are different sizes, or
13 ; (3) either path is invalid.
14 ;
15 ; During the comparison, an error message will appear for any
16 ; location that contains mismatching information in the 2
17 ; files. The message indicates the offset into the files of
18 ; the mismatching bytes, and the contents of the 2 bytes
19 ; themselves (all in hex). This will occur for up to 10
20 ; mismatching bytes - if more than 10 compare errors are
21 ; found, the program assumes that further comparison would be
22 ; useless, and ends its compare of the 2 files at that point.
23 ;
24 ; If all bytes in the 2 files match, a "Files compare OK"
25 ; message will appear.
26 ;
27 ; In all cases, after the comparing of 2 files ends, comparing
28 ; will proceed with the next pair of files that match the 2
29 ; filenames, until no more files can be found that match the
30 ; first filename. You are then asked if you want to compare
31 ; any more files. Replying "N" returns you to the DOS prompt
32 ; (such as A>); a reply of "Y" results in prompts for new
33 ; primary and secondary filenames.
34 ;
35 ; In all compares, COMP looks at the last byte of one of the
36 ; files being compared to assure that it contains a valid
37 ; end-of-file mark (CTRL-Z, which is the hex character 1A).
38 ; If found, no action is taken by COMP. If the end-of-file
39 ; mark is NOT found, COMP produces the message "EOF mark not
40 ; found". This is done because some products produce files
41 ; whose sizes are always recorded in the directory as a
42 ; multiple of 128 bytes, even though the actual usable data in
43 ; the file will usually be a few bytes less than the directory
44 ; size. In this case, COMP may produce "Compare error"
45 ; messages when comparing the few bytes beyond the last real
46 ; data byte in the last block of 128 bytes (COMP always
47 ; compares the number of bytes reflected in the directory).
48 ; Thus, the "EOF mark not found" message indicates that the
49 ; compare errors may not have occurred in the usable data
50 ; portion of the file.
51 ;
52 ; Multiple compare operations may be performed with one load
53 ; of COMP. A prompt, "Compare more files (Y/N)?" permits additional
54 ; executions.
55 ;
56 ; ENTRY POINT: "START" at ORG 100h, jumps to "INIT".
57 ;
58 ; INPUT: (DOS command line parameters)
59 ; [d:][path] COMP [d:][path][filenam1[.ext]] [d:][path][filenam2[.ext]]
60 ;
61 ; Where
62 ; [d:][path] before COMP to specify the drive and path that
63 ; contains the COMP command file.
64 ;
65 ; [d:][path][filenam1[.ext]] - to specify the FIRST (or primary)
66 ; file or group of files to be compared
67 ;
68 ; [d:][path][filenam2[.ext]] - to specify the SECOND file or group
69 ; of files to be compared with the corresponding file
70 ; from the FIRST group
71 ;
72 ; Global filename characters are allowed in both filenames,
73 ; and will cause all of the files matching the first filename
74 ; to be compared with the corresponding files from the second
75 ; filename. Thus, entering COMP A:*.ASM B:*.BAK will cause
76 ; each file from drive A: that has an extension of .ASM to be
77 ; compared with a file of the same name (but with an extension
78 ; of .BAK) from drive B:.
79 ;
80 ; If you enter only a drive specification, COMP will assume
81 ; all files in the current directory of the specified drive.
82 ; If you enter a path without a filename, COMP assumes all
83 ; files in the specified directory. Thus, COMP A:\LEVEL1
84 ; B:\LEVEL2 will compare all files in directory A:\LEVEL1 with
85 ; the files of the same names in directory B:\LEVEL2.
86 ;
87 ; If no parameters are entered with the COMP command, you will
88 ; be prompted for both. If the second parm is omitted, COMP
89 ; will prompt for it. If you simply press ENTER when prompted
90 ; for the second filename, COMP assumes *.* (all files
91 ; matching the primary filename), and will use the current
92 ; directory of the default drive.
93 ;
94 ; If no file matches the primary filename, COMP will prompt
95 ; again for both parameters.
96 ;
97 ; EXIT-NORMAL: Errorlevel = 0, Function completed successfully.
98 ;
99 ; EXIT-ERROR: Errorlevel = 1, Abnormal termination due to error, wrong DOS,
100 ; invalid parameters, unrecoverable I/O errors on the diskette.
101 ;
102 ; EFFECTS: Files are not altered. A Message will show result of compare.
103 ;
104 ; INTERNAL REFERENCES:
105 ; ROUTINES: none
106 ;
107 ; DATA AREAS:
108 ; PSP - Contains the DOS command line parameters.
109 ; WORKAREA - Temporary storage
110 ;
111 ; EXTERNAL REFERENCES:
112 ; ROUTINES:
113 ; SYSDISPMSG - Uses the MSG parm lists to construct the messages
114 ; on STDOUT.
115 ; SYSLOADMSG - Loads messages, makes them accessable.
116 ; SYSPARSE - Processes the DOS Command line, finds parms.
117 ;
118 ; DATA AREAS:
119 ; COMPSM.SAL - Defines the control blocks that describe the messages
120 ; COMPPAR.SAL - Defines the control blocks that describe the
121 ; DOS Command line parameters.
122 ;
123 ; NOTES:
124 ; This module should be processed with the SALUT preprocessor
125 ; with the re-alignment not requested, as:
126 ;
127 ; SALUT COMP1,NUL
128 ;
129 ; To assemble these modules, the alphabetical or sequential
130 ; ordering of segments may be used.
131 ;
132 ; Sample LINK command:
133 ;
134 ; LINK @COMP.ARF
135 ;
136 ; Where the COMP.ARF is defined as:
137 ;
138 ; COMP1+
139 ; COMPPAR+
140 ; COMPP+
141 ; COMPSM+
142 ; COMP2
143 ;
144 ; These modules must be linked in this order. The load module is
145 ; a COM file, to be converted to COM with EXE2BIN.
146 ;
147 ; REVISION HISTORY:
148 ; AN000 Version 4.00: add PARSER, System Message Handler,
149 ; Add compare of code page extended attribute, if present.
150 ;
151 ; COPYRIGHT: The following notice is found in the OBJ code generated from
152 ; the "COMPSM.SAL" module:
153 ;
154 ; "The DOS COMP Utility"
155 ; "Version 4.00 (C) Copyright 1988 Microsoft"
156 ; "Licensed Material - Property of Microsoft"
157 ;
158 ;PROGRAM AUTHOR: Original written by: Dave L.
159 ; 3.30 modifications by Russ W.
160 ; 4.0 modifications by: Edwin M. K.
161 ; 4.0 modifications by: Bill L.
162 ;****************** END OF SPECIFICATIONS *****************************
163 PAGE
164 ; $SALUT (4,13,18,36)
165 IF1
166 %OUT COMPONENT=COMP, MODULE=COMP1.ASM
167 ENDIF
168
169 CSEG segment PARA public 'CODE' ;AN000;
170 assume cs:CSEG,ds:CSEG,es:CSEG,ss:CSEG ;AS SET BY DOS LOADER
171 PSP_HEADER EQU $ ;START OF PROGRAM SEGMENT PREFIX AREA
172 org 02h
173 MEMORY_SIZE LABEL WORD
174 PUBLIC MEMORY_SIZE
175
176 org 5Ch
177 FCB LABEL BYTE
178 PUBLIC FCB
179
180 org 80h
181 PARM_AREA LABEL BYTE
182 PUBLIC PARM_AREA
183
184 org 100h
185 EXTRN INIT:NEAR ;"INIT" IS IN COMP2.SAL
186 START: jmp INIT ;DEFINE THE DOS ENTRY POINT
187
188 CSEG ENDS
189 END START
190 \1a