2 title COMP2
.SAL - COMPARES FILES
3 ;****************** START OF SPECIFICATIONS *****************************
4 ; MODULE NAME: COMP2.ASM
6 ; DESCRIPTIVE NAME: Compare two files to show they are identical or not.
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,
13 ; (3) either path is invalid, or.
14 ; (4) CHCP=Yes (CODE PAGE active) and code page of files
17 ; During the comparison, an error message will appear for any
18 ; location that contains mismatching information in the 2
19 ; files. The message indicates the offset into the files of
20 ; the mismatching bytes, and the contents of the 2 bytes
21 ; themselves (all in hex). This will occur for up to 10
22 ; mismatching bytes - if more than 10 compare errors are
23 ; found, the program assumes that further comparison would be
24 ; useless, and ends its compare of the 2 files at that point.
26 ; If all bytes in the 2 files match, a "Files compare OK"
27 ; message will appear.
29 ; In all cases, after the comparing of 2 files ends, comparing
30 ; will proceed with the next pair of files that match the 2
31 ; filenames, until no more files can be found that match the
32 ; first filename. You are then asked if you want to compare
33 ; any more files. Replying "N" returns you to the DOS prompt
34 ; (such as A>); a reply of "Y" results in prompts for new
35 ; primary and secondary filenames.
37 ; In all compares, COMP looks at the last byte of one of the
38 ; files being compared to assure that it contains a valid
39 ; end-of-file mark (CTRL-Z, which is the hex character 1A).
40 ; If found, no action is taken by COMP. If the end-of-file
41 ; mark is NOT found, COMP produces the message "EOF mark not
42 ; found". This is done because some products produce files
43 ; whose sizes are always recorded in the directory as a
44 ; multiple of 128 bytes, even though the actual usable data in
45 ; the file will usually be a few bytes less than the directory
46 ; size. In this case, COMP may produce "Compare error"
47 ; messages when comparing the few bytes beyond the last real
48 ; data byte in the last block of 128 bytes (COMP always
49 ; compares the number of bytes reflected in the directory).
50 ; Thus, the "EOF mark not found" message indicates that the
51 ; compare errors may not have occurred in the usable data
52 ; portion of the file.
54 ; Multiple compare operations may be performed with one load
55 ; of COMP. A prompt, "Compare more files (Y/N)?" permits additional
58 ; ENTRY POINT: "INIT", jumped to by COMP1 at the DOS entry point.
60 ; INPUT: (DOS command line parameters)
61 ; [d:][path] COMP [d:][path][filenam1[.ext]] [d:][path][filenam2[.ext]]
64 ; [d:][path] before COMP to specify the drive and path that
65 ; contains the COMP command file.
67 ; [d:][path][filenam1[.ext]] - to specify the FIRST (or primary)
68 ; file or group of files to be compared
70 ; [d:][path][filenam2[.ext]] - to specify the SECOND file or group
71 ; of files to be compared with the corresponding file
72 ; from the FIRST group
74 ; Global filename characters are allowed in both filenames,
75 ; and will cause all of the files matching the first filename
76 ; to be compared with the corresponding files from the second
77 ; filename. Thus, entering COMP A:*.ASM B:*.BAK will cause
78 ; each file from drive A: that has an extension of .ASM to be
79 ; compared with a file of the same name (but with an extension
80 ; of .BAK) from drive B:.
82 ; If you enter only a drive specification, COMP will assume
83 ; all files in the current directory of the specified drive.
84 ; If you enter a path without a filename, COMP assumes all
85 ; files in the specified directory. Thus, COMP A:\LEVEL1
86 ; B:\LEVEL2 will compare all files in directory A:\LEVEL1 with
87 ; the files of the same names in directory B:\LEVEL2.
89 ; If no parameters are entered with the COMP command, you will
90 ; be prompted for both. If the second parm is omitted, COMP
91 ; will prompt for it. If you simply press ENTER when prompted
92 ; for the second filename, COMP assumes *.* (all files
93 ; matching the primary filename), and will use the current
94 ; directory of the default drive.
96 ; If no file matches the primary filename, COMP will prompt
97 ; again for both parameters.
99 ; EXIT-NORMAL: Errorlevel = 0, Function completed successfully.
101 ; EXIT-ERROR: Errorlevel = 1, Abnormal termination due to error, wrong DOS,
102 ; invalid parameters, unrecoverable I/O errors on the diskette.
104 ; EFFECTS: Files are not altered. A Message will show result of compare.
106 ; INTERNAL REFERENCES:
108 ; SENDMSG - passes parms to regs and invokes the system message routine.
109 ; EXTERR - get extended error and display message.
110 ; INIT_CP - record chcp switch then turn off. Allows COMP to open first
111 ; or second file regardless of the system code page.
112 ; RESTORE_CP - resets the chcp switch to the initial value.
113 ; COMP_CODEPAGE - verify matching code pages.
114 ; GET_CP - do an extended open, get code page, then close.
117 ; WORKAREA - Temporary storage
119 ; EXTERNAL REFERENCES:
121 ; SYSDISPMSG - Uses the MSG parm lists to construct the messages
123 ; SYSLOADMSG - Loads messages, makes them accessable.
124 ; SYSPARSE - Processes the DOS Command line, finds parms.
127 ; PSP - Contains the DOS command line parameters.
128 ; COMPSM.SAL - Defines the control blocks that describe the messages
129 ; COMPPAR.SAL - Defines the control blocks that describe the
130 ; DOS Command line parameters.
133 ; This module should be processed with the SALUT preprocessor
134 ; with the re-alignment not requested, as:
138 ; To assemble these modules, the alphabetical or sequential
139 ; ordering of segments may be used.
141 ; For LINK information, reference Prolog of COMP1.SAL.
143 ; COPYRIGHT: The following notice is found in the OBJ code generated from
144 ; the "COMPSM.SAL" module:
146 ; "The DOS COMP Utility"
147 ; "Version 4.0 (C) Copyright 1988 Microsoft"
148 ; "Licensed Material - Property of Microsoft"
150 ; Modification History:
152 ; Version Author date comment
153 ; ------- ------ ---- -------
154 ; V0.0 Dave L. Original author
158 ; V4.0 Edwin M. K. ;AN000; Extended attribute support,
159 ; Bill L. 7/10/87 parser, message retriever support
161 ; V4.0 Bill L. 9/17/87 ;AN001; - DCR 201 enhancements to the
162 ; extended attribute support
164 ; V4.0 Bill L. ;AN002; - PTM 708
168 ; ;AN006; - PTM 2205 (DBCS support)
169 ; ;AN007; - PTM 3056 (y/n -> STDERR)
170 ; ;AN008; - optimizations
171 ; ;AN009; - PTM 4076 network hang
173 ;****************** END OF SPECIFICATIONS *****************************
177 %
OUT COMPONENT
=COMP
, MODULE
=COMP2
.SAL
180 ;***********************************
182 ;***********************************
184 fill_name1
macro pfcb
;AN000;
188 mov dx,offset name1
;AN000;
189 mov si,offset path1
;AN000;
190 mov di,offset pfcb
;AN000;
197 fill_name2
macro ;AN000;
201 mov dx,offset name2
;AN000;
202 mov si,offset path2
;AN000;
203 mov di,offset outfcb
;AN000;
210 print_msg
macro msg
,handle
;AC003;
212 mov dx,offset msg
;AN000; ;dx: ptr to msg descriptor
213 ifnb
<handle
> ;AN003; ;check if new handle given
214 push di ;AN003; ;put new handle in msg structure
216 mov [di].msg_handle
,handle
;AN003;
223 doscall
macro func
,subfunc
;AN000;
224 ifnb
<func
> ;AN000; ;are there any parms at all ?
225 ifnb
<subfunc
> ;AN000; ;is there a sub-function ?
226 mov ax,(func
shl 8)+subfunc
;AN000; ;yes, ah=func, al=subfunc
227 else ;AN000; ;no sub-function
234 ;***********************************
236 ;***********************************
238 include compeq
.inc ;AN000; ;include some equates
240 ;***********************************
241 ; Extended attribute structures
242 ;***********************************
244 ea
struc ;AN001; ;extended attr. structure
245 ea_type db EAISBINARY
;AN001;
246 ea_flags dw EASYSTEM
;AN001;
248 ea_namelen db 2 ;AN001;
249 ea_vallen dw 2 ;AN001;
250 ea_name db "CP" ;AN001;
251 ea_value dw ?
;AN001;
254 qea
struc ;AN001; ;query extended attr. name
255 qea_type db EAISBINARY
;AN001;
256 qea_flags dw EASYSTEM
;AN001;
257 qea_namelen db 2 ;AN001;
258 qea_name db "CP" ;AN001;
261 ;***********************************
263 ;***********************************
265 cseg
segment para
public 'CODE' ;AC000;
266 assume
cs:cseg
,ds:cseg
,es:cseg
,ss:cseg
;as set by DOS loader
268 extrn parser
:near ;AN000;
269 extrn sysloadmsg
:near ;AN000;
270 extrn sysdispmsg
:near ;AN000;
271 extrn memory_size
:word
273 extrn parms
:word ;AN000;
275 extrn parm_count
:word ;AN000;
276 extrn current_parm
:word ;AN000;
277 extrn ordinal
:word ;AN000;
278 extrn msgnum_mem
:word ;AN000;
279 extrn msgnum_para
:word ;AN000;
280 extrn msgnum_tenmsg
:word ;AN000;
281 extrn msgnum_baddrv
:word ;AN000;
282 extrn msgnum_bad
:word ;AN000;
283 extrn msgnum_adr
:word ;AN000;
284 extrn msgnum_bdr
:word ;AN000;
285 extrn msgnum_eor
:word ;AN000;
286 extrn msgnum_done
:word ;AN000;
287 extrn msgnum_fnf
:word ;AN000;
288 extrn msgnum_bad_path
:word ;AN000;
289 extrn msgnum_share
:word ;AN000;
290 extrn msgnum_too_many
:word ;AN000;
291 extrn msgnum_prinam
:word ;AN000;
292 extrn msgnum_secnam
:word ;AN000;
293 extrn msgnum_badsiz
:word ;AN000;
294 extrn msgnum_nother
:word ;AN000;
295 extrn msgnum_and_msg
:word ;AN000;
296 extrn msgnum_crlf
:word ;AN000;
297 extrn msgnum_accessdenied
:word ;AN000;
298 extrn msgnum_cp_mismatch
:word ;AN000;
299 extrn msgnum_ok
:word ;AN000;
300 extrn msgnum_exterr
:word ;AN000;
301 extrn msgnum_pparse
:word ;AN000;
302 extrn sublist_6
:word ;AN000;
303 extrn sublist_7
:word ;AN000;
304 extrn sublist_8
:word ;AN000;
305 extrn sublist_11
:word ;AN000;
306 extrn sublist_12
:word ;AN000;
307 extrn sublist_13
:word ;AN000;
308 extrn sublist_19a
:word ;AN000;
309 extrn sublist_19b
:word ;AN000;
310 extrn sublist_21
:word ;AN000;
311 extrn sublist_exterr
:word ;AN000;
312 extrn sublist_24
:word ;AN000;
314 ;***********************************
315 ; Data area in code segment
316 ;***********************************
322 public cur_name
;AN000;
323 public exitfl
;AN000;
325 even
;AN000; ;align stack on word boundary
327 stack_area db 512 dup ("S") ;Added in DOS 3.20 to support hardware requiring
328 End_Stack_Area db 00h ;large stacks. DO NOT PUT DATA ABOVE THIS !
330 clear db 00h ;AN000; ;clear path2
331 cur_name dw 00h ;AN000; ;ptr to current filename
332 input_buf db 130 dup (0) ;AN000; ;input buffer for keyb input
333 name1 db 130 dup (0) ;AN000; ;source file name
334 name2 db 130 dup (0) ;AN000; ;target file name
335 byte1 db 00h ;AN000; ;on compare: bad byte for source
336 byte2 db 00h ;AN000; ;on compare: bad byte for target
337 fcb2 db 16 dup (0) ;entered target filespec
338 ;--------KEEP NEXT VARIABLes IN ORIGINAL ORDER-------------
339 oldp1 db 67 dup (0) ;original path for the first drive 1 KEEP IN ORDER
340 path1 db 130 dup (0) ;path we'll use for the first drive 2
341 infcb db 37 dup (0) ;source fcb 3
342 oldp2 db 67 dup (0) ;original path for second drive 4
343 path2 db 130 dup (0) ;path we'll use for second drive 5
344 outfcb db 37 dup (0) ;target fcb 6
345 ;--------KEEP ABOVE VARIABLes IN ORIGINAL ORDER------------
347 mem db 2 dup (0) ;size of large buffer in bytes
348 curfcb db 4 dup (0) ;first 2 bytes = addr of fcb for large buffer,
349 ;last 2 bytes = addr of fcb for small buffer
350 curpos dw 00h ;current byte offset in large buffer
351 buf2 dw 00h ;seg address of large buffer
352 siz dw 512 ;# bytes of data left to compare in large buffer
353 swt db 00h ;Bit switch:
354 ; 1 = read file to eof
355 ; 4 = had compare error
356 ; 8 = eof mark not found
357 ; 16 = secondary dir path has been found
358 ; 32 = primary file opened
359 ; 64 = secondary file opened
360 ; 128 = zero suppress switch
361 swt2 db 00h ;Bit switch:
364 offs db 00h,00h,00h,00h ;count of bytes compared
365 cnt db 00h ;# of bad compares
366 offp db 8 dup(0) ;AC000; ;offset of mis-compare between bytes
367 off_byte db 8 dup (0) ;AN000; ;same as offp, but the words are reversed
368 curdrv db 00h ;actual number of default drive
369 cdrv db " :" ;ascii letter of default drive
371 tbl db "0123456789ABCDEF
"
372 openpath db 15 dup (0) ;An fcb will be parsed into this path.
373 cpsw_orig db 00h ;AN000; ;save original cpsw value
374 exitfl db EXOK ;AN000; ;errorlevel return code
375 handle dw 00h ;AN000;
377 dbcs_off dw 0 ;AN006;
378 dbcs_seg dw 0 ;AN006;
379 dbcs_len dw 0 ;AN006;
380 string_off dw 0 ;AN006;
381 string_seg dw 0 ;AN006;
382 dstring db 128 dup(0) ;AN006;
384 parm_list label word ;AN001;
390 querylist label byte ;AN001; ;query general list
391 dw 1 ;AN001; ;# of entries
392 querylist_qea qea <EAISBINARY,EASYSTEM,2,"CP
"> ;AN001;
394 qlist label byte ;AN001; ;general get/set list
395 dw 1 ;AN001; ;count of attr entries
396 qlist_ea ea <EAISBINARY,EASYSTEM,?,2,2,"CP
",?> ;AN001; ;return code page in this structure
398 ;***********************************
399 ; Code area in code segment
400 ;***********************************
403 ;-----------------------------------------------------------------------------
404 ; INIT - Fill in fill_seg, fill_off in all msg sublists with current seg_id
405 ; and offset. Also calls the system load massage function so it can
406 ; establish addressability to the system messages, and for it to verify
408 ;-----------------------------------------------------------------------------
409 init proc near ;AC000;
412 mov sp,offset End_Stack_Area ;Big Stack
413 push ax ;AN000; ;on entry--ax (should) = valid drive parm
414 call setfill ;AN000; ;init fill_seg, fill_off in sublists
415 call sysloadmsg ;AN000; ;init sysmsg handler
417 ; $if c ;AN000; ;if there was a problem
419 call sysdispmsg ;AN000; ;let him say why we had a problem
420 mov exitfl,EXVER ;AN000; ;tell errorlevel bad DOS version
421 ; $else ;AN000; ;since sysdispmsg is happy
424 call get_dbcs_vector ;AN006; ;get DOS DBCS table vector
425 ;;(deleted for AN009) call init_cp ;AN000; ;get current setting of CHCP
426 pop ax ;AN000; ;restore valid drive parm
427 call more_init ;AN000; ;do more init
428 call main ;AN000; ;do rest of utility as normal
429 ;;(deleted for AN009) call restore_cp ;AN000; ;set CHCP back to normal
430 ; $endif ;AN000; ;ok with sysdispmsg?
432 mov al,exitfl ;AN000; ;pass back errorlevel ret code
433 doscall RET_FN ;AN000; ;return to DOS with ret code
434 int 20h ;AN000; ;if above not work,
435 ;AN000; ;take stick and kill it
439 ;------------------------------------------------------------------------------
440 ; MAIN - Does the compare for two sets of files
441 ;------------------------------------------------------------------------------
443 main proc near ;AN000;
446 mov clear,0 ;clear it
449 cmp byte ptr path1,0 ;was first parm given?
450 ; $leave ne ;AN000; ;Yes, LEAVE INPUT loop
452 mov byte ptr path2,0 ;AN000; ;make sure that we get the second file name
454 mov dx,offset msgnum_prinam ;AC000; ;to ask user for first parm
455 mov parm_count,FIRST_PARM_CT ;AN000; ;THIS IS FIRST PARM (ONLY ONE ACTUALLY)
456 call getnam ;get first parm from user in path1 and fcb
457 mov di,offset fcb ;AN000; ;es:di=ptr TO UNOPENED fcb
458 mov si,offset path1 ;AN000; ;ds:si=ptr TO COMMAND LINE TO PARSE
459 ;AN000; ;AL-BIT VALUE CONTROLS PARsiNG
460 doscall PARSE_FILENAME,01H ;AN000; ;AND GO MAKE AN fcb, SCAN OFF LEAdiNG SEPARATORS
461 cmp AL,255 ;AN000; ;INVALID DRIVE?
464 print_msg msgnum_baddrv,STDERR ;AN000; ;"Invalid drive spec
."
465 mov byte ptr path1,00 ;AN000; ;BLANK FIRST CHAR. SO TO loop AGAIN
468 ; $enddo ;AC000; ;REPEAT UNTIL FIRST PARM OK
472 ;chek2: ;GET/SET SECOND FILENAME
482 cmp byte ptr path2,0 ;was second parm given?
483 ; $leave ne ;AN000; ;Yes, LEAVE INPUT loop
485 mov dx,offset msgnum_secnam ;AC000; ;to ask for second parm
486 mov parm_count,TRICK_PARM_CT ;AN000; ;THIS IS FIRST PARM (ONLY ONE ACTUALLY)
487 ;AN000; ;BUT PUT FILENAME IN path2 INSTEAD OF path1
488 call getnam ;get second parm in path2 and fcb2
489 mov di,offset fcb2 ;AN000; ;es:di=ptr TO UNOPENED fcb
490 mov si,offset path2 ;AN000; ;ds:si=ptr TO COMMAND LINE TO PARSE
491 ;AN000; ;AL-BIT VALUE CONTROLS PARsiNG
492 doscall PARSE_FILENAME,01H ;AN000; ;AND GO MAKE AN fcb, SCAN OFF LEAdiNG SEPARATORS
493 cmp AL,255 ;AN000; ;INVALID DRIVE?
496 print_msg msgnum_baddrv,STDERR ;AN000; ;"Invalid drive spec
."
497 mov byte ptr path2, 00 ;AN000; ;BLANK FIRST CHAR. SO TO loop AGAIN
500 ; $enddo ;AC000; ;SECOND PARM?
503 mov si,offset path1 ;AN000; ;si = ptr TO PATH NAME TO FIND "\" IN
504 call findfs
;AN000; ;FIND LAST "\" AND SAVE ADDR
505 mov si,offset path2
;AN000; ;si = ptr TO PATH NAME TO FIND "\" IN
506 call findfs
;AN000; ;FIND LAST "\" AND SAVE ADDR
507 mov al,curdrv
;get default drive
508 cmp byte ptr fcb
,0 ;source on default?
511 mov fcb
,al ;yes, set to actual drive
514 cmp byte ptr fcb2
,0 ;target on default?
517 mov fcb2
,al ;yes, set to actual drive
518 ; $endif ;AC000; ;***** FIND PRI FILE
522 call findpath
;locate primary's specified dir
525 fill_name1 fcb
;AN000; ;get full path name
526 mov sublist_12
.sub_value
,offset name1
;AN000; ;SET UP %1 IN sublist OF "Invalid path - %0:
527 mov dx,offset msgnum_bad_path
;AC000; ;dx = ptr TO MSG DesCRIPTOR TO dispLAY
528 ;AN000; ;VALUE IN di,si,dx PAssED TO BADFIL CODE
529 jmp badfil
;dir not found - tell user
533 doscall SETDTA
;AC000; ;diR FOUND, SET DTA TO SOURCE fcb
535 doscall SEARCHF
;AC000; SEARCH FIRST SOURCE FILE
537 ; $if nz ;AC000; ;Yes
539 fill_name1 fcb
;AN000; ;get full path name
540 mov sublist_11
.sub_value
,offset name1
;AN000; ;SET UP %1 IN sublist OF "File not found - %0"
541 mov dx,offset msgnum_fnf
;AC000; ;dx = ptr TO MSG DesCRIPTOR TO dispLAY
542 ;AN000; ;VALUE IN di,si,dx PAssED TO BADFIL CODE
546 f1ok: ;OPEN, PRIME PRIMARY FILE
547 and swt
,09Fh ;clear file open flags
549 doscall FCBOPEN
;AC000; OPEN SOURCE FILE
552 ;Try to open the same file using a handle open with read access
553 ; $if nz ;AC000; ;IF fcb OPEN FAILED, THEN SHARING ERROR
558 mov si,offset infcb
;Take this fcb...
559 mov di,offset OpenPath
; and in this area...
560 call MakePathFromfcb
; make an ASCIIZ path.
561 mov dx,offset OpenPath
562 doscall HANDLEOPEN
,READONLYACCESS
;AC000; TRY TO OPEN IT WITH READONLY ACCEss
565 jmp accessdenied1
;ERROR OPENING FILE. AssUME ACCEss DENIED.
568 mov bx,ax ;Put the handle in bx...
569 doscall HANDLECLOSE
;AC000; AND CLOSE IT
570 cmp byte ptr path1
,0 ;using current dir?
574 doscall CHDIR
;AN000; change directory
578 mov word ptr infcb
+14,1 ;set record size
580 mov di,offset infcb
+33
584 call get
;and prime big buffer from first file
585 print_msg msgnum_crlf
,STDOUT
;AN000; ;dispLAY CRLF
586 print_msg msgnum_crlf
,STDOUT
;AN000; ;dispLAY CRLF
587 fill_name1 infcb
;AN000; ;get full path name
588 mov sublist_19a
.sub_value
,offset name1
;AN000; ;SET UP %1 IN sublist FOR "%1 AND %2" MSG
589 mov al,fcb2
;target drive
590 mov outfcb
,al ;to target fcb
592 ;****** FIND SECONDARY diR
594 test byte ptr swt
,16 ;has secondary path already been found?
598 call findpath
;no, find its path now
599 ; $else ;AC000; ;siNCE SECONDARY PATH ALREADY BEEN FOUND
602 cmp byte ptr [si],0 ;is there a path?
603 ; $if ne ;AC000; ;Yes
605 ; BUT IF NOT, WILL USE CURRENT DIR
607 doscall CHDIR
;AC000; ;yes, set the secondary dir to proper node
614 pushf ;save status of secondary dir search
616 mov di,offset outfcb
+1 ;target filename field
617 mov si,offset fcb2
+1 ;current target filename
618 mov bx,offset infcb
+1 ;current source filename
621 lodsb ;get target name char
622 cmp al,"?" ;is it ambiguous?
625 mov al,[bx] ;yes, copy char from source
628 stosb ;build target name
629 inc bx ;next source char
630 ; $enddo loop ;AC000;
632 fill_name2
;AN000; ;get full path name
633 mov sublist_19b
.sub_value
,offset name2
;AN000; ;SET UP %2 IN sublist FOR "%1 AND %2" MSG
634 print_msg msgnum_and_msg
,STDOUT
;AN000; ;dispLAY " AND "
635 print_msg msgnum_crlf
,STDOUT
;AN000; ;dispLAY CRLF
636 popf ;return from getting secondary dir
637 ; $if ne ;AC000; ;diD NOT GET IT
639 fill_name2
;AN000; ;get full path name
640 mov sublist_12
.sub_value
,offset name2
;AN000; ;SET UP %1 IN sublist FOR "%1 - INVALID PATH" ;AN000;
641 print_msg msgnum_bad_path
,STDERR
;AN000; ;"Invalid path - %0"
642 mov dx,offset oldp2
;Get back to current dir on sec drive
643 doscall CHDIR
;AC000;
649 doscall SETDTA
;AC000; diR FOUND, SET DTA TO TARGET fcb
651 doscall SEARCHF
;AC000; FIND FIRST TARGET FILE
653 ; $if NZ ;AC000; ;Yes
655 print_msg msgnum_crlf
,STDERR
;AN000; ;dispLAY CRLF
656 fill_name2
;AN000; ;get full path name
657 mov sublist_11
.sub_value
,offset name2
;AN000; ;SET UP %1 IN sublist OF MSG
658 print_msg msgnum_fnf
,STDERR
;AN000; ;"File not found - %0"
659 mov dx,offset oldp2
;Get back to current dir on sec drive
660 doscall CHDIR
;AC000;
661 jmp quit3
;and get the next source file
666 doscall FCBOPEN
;AC000; OPEN TARGET FILE
667 or al,al ;Was the fcb open ok?
669 jnz ShrViolation
;If fcb open failed, then SHARING ERROR
670 mov si,offset outfcb
;Take this fcb...
671 mov di,offset OpenPath
; and in this area...
672 call MakePathFromfcb
; make an ASCIIZ path.
673 mov dx,offset OpenPath
674 doscall HANDLEOPEN
,READONLYACCESS
;AC000; TRY TO OPEN IT WITH READONLY ACCEss
676 mov bx,ax ;Put the handle in bx...
677 doscall HANDLECLOSE
;AC000; AND CLOSE IT.
679 jmp filopn
;If successful then continue
680 accessdenied2: ;Oops, there was an error. AssUME it was Access Denied
682 print_msg msgnum_crlf
,STDERR
;AN000; ;dispLAY CRLF
683 fill_name2
;AN000; ;get full path name
684 mov sublist_21
.sub_value
,offset name2
;AN000; ;SET UP %1 IN sublist OF "Access Denied - %0"
685 mov dx,offset oldp2
;Get back to current dir on sec drive
686 doscall CHDIR
;AC000;
687 print_msg msgnum_accessdenied
,STDERR
;AN000; ;"Access Denied - %0"
688 jmp quit3
;and get the next source file
692 print_msg msgnum_crlf
,STDERR
;AN000; ;dispLAY CRLF
693 fill_name2
;AN000; ;get full path name
694 mov sublist_13
.sub_value
,offset name2
;AN000; ;SET UP %1 IN sublist OF "Sharing violation - %0"
695 mov dx,offset oldp2
;Get back to current dir on sec drive
696 doscall CHDIR
;AC000;
697 print_msg msgnum_share
,STDERR
;AN000; ;"Sharing violation - %0"
698 jmp quit3
;and get the next source file
700 mov word ptr outfcb
+14,1 ;record size
702 mov di,offset outfcb
+33
705 mov ax,word ptr infcb
+16 ;low part of file size
706 mov dx,word ptr infcb
+18 ;high part
707 cmp ax,word ptr outfcb
+16 ;are files the same size?
708 jne invsiz
;no, error
709 cmp dx,word ptr outfcb
+18
712 print_msg msgnum_badsiz
,STDOUT
;AN000; ;"Files are different sizes"
713 jmp quit3
;tell user sizes are different and process next source file
715 ;;(deleted for AN009) call comp_codepage ;AN000; ;VERIFY BOTH FILes HAVE THE SAME CODEPAGE
716 ;;(deleted for AN009) $if c ;AN000; ;ERROR WITH CODEPAGE
717 ;;(deleted for AN009) jmp quit3 ;AN000; ;go on to other files if any
718 ;;(deleted for AN009) $endif ;AN000;
720 mov word ptr curfcb
,dx ;get fcb's in proper order
722 mov word ptr curfcb
+2,dx
723 mov word ptr offs
,0 ;set constants
724 mov word ptr offs
+2,0
725 mov byte ptr cnt
,0 ;and fall through to process
726 process: ;**** PREPARE TO COMPARE DATA
727 mov dx,word ptr curfcb
+2 ;small buffer's file
728 cmp word ptr siz
,0 ;any data left in large buffer?
729 jne getsec ;yes, use it
730 test byte ptr swt
,1 ;no, have we reached eof yet?
731 jz large ;no - fill large buffer from other file
732 doscall FCBCLOSE
;AC000; CLOSE THE FILE FILLING SMALL BUFFER
733 test byte ptr swt
,8 ;yes, files are done - did we find eof mark?
736 print_msg msgnum_eor
,STDOUT
;AN000; ;"Eof mark not found"
739 test byte ptr swt
,4 ;any compare errors?
742 print_msg msgnum_ok
,STDOUT
;AN000; ;"FILes COMPARE OK"
745 jmp quit3
;had compare errors - no "ok" msg
747 large: ;Fill large buffer
748 xchg dx,word ptr curfcb
;AC000; ;switch fcbs' association with buffers
749 xchg dx,word ptr curfcb
+2
750 call get
;fill large buffer from currently mounted file
751 jmp process
;and now fill small buffer from other file
753 call getf2
;fill small buffer with 1024 bytes
754 sub siz
,cx ;# bytes left in big buffer after this compare
755 mov bp,cx ;save # bytes of compare
756 les di,dword ptr curpos
;current byte in large buffer
757 mov si,offset buf
;current byte in small buffer
759 jcxz compok
;all done and equal
761 jne cmp1
;bytes don't match
765 mov curpos
,di ;next byte to compare in large buffer
766 mov ax,word ptr offs
+2 ;low part of bytes compared so far
767 add ax,bp ;increment count of bytes compared
768 adc word ptr offs
,0 ;adjust high part
769 mov word ptr offs
+2,ax ;save low part
770 jmp process
;and keep going
771 cmp1: ;***** FOUND UNEQUAL BYTes
772 or byte ptr swt
,4 ;indicate had compare error
773 dec si ;point to the bad bytes
775 mov al,[si] ;bad byte from small buffer
776 mov ah,es:[di] ;bad byte from large buffer
777 mov dx,offset infcb
;AC000; ;FIND OUT WHICH byte CAME FROM WHICH FILE
778 ;AN000; ;SO THAT "File 1 = %1" AND "File 2 = %1"
779 ;AN000; ;MEssAGes WILL BE CORRECT.
780 cmp word ptr curfcb
+2,dx ;is first file in small buffer?
783 xchg ah,al ;no, reverse the bad bytes
786 mov byte1
,al ;AN000; ;SAVE FIRST FILE BAD byte
787 mov byte2
,ah ;AN000; ;SAVE SECOND FILE BAD byte
788 ;AN000; ;COMPUTE offset IN FILE OF BAD BYTes
789 mov bx,word ptr offs
;high part of byte count
790 mov ax,si ;addr of the bad byte in small buffer
791 sub ax,offset buf
;bad byte's offset in this buffer
792 add ax,word ptr offs
+2 ;offset into file
793 adc bx,0 ;adjust high part if needed
794 mov word ptr offp
,bx ;AC000; ;SAVE HIGH PART OF offset
795 mov word ptr off_byte
+2,bx ;AN000; ;SAVE HIGH PART OF offset
796 mov word ptr offp
+2,ax ;AN000; ;SAVE LOW PART OF offset
797 mov word ptr off_byte
,ax ;AN000; ;SAVE LOW PART OF offset
798 inc si ;back to correct position
800 push cx ;save remaining byte count
801 push si ;save next data byte addr
804 mov sublist_6
.sub_value
,offset OFF_byte
;AN000; ;sublist OF MSG DesC
805 print_msg msgnum_bad
,STDOUT
;AN000; ;"Compare error at offset %1"
806 mov sublist_7
.sub_value
,offset byte1
;AN000; ;sublist OF MSG DesC. (ptr TO BAD byte IN FIRST FILE)
807 print_msg msgnum_adr
,STDOUT
;AN000; ;"File 1 = %1"
808 mov sublist_8
.sub_value
,offset byte2
;AN000; ;sublist OF MSG DesC. (ptr TO BAD byte IN SECOND FILE)
809 print_msg msgnum_bdr
,STDOUT
;AN000; ;"File 2 = %1"
810 pop si ;get regs back
812 inc byte ptr cnt
;count errors
813 cmp byte ptr cnt
,10 ;10 errors yet?
814 je gotten
;yes, further compare is useless
815 jmp comp
;no, go on with following byte
819 print_msg msgnum_tenmsg
,STDOUT
;AN000; ;"10 Mismatches - ending compare"
822 mov byte ptr swt
,16 ;say we've found the secondary dir
823 cmp byte ptr path1
,0 ;is primary file in the drive's current dir?
826 mov dx,offset path1
;no,
827 doscall CHDIR
;AC000;
831 doscall SETDTA
;AC000; ;DTA = SOURCE fcb
833 doscall SEARCHN
;AC000; ;12H FIND NEXT SOURCE FILE
836 jmp f1ok
;yes, go process it
837 AccessDenied1: ;Oops, there was an error. AssUME it was Access Denied
838 fill_name1 INfcb
;AN000; ;get full path name
839 mov sublist_21
.sub_value
,offset name1
;AN000; ;SET UP %1 IN sublist OF "Access Denied - %0"
840 mov dx,offset msgnum_accessdenied
;AC000; ;dx = ptr TO MSG DesCRIPTOR TO dispLAY
841 ;AN000; ;VALUES IN dx,si,di PAssED TO BADFIL CODE
845 fill_name1 INfcb
;AN000; ;get full path name
846 mov sublist_13
.sub_value
,offset name1
;AN000; ;SET UP %1 IN sublist OF "Sharing violation - %0"
847 mov dx,offset msgnum_SHARE
;AC000; ;dx = ptr TO MSG DesCRIPTOR TO dispLAY
848 ;AN000; ;VALUes IN dx,si,di PAssED TO BADFIL CODE
849 badfil: ;assume si = path, di = fcb , dx = MSG DesCRIPTOR
852 print_msg msgnum_crlf
,STDERR
;AN000; ;dispLAY CRLF
853 print_msg msgnum_crlf
,STDERR
;AN000; ;dispLAY CRLF
856 ; DISPLAY MSG THAT WAS POINTED TO BY DX
860 mov [di].msg_handle
,STDERR
;AN003;
862 call sendmsg
;AC000; ;dispLAY IT
864 quit4: ;no more primary files
865 ;;;;;; cmp byte ptr path1,0 ;current dir on pri drive?
868 doscall CHDIR
;AC000; ;no, restore it now
870 mov byte ptr path2
,0 ;force get of second name - leave this here
872 ; $do ;AC000; ;REPEAT UNTIL A VALID Y/N REspONSE
874 mov dx,offset msgnum_nother
;AN000; ;dispLAY (Y/N) MEssAGE
875 push di ;AN007; save DI
876 mov di,dx ;AN007; DI -> message struct
877 mov [di].msg_handle
,STDERR
;AN007; display to STDERR
878 pop di ;AN007; restore DI
879 call sendmsg
;AC000; ;dispLAY IT
880 push ax ;SAVE REspONSE
881 print_msg msgnum_crlf
,STDERR
;AC003; ;dispLAY CRLF
882 print_msg msgnum_crlf
,STDOUT
;AC009; ;dispLAY CRLF
883 pop dx ;AN000; ;GET REspONSE BACK
884 doscall GET_EXT_CNTRY_INFO
,YESNO_CHECK
;AC000; ;CHECK REspONSE, dx=REspONSE
885 cmp al,YES
;AN000; ;Yes REspONSE
886 ; $leave e ;AN000; ;LEAVE loop
888 cmp al,0 ;AN000; ;NO REspONSE
891 ; $enddo ;AN000; ;REPEAT UNTIL A VALID Y/N REspONSE
894 cmp al,YES
;AC000; ;ax=0=NO, ax=1=Yes (CHECK REspONSE)
895 ; $if e ;AC000; ;GOT A Yes REspONSE, REPEAT COMP
897 xor ax,ax ;AN008; ;AN000; ;CHAR TO USE TO CLEAR BUFFER
898 mov di,offset path1
;AN000; ;CLEAR OLD PATH, FILE NAMes TO START AGAIN
899 mov cx,129 ;AN000; ;LENGTH OF BUFFER
903 ; $enddo loop ;AN000;
905 mov di,offset path2
;AN000; ;CLEAR OLD PATH, FILE NAMes TO START AGAIN
906 mov cx,129 ;AN000; ;LENGTH OF BUFFER
910 ; $enddo loop ;AN000;
912 mov clear
,1 ;set clear
913 jmp rpt
;AC000; ;REPEAT COMP
919 ;--------------------------------------------
920 ; CONTROL BREAK EXIT CODE (INTERRUPT HANDLER)
921 ;--------------------------------------------
923 test swt2
,2 ;oldp2 set?
924 ; $if nz ;AC000; ;no, restore it now
927 doscall CHDIR
;AC000; ;no, restore it now
931 test swt2
,1 ;oldp1 set?
932 ; $if nz ;AC000; ;if it was
935 doscall CHDIR
;AC000; ;no, restore it now
939 ;;(deleted for AN009) call restore_cp ;AN000; ;restore the codepage
940 mov al,EXCB
;AN000; ;errorlevel: control break exit
941 doscall RET_FN
;AN000; ;return to DOS with ret code
943 int 20h
;AC000; ;if exit didn't work, kill it
946 ;------------------------------------------------------------------------------
947 ; -----------------------------SUBROUTINES----------------------------------
948 ;------------------------------------------------------------------------------
951 ;------------------------------------------------------------------------------
952 ; FINDFS - Finds the last "\" in the path name given. This is done so that the
953 ; path and not the filename can be derived from the path name.
955 ; INPUT - SI = ptr to path name to work on
956 ; OUTPUT - saves address of last "\" at end of buffer that SI points to.
958 ;------------------------------------------------------------------------------
959 findfs proc
near ;AN000;
960 mov string_off
,si ;AN006; save addr of string for Check_DBCS_slash
961 mov string_seg
,cs ;AN006;
964 xor dx,dx ;AN008; ;AN000; ;CLEAR dx IN THE CASE THAT NO "\" IS FOUND
967 lodsb ;AN000; ;GET A CHARACTER
968 cmp al,0 ;AN000; ;AT END OF STRING YET ?
969 ; $leave z ;AN000; ;Yes, LEAVE
971 push si ;AN006; Check the character in AL == '\'
972 dec si ;AN006; and the character in front of
973 call Check_DBCS_slash
;AN006; the '\' is not DBCS.
976 ; $if z ;AN000; ;Yes, SAVE ADDR OF IT IN dx
986 mov [si+128],dx ;AN000; ;SAVE ADDR OF LAST "\" IN THE LAST TWO BYTes OF PATH
992 ;------------------------------------------------------------------------------
993 ; GETNAM - Inputs a filename from STDIN to be used as either the first or second
994 ; parameter for COMP.
996 ; INPUT - PARM_COUNT = ordinal number for parser
997 ; DX = ptr to msg descriptor of message to display
998 ; BX = ptr to FCB of file
999 ; SI = ptr to FCB structure
1000 ;------------------------------------------------------------------------------
1002 mov input_buf
,INPUT_LEN
;AN000; ;PUT LENGTH OF BUFFER AS FIRST byte OF BUFFER
1003 mov di,dx ;AN000; ;FILL IN offset OF INPUT BUFFER IN MSG DesC.
1004 mov [di].msg_input
, offset input_buf
;AN000; ;ptr TO INPUT BUFFER
1005 mov [di].msg_handle
, STDERR
1007 call sendmsg
;AC000; ;dispLAY MEssAGE, GET BUFFERED INPUT
1009 xor ch,ch ;AN000; ;CLEAR HIGH byte OF cx
1010 mov cl,input_len
;AN000; ;CL = LENGTH OF INPUT BUFFER
1011 ;get offset into input buffer (to skip length word)
1012 mov current_parm
,offset INPUT_BUF
+2 ;AN000; ;CURRENT_PARM = offset OF INPUT BUFFER
1013 mov ordinal
,ZERO_PARM_CT
;AN000; ;TELL PARSER THAT THIS IS FIRST PARAMETER (ONLY ONE)
1014 call parser
;PUT NEW STRING AT WHERE di POINTS TO
1019 ;------------------------------------------------------------------------------
1020 ; FINDPATH - Check if path is a directory. If yes, then CHDIR to it and set the
1021 ; FCB to ????????.???. If no, check for "\". If no "\", then assume
1022 ; we are in the correct directory and set FCB to ????????.??? if blank.
1023 ; If "\" is found, then strip last name off path into FCBYTE (?'s if
1024 ; nothing follows "\") and try to find the directory again.
1026 ; INPUT - SI = ptr to path string
1027 ; DI = ptr to FCB (drive byte is valid)
1028 ; OUTPUT - if path found then set ZERO flag and CHDIR to directory and FCB set.
1029 ; else FCB set and reset ZERO flag.
1030 ;------------------------------------------------------------------------------
1032 mov dl,[di] ;drive number from fcb
1036 sub di,67 ;where to put current dir for the drive
1037 mov al,dl ;AN005; ;get drive number
1038 add al,64 ;AN005; ;convert to ascii letter
1042 mov al,pathchar
;get path separator
1043 stosb ;and put in beginning of path
1045 doscall CURDIR
;AC000; ;GET DRIVE'S CURRENT diR
1046 cmp di,offset oldp1
+3 ;See if pri cur dir is set up
1052 cmp di,offset oldp2
+3 ;See if sec cur dir is set up
1060 cmp byte ptr [si],0 ;is there a path?
1063 cmp byte ptr [di+1]," " ;no, is there a name in the fcb?
1064 jne fp2
;yes, use current dir
1066 call setq
;no, set it to ????????.???
1068 cmp al,al ;force eq on return
1070 fp3: ;there's a path
1072 doscall CHDIR
;AC000; ;see if it's a dir
1073 jnc fp1
;yes, set fcb to ?'s - path found and set
1074 mov bx,[si+128] ;no - get last \ in string
1075 or bx,bx ;is there a \?
1076 jnz fp4
;yes, go strip off last name
1077 mov byte ptr [si],0 ;no, there's only 1 name in path - must be filename
1078 jmp short fp0
;go use current dir
1080 call backoff
;strip last name off line into fcb
1082 doscall CHDIR
;AC000; ;noword ptr is result line a valid path?
1083 jnc fp2
;yes, fcb and path are set
1085 cmp ax,1234h
;no, pass back error - path has first part of name,
1086 ret ;remainder is in fcb
1087 findpath endp
;AN000;
1090 ;------------------------------------------------------------------------------
1091 ; BACKOFF - Removes the last name of a path and puts it into an FCB. Assumes at
1092 ; least one "\" in path. If no name is found then set the FCB to
1095 ; INPUT - SI = ptr to path string.
1096 ; DI = ptr to FCB to format.
1098 ;------------------------------------------------------------------------------
1101 mov bx,[si+128] ;address of last \ in path
1102 cmp byte ptr [si+1],":" ;AN002;
1105 add si,2 ;char following d: in path name
1108 cmp si,bx ;is it the only \ and is it at beg of line?
1110 ; $if e ;AC000; ;Yes
1112 inc bx ;yes, going to root - leave \ alone
1115 inc si ;char following \
1116 cmp byte ptr [si],0 ;are there any?
1118 call setq
;no, use ????????.??? in root
1119 jmp short bo3
;AC008;
1122 ;AC000; ;ds:si=POINTER TO COMMAND LINE TO PARSE
1123 ;AC000; ;es:di=POINTER TO UNOPENED fcb
1124 ;AC000; ;AL-BIT VALUE CONTROLS PARsiNG
1125 doscall PARSE_FILENAME
,02h ;AC000; ;PARSE LAST NAME ON LINE INTO fcb, LEAVE DRIVE byte ALONE
1127 cmp byte ptr [di+1]," " ;is there a file name?
1128 ; $if ne ;AC000; ;Yes, TRUNCATE PATH AND LEAVE
1131 mov byte ptr [bx],0 ;truncate the path name
1133 ; $else ;AC000; ;siNCE NO FILE NAME,
1136 pop si ;no, restore si
1137 pop ax ;strip return to findpath
1138 call setq
;fill fcb with ?'s
1139 cmp ax,1234h
;AN000; ;SET ERROR retURN
1143 backoff endp
;AN000;
1146 ;------------------------------------------------------------------------------
1147 ; SETQ - Set an FCB filename field to ????????.???
1149 ; INPUT - DI = ptr to FCB
1150 ; OUTPUT - FCB is changed.
1151 ;------------------------------------------------------------------------------
1157 inc di ;point to filename
1161 ; $enddo loop ;AC000;
1168 ;------------------------------------------------------------------------------
1169 ; GET - Fill large buffer
1173 ;------------------------------------------------------------------------------
1175 push dx ;save fcb address
1176 mov ds,buf2
;point to large buffer
1178 doscall SETDTA
;AC000; ;SET DTA TO LARGE BUFFER
1181 pop dx ;and get fcb addr back
1182 mov cx,word ptr mem
;# bytes of avail mem in large buffer
1183 doscall FCBRNDBLKREAD
;AC000; ;FILL LARGE BUFFER
1184 mov siz
,cx ;# bytes we read
1185 mov word ptr curpos
,0 ;current byte position offset in large buffer
1187 ; $if nz ;AC000; ;Yes, AT EOF
1189 call fileend
;AC000;
1192 ret ;No, keep on going
1196 ;------------------------------------------------------------------------------
1197 ; FILEEND - Check for EOF char on last read into large buffer (?)
1201 ;------------------------------------------------------------------------------
1203 or byte ptr swt
,1 ;yes, flag it
1204 mov bx,cx ;# bytes just read
1206 cmp byte ptr [bx-1],26 ;is the last char of file an eof?
1209 ; $if e ;AC000; ;Yes
1211 or byte ptr swt
,8 ;yes, say we found the eof
1214 doscall FCBCLOSE
;AC000; ;Close the file filling large buffer
1216 fileend endp
;AN000;
1219 ;------------------------------------------------------------------------------
1220 ; GETF2 - Read 8 sectors from file that FCB points to.
1222 ; INPUT - DX = ptr to FCB
1223 ; OUTPUT - fills small buffer
1224 ;------------------------------------------------------------------------------
1226 ;fill small buffer from fcb at [dx]
1228 mov dx,offset buf
;small buffer addr
1229 doscall SETDTA
;AC000; ;SET THE DTA
1231 mov cx,4096 ;ask for 8 sectors
1232 doscall FCBRNDBLKREAD
;AC000; ;GET THE DATA
1237 ;------------------------------------------------------------------------------
1238 ; FILL_N - This routine fills the buffer NAME1 or NAME2 with the full path name
1239 ; of the corresponding file.
1241 ; INPUT - DX = ptr to buffer to put full path name in
1242 ; DI = ptr to FCB to get drive letter,filename,extension from
1243 ; SI = ptr to PATH1 or PATH2 depending on whether first or second file
1245 ;------------------------------------------------------------------------------
1249 mov string_off
,dx ;AN006; pass whole string to Check_DBCS_slash
1250 mov string_seg
,cs ;AN006;
1251 ;get drive letter & colon ;AN000;
1252 xchg dx,si ;AN000; ;make dx=fcb ptr, si=buffer ptr
1253 mov al,[di] ;AN000; ;drive byte from fcb
1254 inc di ;AN000; ;point to filename
1255 add al,64 ;AN000; ;drive to ascii
1256 mov [si],al ;AN000; ;save letter in string
1257 inc si ;AN000; ;increment ptr
1258 mov byte ptr [si],":" ;AN000; ;add colon to drive letter
1261 ;get full path ;AN000;
1263 cmp byte ptr [si],0 ;AN000; ;is there a path?
1264 ; $if ne ;AN000; ;Yes
1266 cmp byte ptr [si+1],':' ;is thera a drive letter ?
1269 add si,2 ;AN000; ;yes, skip drive id in path
1274 lodsb ;AN000; ;get a path char
1275 or al,al ;AN000; ;end of path?
1276 ; $leave Z ;AN000; ;Yes
1278 stosb ;AN000; ;copy character
1282 push si ;AN006; Check the character in AL == '\'
1283 mov si,di ;AN006; and the character in front of
1284 dec si ;AN006; the '\' is not DBCS.
1285 call Check_DBCS_slash
;AN006;
1288 ; $if NE ;AC000; ;NO
1290 mov al,"\" ;AC000; ;no, display separator ahead of filename
1296 ;get filename ;AN000;
1297 xchg dx,si ;AC000; ;dx=path1 or path2, si=ptr buffer, di=ptr fcb
1301 lodsb ;AC000; ;display filename
1302 cmp al," " ;AC000; ;Is it end of filename
1303 ; $leave e ;AC000; ;Yes, GET EXTENsiON
1306 ; $enddo loop ;AC000; ;GET MORE CHARS, IF ANY
1312 dec cx ;AC000; ;# of spaces left to skip in filename
1313 ; $do ;AC000; ;step thru spaces to get to file extension
1316 ; $enddo loop ;AC000; ;until cx=0
1320 ;get filename extension ;AN000;
1321 cmp byte ptr [si]," " ;AC000; ;is there an extension?
1322 ; $if ne ;AC000; ;Yes, DO PERIOD
1329 lodsb ;AC000; ;display extension
1330 cmp al," " ;AC000; ;is it end of extension?
1331 ; $leave e ;AC000; ;Yes
1334 ; $enddo loop ;AC000;
1337 ; $endif ;AC000; ;EXTENsiON?
1340 stosb ;AC000; ;end of string marker
1349 ;------------------------------------------------------------------------------
1350 ; MAKEPATHFROMFCB - Creates an ASCIIZ path at DI from the FCB pointed to by SI.
1352 ; INPUT - SI = ptr to FCB
1353 ; DI = buffer for path name to be stored.
1355 ;------------------------------------------------------------------------------
1356 MakePathFromFcb proc near
1357 push si ;Save fcb address
1358 mov al,byte ptr [si] ;Get drive letter from fcb (0=A,1=B,...)
1359 add al,64 ;Convert it to ASCII
1360 stosb ;Store it in the PATH
1361 mov al,":" ;Put a drive separator
1362 stosb ; in the PATH.
1364 mov cx,8 ;Copy [1..8] bytes
1368 movsb ;Move the char from the fcb
1369 cmp byte ptr [si]," " ;Is the next char a blank ?
1370 ; $leave e ;AC000; ;Yes, NO MORE CHARS IN FILENAME
1372 ; $enddo loop ;AC000; ;NO, GET NEXT CHAR, IF ANY
1376 mov byte ptr [di],"." ;Stick a period in there...
1377 inc di ; and increment the pointer
1378 mov cx,3 ;Copy [0..3] bytes...
1379 pop si ; from the fcb's
1380 add si,9 ; extension area
1383 cmp byte ptr [si]," " ;Is the next char a blank?
1384 ; $leave e ;AC000; ;Yes, THEN WE ARE DONE
1387 ; $enddo loop ;AC000; ;AND GET THE NEXT ONE, IF ANY
1391 stosb ;Copy in a byte of Hex 0
1393 MakePathFromFcb endp
1396 ;------------------------------------------------------------------------------
1397 ; RESTOREDIR - Do a CHDIR to the original directory this program started in.
1399 ; INPUT - OLDP2 = path string of original directory (for target filespec)
1400 ; PATH2 = path string of target filespec.
1401 ; OUTPUT - changes the current directory
1402 ;------------------------------------------------------------------------------
1403 RestoreDir proc near
1404 cmp byte ptr path2,0 ;working with current dir on secondary file?
1405 ; $if ne ;AC000; ;NO,
1407 push ax ;restore old current directory
1409 doscall CHDIR ;AC000;
1414 RestoreDir endp ;AN000;
1417 ;------------------------------------------------------------------------------
1418 ; INIT_CP - To permit "COMP
" to open the first and second files regardless of
1419 ; the system codepage, and to avoid any codepage mismatch critical
1420 ; error from occurring from the open, we temporarily suspend codepage
1421 ; support. It will be restored at the end of COMP.
1424 ; OUTPUT - CPSW_ORIG byte will have the CPSW bit set on if cpsw = on
1425 ;------------------------------------------------------------------------------
1426 init_cp proc near ;AN000;
1427 public init_cp ;AN000;
1429 doscall CPSW_CHECK,GET_CPSW_STATE ;AN000; ;IS CODEPAGE SUPPORT LOADED
1430 and dl,dl ;AC008; ;AN000;
1431 ; $if ne ;AN000; ;IF CPSW IS LOADED
1433 or cpsw_orig,CPSW ;AN000; ;SET FLAG TO INdiCATE CPSW=ON
1434 mov dl,CPSW_OFF ;AN000; ; TO CPSW=OFF
1435 doscall CPSW_CHECK,SET_CPSW_STATE ;AN000; ;SET CPSW=OFF
1436 ; $endif ;AN000; ;CPSW LOADED?
1438 ret ;AN000; ;retURN TO callER
1439 init_cp endp ;AN000;
1442 ;------------------------------------------------------------------------------
1443 ; RESTORE_CP - Restore chcp status (codepage support to original values)
1447 ;------------------------------------------------------------------------------
1448 restore_cp proc near ;AN000;
1449 public restore_cp ;AN000;
1451 test cpsw_orig,CPSW ;AN000; ;WAS CPSW ON WHEN WE STARTED?
1452 ; $if nz ;AN000; ;IF CPSW WAS ON
1454 mov dl,CPSW_ON ;AN000; ; TO CPSW=ON
1455 doscall CPSW_CHECK,SET_CPSW_STATE ;AN000; ;SET CPSW=ON
1456 ; $endif ;AN000; ;CPSW WAS ON?
1458 ret ;AN000; ;retURN TO callER
1459 restore_cp endp ;AN000;
1462 ;------------------------------------------------------------------------------
1463 ; COMP_CODEPAGE - If chcp=on, verify that the codepage of the two files agree.
1465 ; INPUT - PATH1 has the asciiz of the first path\filename
1466 ; PATH2 has the asciiz of the second path\filename
1468 ;------------------------------------------------------------------------------
1469 comp_codepage proc near ;AN000;
1470 public comp_codepage ;AN000;
1472 test cpsw_orig,CPSW ;AN000; ;WAS CPSW=ON WHEN WE STARTED?
1473 ; $if nz ;AN000; ;IF CPSW IS LOADED
1475 fill_name1 infcb ;AN000; ;get full path name
1476 mov cur_name,offset name1 ;AN000; ;PAss INPUTED FILENAME OF FIRST FILE
1477 call getcp ;AN000; ;GET CODEPAGE OF FIRST FILE
1478 mov ax,qlist_ea.ea_value ;AC001; ;SAVE ITS CODEPAGE
1479 push ax ;AN000; ;ON THE STACK
1480 fill_name2 ;AN000; ;get full path name
1481 mov cur_name,offset name2 ;AN000; ;PAss INPUTED FILENAME OF SECOND FILE
1482 call getcp ;AN000; ;GET CODEPAGE OF SECOND FILE
1483 pop ax ;AN000; ;GET FIRST FILE CODEPAGE
1484 mov bx,qlist_ea.ea_value ;AC001; ;GET SECOND FILE CODEPAGE
1485 and ax,ax ;AC008; ;AN000; ;COMPARE TO ZERO CP
1486 ; $if ne ;AN000; ;FIRST FILE HAS NON-ZERO CODE PAGE
1488 and bx,bx ;AC008; ;AN000; ;COMPARE TO ZERO CP
1489 ; $if ne ;AN000; ;SECOND FILE HAS NON-ZERO CODE PAGE
1491 cmp ax,bx ;AN000; ;COMPARE CP OF 1ST WITH CP OF 2ND
1492 ; $if e ;AN000; ;CP ARE ALIKE
1494 clc ;AN000; ;INdiCATE MATCHING CP
1495 ; $else ;AN000; ;siNCE CP ARE NOT ALIKE
1498 stc ;AN000; ;INdiCATE NON-MATCHING CP
1499 ; $endif ;AN000; ;CP ARE ALIKE
1501 ; $else ;AN000; ;siNCE 2ND HAS NO CODE PAGE
1504 stc ;AN000; ;INdiCATE NON-MATCHING CP
1505 ; $endif ;AN000; ;2ND FILE HAS CODE PAGE?
1507 ; $else ;AN000; ;siNCE 1ST FILE HAS NO CODE PAGE
1510 and bx,bx ;AC008; ;AN000; ;COMPARE TO ZERO CP
1511 ; $if ne ;AN000; ;2ND FILE HAS NO CODE PAGE
1513 stc ;AN000; ;INdiCATE NON-MATCHING CP
1514 ; $else ;AN000; ;siNCE 2ND FILE HAS NO CODE PAGE EITHER
1517 clc ;AN000; ;INdiCATE OK, NO CP TO COMPARE
1518 ; $endif ;AN000; ;2ND FILE HAS CP?
1520 ; $endif ;AN000; ;1ST FILE HAS CODE PAGE?
1522 ; $if c ;AN000; ;IF CARRY
1524 print_msg msgnum_cp_mismatch,STDERR ;AN000; ;"CODE PAGE MISMATCH
"
1525 stc ;AN000; ;PAss INdiCATOR OF NON-MATCH CP
1528 ; $else ;AN000; ;siNCE CODE PAGE NOT ACTIVE
1531 clc ;AN000; ;PAss INdiCTOR OF OK CP
1532 ; $endif ;AN000; ;CODEPAGE LOADED?
1534 ret ;AN000; ;retURN TO callER
1535 comp_codepage endp ;AN000;
1538 ;------------------------------------------------------------------------------
1539 ; GETCP - Does an extended open, gets codepage #, closes file.
1541 ; INPUT - AX = ptr to real filename to open
1542 ; CUR_NAME = ptr to inputed filename to open (display this if error)
1544 ;------------------------------------------------------------------------------
1545 getcp proc near ;AN000;
1546 public getcp ;AN000;
1548 ; SET UP INPUTS TO EXTENDED OPEN:
1549 ; REQUesT FUNCTIONS: READ,COMPATABILITY,NO INHERIT,INT 24H ret ERR,
1550 ; NO COMMIT, NO ATTR, FAIL IF NOT EXIST, OPEN IF EXIST
1551 ; NO CODE PAGE CHECK
1553 mov bx,OPEN_MODE ;AN000; ;SET READ MODE TO CORRECT VALUE FOR EXTENDED OPEN
1554 xor cx,cx ;AC008; ;AN000; ;NO ATTRIBUTE TO WORRY ABOUT (00H = NO_ATTR)
1555 mov dx,FUNC_CNTRL ;AN000; ;SET FUNCTION CONTROL FOR EXTENDED OPEN
1556 mov di,offset parm_list ;AN000; ;PAss offset TO PARM_LIST
1557 mov si,cur_name ;AN000; ;ptr to name of file to open
1558 doscall EXT_OPEN,EXT_OPEN_RD ;AN000;
1559 mov handle,ax ;AN000; ;SAVE HANDLE
1560 ; $if c ;AN000; ;IF ERROR
1562 call exterr ;AN000; ;GET EXTENDED ERROR, SHOW MSG
1563 ; $else ;AN000; ;siNCE NO ERROR ON OPEN
1566 ;AN000; ;GET_EXT_ATTR_LIST (5702), GET
1567 ;AN000; ;EXTENDED ATTR. TO LIST
1568 mov bx,handle ;AN000; ;bx=HANDLE
1569 mov di,offset qlist ;AC001; ;es:di=QLIST
1570 mov cx,13 ;AN001; ;size of QLIST returned
1571 mov si,offset querylist ;AN001; ;get code page attr. only
1572 doscall EXT_ATTR_LIST,GET_EXT_ATTR_LIST ;AN000;
1573 ;AN000; ;CY SET IF ERROR
1574 ; $if c ;AN000; ;IF ERROR
1576 call exterr ;AN000; ;GET EXTENDED ERROR, SHOW MSG
1579 mov bx,handle ;AN000; ;PAss HANDLE TO CLOSE FILE
1580 doscall HANDLECLOSE ;AN000; ;CLOSE THIS EXTENDED OPEN OF THE FILE
1583 ret ;AN000; ;retURN TO callER
1587 ;------------------------------------------------------------------------------
1588 ; EXTERR - Displays the extended error message and filename.
1592 ;------------------------------------------------------------------------------
1593 exterr proc near ;AN000;
1594 public exterr ;AN000;
1596 xor bx,bx ;AC008; ;AN000; ;bx = MINOR VERsiON # OF DOS
1597 doscall EXTERROR ;AN000; ;GET EXTENDED ERROR
1598 mov msgnum_exterr.msg_num,ax ;AN000; ;PUT EXT. ERROR # IN MSG DesCRIPTOR STRUCT.
1599 mov msgnum_exterr.msg_sublist,offset sublist_EXTERR ;AN000; ;ptr TO sublist
1600 mov msgnum_exterr.msg_count,NO_SUBS ;AN000; ;ONE sublist WILL BE USED.
1601 mov ax,cur_name ;AN000; ;GET CURRENT FILENAME
1602 mov sublist_exterr.sub_value,ax ;AN000; ;FILL IN offset OF FILENAME TEXT
1603 print_msg msgnum_exterr,STDERR ;AN000; ;dispLAY EXTENDED ERROR MEssAGE
1605 mov exitfl,EXVER ;AN000; ;INdiCATE AN ERROR
1610 ;------------------------------------------------------------------------------
1611 ; GET_DBCS_VECTOR - Get the DOS double byte character table segment and offset
1615 ;------------------------------------------------------------------------------
1616 bufferDB db 6 dup(0)
1618 get_dbcs_vector proc near ;AN006;
1626 mov ax,cs ;AN006; ;segment of return buffer
1628 mov di,offset bufferDB ;AN006; ;offset of return buffer
1629 mov ah,65h ;AN006; ;get extended country info
1630 mov al,07h ;AN006; ;get DBCS environment table
1631 mov bx,0ffffh ;AN006; ;use active code page
1632 mov cx,5 ;AN006; ;number of bytes returned
1633 mov dx,0ffffh ;AN006; ;default country ID
1634 int 21h ;AN006; ;DOS function call,vector returned
1636 inc di ;AN006; ;skip over id byte returned
1637 mov ax,word ptr es:[di] ;AN006; ;get offset of DBCS table
1638 mov cs:dbcs_off,ax ;AN006; ;save it
1640 add di,2 ;AN006; ;skip over offset to get segment
1641 mov bx,word ptr es:[di] ;AN006; ;get segment of DBCS table
1642 mov cs:dbcs_seg,bx ;AN006; ;save it
1644 mov di,ax ;AN006; ;Point to DBCS table to get length
1646 mov ax,word ptr es:[di] ;AN006;
1647 mov cs:dbcs_len,ax ;AN006;
1648 add cs:dbcs_off,2 ;AN006; ;change offset to point to table
1658 get_dbcs_vector endp ;AN006;
1661 ;------------------------------------------------------------------------------
1662 ; Check_DBCS_slash - given SI pointing to string, check if the character SI
1663 ; points to is a slash and that the preceeding character
1666 ; INPUT - SI = ptr to possible slash character
1667 ; STRING_SEG:STRING_OFF points to the beginning of string
1668 ; OUTPUT - set ZERO flag if [SI-1] != DBCS character AND [SI] == '\',
1669 ; else resets ZERO flag.
1670 ;------------------------------------------------------------------------------
1671 Check_DBCS_slash proc near ;AN006;
1679 cmp byte ptr [si],'\' ;AN006; ;Is character a slash ?
1680 jne reset_zero ;AN006; ;no, quit.
1683 mov cx,128 ;AN006; ;clear darray to zeroes
1684 mov di,offset dstring ;AN006; ;dstring will correspond to the string pointed to by
1685 mov al,00 ;AN006; ;string_seg:string_off and for each character in the string
1686 rep stosb ;AN006; ;that is DBCS a corresponding "D
" will be stored in dstring.
1687 ;AN006; ;example: string : [c:\\81\\81\ ]
1688 ; dstring: [ D D ] (there are two DBCS characters)
1690 sub si,string_off ;AN006; ;si will equal length of string from beginning to character that may be a slash.
1691 and si,si ;AC008; ;AN006; ;is character in first position ?
1692 jbe set_zero ;AN006; ;yes, quit.
1693 mov cx,si ;AN006; ;cx will contain the count of characters to check DBCS status of.
1694 push cx ;AN006; ;save for later
1695 mov si,string_off ;AN006; ;si points to beginning of string.
1697 mov bx,cs:dbcs_seg ;AN006; ;ES:SI -> DOS dbcs table (segment)
1700 mov bx,offset dstring ;AN006; ;bx points to dstring
1702 mov di,cs:dbcs_off ;AN006; ;ES:SI -> DOS dbcs table (offset)
1703 lodsb ;AN006; ;get character into al
1705 ; Two consecutive 00 bytes signifies end of table
1709 cmp word ptr es:[di],00h ;AN006; ;Check for two consecutive 00 bytes
1710 jne is_next1 ;AN006; ;no, continue
1711 jmp short DB_inc ;AC008; ;AN006; ;yes, found them, quit
1713 ; Check if byte is within range values of DOS dbcs table
1716 cmp al,byte ptr es:[di] ;AN006; ;is byte >= first byte in range?
1717 jae is_next2 ;AN006; ;yes, continue
1718 jmp short is_again ;AC008; ;AN006; ;no, loop again
1720 cmp al,byte ptr es:[di+1] ;AN006; ;is byte <= last byte in range?
1721 jbe is_found ;AN006; ;yes, found a lead byte of db char
1723 add di,2 ;AN006; ;no, increment ptr to next range
1726 mov byte ptr ds:[bx],'D' ;AN006; ;byte is lead byte of db char, set [BX] = 'D'
1727 inc bx ;AN006; ;skip over second part of double byte char.
1728 inc si ;AN006; ; " " " " " " " "
1732 and cx,cx ;AC008; ;AN006; ;are we done check characters for DBCS
1733 jne DB_loop ;AN006; ;no, check next character
1737 pop cx ;AN006; ;restore offset into string
1738 dec cx ;AN006; ;check character preceeding slah to see if it is DBCS
1739 mov si,offset dstring ;AN006; ;get beginning of string
1740 add si,cx ;AN006; ;si now point to char preceeding slash
1741 cmp byte ptr [si],'D' ;AN006; ;Is it DBCS ?
1742 je reset_zero ;AN006; ;yes
1744 cmp al,al ;AN006; ;set ZERO flag
1745 jmp short is_bye ;AC008; ;AN006;
1748 cmp bx,0ffh ;AN006; ;reset ZERO flag
1758 Check_DBCS_slash endp ;AN006;
1761 ;------------------------------------------------------------------------------
1762 ; SENDMSG - Transfer msg descriptor info to registers and call the msg retriever
1764 ; INPUT - DX = ptr to msg descriptor for this message
1765 ; OUTPUT - DX, AX altered, others ok.
1766 ;------------------------------------------------------------------------------
1767 sendmsg proc near ;AN000;
1768 public sendmsg ;AN000;
1770 push bx ;AN000; ;SAVE callER'S REGS
1774 mov di,dx ;AN000; ;PUT ptr TO MSG DesC. IN di
1775 mov dx,[di].msg_input ;AN000; ;GET ptr TO INPUT BUFFER AND PUT IN dx
1776 push dx ;AN000; ;SAVE IT ON THE STACK FOR LATER
1778 ; PAss PARMS TO MEssAGE HANDLER IN
1779 ; THE APPROPRIATE REGISTERS IT NEEds.
1780 mov ax,[di].msg_num ;AN000; ;MEssAGE NUMBER
1781 mov bx,[di].msg_handle ;AN000; ;HANDLE TO dispLAY TO
1782 mov si,[di].msg_sublist ;AN000; ;offset IN es: OF sublist, OR 0 IF NONE
1783 mov cx,[di].msg_count ;AN000; ;NUMBER OF %PARMS, 0 IF NONE
1784 mov dx,[di].msg_class ;AN000; ;CLAss IN HIGH byte, INPUT FUNCTION IN LOW
1785 pop di ;AN000; ;GET OLD dx VALUE (ptr TO INPUT BUFFER)
1786 call sysdispmsg ;AN000; ;dispLAY THE MEssAGE
1787 ; $if c ;AN000; ;IF THERE IS A PROBLEM
1789 ;AN000; ;ax=EXTENDED ERROR NUMBER
1790 mov bx,STDERR ;AN000; ;HANDLE TO dispLAY TO
1791 xor si,si ;AC008; ;AN000; ;offset IN es: OF sublist, OR 0 IF NONE
1792 xor cx,cx ;AC008; ;AN000; ;NUMBER OF %PARMS, 0 IF NONE
1793 mov dh,CLASS_1 ;AN000; ;CLAss IN HIGH byte, INPUT FUNCTION IN LOW
1794 call sysdispmsg ;AN000; ;TRY TO SAY WHAT HAPPENED
1795 stc ;AN000; ;REPORT PROBLEM
1796 ; $endif ;AN000; ;PROBLEM WITH dispLAY?
1799 pop di ;AN000; ;ResTORE callER'S REGISTERS
1805 sendmsg endp ;AN000;
1809 ;------FIND BOUNDARY--------------
1810 if ($-cseg) mod 16 ;AN000; ;IF NOT ALREADY ON 16 byte BOUNDARY
1811 org ($-cseg)+16-(($-cseg) mod 16) ;AN000; ;ADJUST TO 16 byte BOUNDARY
1813 ;---------------------------------
1816 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1817 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1818 ;;;;;;;ALL CODE BELOW THIS POINT WILL BE OVERLAID WITH DATA BEING COMPARED;;;;;;
1819 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1820 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1823 ;------------------------------------------------------------------------------
1824 ; SETFILL - sets the fill_seg, fill_off with the current seg_id, offset in
1829 ;------------------------------------------------------------------------------
1830 setfill proc near ;AN000;
1831 public setfill ;AN000;
1832 push ax ;AN000; ;save registers
1833 mov ax,cs ;AN000; ;get the code segment
1834 mov sublist_6.sub_value_seg,ax ;AN000; ;save seg_id in sublist
1835 mov sublist_7.sub_value_seg,ax ;AN000; ;save seg_id in sublist
1836 mov sublist_8.sub_value_seg,ax ;AN000; ;save seg_id in sublist
1837 mov sublist_11.sub_value_seg,ax ;AN000; ;save seg_id in sublist
1838 mov sublist_12.sub_value_seg,ax ;AN000; ;save seg_id in sublist
1839 mov sublist_13.sub_value_seg,ax ;AN000; ;save seg_id in sublist
1840 mov sublist_19a.sub_value_seg,ax ;AN000; ;save seg_id in sublist
1841 mov sublist_19b.sub_value_seg,ax ;AN000; ;save seg_id in sublist
1842 mov sublist_24.sub_value_seg,ax ;AN000; ;FILL IN CODE SEGMENT
1843 mov sublist_exterr.sub_value_seg,ax ;AN000; ;FILL IN CODE SEGMENT
1844 pop ax ;AN000; ; GET OLD VALUE IN ax BACK
1846 setfill endp ;AN000;
1849 ;------------------------------------------------------------------------------
1850 ; MORE_INIT - finishes the initialization. this code will be overlaid with data
1851 ; after it executes.
1855 ;------------------------------------------------------------------------------
1856 more_init proc near ;AC000;
1857 public more_init ;AN000;
1861 cmp ah,-1 ;was either drive specified invalid?
1862 ; $if e ;AC000; ;one or both of drives are invalid
1864 print_msg msgnum_baddrv,STDERR ;AN000; ;"INVALID DRIVE SPEC
."
1868 mov ax, offset buf+4096 ;end of pgm
1871 shr ax,cl ;in seg form
1874 add ax,dx ;seg addr of buf2
1876 mov dx,Memory_Size ;# paragraphs in machine
1877 cmp ax,dx ;does start of buf2 exceed mem?
1878 jnb badmem ;yes, can't do nothin' without mem
1879 sub dx,ax ;# avail paragraphs
1880 cmp dx,256 ;have at least 4k?
1883 print_msg msgnum_mem,STDERR ;AN000; ;"INSUFFICIENT MEMORY
"
1886 cmp dx,3840 ;over 61440 bytes avail?
1888 mov dx,3840 ;yes, set to max of 61440 bytes
1891 shl dx,cl ;# bytes avail
1892 and dx,0f000h ;round down to a 4096-byte boundary
1893 mov word ptr mem,dx ;and save buf2 size in bytes
1894 mov byte ptr swt,0 ;initialize master switch
1895 doscall DEFDRV ;AC000; ;get default drive
1897 mov curdrv,al ;and save
1898 or al,64 ;drive to ascii
1901 mov cl,Parm_Area ;length of input parms
1902 mov si,129 ;where parms are
1904 mov current_parm,si ;AN000; ;pass to parser ptr to input parm buffer
1905 mov ordinal,ZERO_PARM_CT ;AN000; ;pass ordinal #, this is begin of parse
1906 mov parm_count,FIRST_PARM_CT ;AN000; ;parse the first parm and second parm
1907 call parser ;AC000; ;returns first filename in path1, and the
1908 ;AN000; ;second filename in path2.
1909 ;fcb is already formatted with correct drive
1912 doscall PARSE_FILENAME,01H ;AC000; ;build 2nd fcb from 2nd parm,
1913 ;AC000; ;scan off leading separators
1914 cmp al,-1 ;invalid drive?
1915 ; $if e ;AC000; ;Yes, invalid drive
1917 print_msg msgnum_baddrv,STDERR ;AN000; ;"Invalid drive spec
."
1922 mov dx,offset CBExit
1923 doscall SETVECTOR,23H ;AC000; ;change control break vector, #23h
1927 ret ;AN000; ;return to main
1928 more_init endp ;AN000;