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

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / CMD / FORMAT / FORINIT.ASM
1
2 ;\ f
3
4
5 ;*****************************************************************************
6 ;*****************************************************************************
7 ;UTILITY NAME: FORMAT.COM
8 ;
9 ;MODULE NAME: FORINIT.SAL
10 ;
11 ;
12 ;
13 ; ÚÄÄÄÄÄÄÄÄÄÄÄ¿
14 ; ³ Main_Init ³
15 ; ÀÄÂÄÄÄÄÄÄÄÄÄÙ
16 ; ³
17 ; ³ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
18 ; ôInit_Input_OutputÃÄÄÄÄ´Preload_Messages³
19 ; ³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
20 ; ³ ³ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
21 ; ³ ôCheck_For_FS_SwitchÃÄÄ´Parse_For_FS_Switch³
22 ; ³ ³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
23 ; ³ ³ ³ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
24 ; ³ ³ À´EXEC_FS_Format³
25 ; ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
26 ; ³ ³ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
27 ; ³ À´Parse_Command_Line ÃÄÄÄ´Interpret_Parse³
28 ; ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
29 ; ³ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
30 ; ôValidate_Target_DriveôCheck_Target_Drive³
31 ; ³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
32 ; ³ ³ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
33 ; ³ ôCheck_For_Network³
34 ; ³ ³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
35 ; ³ ³ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
36 ; ³ À´Check_Translate_Drive³
37 ; ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
38 ; ³ÚÄÄÄÄÄÄÄÄÄÄÄÄ¿
39 ; À´Hook_CNTRL_C³
40 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÙ
41 ;
42 ;
43 ; Change List: AN000 - New code DOS 3.3 spec additions
44 ; AC000 - Changed code DOS 3.3 spec additions
45 ;*****************************************************************************
46 ;*****************************************************************************
47
48 data segment public para 'DATA'
49
50
51 Command_Line db NO
52 PSP_Segment dw 0
53
54 ;These should stay togather
55 ; --------------------------------------- ; ;AN000;
56 FS_String_Buffer db 13 dup(" ") ; ;AN000;
57 FS_String_End db "FMT.EXE",0 ; ;AN000;
58 Len_FS_String_End equ $ - FS_String_End ; ;AN000;
59 ; ;AN000;
60 ;----------------------------------------
61
62 Vol_Label_Count db 80h ;an000; dms;max. string length
63 Vol_Label_Len db 00h ;an000; dms;len. entered
64 Vol_Label_Buffer db 80h dup(0) ; ;AN000;
65 Vol_Label_Buffer_Length equ $ - Vol_Label_Buffer ; ;AN000;
66
67 Command_Line_Buffer db 80h dup(0) ; ;AN000;
68 Command_Line_Length equ $ - Command_Line_Buffer ; ;AN000;
69 Fatal_Error db 0 ; ;AN000;
70
71 Command_Old_Ptr dw ?
72
73 data ends
74
75 code segment public para 'CODE'
76 assume cs:code,ds:data,es:data
77 code ends
78
79 ;
80 ;*****************************************************************************
81 ; Include files
82 ;*****************************************************************************
83 ;
84
85 .xlist
86 INCLUDE FORCHNG.INC
87 INCLUDE FORMACRO.INC
88 INCLUDE SYSCALL.INC
89 INCLUDE IOCTL.INC
90 INCLUDE FOREQU.INC
91 INCLUDE FORPARSE.INC
92 INCLUDE FORSWTCH.INC
93 .list
94
95 ;
96 ;*****************************************************************************
97 ; Public Data
98 ;*****************************************************************************
99 ;
100
101 Public FS_String_Buffer
102 Public Command_Line
103 Public Fatal_Error
104 Public Vol_Label_Count
105 Public Vol_Label_Buffer
106 Public PSP_Segment
107 Public Command_Old_Ptr
108
109
110 ;
111 ;*****************************************************************************
112 ; Public Routines
113 ;*****************************************************************************
114 ;
115
116
117 Public Main_Init
118
119 ;
120 ;*****************************************************************************
121 ; External Routine Declarations
122 ;*****************************************************************************
123 ;
124
125 Extrn Main_Routine:Near
126 Extrn SysLoadMsg:Near
127 Extrn Get_11_Characters:Near
128 Extrn ControlC_Handler:Near
129 Extrn SysDispMsg:Near
130 Extrn SysLoadMsg:Near
131
132 IF FSExec ;/FS: conditional assembly ;an018; dms;
133
134 Extrn EXEC_FS_Format:Near
135
136 ENDIF ;/FS: conditional assembly end ;an018;dms;
137
138 Extrn GetDeviceParameters:Near
139 ;
140 ;*****************************************************************************
141 ; External Data Declarations
142 ;*****************************************************************************
143 ;
144
145 Extrn SwitchMap:Word
146 Extrn ExitStatus:Byte
147 Extrn Drive:Byte
148 Extrn DriveLetter:Byte
149 Extrn TranSrc:Byte
150 Extrn TrackCnt:Word
151 Extrn NumSectors:Word
152 Extrn BIOSFile:Byte
153 Extrn DOSFile:Byte
154 Extrn CommandFile:Byte
155 Extrn MsgNeedDrive:Byte
156 Extrn MsgBadVolumeID:Byte
157 Extrn MsgBadDrive:Byte
158 Extrn MsgAssignedDrive:Byte
159 Extrn MsgNetDrive:Byte
160 Extrn Parse_Error_Msg:Byte
161 Extrn Extended_Error_Msg:Byte
162 Extrn SizeMap:Byte
163 Extrn MsgSameSwitch:Byte
164 Extrn Org_AX:word ;an000; dms;AX on prog. entry
165 Extrn DeviceParameters:Byte ;an000; dms;
166 Extrn FAT_Flag:Byte ;an000; dms;
167 Extrn Sublist_MsgParse_Error:Dword ;an000; dms;
168
169
170 code segment public para 'CODE'
171
172 ;*****************************************************************************
173 ;Routine name: Main_Init
174 ;*****************************************************************************
175 ;
176 ;Description: Main control routine for init section
177 ;
178 ;Called Procedures: Message (macro)
179 ; Check_DOS_Version
180 ; Init_Input_Output
181 ; Validate_Target_Drive
182 ; Hook_CNTRL_C
183 ;
184 ;Input: None
185 ;
186 ;Output: None
187 ;
188 ;Change History: Created 5/1/87 MT
189 ;
190 ;Psuedocode
191 ; ---------
192 ;
193 ; Get PSP segment
194 ; Fatal_Error = NO
195 ; Setup I/O (CALL Init_Input_Output)
196 ; IF !Fatal_Error
197 ; Check target drive letter (CALL Validate_Target_Drive)
198 ; IF !Fatal_Error
199 ; Set up Control Break (CALL Hook_CNTRL_C)
200 ; IF !Fatal_Error
201 ; CALL Main_Routine
202 ; ENDIF
203 ; ENDIF
204 ; ENDIF
205 ; Exit program
206 ;*****************************************************************************
207
208 Procedure Main_Init ; ;AN000;
209
210
211 Set_Data_Segment ;Set DS,ES to Data segment ;AN000;
212 DOS_Call GetCurrentPSP ;Get PSP segment address
213 mov PSP_Segment,bx ;Save it for later
214 mov Fatal_Error,No ;Init the error flag ;AN000;
215 call Init_Input_Output ;Setup messages and parse ;AN000;
216 cmp Fatal_Error,Yes ;Error occur? ;AN000;
217 ; $IF NE ;Nope, keep going ;AN000;
218 JE $$IF1
219 call Validate_Target_Drive ;Check drive letter ;AN000;
220 cmp Fatal_Error,Yes ;Error occur? ;AN000;
221 ; $IF NE ;Nope, keep going ;AN000;
222 JE $$IF2
223 call Hook_CNTRL_C ;Set CNTRL -Break hook ;AN000;
224 cmp Fatal_Error,Yes ;Error occur? ;AN000;
225 ; $IF NE ;Nope, keep going ;AN000;
226 JE $$IF3
227 call Main_Routine ;Go do the real program ;AN000;
228 ; $ENDIF ; ;AN000;
229 $$IF3:
230 ; $ENDIF ; ;AN000;
231 $$IF2:
232 ; $ENDIF ; ;AN000;
233 $$IF1:
234 mov al,ExitStatus ;Get Errorlevel ;AN000;
235 DOS_Call Exit ;Exit program ;AN000;
236 int 20h ;If other exit fails ;AN000;
237
238 Main_Init endp ; ;AN000;
239
240 ;*****************************************************************************
241 ;Routine name: Init_Input_Output
242 ;*****************************************************************************
243 ;
244 ;Description: Initialize messages, Parse command line, allocate memory as
245 ; needed. If there is a /FS switch, go handle it first as
246 ; syntax of IFS format may be different from FAT format.
247 ;
248 ;Called Procedures: Preload_Messages
249 ; Parse_For_FS_Switch
250 ; Parse_Command_Line
251 ;
252 ;Change History: Created 4/1/87 MT
253 ;
254 ;Input: PSP command line at 81h and length at 80h
255 ; Fatal_Error = No
256 ;
257 ;Output: Fatal_Error = YES/NO
258 ;
259 ;Psuedocode
260 ;----------
261 ;
262 ; Load messages (CALL Preload_Messages)
263 ; IF !Fatal_Error
264 ; See if EXEC another file system (CALL Parse_For_FS_Switch)
265 ; IF !FATAL_Error (in this case means FS was found and exec'd)
266 ; CALL Parse_Command_Line
267 ; IF !Fatal_Error
268 ; CALL Interpret_Parse
269 ; ENDIF
270 ; ENDIF
271 ; ENDIF
272 ; ret
273 ;*****************************************************************************
274
275 Procedure Init_Input_Output ; ;AN000;
276
277 Set_Data_Segment ;Set DS,ES to Data segment ;AN000;
278 call Preload_Messages ;Load up message retriever ;AN000;
279
280 IF FSExec ;/FS: conditional assembly ;an018; dms;
281
282 cmp Fatal_Error,YES ;Quit? ;AN000;
283 ; $IF NE ;Nope, keep going ;AN000;
284 JE $$IF7
285 call Check_For_FS_Switch ;Specify FS other than FAT? ;AN000;
286
287 ENDIF ;/FS: conditional assembly end ;an018;dms;
288
289 cmp Fatal_Error,YES ;drive is invalid for format? ;an000;
290 ; $if ne ;no ;an000;
291 JE $$IF8
292 call Parse_Command_Line ;Parse in command line input ;AN000;
293 cmp Fatal_Error,YES ;Quit? ;AN000;
294 ; $IF NE ;Nope, keep going ;AN000;
295 JE $$IF9
296 call Determine_FAT_Non_FAT;see if drive was non_FAT ;an000;
297 call Check_For_Invalid_Drive;Drive joined? ;an000;
298 ; $ENDIF ; ;AN000;
299 $$IF9:
300 ; $ENDIF ; ;AN000;
301 $$IF8:
302
303 IF FSExec ;/FS: conditional assembly ;an018; dms;
304
305 ; $ENDIF ; ;an000;
306 $$IF7:
307
308 ENDIF ;/FS: conditional assembly end ;an018;dms;
309
310 ret ; ;AN000;
311
312 Init_Input_Output endp ; ;AN000;
313
314 ;*****************************************************************************
315 ;Routine name: Preload_Messages
316 ;*****************************************************************************
317 ;
318 ;Description: Preload messages using common message retriever routines.
319 ;
320 ;Called Procedures: SysLoadMsg
321 ;
322 ;
323 ;Change History: Created 5/1/87 MT
324 ;
325 ;Input: Fatal_Error = NO
326 ;
327 ;Output: Fatal_Error = YES/NO
328 ;
329 ;Psuedocode
330 ;----------
331 ;
332 ; Preload All messages (Call SysLoadMsg)
333 ; IF error
334 ; Display SysLoadMsg error message
335 ; Fatal_Error = YES
336 ; ENDIF
337 ; ret
338 ;*****************************************************************************
339
340 Procedure Preload_Messages ; ;AN000;
341 ;
342 Set_Data_Segment ;Set DS,ES to Data segment ;AN000;
343 call SysLoadMsg ;Preload the messages ;AN000;
344 ; $IF C ;Error? ;AN000;
345 JNC $$IF13
346 call SysDispMsg ;Display preload msg ;AN000;
347 mov Fatal_Error, YES ;Indicate error exit ;AN000;
348 ; $ENDIF ; ;AN000;
349 $$IF13:
350 ret ; ;AN000;
351
352 Preload_Messages endp ; ;AN000;
353
354
355
356
357 IF FSExec ;/FS: conditional assembly ;an018; dms;
358
359
360 ;*****************************************************************************
361 ;Routine name: Check_For_FS_Switch
362 ;*****************************************************************************
363 ;
364 ;Description: Parse to see if /FS switch entered, and if so, go EXEC the
365 ; asked for file system. Set Fatal_Error = YES if FS found
366 ; If we do find /FS, we need to build a string of xxxxxfmt.exe,0
367 ; where xxxxx is the first 5 characters or less of /FS:xxxxx
368 ;
369 ;Called Procedures: Parse_For_FS_Switch
370 ; EXEC_FS_Format
371 ;
372 ;Change History: Created 6/21/87 MT
373 ;
374 ;Input: Fatal_Error = NO
375 ;
376 ;Output: Fatal_Error = YES/NO
377 ; Exit_Status set
378 ;
379 ;Psuedocode
380 ;----------
381 ;
382 ; Parse for /FS switch (CALL Parse_For_FS_Switch)
383 ; IF !FATAL_ERROR
384 ; IF /FS found
385 ; Point at what was entered on /FS:xxxxx
386 ; DO
387 ; LEAVE end of entered string
388 ; Got good char, move into path
389 ; ENDDO already got 5 chars (max in xxxxxfmt.exe)
390 ; Tack on the rest of the string (fmt.exe,0)
391 ; Go exec the needed format (CALL EXEC_FS_Format)
392 ; ENDIF
393 ; ENDIF
394 ; ret
395 ;*****************************************************************************
396
397 Procedure Check_For_FS_Switch ; ;AN000;
398 ;AN000;
399 Set_Data_Segment ;Set DS,ES to Data segment ;AN000;
400 call Parse_For_FS_Switch ;See if /FS entered ;AN000;
401 cmp Fatal_Error,YES ;Bad stuff entered?? ;AN000;
402 ; $IF NE ;Nope, cruise onward ;AN000;
403 JE $$IF15
404 cmp Switch_String_Buffer.Switch_Pointer,offset Switch_FS_Control.Keyword ; ;AN000;
405 ; $IF E ;We got the switch ;AN000;
406 JNE $$IF16
407 mov Switch_FS_Control.Keyword,20h ;an000; dms;remove switch from table
408 test SwitchMap,Switch_FS ;Have this already? ;AN002;
409 ; $IF Z ;Nope ;AN002;
410 JNZ $$IF17
411 push ds ;Get addressibility ;AN000;
412 pop es ; " " " " ;AN000;
413 ;
414 assume ds:nothing,es:data ; ;AN000;
415 ;
416 mov ax,Switch_String_Buffer.Switch_String_Seg ;Get the entered FS ;AN000;
417 mov ds,ax ; ;AN000;
418 mov si,es:Switch_String_Buffer.Switch_String_Off ; ;AN000;
419 mov cx,FS_String_Max_Length ; ;AN000;
420 mov di,offset es:FS_String_Buffer ; ;AN000;
421 ; $DO ;Move whatever user entered ;AN000;
422 $$DO18:
423 cmp byte ptr [si],ASCIIZ_End ;End of the string? ;AN000;
424 ; $LEAVE E ;Yep ;AN000;
425 JE $$EN18
426 movsb ;Put character in buffer ;AN000;
427 dec cx ;Dec character counter
428 cmp cx,0 ;Nope, reached max # chars? ;AN000;
429 ; $ENDDO E ;Yes ;AN000;
430 JNE $$DO18
431 $$EN18:
432 Set_Data_Segment ;Set DS,ES to Data segment ;AN000;
433 mov cx,Len_FS_String_End ;Tack the FMT.EXE onto it ;AN000;
434 mov si,offset es:FS_String_End ;DI still points at string ;AN000;
435 rep movsb ;We now have Asciiz path! ;AN000;
436 call EXEC_FS_Format ;Go try to EXEC it..... ;AN000;
437 ; $ELSE ; ;AN002;
438 JMP SHORT $$EN17
439 $$IF17:
440 Message msgSameSwitch ; ;AN002;
441 mov Fatal_Error,Yes ; ;AN002;
442 ; $ENDIF ; ;AN002;
443 $$EN17:
444 ; $ENDIF ; ;AN000;
445 $$IF16:
446 ; $ENDIF ; ;AN000;
447 $$IF15:
448 ret ; ;AN000;
449
450 Check_For_FS_Switch endp ; ;AN000;
451
452 ;*****************************************************************************
453 ;Routine name: Parse_For_FS_Switch
454 ;*****************************************************************************
455 ;
456 ;Description: Copy the command line. Parse the new command line (Parse routines
457 ; destroy the data being parsed, so need to work on copy so that
458 ; complete command line can be passed to child format).
459 ; The only thing we care about is if the /FS: switch exists, so
460 ; parse until end of command line found. If there was an error,
461 ; and it occurred on the /FS switch, then give parse error,
462 ; otherwise ignore the parse error, because it might be something
463 ; file system specific that doesn't meet DOS syntax rules. Also
464 ; check for drive letter, as it is alway required.
465 ;
466 ;Called Procedures: Message (macro)
467 ; SysLoadMsg
468 ; Preload_Error
469 ; SysParse
470 ;
471 ;Change History: Created 5/1/87 MT
472 ;
473 ;Input: Command line at 80h in PSP
474 ; Fatal_Error = NO
475 ; PSP_Segment
476 ;
477 ;Output: Fatal_Error = YES/NO
478 ;
479 ;Psuedocode
480 ;----------
481 ; Copy command line to buffer
482 ; DO
483 ; Parse command line (Call SysParse)
484 ; LEAVE end of parse
485 ; ENDDO found /FS
486 ; IF drive letter not found (This assumes drive letter before switches)
487 ; Tell user
488 ; Fatal_Error = YES
489 ; ENDIF
490 ; ret
491 ;*****************************************************************************
492
493 Procedure Parse_For_FS_Switch ; ;AN000;
494 ;
495 Set_Data_Segment ;Set DS,ES to Data segment ;AN000;
496 mov Drive_Letter_Buffer.Drive_Number,Init ; ;AN000;
497 mov cx,PSP_Segment ;Get segment of PSP ;AN000;
498 mov ds,cx ; " " " " ;AN000;
499 assume ds:nothing ;
500 ;
501 mov si,Command_Line_Parms ;Point at command line ;AN000;
502 mov di,offset data:Command_Line_Buffer ;Where to put a copy of it ;AN000;
503 mov cx,Command_Line_Length ;How long was input? ;AN000;
504 repnz movsb ;Copy it ;AN000;
505 Set_Data_Segment ;Set DS,ES to Data segment ;AN000;
506 xor cx,cx ; ;AN000;
507 xor dx,dx ;Required for SysParse call ;AN000;
508 mov si,offset Command_Line_Buffer ;Pointer to parse line ;AN000;
509 mov di,offset Switch_FS_Table ;Pointer to control table ;AN000;
510 ; $DO ;Setup parse call ;AN000;
511 $$DO25:
512 call SysParse ;Go parse ;AN000;
513 cmp ax,End_Of_Parse ;Check for end of parse ;AN000;
514 ; $LEAVE E,OR ;Exit if it is end, or ;AN000;
515 JE $$EN25
516 cmp ax,Operand_Missing ; exit if positional missing ;AN000;
517 ; $LEAVE E ;In other words, no drive letter;AN000;
518 JE $$EN25
519 cmp Switch_String_Buffer.Switch_Pointer,offset Switch_FS_Control.Keyword ;AN000;
520 ; $ENDDO E ;Exit if we find /FS ;AN000;
521 JNE $$DO25
522 $$EN25:
523 cmp Drive_Letter_Buffer.Drive_Type,Type_Drive ;Check for drive letter found;AN000;
524 ; $IF NE ;Did we not find one? ;AN000;
525 JE $$IF28
526 MESSAGE msgNeedDrive ;Must enter drive letter ;AN000;
527 mov Fatal_Error,Yes ;Indicate error on exit ;AN000;
528 ; $ENDIF ; ;AN000;
529 $$IF28:
530 ret ; ;AN000;
531
532 Parse_For_FS_Switch endp ; ;AN000;
533
534
535 ENDIF ;/FS: conditional assembly end ;an018;dms;
536
537
538 ;*****************************************************************************
539 ;Routine name: Parse_Command_Line
540 ;*****************************************************************************
541 ;
542 ;Description: Parse the command line. Check for errors, and display error and
543 ; exit program if found. Use parse error messages except in case
544 ; of no parameters, which has its own message
545 ;
546 ;Called Procedures: Message (macro)
547 ; SysParse
548 ; Interpret_Parse
549 ;
550 ;Change History: Created 5/1/87 MT
551 ;
552 ;Input: Fatal_Error = NO
553 ; PSP_Segment
554 ;
555 ;Output: Fatal_Error = YES/NO
556 ;
557 ;
558 ;Psuedocode
559 ;----------
560 ;
561 ; Assume Fatal_Error = NO on entry
562 ; SEARCH
563 ; EXITIF Fatal_Error = YES,OR (This can be set by Interpret_Parse)
564 ; Parse command line (CALL SysParse)
565 ; EXITIF end of parsing command line
566 ; Figure out last thing parsed (Call Interpret_Parse)
567 ; ORELSE
568 ; See if parse error
569 ; LEAVE parse error,OR
570 ; See what was parsed (Call Interpret_Parse)
571 ; LEAVE if interpret error such as bad volume label
572 ; ENDLOOP
573 ; Display parse error message and print error operand
574 ; Fatal_Error = YES
575 ; ENDSRCH
576 ; ret
577 ;*****************************************************************************
578
579 Procedure Parse_Command_Line ; ;AN000;
580
581 Set_Data_Segment ;Set DS,ES to Data segment ;AN000;
582 push ds
583 mov cx,PSP_Segment ;Get segment of PSP ;AN000;
584 mov ds,cx ; " " " " ;AN000;
585
586 assume ds:nothing,es:data
587
588 xor cx,cx ;Parse table @DI ;AN000;
589 xor dx,dx ;Parse line @SI ;AN000;
590 mov si,Command_Line_Parms ;Pointer to parse line ;AN000;
591 mov word ptr es:Command_Old_Ptr,si
592 mov di,offset es:Command_Line_Table ;Pointer to control table ;AN000;
593 ; $SEARCH ;Loop until all parsed ;AN000;
594 $$DO30:
595 cmp es:Fatal_Error,Yes ;Interpret something bad? ;AN000;
596 ; $EXITIF E,OR ;If so, don't parse any more ;AN000;
597 JE $$LL31
598 call SysParse ;Go parse ;AN000;
599 cmp ax,End_Of_Parse ;Check for end of parse ;AN000;
600 ; $EXITIF E ;Is it? ;AN000;
601 JNE $$IF30
602 $$LL31:
603 ;All done ;AN000;
604 ; $ORELSE ;Not end ;AN000;
605 JMP SHORT $$SR30
606 $$IF30:
607 cmp ax,0 ;Check for parse error ;AN000;
608 ; $LEAVE NE ;Stop if there was one ;AN000;
609 JNE $$EN30
610 mov word ptr es:Command_Old_Ptr,si
611 call Interpret_Parse ;Go find what we parsed ;AN000;
612 ; $ENDLOOP ;Parse error, see what it was ;AN000;
613 JMP SHORT $$DO30
614 $$EN30:
615 mov byte ptr ds:[si],0
616 push di
617 push ax
618 mov di,offset es:Sublist_MsgParse_Error
619 mov ax,word ptr es:Command_Old_Ptr
620 mov word ptr es:[di+2],ax
621 mov word ptr es:[di+4],ds
622 pop ax
623 pop di
624 PARSE_MESSAGE ;Display parse error ;AN000;
625 mov es:Fatal_Error,YES ;Indicate death! ;AN000;
626 ; $ENDSRCH ; ;AN000;
627 $$SR30:
628 pop ds ; ;AN000;
629 ret ; ;AN000;
630
631 Parse_Command_Line endp ; ;AN000;
632
633 ;*****************************************************************************
634 ;Routine name: Interpret_Parse
635 ;*****************************************************************************
636 ;
637 ;Description: Set the SwitchMap field with the switches found on the
638 ; command line. Get the drive letter. /FS will be handled before
639 ; here, will not be seen in this parse or accepted. Also, if /V
640 ; see if volume label entered and verify it is good, setting up
641 ; FCB for later create
642 ;
643 ;Called Procedures: Get_11_Characters
644 ;
645 ;Change History: Created 5/1/87 MT
646 ;
647 ;Input: Fatal_Error = NO
648 ;
649 ;Output: SwitchMap set
650 ; DriveLetter set
651 ; DriveNum set A=0,B=1 etc...
652 ; Command_Line = YES/NO
653 ; Fatal_Error = YES/NO
654 ;
655 ;Psuedocode
656 ;----------
657 ;
658 ; IF Drive letter parsed
659 ; Drive = Parsed drive number -1
660 ; DriveLetter = (Parsed drive number - 1) +'A'
661 ; ENDIF
662 ; IF /1
663 ; or SwitchMap,Switch_1
664 ; ENDIF
665 ; IF /4
666 ; or SwitchMap,Switch_4
667 ; ENDIF
668 ; IF /8
669 ; or SwitchMap,Switch_8
670 ; ENDIF
671 ; IF /S
672 ; or SwitchMap,Switch_S
673 ; ENDIF
674 ; IF /BACKUP
675 ; or SwitchMap,Switch_BACKUP
676 ; ENDIF
677 ; IF /B
678 ; or SwitchMap,Switch_B
679 ; ENDIF
680 ; IF /T
681 ; or SwitchMap,Switch_T
682 ; TrackCnt = entered value
683 ; ENDIF
684 ; IF /N
685 ; or SwitchMap,Switch_N
686 ; NumSectors = entered value
687 ; ENDIF
688 ; IF /SELECT
689 ; or SwitchMap,Switch_SELECT
690 ; ENDIF
691 ; IF /V
692 ; or SwitchMap,Switch_V
693 ; IF string entered
694 ; Build ASCIIZ string for next call (CALL Build_String)
695 ; Verify DBCS and setup FCB (CALL Get_11_Characters)
696 ; Command_Line = YES
697 ; IF error
698 ; Invalid label message
699 ; Fatal_Error = YES
700 ; ENDIF
701 ; ENDIF
702 ; ENDIF
703 ; IF /AUTOTEST
704 ; or SwitchMap,Switch_AUTOTEST
705 ; ENDIF
706 ;
707 ; IF /F
708 ; or SwitchMap,Switch_F
709 ; or Size_Map,Item_Tag
710 ; ENDIF
711 ; IF /Z (only if assembled)
712 ; or SwitchMap,Switch_Z
713 ; ENDIF
714 ; ret
715 ;*****************************************************************************
716
717 Procedure Interpret_Parse ; ;AN000;
718
719 push ds ;Save segment ;AN000;
720 push si ;Restore SI for parser ;AN000;
721 push cx ; ;AN000;
722 push di ;
723 Set_Data_Segment ;Set DS,ES to Data segment ;AN000;
724 cmp byte ptr Drive_Letter_Buffer.Drive_Type,Type_Drive ;Have drive letter? ;AN000;
725 ; $IF E ;Yes, save info ;AN000;
726 JNE $$IF36
727 mov al,Drive_Letter_Buffer.Drive_Number ;Get drive entered ;AN000;
728 dec al ;Make it 0 based ;AN000;
729 mov Drive,al ; " " " " ;AN000;
730 add al,'A' ;Make it a drive letter ;AN000;
731 mov DriveLetter,al ;Save it ;AN000;
732 ; $ENDIF ; ;AN000;
733 $$IF36:
734 cmp Switch_Buffer.Switch_Pointer,offset Switch_1_Control.Keyword ;;AN000;
735 ; $IF E ; ;AN000;
736 JNE $$IF38
737 mov Switch_1_Control.Keyword,20h ;an000; dms;remove switch from table
738 or SwitchMap,Switch_1 ; ;AN000;
739 ; $ENDIF ; ;AN000;
740 $$IF38:
741 cmp Switch_Buffer.Switch_Pointer,offset Switch_4_Control.Keyword ;;AN000;
742 ; $IF E ; ;AN000;
743 JNE $$IF40
744 mov Switch_4_Control.Keyword,20h ;an000; dms;remove switch from table
745 or SwitchMap,Switch_4 ; ;AN000;
746 ; $ENDIF ; ;AN000;
747 $$IF40:
748 cmp Switch_Buffer.Switch_Pointer,offset Switch_8_Control.Keyword ;;AN000;
749 ; $IF E ; ;AN000;
750 JNE $$IF42
751 mov Switch_8_Control.Keyword,20h ;an000; dms;remove switch from table
752 or SwitchMap,Switch_8 ; ;AN000;
753 ; $ENDIF ; ;AN000;
754 $$IF42:
755 cmp Switch_Buffer.Switch_Pointer,offset Switch_S_Control.Keyword ;;AN000;
756 ; $IF E ; ;AN000;
757 JNE $$IF44
758 mov Switch_S_Control.Keyword,20h ;an000; dms;remove switch from table
759 or SwitchMap,Switch_S ; ;AN000;
760 ; $ENDIF ; ;AN000;
761 $$IF44:
762 cmp Switch_Buffer.Switch_Pointer,offset Switch_Backup_Control.Keyword ;AN000;
763 ; $IF E ; ;AN000;
764 JNE $$IF46
765 mov Switch_Backup_Control.Keyword,20h ;an000; dms;remove switch from table
766 or SwitchMap,Switch_Backup ; ;AN000;
767 ; $ENDIF ; ;AN000;
768 $$IF46:
769 cmp Switch_Buffer.Switch_Pointer,offset Switch_Select_Control.Keyword ;AN000;
770 ; $IF E ; ;AN000;
771 JNE $$IF48
772 mov Switch_Select_Control.Keyword,20h ;an000; dms;remove switch from table
773 or SwitchMap,Switch_Select ; ;AN000;
774 ; $ENDIF ; ;AN000;
775 $$IF48:
776 cmp Switch_Buffer.Switch_Pointer,offset Switch_B_Control.Keyword ;AN000;
777 ; $IF E ; ;AN000;
778 JNE $$IF50
779 mov Switch_B_Control.Keyword,20H
780 or SwitchMap,Switch_B ; ;AN000;
781 ; $ENDIF ; ;AN000;
782 $$IF50:
783 cmp Switch_Num_Buffer.Switch_Num_Pointer,offset es:Switch_T_Control.Keyword ;AN000;
784 ; $IF E ; ;AN000;
785 JNE $$IF52
786 mov Switch_T_Control.Keyword,20h ;an000; dms;remove switch from table
787 mov Switch_Num_Buffer.Switch_Num_Pointer,0 ;Init for next switch ;AN008;
788 test SwitchMap,Switch_T ;Don't allow if switch already ;AN002;
789 ; $IF Z ; entered ;AN002;
790 JNZ $$IF53
791 or SwitchMap,Switch_T ; ;AN000;
792 mov ax,Switch_Num_Buffer.Switch_Number_Low ;Get entered tracks ;AN000;
793 mov TrackCnt,ax ;1024 or less, so always dw ;AN000;
794 ; $ELSE ; ;AN002;
795 JMP SHORT $$EN53
796 $$IF53:
797 Message msgSameSwitch ; ;AN002;
798 mov Fatal_Error,Yes ; ;AN002;
799 ; $ENDIF ; ;AN000;
800 $$EN53:
801 ; $ENDIF ; ;AN002;
802 $$IF52:
803 cmp Switch_Num_Buffer.Switch_Num_Pointer,offset Switch_N_Control.Keyword ;AN000;
804 ; $IF E ; ;AN000;
805 JNE $$IF57
806 mov Switch_N_Control.Keyword,20h ;an000; dms;remove switch from table
807 mov Switch_Num_Buffer.Switch_Num_Pointer,0 ;Init for next switch ;AN008;
808 test SwitchMap,Switch_N ;Make sure switch not already ;AN002;
809 ; $IF Z ; entered ;AN002;
810 JNZ $$IF58
811 or SwitchMap,Switch_N ; ;AN000;
812 mov ax,Switch_Num_Buffer.Switch_Number_Low ;Get entered tracks ;AN000;
813 xor ah,ah ;clear high byte ;an000;
814 mov NumSectors,ax ;Save tracks per sector ;AN000;
815 ; $ELSE ; ;AN002;
816 JMP SHORT $$EN58
817 $$IF58:
818 Message msgSameSwitch ; ;AN002;
819 mov Fatal_Error,Yes ; ;AN002;
820 ; $ENDIF ; ;AN000;
821 $$EN58:
822 ; $ENDIF ; ;AN002;
823 $$IF57:
824 cmp Switch_String_Buffer.Switch_String_Pointer,offset Switch_V_Control.Keyword ;AN000;
825 ; $IF E ;If /v and haven't already done ;AN000;
826 JNE $$IF62
827 mov Switch_String_Buffer.Switch_String_Pointer,0 ;Init for next switch ;AN008;
828 mov Switch_V_Control.Keyword,20h ;an000; dms;remove switch from table
829 test SwitchMap,Switch_V ; it - Only allow one /V entry ;AN002;
830 ; $IF Z ; ;AN002;
831 JNZ $$IF63
832 or SwitchMap,Switch_V ;Set /v indicator ;AN000;
833 mov si,Switch_String_Buffer.Switch_String_Seg ;Get string address ;;AN000;
834 mov ds,si ; ;AN000;
835
836 assume ds:nothing
837
838 mov si,es:Switch_String_Buffer.Switch_String_Off ; ;AN000;
839 cmp byte ptr ds:[si],None ;Is there a string there? ;AN000;
840 ; $IF NE ;Yep ;AN000;
841 JE $$IF64
842 cld ; ;AN000;
843 mov di,offset es:Vol_Label_Buffer ;Point at buffer to move string;AN000;
844 mov cx,Label_Length+1 ;Max length of string ;AN000;
845 rep movsb ;This will copy string & always ;AN000;
846 ; leave ASCIIZ end in buffer, ; ;
847 ; which is init'd to 13 dup(0) ; ;
848 mov si,offset es:Vol_Label_Buffer ;Point at string ;AN000;
849 Set_Data_Segment ;Set DS,ES to Data segment ;AN000;
850 mov Command_Line,YES ;Set flag indicating vol label ;AN000;
851 call Get_11_Characters ;Check DBCS and build FCB ;AN000;
852 ; $IF C ;Bad DBCS setup ;AN000;
853 JNC $$IF65
854 Message msgBadVolumeID ;Tell user ;AN000;
855 mov es:Fatal_Error,YES ;Indicate time to quit ;AN000;
856 ; $ENDIF ; ;AN000;
857 $$IF65:
858 ; $ENDIF ; ;AN000;
859 $$IF64:
860 ; $ELSE ; ;AN002;
861 JMP SHORT $$EN63
862 $$IF63:
863 Message msgSameSwitch ; ;AN002;
864 mov Fatal_Error,Yes ; ;AN002;
865 ; $ENDIF ; ;AN002;
866 $$EN63:
867 ; $ENDIF ; ;AN000;
868 $$IF62:
869 cmp Switch_Buffer.Switch_Pointer,offset Switch_Autotest_Control.Keyword ;AN000;
870 ; $IF E ; ;AN000;
871 JNE $$IF71
872 mov Switch_Autotest_Control.Keyword,20h ;an000; dms;remove switch from table
873 or SwitchMap,Switch_Autotest ; ;AN000;
874 ; $ENDIF ; ;AN000;
875 $$IF71:
876
877 IF ShipDisk
878
879 cmp Switch_Buffer.Switch_Pointer,offset Switch_Z_Control.Keyword ;an000; dms;/Z switch?
880 ; $IF E ; ;an000; dms;yes
881 JNE $$IF73
882 mov Switch_Z_Control.Keyword,20h ;an000; dms;remove switch from table
883 or SwitchMap,Switch_Z ; ;an000; dms;signal switch found
884 ; $ENDIF ; ;an000; dms;
885 $$IF73:
886
887 ENDIF
888
889 cmp Switch_String_Buffer.Switch_Pointer,offset Switch_F_Control.Keyword ; ;AN000;
890 ; $IF E ; ;AN000;
891 JNE $$IF75
892 mov Switch_F_Control.Keyword,20h ;an000; dms;remove switch from table
893 mov Switch_String_Buffer.Switch_Pointer,0 ;an000; dms; clear out ptr for next iteration
894 mov Switch_Num_Buffer.Switch_Num_Pointer,0 ;Init for next switch ;AN008;
895 test SwitchMap,Switch_F ; it - do this because SysParse ;AN002;
896 ; $IF Z ; reuses string buffer each time;AN002;
897 JNZ $$IF76
898 or SwitchMap,Switch_F ; ;AN000;
899 mov al,Switch_String_Buffer.Switch_String_Item_Tag ; Indicate what size;AN000;
900 or SizeMap,al ; ;AN000;
901 ; $ELSE ; ;AN002;
902 JMP SHORT $$EN76
903 $$IF76:
904 Message msgSameSwitch ; ;AN002;
905 mov Fatal_Error,Yes ; ;AN002;
906 ; $ENDIF ; ;AN002;
907 $$EN76:
908 ; $ENDIF ; ;AN000;
909 $$IF75:
910 pop di ;Restore parse regs ;AN000;
911 pop cx ; ;AN000;
912 pop si ; ;AN000;
913 pop ds ; ;AN000;
914 ret ; ;AN000;
915
916 Interpret_Parse endp ; ;AN000;
917
918
919
920 ;*****************************************************************************
921 ;Routine name: Validate_Target_Drive
922 ;*****************************************************************************
923 ;
924 ;Description: Control routine for validating the specified format target drive.
925 ; If any of the called routines find an error, they will print
926 ; message and terminate program, without returning to this routine
927 ;
928 ;Called Procedures: Check_Target_Drive
929 ; Check_For_Network
930 ; Check_Translate_Drive
931 ;
932 ;Change History: Created 5/1/87 MT
933 ;
934 ;Input: Fatal_Error = NO
935 ;
936 ;Output: Fatal_Error = YES/NO
937 ;
938 ;Psuedocode
939 ;----------
940 ;
941 ; CALL Check_Target_Drive
942 ; IF !Fatal_Error
943 ; CALL Check_For_Network
944 ; IF !Fatal_Error
945 ; CALL Check_Translate_Drive
946 ; ENDIF
947 ; ENDIF
948 ; ret
949 ;*****************************************************************************
950
951 Procedure Validate_Target_Drive ; ;AN000;
952 ;
953 call Check_Target_Drive ;See if valid drive letter ;AN000;
954 cmp Fatal_Error,YES ;Can we continue? ;AN000;
955 ; $IF NE ;Yep ;AN000;
956 JE $$IF80
957 call Check_For_Network ;See if Network drive letter ;AN000;
958 cmp Fatal_Error,YES ;Can we continue? ;AN000;
959 ; $IF NE ;Yep ;AN000;
960 JE $$IF81
961 call Check_Translate_Drive ;See if Subst, Assigned ;AN000;
962 ; $ENDIF ;- Fatal_Error passed back ;AN000;
963 $$IF81:
964 ; $ENDIF ; ;AN000;
965 $$IF80:
966 ret ; ;AN000;
967
968 Validate_Target_Drive endp ; ;AN000;
969
970 ;*****************************************************************************
971 ;Routine name: Check_Target_Drive
972 ;*****************************************************************************
973 ;
974 ;Description: Check to see if valid DOS drive by checking if drive is
975 ; removable. If error, the drive is invalid. Save default
976 ; drive info.
977 ;
978 ;Called Procedures: Message (macro)
979 ;
980 ;Change History: Created 5/1/87 MT
981 ;
982 ;Input: Fatal_Error = NO
983 ;
984 ;Output: BIOSFile = default drive letter
985 ; DOSFile = default drive letter
986 ; CommandFile = default drive letter
987 ; Fatal_Error = YES/NO
988 ;
989 ;Psuedocode
990 ;----------
991 ;
992 ; Get default drive (INT 21h, AH = 19h)
993 ; Convert it to drive letter
994 ; Save into BIOSFile,DOSFile,CommandFile
995 ; See if drive removable (INT 21h, AX=4409h IOCtl)
996 ; IF error - drive invalid
997 ; Display Invalid drive message
998 ; Fatal_Error= YES
999 ; ENDIF
1000 ; ret
1001 ;*****************************************************************************
1002
1003 Procedure Check_Target_Drive ; ;AN000;
1004 ;
1005 DOS_Call Get_Default_Drive ;Find the current drive ;AC000;
1006 add al,'A' ;Convert to drive letter ; ;
1007 mov BIOSFile,al ;Put it into path strings ; ;
1008 mov DOSFile,al ; " " " " ; ;
1009 mov CommandFile,al ; " " " " ; ;
1010 mov bl,Drive ;Set up for next call ;AN000;
1011 inc bl ;A=1,B=2 for IOCtl call ;AN000;
1012 mov al,09h ;See if drive is local ;AC000;
1013 DOS_Call IOCtl ;-this will fail if bad drive ;AC000;
1014 ; $IF C ;CY means invalid drive ;AC000;
1015 JNC $$IF84
1016 Extended_Message ;Print message ;AC000;
1017 mov Fatal_Error,Yes ;Indicate error ;AN000;
1018 ; $ENDIF ; ;AN000;
1019 $$IF84:
1020 ret ;And we're outa here ;AN000;
1021
1022 Check_Target_Drive endp ; ;AN000;
1023
1024 ;*****************************************************************************
1025 ;Routine name: Check_For_Network
1026 ;*****************************************************************************
1027 ;
1028 ;Description: See if target drive isn't local, or if it is a shared drive. If
1029 ; so, exit with error message. The IOCtl call is not checked for
1030 ; an error because it is called previously in another routine, and
1031 ; invalid drive is the only error it can generate. That condition
1032 ; would not get this far
1033 ;
1034 ;Called Procedures: Message (macro)
1035 ;
1036 ;Change History: Created 5/1/87 MT
1037 ;
1038 ;Input: Drive
1039 ; Fatal_Error = NO
1040 ;
1041 ;Output: Fatal_Error = YES/NO
1042 ;
1043 ;Psuedocode
1044 ;----------
1045 ; See if drive is local (INT 21h, AX=4409 IOCtl)
1046 ; IF not local
1047 ; Display network message
1048 ; Fatal_ERROR = YES
1049 ; ELSE
1050 ; IF 8000h bit set on return
1051 ; Display assign message
1052 ; Fatal_Error = YES
1053 ; ENDIF
1054 ; ENDIF
1055 ; ret
1056 ;*****************************************************************************
1057
1058 Procedure Check_For_Network ; ;AN000;
1059 ;
1060 mov bl,Drive ;Drive is 0=A, 1=B ; ;
1061 inc bl ;Get 1=A, 2=B for IOCtl call ; ;
1062 mov al,09h ;See if drive is local or remote;AC000;
1063 DOS_CALL IOCtl ;We will not check for error ;AC000;
1064 test dx,Net_Check ;if (x & 1200H)(redir or shared); ;
1065 ; $IF NZ ;Found a net drive ;AC000;
1066 JZ $$IF86
1067 Message MsgNetDrive ;Tell 'em ;AC000;
1068 mov Fatal_Error,Yes ;Indicate bad stuff ;AN000;
1069 ; $ELSE ;Local drive, now check assign ;AN000;
1070 JMP SHORT $$EN86
1071 $$IF86:
1072 test dx,Assign_Check ;8000h bit is bad news ; ;
1073 ; $IF NZ ;Found it ;AC000;
1074 JZ $$IF88
1075 Message MsgAssignedDrive ;Tell error ;AC000;
1076 mov Fatal_Error,Yes ;Indicate bad stuff ;AN000;
1077 ; $ENDIF ; ;AN000;
1078 $$IF88:
1079 ; $ENDIF ; ;AN000;
1080 $$EN86:
1081 ret ; ;AN000;
1082
1083 Check_For_Network endp ; ;AN000;
1084
1085 ;*****************************************************************************
1086 ;Routine name: Check_Translate_Drive
1087 ;*****************************************************************************
1088 ;
1089 ;Description: Do a name translate call on the drive letter to see if it is
1090 ; assigned by SUBST or ASSIGN
1091 ;
1092 ;Called Procedures: Message (macro)
1093 ;
1094 ;Change History: Created 5/1/87 MT
1095 ;
1096 ;Input: Drive
1097 ; Fatal_Error = NO
1098 ;
1099 ;Output: Fatal_Error = YES/NO
1100 ;
1101 ;Psuedocode
1102 ;----------
1103 ; Put drive letter in ASCIIZ string "d:\",0
1104 ; Do name translate call (INT 21)
1105 ; IF drive not same
1106 ; Display assigned message
1107 ; Fatal_Error = YES
1108 ; ENDIF
1109 ; ret
1110 ;*****************************************************************************
1111
1112 Procedure Check_Translate_Drive ; ;AN000;
1113 ;
1114 mov bl,Drive ;Get drive ; ;
1115 add byte ptr [TranSrc],bl ;Make string "d:\" ; ;
1116 mov si,offset TranSrc ;Point to translate string ; ;
1117 push ds ;Set ES=DS (Data segment) ; ;
1118 pop es ; " " " " ; ;
1119 mov di,offset Command_Line_Buffer ;Point at output buffer ; ;
1120 DOS_Call xNameTrans ;Get real path ;AC000;
1121 mov bl,byte ptr [TranSrc] ;Get drive letter from path ; ;
1122 cmp bl,byte ptr Command_Line_Buffer ;Did drive letter change? ; ;
1123 ; $IF NE ;If not the same, it be bad ;AC000;
1124 JE $$IF91
1125 Message MsgAssignedDrive ;Tell user ;AC000;
1126 mov Fatal_Error,Yes ;Setup error flag ;AN000;
1127 ; $ENDIF ; ;AN000;
1128 $$IF91:
1129 ret ; ;AN000;
1130
1131 Check_Translate_Drive endp ; ;AN000;
1132
1133 ;*****************************************************************************
1134 ;Routine name: Hook_CNTRL_C
1135 ;*****************************************************************************
1136 ;
1137 ;Description: Change the interrupt handler for INT 13h to point to the
1138 ; ControlC_Handler routine
1139 ;
1140 ;Called Procedures: None
1141 ;
1142 ;Change History: Created 4/21/87 MT
1143 ;
1144 ;Input: None
1145 ;
1146 ;Output: None
1147 ;
1148 ;Psuedocode
1149 ;----------
1150 ;
1151 ; Point at ControlC_Handler routine
1152 ; Set interrupt handler (INT 21h, AX=2523h)
1153 ; ret
1154 ;*****************************************************************************
1155
1156 Procedure Hook_CNTRL_C ; ;AN000;
1157 ;
1158 mov al,23H ;Specify CNTRL handler ; ;
1159 mov dx, offset ControlC_Handler ;Point at it ; ;
1160 push ds ;Save data seg ; ;
1161 push cs ;Point to code segment ; ;
1162 pop ds ; ; ;
1163 DOS_Call Set_Interrupt_Vector ;Set the INT 23h handler ;AC000;
1164 pop ds ;Get Data degment back ; ;
1165 ret ; ;AN000;
1166
1167 Hook_CNTRL_C endp ; ;AN000;
1168
1169 ;=========================================================================
1170 ; Check_For_Invalid_Drive : This routine checks the AX received by
1171 ; FORMAT on its entry. This value will
1172 ; tell us if we are attempting to format
1173 ; a JOINED drive.
1174 ;
1175 ; Inputs : Org_AX - AX on entry to FORMAT
1176 ;
1177 ; Outputs : Fatal_Error - Yes if AL contained FFh
1178 ;=========================================================================
1179
1180 Procedure Check_For_Invalid_Drive ;an000; dms;
1181
1182 push ax ;an000; dms;save ax
1183 cmp FAT_Flag,Yes ;an000; dms;FAT system?
1184 ; $if e ;an000; dms;yes
1185 JNE $$IF93
1186 mov ax,Org_AX ;an000; dms;get its org. value
1187 cmp al,0ffh ;an000; dms;Invalid drive?
1188 ; $if e ;an000; dms;yes
1189 JNE $$IF94
1190 mov Fatal_Error,YES ;an000; dms;flag an error
1191 mov ax,Invalid_Drive;an000; dms;error message
1192 Extended_Message ;an000; dms;tell error
1193 ; $endif ;an000; dms;
1194 $$IF94:
1195 ; $endif ;an000; dms;
1196 $$IF93:
1197 pop ax ;an000; dms;
1198 ret ;an000; dms;
1199
1200 Check_For_Invalid_Drive endp ;an000; dms;
1201
1202
1203 ;=========================================================================
1204 ; Determine_FAT_Non_FAT - This routine determines whether or
1205 ; not a device is formatted to a FAT
1206 ; specification versus a Non-FAT
1207 ; specification.
1208 ;
1209 ; Inputs : DX - Pointer to device parameters buffer
1210 ;
1211 ; Outputs : DeviceParameters - buffer containing BPB.
1212 ;
1213 ; Date : 11/6/87
1214 ;=========================================================================
1215
1216 Procedure Determine_FAT_Non_FAT ;an012; dms;
1217
1218 push ax ;an012; dms;save regs
1219 push dx ;an012; dms;
1220
1221 lea dx, deviceParameters ;an012; dms;point to buffer
1222 mov deviceParameters.DP_SpecialFunctions, 0 ;an012; dms;get default BPB
1223 call GetDeviceParameters ;an012; dms;make the call
1224 ; $if nc ;an012; dms;no error occurred
1225 JC $$IF97
1226 cmp byte ptr DeviceParameters.DP_BPB.BPB_NumberOfFATS,00h ;an012; dms;non-FAT system?
1227 ; $if e ;an012; dms;yes
1228 JNE $$IF98
1229 mov FAT_Flag,No ;an012; dms;signal system non-FAT
1230 mov ax,5f07h ;an012; dms;allow access to disk
1231 mov dl,Drive ;an012; dms;get 0 based driver number
1232 int 21h ;an012; dms;allow access to the drive
1233 ; $else ;an012; dms;FAT system
1234 JMP SHORT $$EN98
1235 $$IF98:
1236 mov FAT_Flag,Yes ;an012; dms;flag FAT system
1237 ; $endif ;an012; dms;
1238 $$EN98:
1239 ; $endif ;an012; dms;
1240 $$IF97:
1241
1242 pop dx ;an012; dms;restore regs
1243 pop ax ;an012; dms;
1244
1245 ret ;an012; dms;
1246
1247 Determine_FAT_Non_FAT endp ;an012; dms;
1248
1249
1250
1251
1252 code ends
1253 end
1254
1255 \1a