summaryrefslogtreecommitdiff
path: root/v4.0/src/BIOS/SYSCONF.ASM
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/BIOS/SYSCONF.ASM')
-rw-r--r--v4.0/src/BIOS/SYSCONF.ASM3392
1 files changed, 3392 insertions, 0 deletions
diff --git a/v4.0/src/BIOS/SYSCONF.ASM b/v4.0/src/BIOS/SYSCONF.ASM
new file mode 100644
index 0000000..7de3d30
--- /dev/null
+++ b/v4.0/src/BIOS/SYSCONF.ASM
@@ -0,0 +1,3392 @@
1 PAGE ,132 ;
2; SCCSID = @(#)sysconf.asm 0.0 86/10/20
3TITLE BIOS SYSTEM INITIALIZATION
4%OUT ...SYSCONF
5
6;==============================================================================
7;REVISION HISTORY:
8;AN000 - New for DOS Version 4.00 - J.K.
9;AC000 - Changed for DOS Version 4.00 - J.K.
10;AN00x - PTM number for DOS Version 4.00 - J.K.
11;==============================================================================
12;AN001; P132 Multiple character device installation problem. 06/27/87 J.K.
13;AN002; D24 MultiTrack= command added. 06/29/87 J.K.
14;AN003; D41 REM command in CONFIG.SYS. 07/6/87 J.K.
15;AN004; D184 Set DEVMARK for MEM command 08/25/87 J.K.
16;AN005; P568 CONFIG.SYS parsing error with FCBS=10,15 08/31/87 J.K.
17;AN006; P887 STACKS=0 does not show "ERROR in CONFIG.SYS..." 09/09/87 J.K.
18;AN007; D246, P976 Show "Bad command or parameters - ..." msg 09/22/87 J.K.
19;AN008; P1299 Set the second entry of DEVMARK for MEM command 09/25/87 J.K.
20;AN009; P1326 New Extended attribute 09/28/87 J.K.
21;AN010; P1820 New message SKL file 10/20/87 J.K.
22;AN011; P1970 AUTOTEST FCBS= command error msg inconsistent 10/23/87 J.K.
23;AN012; P2211 Setting the EA=7 for ANSI.SYS hangs the system 11/02/87 J.K.
24;AN013; P2342 REM not allowed after INSTALL command 11/09/87 J.K.
25;AN014; P2546 DEVICE= command still allowed after IFS= 11/17/87 J.K.
26;AN015; D358 New device driver INIT function package 12/03/87 J.K.
27;AN016; D285 Undo the extended error handling 12/17/87 J.K.
28;AN017; P3170 Do not call block device driver when drive # > 26 01/20/88 J.K.
29;AN018; P3111 Take out the order dependency of the INSTALL= 01/25/88 J.K.
30;AN019; D479 New option to disable extended INT 16h function call 02/12/88 J.K.
31;AN020; P3607 MEM does not give correct filename 02/24/88 J.K.
32;AN021; D493 Undo D358 & do not show error message for device driv 02/24/88 J.K.
33;AN022; P3807 Single buffer unprotected - System hangs 03/10/88 J.K.
34;AN023; P3797 An INSTALL cmd right after Bad cmd is not executed 03/10/88 J.K.
35;AN024; D503 Version change to 4.0 - IBMCACHE.SYS is an exception 03/15/88 J.K.
36;AN025; D474 Change BUFFERS= /E option to /X for expanded memory 03/16/88 J.K.
37;AN026; D506 Take out the order dependency of the IFS= 03/28/88 J.K.
38;AN027; P3957 Undo D503 - IBMCACHE.SYS version check problem 03/30/88 J.K.
39;AN028; P4086 Memory allocation error when loading share.exe 03/31/88 J.K.
40;AN029; D528 Install XMAEM.SYS first before everything else 04/29/88 J.K.
41;AN030; P4759 INT2f, INT 67h handlers for XMA 05/11/88 J.K.
42;AN031; P4889 Should check the validity of INT 67h call 05/17/88 G.A.
43;AN032; P4934 P4759 INT 2fh number should be changed to 1Bh 05/20/88 J.K.
44;AN033; P5002 EMS w/single page allocated now works 05/20/88 G.A.
45;AN034; P5128 EMS INT 2FH HANDLER BUG 06/24/88
46;==============================================================================
47
48TRUE EQU 0FFFFh
49FALSE EQU 0
50LF equ 10
51CR equ 13
52TAB equ 9
53SEMICOLON equ ';'
54
55IBMVER EQU TRUE
56IBM EQU IBMVER
57STACKSW EQU TRUE ;Include Switchable Hardware Stacks
58IBMJAPVER EQU FALSE ;If TRUE set KANJI true also
59MSVER EQU FALSE
60ALTVECT EQU FALSE ;Switch to build ALTVECT version
61KANJI EQU FALSE
62
63HAVE_INSTALL_CMD equ 00000001b ;AN018; CONFIG.SYS has INSTALL= commands
64HAS_INSTALLED equ 00000010b ;AN018; SYSINIT_BASE installed.
65
66IS_IFS equ 00000001b ;IFS command?
67NOT_IFS equ 11111110b
68;
69;AN016; Undo the extended attribute handling
70;;Extended attribute value
71;EA_UNSPECIFIED equ 0 ;AN009;
72;EA_DEVICE_DRIVER equ 6 ;AN009;
73;EA_IFS_DRIVER equ 7 ;AN009;
74
75DEFAULT_FILENUM = 8
76;
77 IF IBMJAPVER
78NOEXEC EQU TRUE
79 ELSE
80NOEXEC EQU FALSE
81 ENDIF
82
83DOSSIZE EQU 0A000H
84;dossize equ 0C000H ;J.K. for the debugging version of IBMDOS.
85
86.xlist
87; INCLUDE dossym.INC
88 include smdossym.inc ;J.K. Reduced version of DOSSYM.INC
89 INCLUDE devsym.INC
90 include ioctl.INC
91 include BIOSTRUC.INC
92 include smifssym.inc ;AN000; Reduced version of IFSSYM.INC.
93 include DEVMARK.inc ;AN004;
94 include version.inc
95.list
96
97 IF NOT IBMJAPVER
98 EXTRN RE_INIT:FAR
99 ENDIF
100
101;
102
103;J.K. 6/29/87 External variable defined in IBMBIO module for Multi-track
104MULTRK_ON EQU 10000000B ;User spcified Mutitrack=on, or System turns
105 ; it on after handling CONFIG.SYS file as a
106 ; default value, if MulTrk_flag = MULTRK_OFF1.
107MULTRK_OFF1 EQU 00000000B ;initial value. No "Multitrack=" command entered.
108MULTRK_OFF2 EQU 00000001B ;User specified Multitrack=off.
109
110CODE segment public 'code'
111 EXTRN MulTrk_flag:word ;AN002;
112 extrn KEYRD_Func:byte ;AN019;
113 extrn KEYSTS_Func:byte ;AN019;
114CODE ends
115;J.K. 6/29/87 End of Multi-track definition.
116
117SYSINITSEG SEGMENT PUBLIC 'SYSTEM_INIT'
118
119ASSUME CS:SYSINITSEG,DS:NOTHING,ES:NOTHING,SS:NOTHING
120
121 EXTRN BADOPM:BYTE,CRLFM:BYTE,BADCOM:BYTE,BADMEM:BYTE,BADBLOCK:BYTE
122 EXTRN BADSIZ_PRE:BYTE,BADLD_PRE:BYTE
123; EXTRN BADSIZ_POST:BYTE,BADLD_POST:BYTE
124 EXTRN BADSTACK:BYTE,BADCOUNTRYCOM:BYTE
125 EXTRN SYSSIZE:BYTE,BADCOUNTRY:BYTE,INSUFMEMORY:BYTE
126 EXTRN CONDEV:BYTE,AUXDEV:BYTE,PRNDEV:BYTE,COMMND:BYTE,CONFIG:BYTE
127 EXTRN Cntry_Drv:BYTE,Cntry_Root:BYTE,Cntry_Path:BYTE
128 EXTRN DeviceParameters:byte
129 EXTRN MEMORY_SIZE:word
130 EXTRN BUFFERS:word
131 EXTRN FILES:byte,NUM_CDS:byte
132 EXTRN DOSINFO:dword,ENTRY_POINT:dword
133 EXTRN FCBS:byte,KEEP:byte
134 EXTRN CONFBOT:word,ALLOCLIM:word,COMMAND_LINE:byte
135 EXTRN ZERO:byte,SEPCHR:byte
136 EXTRN COUNT:word,CHRPTR:word,CNTRYFILEHANDLE:word
137 EXTRN MEMLO:word,MEMHI:word,PRMBLK:word,LDOFF:word
138 EXTRN PACKET:byte,UNITCOUNT:byte,BREAK_ADDR:dword
139 EXTRN BPB_ADDR:dword,DRIVENUMBER:byte,SYSI_COUNTRY:dword
140 extrn Config_Size:word ;AN000;
141 extrn Install_Flag:word ;AN000;
142 extrn BadOrder:byte ;AN000;
143 extrn Errorcmd:byte ;AN000;
144 extrn LineCount:word ;AN000;
145 extrn ShowCount:byte ;AN000;
146 extrn Buffer_LineNum:word ;AN000;
147 extrn IFS_Flag:word ;AN000;
148 extrn IFS_RH:byte ;AN000;
149 extrn H_Buffers:word ;AN000;
150 extrn Buffer_Slash_X:byte ;AN000;AN025;
151 extrn Badparm:byte ;AN007;
152 extrn ConfigMsgFlag:Word ;AN015;
153 extrn Org_Count:Word ;AN018;
154 extrn Multi_Pass_Id:byte ;AN026;
155
156 EXTRN MEM_ERR:NEAR,SetDOSCountryInfo:NEAR
157 EXTRN PARAROUND:NEAR,TEMPCDS:NEAR
158 EXTRN Set_Country_Path:NEAR,Move_ASCIIZ:NEAR,DELIM:NEAR
159 EXTRN BADFIL:NEAR,ROUND:NEAR
160 extrn Do_Install_Exec:NEAR ;AN018;
161 extrn SetDevMark:NEAR ;AN030;
162
163;AN016; Undo the extended attribute handling
164; extrn Get_Ext_Attribute:near ;AN009;
165
166 IF STACKSW
167
168; Internal Stack Parameters
169 EntrySize equ 8
170
171 MinCount equ 8
172 DefaultCount equ 9
173 MaxCount equ 64
174
175 MinSize equ 32
176 DefaultSize equ 128
177 MaxSize equ 512
178
179 extrn stack_count:word
180 extrn stack_size:word
181 extrn stack_addr:dword
182
183 ENDIF
184
185 PUBLIC DOCONF
186 PUBLIC GETCHR
187 public Multi_Pass ;AN018;AN026;
188
189 public MultDeviceFlag
190MultDeviceFlag db 0 ;AN001;
191 public DevMark_Addr
192DevMark_Addr dw ? ;AN004;Segment address for DEVMARK.
193 public SetDevMarkFlag
194SetDevMarkFlag db 0 ;AN004;Flag used for DEVMARK
195
196EMS_Stub_Installed db 0 ;AN030;
197
198Badparm_Ptr label dword
199Badparm_Off dw 0 ;AN007;
200Badparm_Seg dw 0 ;AN007;
201
202XMAEM_file db 'XMAEM.SYS',0 ;AN029;
203
204;IBMCACHE_file db 'IBMCACHE.SYS',0;AN024;AN026;To cope with the IBMCACHE.SYS
205 ; problem of DOS version checking.
206
207;******************************************************************************
208;Take care of Config.sys file.
209;SYSTEM parser data and code.
210;******************************************************************************
211.xlist
212 include PSOPTION.INC ;Parsing options for SYSCONF.
213 include PARSE.ASM ;together with PSDATA.INC
214.list
215;Control block definitions for PARSER.
216;---------------------------------------------------
217; BUFFER = [n | n,m] {/E}
218
219Buf_Parms label byte ;AN000;
220 dw Buf_Parmsx ;AN000;
221 db 1 ;AN000; An extra delimeter list
222 db 1 ;AN000; length is 1
223 db SEMICOLON ;AN000;
224
225Buf_Parmsx label byte ;AN000;
226 db 1,2 ;AN000; Min 1, Max 2 positional
227 dw Buf_Pos1 ;AN000;
228 dw Buf_Pos2 ;AN000;
229 db 1 ;AN000; 1 switch
230 dw SW_X_Ctrl ;AN000;AN025; /X control
231 db 0 ;AN000; no keywords
232
233Buf_Pos1 label word ;AN000;
234 dw 8000h ;AN000; Numeric value
235 dw 0 ;AN000; no function
236 dw Result_Val ;AN000; Result value buffer
237 dw Buf_Range_1 ;AN000; value list
238 db 0 ;AN000; no switches/keywords
239
240Buf_Range_1 label byte ;AN000; value definition
241 db 1 ;AN000; range definition
242 db 1 ;AN000; 1 definition of range
243 db 1 ;AN000; item tag for this range
244 dd 1,10000 ;AN000; from 1 to 10000
245
246Buf_Pos2 label word ;AN000;
247 dw 8001h ;AN000; Numeric value, Optional
248 dw 0 ;AN000; no function
249 dw Result_Val ;AN000; Result value buffer
250 dw Buf_Range_2 ;AN000; value list
251 db 0 ;AN000; no switches/keywords
252
253Buf_Range_2 label byte ;AN000; value definition
254 db 1 ;AN000; range definition
255 db 1 ;AN000; 1 definition of range
256 db 1 ;AN000; item tag for this range
257 dd 0,8 ;AN000; from 0 to 8.
258
259SW_X_Ctrl label word ;AN000;AN025;
260 dw 0 ;AN000; no matching flag
261 dw 0 ;AN000; no function
262 dw Result_Val ;AN000; return value
263 dw NoVal ;AN000; no value definition
264 db 1 ;AN000; # of switches
265Switch_X label byte ;AN000;AN025;
266 db '/X',0 ;AN000;AN025;
267;local variables
268P_Buffers dw 0 ;AN000;
269P_H_Buffers dw 0 ;AN000;
270P_Buffer_Slash_X db 0 ;AN000;AN025;
271Buffer_Pre_Scan db 0 ;AN030;
272
273;Common definitions -------------
274NoVal db 0 ;AN000;
275
276Result_Val label byte ;AN000;
277 db ? ;AN000; type returned
278 db ? ;AN000; item tag returned
279 dw ? ;AN000; ES:offset of the switch defined
280RV_Byte label byte ;AN000;
281RV_Dword label dword ;AN000;
282 dd ? ;AN000; value if number, or seg:offset to string.
283;--------------------------------
284
285; BREAK = [ ON | OFF ]
286
287Brk_Parms label byte ;AN000;
288 dw Brk_Parmsx ;AN000;
289 db 1 ;AN000; An extra delimeter list
290 db 1 ;AN000; length is 1
291 db SEMICOLON ;AN000;
292
293Brk_Parmsx label byte ;AN000;
294 db 1,1 ;AN000; Min 1, Max 1 positional
295 dw Brk_Pos ;AN000;
296 db 0 ;AN000; no switches
297 db 0 ;AN000; no keywords
298
299Brk_Pos label word ;AN000;
300 dw 2000h ;AN000; Simple string
301 dw 0 ;AN000; No functions
302 dw Result_Val ;AN000;
303 dw On_Off_String ;AN000; ON,OFF string descriptions
304 db 0 ;AN000; no keyword/switch synonyms
305
306On_Off_String label byte ;AN000;
307 db 3 ;AN000; signals that there is a string choice
308 db 0 ;AN000; no range definition
309 db 0 ;AN000; no numeric values choice
310 db 2 ;AN000; 2 strings for choice
311 db 1 ;AN000; the 1st string tag
312 dw On_String ;AN000;
313 db 2 ;AN000; the 2nd string tag
314 dw Off_String ;AN000;
315
316On_String db "ON",0 ;AN000;
317Off_String db "OFF",0 ;AN000;
318;local variable
319P_Ctrl_Break db 0 ;AN000; local variable
320
321;--------------------------------
322
323; COUNTRY = n {m {path}}
324; or
325; COUNTRY = n,,path
326
327Cntry_Parms label byte ;AN000;
328 dw Cntry_Parmsx ;AN000;
329 db 1 ;AN000; An extra delimeter list
330 db 1 ;AN000; length is 1
331 db SEMICOLON ;AN000;
332
333Cntry_Parmsx label byte ;AN000;
334 db 1,3 ;AN000; Min 1, Max 3 positional
335 dw Cntry_Pos1 ;AN000;
336 dw Cntry_Pos2 ;AN000;
337 dw Cntry_Pos3 ;AN000;
338 db 0 ;AN000; no switches
339 db 0 ;AN000; no keywords
340
341Cntry_Pos1 label word ;AN000; control definition for positional 1
342 dw 8000h ;AN000; Numeric value
343 dw 0 ;AN000; no functions
344 dw Result_Val ;AN000;
345 dw Cntry_Codepage_Range ;AN000; country id code range description
346 db 0 ;AN000; no switch/keyword synonyms
347
348Cntry_Codepage_Range label byte ;AN000;
349 db 1 ;AN000; # of value definitions
350 db 1 ;AN000; # of ranges
351 db 1 ;AN000; Tag for this range
352 dd 1,999 ;AN000;
353
354Cntry_Pos2 label word ;AN000; control definition for positional 2
355 dw 8001h ;AN000; Numeric value, optional
356 dw 0 ;AN000; no functions
357 dw Result_Val ;AN000;
358 dw Cntry_Codepage_Range ;AN000; code page range descriptions.
359 db 0 ;AN000; no switch/keyword synonyms
360
361Cntry_Pos3 label word ;AN000; control definition for positional 3
362 dw 0201h ;AN000; File spec, optional
363 dw 0 ;AN000; No functions. Don't need to CAP.
364 dw Result_Val ;AN000;
365 dw NoVal ;AN000; no value list
366 db 0 ;AN000; no switch/keyword synonyms
367
368;Local variables
369P_Cntry_Code dw 0 ;AN000;
370P_Code_Page dw 0 ;AN000;
371
372;--------------------------------
373
374; FILES = n
375
376Files_Parms label byte ;AN000;
377 dw Files_Parmsx ;AN000;
378 db 1 ;AN000; An extra delimeter list
379 db 1 ;AN000; length is 1
380 db SEMICOLON ;AN000;
381
382Files_Parmsx label byte ;AN000;
383 db 1,1 ;AN000; Min 1, Max 1 positional
384 dw Files_Pos ;AN000;
385 db 0 ;AN000; no switches
386 db 0 ;AN000; no keywords
387
388Files_Pos label byte ;AN000;
389 dw 8000h ;AN000; Numeric value
390 dw 0 ;AN000; no functions
391 dw Result_Val ;AN000;
392 dw Files_Range ;AN000; Files range description
393 db 0 ;AN000; no switch/keyword synonyms
394
395Files_Range label byte ;AN000;
396 db 1 ;AN000; # of value definitions
397 db 1 ;AN000; # of ranges
398 db 1 ;AN000; Tag for this range
399 dd 8,255 ;AN000;
400;local variable
401P_Files db 0 ;AN000;
402
403;--------------------------------
404
405; FCBS = n,m
406
407FCBS_Parms label byte ;AN000;
408 dw FCBS_Parmsx ;AN000;
409 db 1 ;AN000; An extra delimeter list
410 db 1 ;AN000; length is 1
411 db SEMICOLON ;AN000;
412
413FCBS_Parmsx label byte ;AN000;
414 db 2,2 ;AN000; Min 2, Max 2 positional
415 dw FCBS_Pos_1 ;AN000;
416 dw FCBS_Pos_2 ;AN000;
417 db 0 ;AN000; no switches
418 db 0 ;AN000; no keywords
419
420FCBS_Pos_1 label byte ;AN000;
421 dw 8000h ;AN000; Numeric value
422 dw 0 ;AN000; no functions
423 dw Result_Val ;AN000;
424 dw FCBS_Range ;AN000; FCBS range descriptions
425 db 0 ;AN000; no switch/keyword synonyms
426
427FCBS_Range label byte ;AN000;
428 db 1 ;AN000; # of value definitions
429 db 1 ;AN000; # of ranges
430 db 1 ;AN000; Tag for this range
431 dd 1,255 ;AN000;
432
433FCBS_Pos_2 label byte ;AN000;
434 dw 8000h ;AN000; Numeric value
435 dw 0 ;AN000; no functions
436 dw Result_Val ;AN000;
437 dw FCBS_Keep_Range ;AN000; FCBS KEEP range descriptions
438 db 0 ;AN000; no switch/keyword synonyms
439
440FCBS_Keep_Range label byte ;AN000;
441 db 1 ;AN000; # of value definitions
442 db 1 ;AN000; # of ranges
443 db 1 ;AN000; Tag for this range
444 dd 0,255 ;AN000;
445
446;local variable
447P_Fcbs db 0 ;AN000;
448P_Keep db 0 ;AN000;
449;--------------------------------
450
451; LASTDRIVE = x
452
453LDRV_Parms label byte ;AN000;
454 dw LDRV_Parmsx ;AN000;
455 db 1 ;AN000; An extra delimeter list
456 db 1 ;AN000; length is 1
457 db SEMICOLON ;AN000;
458
459LDRV_Parmsx label byte ;AN000;
460 db 1,1 ;AN000; Min 1, Max 1 positional
461 dw LDRV_Pos ;AN000;
462 db 0 ;AN000; no switches
463 db 0 ;AN000; no keywords
464
465LDRV_Pos label byte ;AN000;
466 dw 0110h ;AN000; Drive only, Ignore colon.
467 dw 0010h ;AN000; Remove colon at end
468 dw Result_Val ;AN000;
469 dw NoVal ;AN000; No value list
470 db 0 ;AN000; no switch/keyword synonyms
471
472;local variable
473P_Ldrv db 0 ;AN000;
474;--------------------------------
475
476; STACKS = n,m
477
478STKS_Parms label byte ;AN000;
479 dw STKS_Parmsx ;AN000;
480 db 1 ;AN000; An extra delimeter list
481 db 1 ;AN000; length is 1
482 db SEMICOLON ;AN000;
483
484STKS_Parmsx label byte ;AN000;
485 db 2,2 ;AN000; Min 2, Max 2 positional
486 dw STKS_Pos_1 ;AN000;
487 dw STKS_Pos_2 ;AN000;
488 db 0 ;AN000; no switches
489 db 0 ;AN000; no keywords
490
491STKS_Pos_1 label byte ;AN000;
492 dw 8000h ;AN000; Numeric value
493 dw 0 ;AN000; no functions
494 dw Result_Val ;AN000;
495 dw STKS_Range ;AN000; number of stack range descriptions
496 db 0 ;AN000; no switch/keyword synonyms
497
498STKS_Range label byte ;AN000;
499 db 1 ;AN000; # of value definitions
500 db 1 ;AN000; # of ranges
501 db 1 ;AN000; Tag for this range
502 dd 0,64 ;AN000;
503
504STKS_Pos_2 label byte ;AN000;
505 dw 8000h ;AN000; Numeric value
506 dw 0 ;AN000; no functions
507 dw Result_Val ;AN000;
508 dw STK_SIZE_Range ;AN000; stack size range descriptions
509 db 0 ;AN000; no switch/keyword synonyms
510
511STK_SIZE_Range label byte ;AN000;
512 db 1 ;AN000; # of value definitions
513 db 1 ;AN000; # of ranges
514 db 1 ;AN000; Tag for this range
515 dd 0,512 ;AN000;
516;local variables
517P_Stack_Count dw 0 ;AN000;
518P_Stack_Size dw 0 ;AN000;
519
520;--------------------------------
521
522; MULTITRACK = [ ON | OFF ]
523
524MTrk_Parms label byte ;AN002;
525 dw MTrk_Parmsx ;AN002;
526 db 1 ;AN002; An extra delimeter list
527 db 1 ;AN002; length is 1
528 db SEMICOLON ;AN002;
529
530MTrk_Parmsx label byte ;AN002;
531 db 1,1 ;AN002; Min 1, Max 1 positional
532 dw MTrk_Pos ;AN002;
533 db 0 ;AN002; no switches
534 db 0 ;AN002; no keywords
535
536MTrk_Pos label word ;AN002;
537 dw 2000h ;AN002; Simple string
538 dw 0 ;AN002; No functions
539 dw Result_Val ;AN002;
540 dw On_Off_String ;AN002; ON,OFF string descriptions
541 db 0 ;AN002; no keyword/switch synonyms
542
543;local variables
544P_Mtrk db 0 ;AN002;
545;--------------------------------
546
547; CPSW = [ ON | OFF ]
548
549CPSW_Parms label byte ;AN002;
550 dw CPSW_Parmsx ;AN002;
551 db 1 ;AN002; An extra delimeter list
552 db 1 ;AN002; length is 1
553 db SEMICOLON ;AN002;
554
555CPSW_Parmsx label byte ;AN002;
556 db 1,1 ;AN002; Min 1, Max 1 positional
557 dw CPSW_Pos ;AN002;
558 db 0 ;AN002; no switches
559 db 0 ;AN002; no keywords
560
561CPSW_Pos label word ;AN002;
562 dw 2000h ;AN002; Simple string
563 dw 0 ;AN002; No functions
564 dw Result_Val ;AN002;
565 dw On_Off_String ;AN002; ON,OFF string descriptions
566 db 0 ;AN002; no keyword/switch synonyms
567
568;local variables
569P_CPSW db 0 ;AN002;
570
571;--------------------------------
572; SWITCHES=/K
573
574Swit_Parms label byte ;AN019;
575 dw Swit_Parmsx ;AN019;
576 db 1 ;AN019; An extra delimeter list
577 db 1 ;AN019; length is 1
578 db SEMICOLON ;AN019;
579
580Swit_Parmsx label byte ;AN019;
581 db 0,0 ;AN019; No positionals
582 db 1 ;AN019; 1 switch for now.
583 dw Swit_K_Ctrl ;AN019; /K control
584 db 0 ;AN019; no keywords
585
586Swit_K_Ctrl label word ;AN019;
587 dw 0 ;AN019; no matching flag
588 dw 0 ;AN019; no function
589 dw Result_Val ;AN019; return value
590 dw NoVal ;AN019; no value definition
591 db 1 ;AN019; # of switches
592Swit_K label byte ;AN019;
593 db '/K',0 ;AN019;
594;local variables
595P_Swit_K db 0 ;AN019;
596
597;******************************************************************************
598
599DOCONF:
600 PUSH CS
601 POP DS
602 ASSUME DS:SYSINITSEG
603
604 MOV AX,(CHAR_OPER SHL 8) ;GET SWITCH CHARACTER
605 INT 21H
606 MOV [COMMAND_LINE+1],DL ; Set in default command line
607
608 MOV DX,OFFSET CONFIG ;NOW POINTING TO FILE DESCRIPTION
609 MOV AX,OPEN SHL 8 ;OPEN FILE "CONFIG.SYS"
610 STC ;IN CASE OF INT 24
611 INT 21H ;FUNCTION REQUEST
612; JC ENDCONF ;Wasn't there, or couldn't open (sickness)
613 jc No_Config_sys ;AN028;
614 JMP NOPROB ;PROBLEM WITH OPEN
615No_Config_sys: ;AN028;
616 mov Multi_Pass_Id, 11 ;AN028; set it to unreasonable number
617ENDCONF:
618 return
619
620
621BADOP: MOV DX,OFFSET BADOPM ;WANT TO PRINT COMMAND ERROR "Unrecognized command..."
622 invoke PRINT
623 call Error_Line ;show "Error in CONFIG.SYS ..." .
624 JMP COFF
625
626Badop_p proc near ;AN000;
627;Same thing as BADOP, but will make sure to set DS register back to SYSINITSEG
628;and return back to the calller.
629 push cs
630 pop ds ;set ds to CONFIGSYS seg.
631 mov dx, offset badopm
632 invoke PRINT
633 call Error_Line
634 ret
635Badop_p endp
636
637Badparm_p proc near ;AN007;
638;Show "Bad command or parameters - xxxxxx"
639;In Badparm_seg, Badparm_off -> xxxxx
640;
641 cmp cs:Buffer_Pre_Scan, 1 ;AN030; Pre scanning Buffers ... /X?
642 je BadParmp_Ret ;AN030; then do not show any message.
643 push ds ;AN007;
644 push dx ;AN007;
645 push si ;AN007;
646
647 push cs ;AN007;
648 pop ds ;AN007;
649 mov dx, offset Badparm ;AN007;
650 invoke PRINT ;AN007;"Bad command or parameters - "
651 lds si, Badparm_ptr ;AN007;
652Badparm_Prt: ;AN007;print "xxxx" until CR.
653 mov dl, byte ptr [si] ;AN007;
654 mov ah,STD_CON_OUTPUT ;AN007;
655 int 21h ;AN007;
656 inc si ;AN007;
657 cmp dl, CR ;AN007;
658 jne Badparm_Prt ;AN007;
659 push cs ;AN007;
660 pop ds ;AN007;
661 mov dx, offset CRLFM ;AN007;
662 invoke PRINT ;AN007;
663 call Error_Line ;AN007;
664 pop si ;AN007;
665 pop dx ;AN007;
666 pop ds ;AN007;
667BadParmp_Ret: ;AN030;
668 ret ;AN007;
669Badparm_p endp
670
671NOPROB: ;GET FILE SIZE (NOTE < 64K!!)
672 MOV BX,AX
673 XOR CX,CX
674 XOR DX,DX
675 MOV AX,(LSEEK SHL 8) OR 2
676 INT 21H
677 MOV [COUNT],AX
678 XOR DX,DX
679 MOV AX,LSEEK SHL 8 ;Reset pointer to beginning of file
680 INT 21H
681; MOV DX,CS
682 mov dx, [ConfBot] ;AN022;Use current CONFBOT value
683 MOV AX,[COUNT]
684 mov [config_size], ax ;save the size of config.sys file.
685 call ParaRound
686 SUB DX,AX
687 SUB DX,11H ;ROOM FOR HEADER
688 MOV [CONFBOT],DX ; Config starts here. New CONBOT value.
689 CALL TEMPCDS ; Finally get CDS to "safe" location
690ASSUME DS:NOTHING,ES:NOTHING
691
692 MOV DX,[CONFBOT]
693 MOV DS,DX
694 MOV ES,DX
695 XOR DX,DX
696 MOV CX,[COUNT]
697 MOV AH,READ
698 STC ;IN CASE OF INT 24
699 INT 21H ;Function request
700 PUSHF
701;
702; Find the EOF mark in the file. If present, then trim length.
703
704 SaveReg <AX,DI,CX>
705 MOV AL,1Ah ; eof mark
706 MOV DI,DX ; point ro buffer
707 JCXZ PutEOL ; no chars
708 REPNZ SCASB ; find end
709 JNZ PutEOL ; none found and count exahusted
710;
711; We found a 1A. Back up
712;
713 DEC DI ; backup past 1A
714;
715; Just for the halibut, stick in an extra EOL
716;
717PutEOL:
718 MOV AL,CR
719 STOSB ; CR
720 MOV AL,LF
721 STOSB ; LF
722 SUB DI,DX ; difference moved
723 MOV Count,DI ; new count
724;
725; Restore registers
726;
727 RestoreReg <CX,DI,AX>
728
729 PUSH CS
730 POP DS
731ASSUME DS:SYSINITSEG
732 PUSH AX
733 MOV AH,CLOSE
734 INT 21H
735 POP AX
736 POPF
737 JC CONFERR ;IF NOT WE'VE GOT A PROBLEM
738 CMP CX,AX
739 JZ GETCOM ;COULDN'T READ THE FILE
740CONFERR:
741 MOV DX,OFFSET CONFIG ;WANT TO PRINT CONFIG ERROR
742 CALL BADFIL
743ENDCONV:JMP ENDCONF
744
745Multi_Pass: ;AN018;AN026; called to execute IFS=, INSTALL= commands
746 push cs ;AN018;
747 pop ds ;AN018;
748 cmp Multi_Pass_id, 10 ;J.K.
749 jae Endconv ;J.K. Do nothing. Just return.
750 push Confbot ;AN018;
751 pop es ;AN018; ES -> Confbot
752 mov si, Org_Count ;AN018;
753 mov Count, si ;AN018; set Count
754 xor si,si ;AN018;
755 mov Chrptr, si ;AN018; reset Chrptr, LineCount
756 mov LineCount, si ;AN018;
757 call GetChr ;AN018;
758 jmp Conflp ;AN018;
759GETCOM:
760 invoke ORGANIZE ;ORGANIZE THE FILE
761 CALL GETCHR
762
763CONFLP: JC ENDCONV
764 call Reset_DOS_Version ;AN024;AN026; Still need to reset version even IBMDOS handles this through
765 ; function 4Bh call, since IBMDOS does not know when Load/Overlay call finishes.
766
767IF NOT BUFFERFLAG
768 call EMS_Stub_handler ;AN030;
769ENDIF
770
771 inc LineCount ;AN000; Increase LineCount.
772 mov Buffer_Pre_Scan, 0 ;AN030; Reset Buffer_Pre_Scan.
773 mov MultDeviceFlag,0 ;AN001; Reset MultDeviceFlag.
774 mov SetDevMarkFlag,0 ;AN004; Reset SetDevMarkFlag.
775 cmp al, LF ;AN000; LineFeed?
776 je Blank_Line ;AN000; then ignore this line.
777 MOV AH,AL
778 CALL GETCHR
779 jnc TryI ;AN000;
780 cmp Multi_Pass_ID, 2 ;AN026;
781 jae Endconv ;AN026;Do not show Badop again for multi_pass.
782 JMP BADOP
783
784COFF: PUSH CS
785 POP DS
786 invoke NEWLINE
787 JMP CONFLP
788Blank_Line: ;AN000;
789 call Getchr ;AN000;
790 jmp CONFLP ;AN000;
791
792COFF_P:
793 push cs
794 pop ds
795
796
797;J.K. 1/27/88 ;;;;;;;;;;;;;;;;;;
798;To handle INSTALL= commands, we are going to use multi-pass.
799;The first pass handles the other commands and only set Install_Flag when
800;it finds any INSTALL command. The second pass will only handle the
801;INSTALL= command.
802
803;------------------------------------------------------------------------------
804;INSTALL command
805;------------------------------------------------------------------------------
806TRYI:
807 cmp Multi_Pass_Id, 0 ;AN029; the initial pass for XMAEM.SYS
808 je Multi_Try_XMAEM ;AN029; and BUFFERS= ... /X pre scan.
809 cmp Multi_Pass_Id, 2 ;AN026; the second pass for IFS= ?
810 je Multi_Try_J ;AN026;
811 cmp Multi_Pass_Id, 3 ;AN026; the third pass for INSTALL= ?
812 je Multi_Try_I ;AN026;
813 cmp ah, 'I' ;AN018; INSTALL= command?
814 jne TryB ;AN018; the first pass is for normal operation.
815 or Install_Flag, HAVE_INSTALL_CMD ;AN018; Set the flag
816 jmp coff ;AN018; and handles the next command
817
818Multi_Try_XMAEM: ;AN029;
819 cmp ah, 'D' ;AN029; device= command?
820 jne Multi_Try_Buff ;AN029; no skip it.
821 call Chk_XMAEM ;AN029; is it for XMAEM.SYS?
822 jnz Multi_Pass_FIlter ;AN029; no skip it.
823 mov byte ptr es:[si-1], 0FFh ;AN029; mark this command as a Null command for the next pass.
824 jmp TryDJ ;AN029; execute this command.
825Multi_Try_Buff: ;AN030;
826 cmp ah, 'B' ;AN030; Buffers= command?
827 jne Multi_Pass_Filter ;AN030;
828 mov Buffer_Pre_Scan, 1 ;AN030; Set Buffer_Pre_Scan
829 jmp TryB ;AN030; TryB will set P_Buffer_Slash_X to non-zero value.
830
831Multi_Try_J: ;AN026;
832 cmp ah, 'J' ;AN026; IFS= command?
833 jne Multi_Pass_Filter ;AN026; No. Ignore this.
834 jmp GotJ ;AN026; Handles IFS= command.
835
836Multi_Try_I: ;AN026;
837 cmp ah, 'I' ;AN026; INSTALL= command?
838 jne Multi_Pass_Filter ;AN026; No. Ignore this.
839 call Do_Install_Exec ;Install it.
840 jmp Coff ;to handle next Install= command.
841
842Multi_Pass_Filter: ;AN023;AN026;
843 cmp ah, 'Y' ;AN023; Comment?
844 je Multi_Pass_Adjust ;AN023;
845 cmp ah, 'Z' ;AN023; Bad command?
846 je Multi_Pass_Adjust ;AN023;
847 cmp ah, '0' ;AN023; REM?
848 jne Multi_Pass_Coff ;AN023; ignore the rest of the commands.
849Multi_Pass_Adjust: ;AN023; These commands need to
850 dec Chrptr ;AN023; adjust chrptr, count
851 inc Count ;AN023; for NEWLINE proc.
852Multi_Pass_Coff: ;AN023;
853 jmp Coff ;AN018; To handle next INSTALL= commands.
854
855;------------------------------------------------------------------------------
856
857Sysinit_Parse proc
858;Set up registers for SysParse
859;In) ES:SI -> command line in CONFBOT
860; DI -> offset of the parse control defintion.
861;
862;Out) Calls SYSPARSE.
863; Carry will set if Parse error.
864; *** The caller should check the EOL condition by looking at AX
865; *** after each call.
866; *** If no parameters are found, then AX will contain a error code.
867; *** If the caller needs to look at the SYNOMYM@ of the result,
868; *** the caller should use CS:@ instead of ES:@.
869; CX register should be set to 0 at the first time the caller calls this
870; procedure.
871; AX - exit code
872; BL - TErminated delimeter code
873; CX - new positional ordinal
874; SI - set to pase scanned operand
875; DX - selected result buffer
876
877 push es ;save es,ds
878 push ds
879
880 push es
881 pop ds ;now DS:SI -> command line
882 push cs
883 pop es ;now ES:DI -> control definition
884
885 mov cs:Badparm_Seg,ds ;AN007;Save the pointer to the parm
886 mov cs:Badparm_Off,si ;AN007; we are about to parse for Badparm msg.
887 mov dx, 0
888 call SysParse
889 cmp ax, $P_NO_ERROR ;no error
890; $IF E,OR
891 JE $$LL1
892 cmp ax, $P_RC_EOL ;or the end of line?
893; $IF E
894 JNE $$IF1
895$$LL1:
896 clc
897; $ELSE
898 JMP SHORT $$EN1
899$$IF1:
900 stc
901; $ENDIF
902$$EN1:
903 pop ds
904 pop es ;restore es,ds
905 ret
906Sysinit_Parse endp
907
908;------------------------------------------------------------------------------
909; Buffer command
910;------------------------------------------------------------------------------
911;*******************************************************************************
912; *
913; Function: Parse the parameters of buffers= command. *
914; *
915; Input : *
916; ES:SI -> parameters in command line. *
917; Output: *
918; Buffers set *
919; Buffer_Slash_X flag set if /X option chosen. *
920; H_Buffers set if secondary buffer cache specified. *
921; *
922; Subroutines to be called: *
923; Sysinit_Parse *
924; Logic: *
925; { *
926; Set DI points to Buf_Parms; /*Parse control definition*/ *
927; Set DX,CX to 0; *
928; Reset Buffer_Slash_X; *
929; While (End of command line) *
930; { Sysinit_parse; *
931; if (no error) then *
932; if (Result_Val.$P_SYNONYM_ptr == Slash_E) then /*Not a switch *
933; Buffer_Slash_X = 1 *
934; else if (CX == 1) then /* first positional */ *
935; Buffers = Result_Val.$P_Picked_Val; *
936; else H_Buffers = Result_Val.$P_Picked_Val; *
937; else {Show Error message;Error Exit} *
938; }; *
939; If (Buffer_Slash_X is off & Buffers > 99) then Show_Error; *
940; }; *
941; *
942;*******************************************************************************
943;TryB: CMP AH,'B' ;BUFFER COMMAND?
944; JNZ TRYC
945; invoke GETNUM
946; JZ TryBBad ; Gotta have at least one
947; CMP AX,100 ; check for max number
948; JB SaveBuf
949;TryBBad:JMP BadOp
950;SaveBuf:
951; MOV [BUFFERS],AX
952;CoffJ1: JMP COFF
953
954TryB:
955 CMP AH,'B'
956 JNZ TryC
957 mov P_Buffer_Slash_X, 0 ;AN000;AN025;
958 mov di, offset Buf_Parms ;AN000;
959 xor cx, cx ;AN000;
960 mov dx, cx ;AN000;
961
962; $SEARCH ;AN000;
963$$DO4:
964 call Sysinit_Parse ;AN000;
965; $EXITIF C ;AN000; Parse Error,
966 JNC $$IF4
967 call Badparm_p ;AN007; and Show messages and end the search loop.
968; $ORELSE ;AN000;
969 JMP SHORT $$SR4
970$$IF4:
971 cmp ax, $P_RC_EOL ;AN000; End of Line?
972; $LEAVE E ;AN000; then jmp to $Endloop for semantic check.
973 JE $$EN4
974 cmp Result_Val.$P_SYNONYM_PTR, offset Switch_X ;AN000;AN025;
975; $IF E ;AN000;
976 JNE $$IF8
977 mov P_Buffer_Slash_X, 1 ;AN000;AN025; set the flag
978; $ELSE ;AN000;
979 JMP SHORT $$EN8
980$$IF8:
981 mov ax, word ptr Result_Val.$P_PICKED_VAL ;AN000;
982 cmp cx, 1 ;AN000;
983; $IF E ;AN000;
984 JNE $$IF10
985 mov P_Buffers, ax ;AN000;
986; $ELSE ;AN000;
987 JMP SHORT $$EN10
988$$IF10:
989 mov P_H_Buffers, ax ;AN000;
990; $ENDIF ;AN000;
991$$EN10:
992; $ENDIF ;AN000;
993$$EN8:
994; $ENDLOOP ;AN000;
995 JMP SHORT $$DO4
996$$EN4:
997 cmp P_Buffers, 99 ;AN000;
998; $IF A,AND ;AN000;
999 JNA $$IF15
1000 cmp P_Buffer_Slash_X, 0 ;AN000;AN025;
1001; $IF E ;AN000;
1002 JNE $$IF15
1003 call Badparm_p ;AN000;
1004 mov P_H_Buffers, 0 ;AN000;
1005; $ELSE ;AN000;
1006 JMP SHORT $$EN15
1007$$IF15:
1008 mov ax, P_Buffers ;AN000; We don't have any problem.
1009 mov Buffers, ax ;AN000; Now, let's set it really.
1010 mov ax, P_H_Buffers ;AN000;
1011 mov H_Buffers, ax ;AN000;
1012 mov al, P_Buffer_Slash_X ;AN000;AN025;
1013 mov Buffer_Slash_X, al ;AN000;AN025;
1014 mov ax, LineCount ;AN000;
1015 mov Buffer_LineNum, ax ;AN000; Save the line number for the future use.
1016; $ENDIF ;AN000;
1017$$EN15:
1018; $ENDSRCH ;AN000;
1019$$SR4:
1020 jmp Coff
1021
1022;------------------------------------------------------------------------------
1023; Break command
1024;------------------------------------------------------------------------------
1025;*******************************************************************************
1026; *
1027; Function: Parse the parameters of Break = command. *
1028; *
1029; Input : *
1030; ES:SI -> parameters in command line. *
1031; Output: *
1032; Turn the Control-C check on or off. *
1033; *
1034; Subroutines to be called: *
1035; Sysinit_Parse *
1036; Logic: *
1037; { *
1038; Set DI to Brk_Parms; *
1039; Set DX,CX to 0; *
1040; While (End of command line) *
1041; { Sysinit_Parse; *
1042; if (no error) then *
1043; if (Result_Val.$P_Item_Tag == 1) then /*ON */ *
1044; Set P_Ctrl_Break, on; *
1045; else /*OFF */ *
1046; Set P_Ctrl_Break, off; *
1047; else {Show message;Error_Exit}; *
1048; }; *
1049; If (no error) then *
1050; DOS function call to set Ctrl_Break check according to *
1051; }; *
1052; *
1053;********************************************************************************
1054;TryC: CMP AH,'C'
1055; JZ GOTC
1056; JMP TRYDJ
1057;GOTC:
1058; CMP AL,'O' ;FIRST LETTER OF "ON" or "OFF"
1059; JNZ TryCBad
1060; CALL GETCHR
1061; JC TryCBad
1062; CMP AL,'N' ;SECOND LETTER OF "ON"
1063; JNZ TryCoff
1064; MOV AH,SET_CTRL_C_TRAPPING ;TURN ON CONTROL-C CHECK
1065; MOV AL,1
1066; MOV DL,AL
1067; INT 21H
1068;CoffJ2: JMP Coff
1069;TryCOff:CMP AL,'F'
1070; JNZ TryCBad ; Check for "OFF"
1071; CALL GetChr
1072; JC TryCBad
1073; CMP AL,'F'
1074; JZ COffJ2
1075;TryCBad:JMP BadOp
1076;
1077TryC:
1078 CMP AH,'C'
1079 JNZ TRYM
1080 mov di, offset Brk_Parms ;AN000;
1081 xor cx,cx ;AN000;
1082 mov dx,cx ;AN000;
1083; $SEARCH ;AN000;
1084$$DO19:
1085 call Sysinit_Parse ;AN000;
1086; $EXITIF C ;AN000; Parse error
1087 JNC $$IF19
1088 call Badparm_p ;AN007; Show message and end the serach loop.
1089; $ORELSE ;AN000;
1090 JMP SHORT $$SR19
1091$$IF19:
1092 cmp ax, $P_RC_EOL ;AN000; End of Line?
1093; $LEAVE E ;AN000; then end the $ENDLOOP
1094 JE $$EN19
1095 cmp Result_Val.$P_ITEM_TAG, 1 ;AN000;
1096; $IF E ;AN000;
1097 JNE $$IF23
1098 mov P_Ctrl_Break, 1 ;AN000; Turn it on
1099; $ELSE ;AN000;
1100 JMP SHORT $$EN23
1101$$IF23:
1102 mov P_Ctrl_Break, 0 ;AN000; Turn it off
1103; $ENDIF ;AN000;
1104$$EN23:
1105; $ENDLOOP ;AN000; we actually set the ctrl break
1106 JMP SHORT $$DO19
1107$$EN19:
1108 mov ah, SET_CTRL_C_TRAPPING ;AN000; if we don't have any parse error.
1109 mov al, 1 ;AN000;
1110 mov dl, P_Ctrl_Break ;AN000;
1111 Int 21h ;AN000;
1112; $ENDSRCH ;AN000;
1113$$SR19:
1114 jmp Coff
1115
1116;------------------------------------------------------------------------------
1117; MultiTrack command
1118;------------------------------------------------------------------------------
1119;*******************************************************************************
1120; *
1121; Function: Parse the parameters of MultiTrack= command. *
1122; *
1123; Input : *
1124; ES:SI -> parameters in command line. *
1125; Output: *
1126; Turn MulTrk_Flag on or off. *
1127; *
1128; Subroutines to be called: *
1129; Sysinit_Parse *
1130; Logic: *
1131; { *
1132; Set DI to Brk_Parms; *
1133; Set DX,CX to 0; *
1134; While (End of command line) *
1135; { Sysinit_Parse; *
1136; if (no error) then *
1137; if (Result_Val.$P_Item_Tag == 1) then /*ON */ *
1138; Set P_Mtrk, on; *
1139; else /*OFF */ *
1140; Set P_Mtrk, off; *
1141; else {Show message;Error_Exit}; *
1142; }; *
1143; If (no error) then *
1144; DOS function call to set MulTrk_Flag according to P_Mtrk. *
1145; *
1146; }; *
1147; *
1148;********************************************************************************
1149TryM: ;AN002;
1150 CMP AH,'M' ;AN002;
1151 JNZ TRYW ;AN002;
1152 mov di, offset Mtrk_Parms ;AN002;
1153 xor cx,cx ;AN002;
1154 mov dx,cx ;AN002;
1155; $SEARCH ;AN002;
1156$$DO28:
1157 call Sysinit_Parse ;AN002;
1158; $EXITIF C ;AN002; Parse error
1159 JNC $$IF28
1160 call Badparm_p ;AN007; Show message and end the serach loop.
1161; $ORELSE ;AN002;
1162 JMP SHORT $$SR28
1163$$IF28:
1164 cmp ax, $P_RC_EOL ;AN002; End of Line?
1165; $LEAVE E ;AN002; then end the $ENDLOOP
1166 JE $$EN28
1167 cmp Result_Val.$P_ITEM_TAG, 1 ;AN002;
1168; $IF E ;AN002;
1169 JNE $$IF32
1170 mov P_Mtrk, 1 ;AN002; Turn it on temporarily.
1171; $ELSE ;AN002;
1172 JMP SHORT $$EN32
1173$$IF32:
1174 mov P_Mtrk, 0 ;AN002; Turn it off temporarily.
1175; $ENDIF ;AN002;
1176$$EN32:
1177; $ENDLOOP ;AN002; we actually set the MulTrk_Flag here.
1178 JMP SHORT $$DO28
1179$$EN28:
1180 push ds ;AN002;
1181 mov ax, Code ;AN002;
1182 mov ds, ax ;AN002;
1183 assume ds:Code
1184 cmp P_Mtrk, 0 ;AN002;
1185; $IF E ;AN002;
1186 JNE $$IF36
1187 mov MulTrk_Flag, MULTRK_OFF2 ;AN002; 0001h
1188; $ELSE ;AN002;
1189 JMP SHORT $$EN36
1190$$IF36:
1191 mov MulTrk_Flag, MULTRK_ON ;AN002; 8000h
1192; $ENDIF ;AN002;
1193$$EN36:
1194 pop ds ;AN002;
1195 assume ds:SYSINITSEG
1196; $ENDSRCH ;AN002;
1197$$SR28:
1198 jmp Coff ;AN002;
1199
1200;------------------------------------------------------------------------------
1201; CPSW command
1202;------------------------------------------------------------------------------
1203;*******************************************************************************
1204; *
1205; Function: Parse the parameters of CPSW= command. *
1206; *
1207; Input : *
1208; ES:SI -> parameters in command line. *
1209; Output: *
1210; Turn CPSW on or off. *
1211; *
1212; Subroutines to be called: *
1213; Sysinit_Parse *
1214; Logic: *
1215; { *
1216; Set DI to CPSW_Parms; *
1217; Set DX,CX to 0; *
1218; While (End of command line) *
1219; { Sysinit_Parse; *
1220; if (no error) then *
1221; if (Result_Val.$P_Item_Tag == 1) then /*ON */ *
1222; Set P_CPSW, on; *
1223; else /*OFF */ *
1224; Set P_CPSW, off; *
1225; else {Show message;Error_Exit}; *
1226; }; *
1227; If (no error) then *
1228; DOS function call to set CPSW according to P_CPSW. *
1229; }; *
1230; *
1231;********************************************************************************
1232TryW: ;AN002;
1233 CMP AH,'W' ;AN002;
1234 JNZ TRYDJ ;AN002;
1235 mov di, offset CPSW_Parms ;AN002;
1236 xor cx,cx ;AN002;
1237 mov dx,cx ;AN002;
1238; $SEARCH ;AN002;
1239$$DO40:
1240 call Sysinit_Parse ;AN002;
1241; $EXITIF C ;AN002; Parse error
1242 JNC $$IF40
1243 call Badparm_p ;AN007; Show message and end the serach loop.
1244; $ORELSE ;AN002;
1245 JMP SHORT $$SR40
1246$$IF40:
1247 cmp ax, $P_RC_EOL ;AN002; End of Line?
1248; $LEAVE E ;AN002; then end the $ENDLOOP
1249 JE $$EN40
1250 cmp Result_Val.$P_ITEM_TAG, 1 ;AN002;
1251; $IF E ;AN002;
1252 JNE $$IF44
1253 mov P_CPSW, 1 ;AN002; Turn it on temporarily.
1254; $ELSE ;AN002;
1255 JMP SHORT $$EN44
1256$$IF44:
1257 mov P_CPSW, 0 ;AN002; Turn it off temporarily.
1258; $ENDIF ;AN002;
1259$$EN44:
1260; $ENDLOOP ;AN002; we actually set the MulTrk_Flag here.
1261 JMP SHORT $$DO40
1262$$EN40:
1263 mov ah, SET_CTRL_C_TRAPPING ;AN000; The same function number as Ctrl_Break
1264 mov al, 4 ;AN000; Set CPSW state function
1265 mov dl, P_CPSW ;AN000; 0=off, 1=on
1266 Int 21h ;AN000;
1267; $ENDSRCH ;AN002;
1268$$SR40:
1269 jmp Coff ;AN002;
1270
1271;------------------------------------------------------------------------------
1272; Device command
1273;------------------------------------------------------------------------------
1274TRYDJ:
1275 and cs:IFS_Flag, NOT_IFS ;AN000; Reset the flag
1276 CMP AH,'D'
1277 JZ GOTDJ
1278 CMP AH,'J'
1279 jz GOTJ
1280 JMP TRYQ
1281GOTJ: ;AN000; IFS= command.
1282 or cs:[IFS_Flag], IS_IFS ;AN000; set the flag.
1283 cmp Multi_Pass_Id, 2 ;second pass?
1284 je GOTDJ ;then proceed
1285 jmp Coff ;else ignore this until the second pass.
1286
1287; jmp GOTDJ_Cont
1288;GOTD:
1289; test cs:[IFS_Flag], HAD_IFS ;AN000; Cannot have DEVICE= command after IFS= command.
1290; jz GOTDJ_Cont ;AN000;
1291; call Incorrect_Order ;AN000; Display "Incorrect order ..." msg.
1292; jmp COFF ;AN000;
1293
1294GOTDJ:
1295 MOV BX,CS ;DEVICE= or IFS= command.
1296 MOV DS,BX
1297
1298 MOV WORD PTR [BPB_ADDR],SI
1299 MOV WORD PTR [BPB_ADDR+2],ES
1300
1301;J.K. In case it is for IFS=, then set the parameter pointer.
1302 mov word ptr [ifs_rh.IFSR_PARMS@], SI ;AN000; for IFS
1303 mov word ptr [ifs_rh.IFSR_PARMS@+2], ES ;AN000;
1304
1305 CALL ROUND
1306;J.K. Set up the DEVMARK entries here for MEM command.
1307;J.K. Only the DEVMARK_ID and DEVMARK_FILENAME will be set.
1308;J.K. DEVMARK_SIZE should be set after a successful process of this file.
1309 call Set_DevMark ;AN004;
1310 inc [MEMHI] ;AN004;Size of DEVMARK is a paragraph!!
1311 ;Don't forget decrease MEMHI
1312 ; with an unsuccessful process of this file!!.
1313 XOR AX,AX
1314 MOV WORD PTR [ENTRY_POINT],AX
1315 MOV AX,[MEMHI]
1316 MOV WORD PTR [ENTRY_POINT+2],AX ;SET ENTRY POINT
1317
1318 IF NOT NOEXEC
1319 MOV [LDOFF],AX ;SET LOAD OFFSET
1320 ENDIF
1321
1322 PUSH ES
1323 POP DS
1324ASSUME DS:NOTHING
1325 MOV DX,SI ;DS:DX POINTS TO FILE NAME
1326
1327 IF NOEXEC
1328 LES BX,DWORD PTR CS:[MEMLO]
1329 CALL LDFIL ;LOAD IN THE DEVICE DRIVER
1330 ELSE
1331; We are going to open the cdevice driver and size it as is done
1332; in LDFIL. The reason we must do this is that EXEC does NO checking
1333; for us. We must make sure there is room to load the device without
1334; trashing SYSINIT. This code is not
1335; perfect (for instance .EXE device drivers are possible) because
1336; it does its sizing based on the assumption that the file being loaded
1337; is a .COM file. It is close enough to correctness to be usable.
1338 MOV ES,AX ;ES:0 is LOAD addr
1339 MOV AX,OPEN SHL 8 ;OPEN THE FILE
1340 STC ;IN CASE OF INT 24
1341 INT 21H
1342 JC BADLDRESET
1343 MOV BX,AX ;Handle in BX
1344;AN016; UNDO THE EXTENDED ATTRIBUTE HANDLING
1345; call Get_Ext_Attribute ;AN009;
1346; jc BadLdReset ;AN009;
1347; test cs:[IFS_Flag], IS_IFS ;AN009;
1348; jnz Chk_Ext_Attr_IFS ;AN009;
1349; cmp al, EA_UNSPECIFIED ;AN009;Check the extended attr. for device driver
1350; je Ext_Attr_Ok ;AN009; Allow 0 and EA_DEVICE_DRIVER
1351; cmp al, EA_DEVICE_DRIVER ;AN009;
1352; je Ext_Attr_Ok ;AN009;
1353; stc ;AN012;BadLdReset depends on the carry bit.
1354; jmp BadLdReset ;AN009;
1355;Chk_Ext_Attr_IFS: ;AN009;
1356; cmp al, EA_IFS_DRIVER ;AN009;
1357; je Ext_Attr_Ok ;AN012;
1358; stc ;AN012;
1359; jmp BadLdReset ;AN012;
1360;Ext_Attr_Ok: ;AN009;
1361 PUSH DX ; Save pointer to name
1362 XOR CX,CX
1363 XOR DX,DX
1364 MOV AX,(LSEEK SHL 8) OR 2
1365 STC ;IN CASE OF INT 24
1366 INT 21H ; Get file size in DX:AX
1367 JNC GO_AHEAD_LOAD
1368 MOV AH,CLOSE ; Close file
1369 INT 21H
1370 POP DX ; Clean stack
1371 STC ; Close may clear carry
1372 JMP SHORT BADLDRESET
1373
1374GO_AHEAD_LOAD:
1375 ; Convert size in DX:AX to para in AX
1376 ADD AX,15 ; Round up size for conversion to para
1377 ADC DX,0
1378 MOV CL,4
1379 SHR AX,CL
1380 MOV CL,12
1381 SHL DX,CL ; Low nibble of DX to high nibble
1382 OR AX,DX ; AX is now # of para for file
1383
1384 MOV CX,ES ; CX:0 is xaddr
1385 ADD CX,AX ; New device will take up to here
1386 JC MEM_ERRJY ; WOW!!!!
1387 CMP CX,CS:[ALLOCLIM]
1388 JB OKLDX
1389MEM_ERRJY:
1390 JMP MEM_ERR
1391
1392OKLDX:
1393 POP DX ; Recover name pointer
1394 MOV AH,CLOSE ; Close file
1395 INT 21H
1396 MOV BX,CS
1397 MOV ES,BX
1398 MOV BX,OFFSET PRMBLK ;ES:BX POINTS TO PARAMETERS
1399 MOV AL,3
1400 MOV AH,EXEC
1401 STC ;IN CASE OF INT 24
1402 INT 21H ;LOAD IN THE DEVICE DRIVER
1403 ENDIF
1404
1405BADLDRESET:
1406 PUSH DS
1407 POP ES ;ES:SI BACK TO CONFIG.SYS
1408 PUSH CS
1409 POP DS ;DS BACK TO SYSINIT
1410ASSUME DS:SYSINITSEG
1411 JNC GOODLD
1412BADBRK:
1413 test cs:[SetDevMarkFlag],SETBRKDONE ;AN004;If already Set_Break is done,
1414 jnz Skip0_ResetMEMHI ;AN004; then do not
1415 dec cs:[MEMHI] ;AN004;Adjust MEMHI by a paragrah of DEVMARK.
1416Skip0_ResetMEMHI:
1417 cmp byte ptr es:[si], CR ;file name is CR? (Somebody entered "device=" without filename)
1418 jne BADBRK_1
1419 jmp BADOP ;show "Unrecognized command in CONFIG.SYS"
1420BADBRK_1:
1421 invoke BADLOAD
1422 JMP COFF
1423
1424GOODLD:
1425;J.K. If it is IFS=, then we should set IFS_DOSCALL@ field in IFSHEADER.
1426 test cs:[IFS_Flag], IS_IFS ;AN000;
1427 jz Skip_IFSHEADER_Set ;AN000;
1428 push es ;AN000;
1429 push di ;AN000;
1430 push ds ;AN000;
1431 mov bx, word ptr cs:[ENTRY_POINT+2] ;AN000;
1432 mov ds, bx ;AN000; DS:0 will be the header
1433 les di, cs:[DosInfo] ;AN000;
1434 mov bx, word ptr es:[di.SYSI_IFS_DOSCALL@] ;AN000;
1435 mov word ptr ds:[IFS_DOSCALL@], bx ;AN000;
1436 mov bx, word ptr es:[di.SYSI_IFS_DOSCALL@]+2 ;AN000;
1437 mov word ptr ds:[IFS_DOSCALL@]+2, bx ;AN000;
1438 pop ds ;AN000;
1439 pop di ;AN000;
1440 pop es ;AN000;
1441Skip_IFSHEADER_Set: ;AN000;
1442 SaveReg <ES,SI> ;INITIALIZE THE DEVICE
1443; call Chk_IBMCACHE ;AN024 IBMCACHE.SYS problem.;AN026;IBMDOS will handles this thru 4Bh call.
1444Restore:MOV BL,ES:[SI] ; while ((c=*p) != 0)
1445 OR BL,BL
1446 JZ Got
1447 INC SI ; p++;
1448 JMP Restore
1449Got: MOV BYTE PTR ES:[SI],' ' ; *p = ' ';
1450 SaveReg <ES,SI>
1451 PUSH CS
1452 POP ES
1453
1454 test cs:[IFS_Flag], IS_IFS ;AN000;
1455 jz Got_Device_Com ;AN000;
1456 mov bx, IFS_CALL@ ;AN000; offset from the start of IFSHEADER
1457 call CallIFS ;AN000;
1458 jmp short End_Init_Call
1459Got_Device_Com:
1460 push ds ;AN017;
1461 push si ;AN017;
1462 lds si, cs:[ENTRY_POINT] ;AN017; Peeks the header attribute
1463 test word ptr ds:[si.SDEVATT], DEVTYP ;AN017;Block device driver?
1464 jnz Got_Device_Com_Cont ;AN017;No.
1465 lds si, cs:[DOSINFO] ;AN017; DS:SI -> SYS_VAR
1466 cmp ds:[si.SYSI_NUMIO], 26 ;AN017; No more than 26 drive number
1467 jb Got_Device_Com_Cont ;AN017;
1468 pop si ;AN017;
1469 pop ds ;AN017;
1470 pop si ;AN017;clear the stack
1471 pop es ;AN017;
1472 jmp BadNumBlock ;AN017;
1473Got_Device_Com_Cont: ;AN017;
1474 pop si ;AN017;
1475 pop ds ;AN017;
1476 MOV BX,SDEVSTRAT
1477 invoke CALLDEV ; CallDev (SDevStrat);
1478 MOV BX,SDEVINT
1479 invoke CALLDEV ; CallDev (SDevInt);
1480End_Init_Call:
1481 RestoreReg <SI,DS>
1482 MOV BYTE PTR [SI],0 ; *p = 0;
1483
1484 PUSH CS
1485 POP DS
1486
1487 test [IFS_Flag], IS_IFS ;AN000;
1488 jz Was_Device_Com ;AN000;
1489 cmp [ifs_rh.IFSR_RETCODE], 0 ;AN000; Was a success ?
1490 jne Erase_Dev_do ;AN000;
1491 pop si ;AN000; restore es:si to clean up the
1492 pop es ;AN000; stack for Set_Break call.
1493 mov ax, word ptr [Entry_Point+2] ;AN000; Get the loaded segment
1494 add ax, word ptr [ifs_rh.IFSR_RESSIZE] ;AN000;
1495 mov word ptr [Break_addr], 0 ;AN000;
1496 mov word ptr [Break_addr+2], ax ;AN000;
1497 or cs:[SetDevMarkFlag], FOR_DEVMARK ;AN004;
1498 invoke Set_Break ;AN000; Will also check the memory size too.
1499 push es ;AN000; Save it again, in case, for Erase_Dev_Do.
1500 push si ;AN000;
1501 jc Erase_Dev_do ;AN000;
1502Link_IFS: ;AN000;
1503 les di, cs:[dosinfo] ;AN000;
1504 mov cx, word ptr es:[di.SYSI_IFS] ;AN000; save old pointer
1505 mov dx, word ptr es:[di.SYSI_IFS+2] ;AN000;
1506 lds si, cs:[Entry_Point] ;AN000;
1507 mov word ptr es:[di.SYSI_IFS],si ;AN000;
1508 mov word ptr es:[di.SYSI_IFS+2], ds ;AN000;
1509 mov word ptr ds:[si], cx ;AN000; We don't permit multiple IFSs.
1510 mov word ptr ds:[si+2], dx ;AN000;
1511 pop si ;AN000; Restore es:si for the next command.
1512 pop es ;AN000;
1513; mov cs:[IFS_Flag], HAD_IFS ;AN014; Set the flag.
1514 jmp COFF ;AN000;
1515
1516ERASE_DEV_do: ;AC000;; Modified to show message "Error in CONFIG.SYS..."
1517 pop si
1518 pop es
1519 push cs
1520 pop ds
1521 test [SetDevMarkFlag],SETBRKDONE ;AN004;If already Set_Break is done,
1522 jnz Skip1_ResetMEMHI ;AN004; then do not
1523 dec [MEMHI] ;AN004;Adjust MEMHI by a paragrah of DEVMARK.
1524Skip1_ResetMEMHI:
1525 cmp ConfigMsgFlag, 0 ;AN015;
1526 je No_Error_Line_Msg ;AN015;
1527 call Error_Line ;AN021; No "Error in CONFIG.SYS" msg for device driver. DCR D493
1528 mov ConfigMsgFlag, 0 ;AN015;AN021;Set the default value again.
1529No_Error_Line_Msg: ;AN015;
1530 JMP Coff
1531
1532Was_Device_Com: ;AN000;
1533 MOV AX,WORD PTR [BREAK_ADDR+2]
1534 CMP AX,[MEMORY_SIZE]
1535 JB BREAKOK
1536 POP SI
1537 POP ES
1538 JMP BADBRK
1539
1540BREAKOK:
1541 LDS DX,[ENTRY_POINT] ;SET DS:DX TO HEADER
1542 MOV SI,DX
1543 ADD SI,SDEVATT ;DS:SI POINTS TO ATTRIBUTES
1544 LES DI,CS:[DOSINFO] ;ES:DI POINT TO DOS INFO
1545 MOV AX,DS:[SI] ;GET ATTRIBUTES
1546 TEST AX,DEVTYP ;TEST IF BLOCK DEV
1547 JZ ISBLOCK
1548 or cs:[SetDevMarkFlag],FOR_DEVMARK ;AN004;
1549 invoke Set_Break ; Go ahead and alloc mem for device
1550 jc Erase_Dev_do ;device driver's Init routien failed.
1551 TEST AX,ISCIN ;IS IT A CONSOLE IN?
1552 JZ TRYCLK
1553 MOV WORD PTR ES:[DI.SYSI_CON],DX
1554 MOV WORD PTR ES:[DI.SYSI_CON+2],DS
1555
1556TRYCLK: TEST AX,ISCLOCK ;IS IT A CLOCK DEVICE?
1557 JZ GOLINK
1558 MOV WORD PTR ES:[DI+SYSI_CLOCK],DX
1559 MOV WORD PTR ES:[DI+SYSI_CLOCK+2],DS
1560GOLINK: JMP LINKIT
1561
1562ISBLOCK:
1563 MOV AL,CS:[UNITCOUNT] ;IF NO UNITS FOUND, erase the device
1564 OR AL,AL
1565 jz Erase_Dev_do
1566; JNZ PERDRV
1567; MOV AX, -1
1568; JMP ENDDEV
1569
1570PERDRV:
1571 CBW ; WARNING NO DEVICE > 127 UNITS
1572 MOV CX,AX
1573 MOV DH,AH
1574 MOV DL,ES:[DI.SYSI_NUMIO] ;GET NUMBER OF DEVICES
1575 MOV AH,DL
1576 ADD AH,AL ; Check for too many devices
1577 CMP AH,26 ; 'A' - 'Z' is 26 devices
1578 JBE OK_BLOCK
1579BadNumBlock: ;AN017;
1580 PUSH CS
1581 POP DS
1582 MOV DX,OFFSET BADBLOCK
1583 invoke PRINT
1584 JMP ERASE_DEV_do
1585
1586OK_BLOCK:
1587 or cs:[SetDevMarkFlag],FOR_DEVMARK ;AN004;
1588 invoke SET_BREAK ; Alloc the device
1589 ADD ES:[DI.SYSI_NUMIO],AL ;UPDATE THE AMOUNT
1590 ADD CS:DriveNumber,AL ; remember amount for next device
1591 LDS BX,CS:[BPB_ADDR] ;POINT TO BPB ARRAY
1592PERUNIT:
1593 LES BP,CS:[DOSINFO]
1594 LES BP,DWORD PTR ES:[BP.SYSI_DPB] ;GET FIRST DPB
1595
1596SCANDPB:CMP WORD PTR ES:[BP.DPB_NEXT_DPB],-1
1597 JZ FOUNDPB
1598 LES BP,ES:[BP.DPB_NEXT_DPB]
1599 JMP SCANDPB
1600FOUNDPB:
1601 MOV AX,CS:[MEMLO]
1602 MOV WORD PTR ES:[BP.DPB_NEXT_DPB],AX
1603 MOV AX,CS:[MEMHI]
1604 MOV WORD PTR ES:[BP.DPB_NEXT_DPB+2],AX
1605 LES BP,DWORD PTR CS:[MEMLO]
1606 ADD WORD PTR CS:[MEMLO],DPBSIZ
1607 or cs:[SetDevMarkFlag], FOR_DEVMARK ;AN004;Add DPB area for this unit
1608 CALL ROUND ;Check for alloc error
1609 MOV WORD PTR ES:[BP.DPB_NEXT_DPB],-1
1610 MOV ES:[BP.DPB_FIRST_ACCESS],-1
1611
1612 MOV SI,[BX] ;DS:SI POINTS TO BPB
1613 INC BX
1614 INC BX ;POINT TO NEXT GUY
1615 MOV WORD PTR ES:[BP.DPB_DRIVE],DX
1616 MOV AH,SETDPB ;HIDDEN SYSTEM CALL
1617 INT 21H
1618 MOV AX,ES:[BP.DPB_SECTOR_SIZE]
1619 PUSH ES
1620 LES DI,CS:[DOSINFO] ;ES:DI POINT TO DOS INFO
1621 CMP AX,ES:[DI.SYSI_MAXSEC]
1622 POP ES
1623 ja Bad_BPB_Size_Sector
1624 PUSH DS
1625 PUSH DX
1626 LDS DX,CS:[ENTRY_POINT]
1627 MOV WORD PTR ES:[BP.DPB_DRIVER_ADDR],DX
1628 MOV WORD PTR ES:[BP.DPB_DRIVER_ADDR+2],DS
1629 POP DX
1630 POP DS
1631 INC DX
1632 INC DH
1633 LOOP PERUNIT
1634 PUSH CS
1635 POP DS
1636 CALL TEMPCDS ; Set CDS for new drives
1637
1638LINKIT:
1639 LES DI,CS:[DOSINFO] ;ES:DI = DOS TABLE
1640 MOV CX,WORD PTR ES:[DI.SYSI_DEV] ;DX:CX = HEAD OF LIST
1641 MOV DX,WORD PTR ES:[DI.SYSI_DEV+2]
1642
1643 LDS SI,CS:[ENTRY_POINT] ;DS:SI = DEVICE LOCATION
1644 MOV WORD PTR ES:[DI.SYSI_DEV],SI ;SET HEAD OF LIST IN DOS
1645 MOV WORD PTR ES:[DI.SYSI_DEV+2],DS
1646 MOV AX,DS:[SI] ;GET POINTER TO NEXT DEVICE
1647 MOV WORD PTR CS:[ENTRY_POINT],AX ;AND SAVE IT
1648
1649 MOV WORD PTR DS:[SI],CX ;LINK IN THE DRIVER
1650 MOV WORD PTR DS:[SI+2],DX
1651ENDDEV:
1652 POP SI
1653 POP ES
1654 INC AX ;AX = FFFF (no more devs if YES)?
1655 JZ COFFJ3
1656 inc cs:MultDeviceFlag ;AN001; Possibly multiple device driver.
1657 JMP GOODLD ;OTHERWISE PRETEND WE LOADED IT IN
1658COFFJ3: mov cs:MultDeviceFlag, 0 ;AN001; Reset the flag
1659 JMP COFF
1660
1661Bad_BPB_Size_Sector:
1662 POP SI
1663 POP ES
1664 MOV DX,OFFSET BADSIZ_PRE
1665; MOV BX,OFFSET BADSIZ_POST
1666 mov bx, offset CRLFM ;AN???;
1667 invoke PRNERR
1668 test [SetDevMarkFlag],SETBRKDONE ;AN004;If already Set_Break is done,
1669 jnz Skip2_ResetMEMHI ;AN004; then do not
1670 dec [MEMHI] ;AN004;Adjust MEMHI by a paragrah of DEVMARK.
1671Skip2_ResetMEMHI:
1672 JMP COFF
1673
1674
1675;------------------------------------------------------------------------------
1676; Country command
1677; J.K. The syntax is:
1678; COUNTRY=country id {,codepage {,path}}
1679; COUNTRY=country id {,,path} :Default CODEPAGE ID in DOS
1680;------------------------------------------------------------------------------
1681TRYQ:
1682 CMP AH,'Q'
1683 JZ TRYQ_CONT
1684 JMP TRYF
1685TRYQ_CONT:
1686
1687; invoke GETNUM
1688; JZ TryQBad ; 0 is never a valid code, or number is
1689; ; bad
1690; MOV BX,AX ; Country code in BX
1691;
1692; ;J.K. 5/26/86
1693; MOV DX,0 ; assume no code page id
1694;
1695; invoke skip_delim ;skip the delimeters after the first num
1696; jc TryQ_Def_File ;no more characters left? then use default file
1697; cmp al, CR ;
1698; je TryQ_Def_File
1699; cmp al, LF
1700; jne TRYQ_YES_EXTENDED
1701; inc [COUNT] ;This is for NEWLINE routine in COFF.
1702; dec [CHRPTR]
1703;COFFJ41:
1704; JMP TryQ_Def_File ;O.K. no code page, no path specified. Use default path.
1705;
1706;TRYQ_YES_EXTENDED:
1707; cmp al, ',' ;was the second comma?
1708; jne TryQ_GETNUM
1709; invoke skip_delim ;Yes, skip ',' and other possible delim
1710; jmp short TRYQ_PATH ;and No code page id entered.
1711;TRYQ_GETNUM:
1712; invoke GETNUM
1713; jc TryQBadCOM ;"Country=xxx,path" will not be accepted.
1714;; jc TRYQ_PATH ;Codepage is not specified. No code page.
1715;; ;At this point, AL already contain the
1716;; ;first char of the PATH.
1717; jz TryQBad ;codepage=0 entered. Error
1718; mov DX, AX ;save code page in DX
1719; invoke skip_delim ;move CHRPTR to the path string
1720; jc TryQ_Def_File ;no more char? then use default filename
1721; cmp al, CR
1722; je TryQ_Def_File
1723; cmp al, LF
1724; jne TryQ_PATH ;path entered.
1725; inc [COUNT]
1726; dec [CHRPTR]
1727;TryQ_Def_File:
1728; push dx ;save code page
1729; mov cs:CNTRY_DRV, 0 ;flag that the default path has been used!!!
1730; mov dx, offset CNTRY_ROOT ;the default path
1731; jmp TRYQ_OPEN
1732;
1733;TryQBad: ;"Invalid country code or code page"
1734; STC
1735; MOV DX,OFFSET BADCOUNTRY
1736; jmp TryQChkErr
1737;
1738;TryQBadCOM: ;Error in COUNTRY command
1739; STC
1740; MOV DX,OFFSET BADCOUNTRYCOM
1741; jmp TryQChkErr
1742;
1743;TRYQ_PATH: ;DS - sysinitseg, ES - CONFBOT,
1744; mov CX, [COUNT] ;AL - the first char of path
1745; inc CX ;BX - country id, DX - codepage id, 0 = No code page
1746; mov DI, SI
1747;TRYQ_PATH_LOOP: ;find the end of path to put 0 after that.
1748; mov AL, byte ptr ES:[DI]
1749; call delim
1750; jz TRYQ_PATH_END
1751; cmp al, 13
1752; jz TRYQ_PATH_END
1753; inc DI
1754; jmp short TRYQ_PATH_LOOP
1755;TryQBad_Brg:jmp short TryQBad
1756;TRYQ_PATH_END:
1757; mov es:byte ptr [di], 0 ;make it a ASCIIZ string. (Organize did not handle this string)
1758; push ds ;switch ds,es
1759; push es
1760; pop ds
1761; pop es
1762;
1763; mov di, offset CNTRY_DRV ;move the user specified path to CNTRY_DRV
1764; call Move_ASCIIZ
1765;
1766; push ds ;restore ds,es
1767; push es
1768; pop ds
1769; pop es
1770;
1771;; call Set_Country_Path ;set CNTRY_DRV
1772;
1773; push dx ;save DX
1774; mov dx, offset CNTRY_DRV ;Now DS:DX -> CNTRY_DRV
1775
1776 mov Cntry_Drv, 0 ;AN000; Reset the drive,path to default value.
1777 mov P_Code_Page,0 ;AN000;
1778 mov di, offset Cntry_Parms ;AN000;
1779 xor cx,cx ;AN000;
1780 mov dx,cx ;AN000;
1781; $SEARCH ;AN000;
1782$$DO49:
1783 call Sysinit_Parse ;AN000;
1784; $EXITIF C ;AN000; Parse error, check the error code and
1785 JNC $$IF49
1786 call Cntry_Error ;AN000; Show message and end the serach loop.
1787 mov P_Cntry_Code, -1 ;AN000; Signals that parse error.
1788; $ORELSE ;AN000;
1789 JMP SHORT $$SR49
1790$$IF49:
1791 cmp ax, $P_RC_EOL ;AN000; End of Line?
1792; $LEAVE E ;AN000; then end the $SEARCH LOOP
1793 JE $$EN49
1794 cmp Result_Val.$P_TYPE, $P_NUMBER ;AN000; Numeric?
1795; $IF E ;AN000;
1796 JNE $$IF53
1797 mov ax, word ptr Result_Val.$P_PICKED_VAL ;AN000;
1798 cmp cx, 1 ;AN000;
1799; $IF E ;AN000;
1800 JNE $$IF54
1801 mov P_Cntry_Code, ax ;AN000;
1802; $ELSE ;AN000;
1803 JMP SHORT $$EN54
1804$$IF54:
1805 mov P_Code_Page, ax ;AN000;
1806; $ENDIF ;AN000;
1807$$EN54:
1808; $ELSE ;AN000; Path entered.
1809 JMP SHORT $$EN53
1810$$IF53:
1811 push ds ;AN000;
1812 push es ;AN000;
1813 push si ;AN000;
1814 push di ;AN000;
1815 push cs ;AN000;
1816 pop es ;AN000;
1817 lds si, RV_Dword ;AN000; Move the path to known place.
1818 mov di, offset CNTRY_Drv ;AN000;
1819 call Move_ASCIIZ ;AN000;
1820 pop di ;AN000;
1821 pop si ;AN000;
1822 pop es ;AN000;
1823 pop ds ;AN000;
1824; $ENDIF ;AN000;
1825$$EN53:
1826; $ENDLOOP
1827 JMP SHORT $$DO49
1828$$EN49:
1829; $ENDSRCH ;AN000;
1830$$SR49:
1831 cmp P_Cntry_Code, -1 ;AN000; Had a parse error?
1832 jne TRYQ_OPEN ;AN000;
1833 jmp Coff ;AN000;
1834
1835TryQBad: ;"Invalid country code or code page"
1836 STC
1837 MOV DX,OFFSET BADCOUNTRY
1838 jmp TryQChkErr
1839
1840TRYQ_OPEN:
1841 cmp CNTRY_Drv, 0 ;AC000;
1842 je TRYQ_Def ;AC000;
1843 mov dx, offset CNTRY_Drv ;AC000;
1844 jmp TryQ_Openit ;AC000;
1845TRYQ_Def: ;AC000;
1846 mov dx, offset CNTRY_Root ;AC000;
1847TryQ_Openit:
1848 mov ax, 3d00h ;open a file
1849 stc
1850 int 21h
1851 jc TryQFileBad ;open failure
1852
1853 mov cs:CntryFileHandle, ax ;save file handle
1854 mov bx, ax
1855 mov ax, cs:P_Cntry_Code ;AN000;
1856 mov dx, cs:P_Code_Page ;AN000; Now, AX=country id, bx=filehandle
1857; xchg ax, bx ;now, AX = country id, BX = file handle
1858 mov cx, cs:[MEMHI]
1859 add cx, 128 ;I need 2K buffer to handle COUNTRY.SYS
1860 cmp cx, cs:[ALLOCLIM]
1861 ja TryQMemory ;cannot allocate the buffer for country.sys
1862
1863 mov si, offset CNTRY_DRV ;DS:SI -> CNTRY_DRV
1864 cmp byte ptr [si],0 ;default path?
1865 jne TRYQ_Set_for_DOS
1866 inc si
1867 inc si ;DS:SI -> CNTRY_ROOT
1868TRYQ_Set_for_DOS:
1869 les di, cs:SYSI_Country ;ES:DI -> country info tab in DOS
1870 push di ;save di
1871 add di, ccPath_CountrySys
1872 call MOVE_ASCIIZ ;Set the path to COUNTRY.SYS in DOS.
1873 pop di ;ES:DI -> country info tab again.
1874 mov cx, cs:[MEMHI]
1875 mov ds, cx
1876 xor si, si ;DS:SI -> 2K buffer to be used.
1877 call SetDOSCountryInfo ;now do the job!!!
1878 jnc TryQchkERR ;read error or could not find country,code page combination
1879 cmp cx, -1 ;Could not find matching country_id,code page?
1880 je TryQBad ;then "Invalid country code or code page"
1881TryQFileBad:
1882 push cs ;AN000;
1883 pop es ;AN000;
1884 cmp cs:CNTRY_DRV,0 ;Is the default file used?
1885 je TryQDefBad
1886; mov si, cs:[CONFBOT]
1887; mov es, si
1888; mov si, cs:[CHRPTR]
1889; dec si ;ES:SI -> path in CONFBOT
1890 mov si, offset CNTRY_Drv
1891 jmp short TryQBADLOAD
1892TryQDefBad: ;Default file has been used.
1893; push cs
1894; pop es
1895 mov si, offset CNTRY_ROOT ;ES:SI -> \COUNTRY.SYS in SYSINIT_SEG
1896TryQBADLOAD:
1897 call BADLOAD ;DS will be restored to SYSINIT_SEG
1898 mov cx, cs:[CONFBOT]
1899 mov es, cx ;Restore ES -> CONFBOT.
1900 jmp short CoffJ4
1901TryQMemory:
1902 MOV DX,OFFSET INSUFMEMORY
1903TryQChkErr:
1904 mov cx, cs:[CONFBOT]
1905 mov es, cx ;restore ES -> CONFBOT seg
1906 push cs
1907 pop ds ;retore DS to SYSINIT_SEG
1908 jnc CoffJ4 ;if no error, then exit
1909 invoke PRINT ;else show error message
1910 call Error_Line ;AN000;
1911CoffJ4:
1912 mov bx, CntryFileHandle
1913 mov ah, 3eh
1914 int 21h ;close a file. Don't care even if it fails.
1915 JMP COFF
1916
1917Cntry_Error proc near
1918;Function: Show "Invalid country code or code page" messages, or
1919; "Error in COUNTRY command" depending on the error code
1920; in AX returned by SYSPARSE;
1921;In: AX - error code
1922; DS - Sysinitseg
1923; ES - CONFBOT
1924;Out: Show message. DX destroyed.
1925
1926 cmp ax, $P_OUT_OF_RANGE
1927; $IF E
1928 JNE $$IF61
1929 mov dx, offset BadCountry ;"Invalid country code or code page"
1930; $ELSE
1931 JMP SHORT $$EN61
1932$$IF61:
1933 mov dx, offset BadCountryCom ;"Error in CONTRY command"
1934; $ENDIF
1935$$EN61:
1936 invoke Print
1937 call Error_Line
1938 ret
1939Cntry_Error endp
1940
1941;------------------------------------------------------------------------------
1942; Files command
1943;------------------------------------------------------------------------------
1944;*******************************************************************************
1945; Function: Parse the parameters of FILES= command. *
1946; *
1947; Input : *
1948; ES:SI -> parameters in command line. *
1949; Output: *
1950; Variable FILES set. *
1951; *
1952; Subroutines to be called: *
1953; Sysinit_Parse *
1954; Logic: *
1955; { *
1956; Set DI points to FILES_Parms; *
1957; Set DX,CX to 0; *
1958; While (End of command line) *
1959; { Sysinit_parse; *
1960; if (no error) then *
1961; Files = Result_Val.$P_Picked_Val *
1962; else *
1963; Error Exit; *
1964; }; *
1965; }; *
1966; *
1967;*******************************************************************************
1968TRYF:
1969 CMP AH,'F'
1970 JNZ TRYL
1971
1972; invoke GETNUM
1973; CMP AX,5 ;j.k. change it to 8!!!!!!!!
1974; JB TryFBad ; Gotta have at least 5
1975; CMP AX,256
1976; JAE TryFBad ; Has to be a byte
1977; MOV [FILES],AL
1978;CoffJ5: JMP COFF
1979;TryFBad:JMP BadOp
1980
1981 mov di, offset Files_Parms ;AN000;
1982 xor cx, cx ;AN000;
1983 mov dx, cx ;AN000;
1984
1985; $SEARCH ;AN000;
1986$$DO64:
1987 call Sysinit_Parse ;AN000;
1988; $EXITIF C ;AN000; Parse Error,
1989 JNC $$IF64
1990 call Badparm_p ;AN007; and Show messages and end the search loop.
1991; $ORELSE ;AN000;
1992 JMP SHORT $$SR64
1993$$IF64:
1994 cmp ax, $P_RC_EOL ;AN000; End of Line?
1995; $LEAVE E ;AN000; then end the $ENDLOOP
1996 JE $$EN64
1997 mov al, byte ptr Result_Val.$P_PICKED_VAL ;AN000;
1998 mov P_Files, al ;AN000; Save it temporarily
1999; $ENDLOOP ;AN000;
2000 JMP SHORT $$DO64
2001$$EN64:
2002 mov al, P_Files ;AN000;
2003 mov Files, al ;AN000; No error. Really set the value now.
2004; $ENDSRCH ;AN000;
2005$$SR64:
2006 jmp Coff
2007
2008;------------------------------------------------------------------------------
2009; LastDrive command
2010;------------------------------------------------------------------------------
2011;*******************************************************************************
2012; Function: Parse the parameters of LASTDRIVE= command. *
2013; *
2014; Input : *
2015; ES:SI -> parameters in command line. *
2016; Output: *
2017; Set the variable NUM_CDS. *
2018; *
2019; Subroutines to be called: *
2020; Sysinit_Parse *
2021; Logic: *
2022; { *
2023; Set DI points to LDRV_Parms; *
2024; Set DX,CX to 0; *
2025; While (End of command line) *
2026; { Sysinit_Parse; *
2027; if (no error) then *
2028; Set NUM_CDS to the returned value; *
2029; else /*Error exit*/ *
2030; Error Exit; *
2031; }; *
2032; }; *
2033; *
2034;*******************************************************************************
2035TRYL:
2036 CMP AH,'L'
2037 JNZ TRYP
2038
2039; OR AL,020h
2040; SUB AL,'a'
2041; JB TryLBad
2042; INC AL
2043; CMP AL,26 ; a-z are allowed
2044; JA TryLBad
2045; MOV [NUM_CDS],AL
2046;CoffJ6: JMP COFF
2047;TryLBad:JMP BadOp
2048
2049 mov di, offset LDRV_Parms ;AN000;
2050 xor cx, cx ;AN000;
2051 mov dx, cx ;AN000;
2052
2053; $SEARCH ;AN000;
2054$$DO70:
2055 call Sysinit_Parse ;AN000;
2056; $EXITIF C ;AN000; Parse Error,
2057 JNC $$IF70
2058 call Badparm_p ;AN007; and Show messages and end the search loop.
2059; $ORELSE ;AN000;
2060 JMP SHORT $$SR70
2061$$IF70:
2062 cmp ax, $P_RC_EOL ;AN000; End of Line?
2063; $LEAVE E ;AN000; then end the $ENDLOOP
2064 JE $$EN70
2065 mov al, RV_Byte ;AN000; Pick up the drive number
2066 mov P_Ldrv, al ;AN000; Save it temporarily
2067; $ENDLOOP ;AN000;
2068 JMP SHORT $$DO70
2069$$EN70:
2070 mov al, P_Ldrv ;AN000;
2071; sub al, 'A' ;AN000; Convert it to drive number
2072; inc al ;AN000; make it to be a number of drives.
2073 mov Num_CDS, al ;AN000; No error. Really set the value now.
2074; $ENDSRCH ;AN000;
2075$$SR70:
2076 jmp Coff
2077
2078
2079;-------------------------------------------------------------------------------
2080; Setting Drive Parameters
2081;-------------------------------------------------------------------------------
2082TRYP:
2083 CMP AH,'P'
2084 JNZ TRYK
2085 invoke PARSELINE
2086 JC TryPBad
2087 invoke SETPARMS
2088 INVOKE DIDDLEBACK
2089 jc TryPBad
2090 JMP COFF
2091TryPBad:jmp Badop
2092;-------------------------------------------------------------------------------
2093; Setting Internal Stack Parameters
2094; STACKS=M,N where
2095; M is the number of stacks (range 8 to 64, default 9)
2096; N is the stack size (range 32 to 512 bytes, default 128)
2097; J.K. 5/5/86: STACKS=0,0 implies no stack installation.
2098; Any combinations that are not within the specified limits will
2099; result in "Unrecognized command" error.
2100;-------------------------------------------------------------------------------
2101;*******************************************************************************
2102; *
2103; Function: Parse the parameters of STACKS= command. *
2104; The minimum value for "number of stacks" and "stack size" is *
2105; 8 and 32 each. In the definition of SYSPARSE value list, they *
2106; are set to 0. This is for accepting the exceptional case of *
2107; STACKS=0,0 case (,which means do not install the stack.) *
2108; So, after SYSPARSE is done, we have to check if the entered *
2109; values (STACK_COUNT, STACK_SIZE) are within the actual range, *
2110; (or if "0,0" pair has been entered.) *
2111; Input : *
2112; ES:SI -> parameters in command line. *
2113; Output: *
2114; Set the variables STACK_COUNT, STACK_SIZE. *
2115; *
2116; Subroutines to be called: *
2117; Sysinit_Parse *
2118; Logic: *
2119; { *
2120; Set DI points to STKS_Parms; *
2121; Set DX,CX to 0; *
2122; While (End of command line) *
2123; { Sysinit_Parse; *
2124; if (no error) then *
2125; { if (CX == 1) then /* first positional = stack count */ *
2126; P_Stack_Count = Result_Val.$P_Picked_Val; *
2127; if (CX == 2) then /* second positional = stack size */ *
2128; P_Stack_Size = Result_Val.$P_Picked_Val; *
2129; } *
2130; else /*Error exit*/ *
2131; Error Exit; *
2132; }; *
2133; Here check P_STACK_COUNT,P_STACK_SIZE if it meets the condition; *
2134; If O.K., then set Stack_Count, Stack_Size; *
2135; else Error_Exit; *
2136; }; *
2137;*******************************************************************************
2138TRYK:
2139 CMP AH,'K'
2140 JE Do_TryK
2141 jmp TRYS
2142
2143 IF STACKSW
2144
2145; MOV SepChr,','
2146; INVOKE GetNum ; Get number of stacks
2147; MOV SepChr,0
2148; cmp ax, 0 ;J.K. 5/5/86
2149; je TRYK_0 ;J.K. Let's accept 0.
2150; CMP AX, MinCount ; 8 <= Number of Stacks <= 64
2151; JB TryKBad
2152; CMP AX, MaxCount
2153; JA TryKBad
2154;TRYK_0:
2155; MOV [STACK_COUNT], AX
2156;
2157; Skip delimiters after the first number.
2158;
2159; invoke Skip_delim ;J.K.
2160; JC TryKBad
2161;
2162; INVOKE GetNum ; Get size of individual stack
2163; JC TryKBad ; Number bad
2164;
2165; cmp ax, 0 ;J.K. 5/5/86
2166; je TRYK_SIZE0 ;J.K. 5/5/86. Accept 0
2167;
2168; CMP AX, MinSize ; 32 <= Stack Size <= 512
2169; JB TryKBad
2170; CMP AX, MaxSize
2171; JA TryKBad
2172;TRYK_SIZE0:
2173; MOV [STACK_SIZE], AX
2174; cmp ax,0
2175; je TRYK_BOTH0
2176;TRYK_OK:
2177; mov word ptr [stack_addr], -1 ;set the flag that the user entered stacks= command.
2178; JMP COFF
2179;TRYK_BOTH0:
2180; cmp [STACK_COUNT],0 ;stack_size = 0. Stack_Count = 0 too?
2181; je TRYK_OK ;yes. accepted.
2182;TryKBad:
2183; MOV DX, OFFSET BADSTACK ;J.K. 5/26/86 "Invalid stack parameter"
2184; invoke PRINT
2185; JMP COFF
2186
2187Do_TryK:
2188 mov di, offset STKS_Parms ;AN000;
2189 xor cx, cx ;AN000;
2190 mov dx, cx ;AN000;
2191
2192; $SEARCH ;AN000;
2193$$DO76:
2194 call Sysinit_Parse ;AN000;
2195; $EXITIF C ;AN000; Parse Error,
2196 JNC $$IF76
2197 mov dx, offset BadStack ;AN000; "Invalid stack parameter"
2198 call Print ;AN000; and Show messages and end the search loop.
2199 call Error_Line ;AN006;
2200; $ORELSE ;AN000;
2201 JMP SHORT $$SR76
2202$$IF76:
2203 cmp ax, $P_RC_EOL ;AN000; End of Line?
2204; $LEAVE E ;AN000; then end the $ENDLOOP
2205 JE $$EN76
2206 mov ax, word ptr Result_Val.$P_PICKED_VAL ;AN000;
2207 cmp cx, 1 ;AN000;
2208; $IF E ;AN000;
2209 JNE $$IF80
2210 mov P_Stack_Count, ax ;AN000;
2211; $ELSE ;AN000;
2212 JMP SHORT $$EN80
2213$$IF80:
2214 mov P_Stack_Size, ax ;AN000;
2215; $ENDIF ;AN000;
2216$$EN80:
2217; $ENDLOOP ;AN000;
2218 JMP SHORT $$DO76
2219$$EN76:
2220 cmp P_Stack_Count, 0 ;AN000;
2221; $IF NE ;AN000;
2222 JE $$IF84
2223 cmp P_Stack_Count, MINCOUNT ;AN000;
2224; $IF B,OR ;AN000;
2225 JB $$LL85
2226 cmp P_Stack_Size, MINSIZE ;AN000;
2227; $IF B ;AN000;
2228 JNB $$IF85
2229$$LL85:
2230 mov P_Stack_Count, -1 ;AN000; Invalid
2231; $ENDIF ;AN000;
2232$$IF85:
2233; $ELSE ;AN000;
2234 JMP SHORT $$EN84
2235$$IF84:
2236 cmp P_Stack_Size, 0 ;AN000;
2237; $IF NE ;AN000;
2238 JE $$IF88
2239 mov P_Stack_Count, -1 ;AN000; Invalid
2240; $ENDIF ;AN000;
2241$$IF88:
2242; $ENDIF ;AN000;
2243$$EN84:
2244 cmp P_Stack_Count, -1 ;AN000; Invalid?
2245; $IF E ;AN000;
2246 JNE $$IF91
2247 mov Stack_Count, DEFAULTCOUNT ;AN000;Reset to default value.
2248 mov Stack_Size, DEFAULTSIZE ;AN000;
2249 mov word ptr STACK_ADDR, 0 ;AN000;
2250 mov dx, offset BadStack ;AN000;
2251 call Print ;AN000;
2252 call Error_Line ;AN006;
2253; $ELSE ;AN000;
2254 JMP SHORT $$EN91
2255$$IF91:
2256 mov ax, P_Stack_Count ;AN000;
2257 mov Stack_Count, ax ;AN000;
2258 mov ax, P_Stack_Size ;AN000;
2259 mov Stack_Size, ax ;AN000;
2260 mov word ptr Stack_Addr, -1 ;AN000;STACKS= been accepted.
2261; $ENDIF ;AN000;
2262$$EN91:
2263; $ENDSRCH ;AN000;
2264$$SR76:
2265 jmp Coff
2266 ENDIF
2267;------------------------------------------------------------------------------
2268; Switch command ;No longer supported.
2269;------------------------------------------------------------------------------
2270;TRYW:
2271; CMP AH,'W'
2272; JNZ TRYA
2273; JMP BadOp ; no longer implemented
2274; MOV DL,AL
2275; MOV AX,(CHAR_OPER SHL 8) OR 1 ;SET SWITCH CHARACTER
2276; MOV [COMMAND_LINE+1],DL
2277; INT 21H
2278; JMP COFF
2279;------------------------------------------------------------------------------
2280; Availdev command ;No longer supported.
2281;------------------------------------------------------------------------------
2282;TRYA:
2283; CMP AH,'A'
2284; JNZ TRYS
2285; JMP BadOp ; NO LONGER IMPLEMENTED
2286; CMP AL,'F' ;FIRST LETTER OF "FALSE"
2287; JNZ COFFJ7
2288; MOV AX,(CHAR_OPER SHL 8) OR 3 ;TURN ON "/DEV" PREFIX
2289; XOR DL,DL
2290; INT 21H
2291;COFFJ7: JMP COFF
2292
2293;------------------------------------------------------------------------------
2294; shell command
2295;------------------------------------------------------------------------------
2296TRYS:
2297 CMP AH,'S'
2298 JNZ TRYX
2299 MOV [COMMAND_LINE+1],0
2300 MOV DI,OFFSET COMMND + 1
2301 MOV [DI-1],AL
2302STORESHELL:
2303 CALL GETCHR
2304 OR AL,AL
2305 JZ GETSHPARMS
2306 CMP AL," "
2307 JB ENDSH
2308 MOV [DI],AL
2309 INC DI
2310 JMP STORESHELL
2311
2312ENDSH:
2313 MOV BYTE PTR [DI],0
2314 CALL GETCHR
2315 CMP AL,LF
2316 JNZ CONV
2317 CALL GETCHR
2318CONV: JMP CONFLP
2319
2320GETSHPARMS:
2321 MOV BYTE PTR [DI],0
2322 MOV DI,OFFSET COMMAND_LINE+1
2323PARMLOOP:
2324 CALL GETCHR
2325 CMP AL," "
2326 JB ENDSH
2327 MOV [DI],AL
2328 INC DI
2329 JMP PARMLOOP
2330
2331;------------------------------------------------------------------------------
2332; FCBS Command
2333;------------------------------------------------------------------------------
2334;*******************************************************************************
2335; Function: Parse the parameters of FCBS= command. *
2336; *
2337; Input : *
2338; ES:SI -> parameters in command line. *
2339; Output: *
2340; Set the variables FCBS, KEEP. *
2341; *
2342; Subroutines to be called: *
2343; Sysinit_Parse *
2344; Logic: *
2345; { *
2346; Set DI points to FCBS_Parms; *
2347; Set DX,CX to 0; *
2348; While (End of command line) *
2349; { SYSPARSE; *
2350; if (no error) then *
2351; { if (CX == 1) then /* first positional = FCBS */ *
2352; FCBS = Result_Val.$P_Picked_Val; *
2353; if (CX == 2) then /* second positional = KEEP */ *
2354; KEEP = Result_Val.$P_Picked_Val; *
2355; } *
2356; else /*Error exit*/ *
2357; Error Exit; *
2358; }; *
2359; }; *
2360;*******************************************************************************
2361TRYX:
2362 CMP AH,'X'
2363 JNZ TRYY
2364; invoke GETNUM
2365; JZ TryXBad ; gotta have at least one
2366; CMP AX,256
2367; JAE TryXBad ; Can't be more than 8 bits worth
2368; MOV [FCBS],AL
2369;
2370; Skip delimiters after the first number including ","
2371;
2372; invoke Skip_delim ;J.K.
2373; jc tryxbad
2374; invoke GetNum
2375; JC TryXBad ; Number bad (Zero is OK here)
2376; CMP AX,256
2377; JAE TryXBad
2378; CMP AL,FCBS
2379; JA TryXBad
2380; MOV Keep,AL
2381; JMP COFF
2382;TryXBad:JMP BadOp
2383
2384 mov di, offset FCBS_Parms ;AN000;
2385 xor cx, cx ;AN000;
2386 mov dx, cx ;AN000;
2387
2388; $SEARCH ;AN000;
2389$$DO95:
2390 call Sysinit_Parse ;AN000;
2391; $EXITIF C ;AN000; Parse Error,
2392 JNC $$IF95
2393 call Badparm_p ;AN007; and Show messages and end the search loop.
2394; $ORELSE ;AN000;
2395 JMP SHORT $$SR95
2396$$IF95:
2397 cmp ax, $P_RC_EOL ;AN000; End of Line?
2398; $LEAVE E ;AN000; then end the $ENDLOOP
2399 JE $$EN95
2400 mov al, byte ptr Result_Val.$P_PICKED_VAL ;AN000;
2401 cmp cx, 1 ;AN000; The first positional?
2402; $IF E ;AN000;
2403 JNE $$IF99
2404 mov P_Fcbs, al ;AN000;
2405; $ELSE ;AN000;
2406 JMP SHORT $$EN99
2407$$IF99:
2408 mov P_Keep, al ;AN000;
2409; $ENDIF ;AN000;
2410$$EN99:
2411; $ENDLOOP ;AN000;
2412 JMP SHORT $$DO95
2413$$EN95:
2414 mov al, P_Fcbs ;AN005;make sure P_Fcbs >= P_Keep
2415 cmp al, P_Keep ;AN005;
2416; $IF B ;AN005;
2417 JNB $$IF103
2418; call Badop_p ;AN005;
2419 call Badparm_p ;AN011;show "Bad parameter -" msg.
2420 mov P_Keep, 0 ;AN005;
2421; $ELSE ;AN005;
2422 JMP SHORT $$EN103
2423$$IF103:
2424 mov Fcbs, al ;AN000; No error. Really set the value now.
2425 mov al, P_Keep ;AN000;
2426 mov Keep, al ;AN000;
2427; $ENDIF ;AN005;
2428$$EN103:
2429; $ENDSRCH ;AN000;
2430$$SR95:
2431 jmp Coff
2432
2433;------------------------------------------------------------------------------
2434; Comment= Do nothing. Just decrese CHRPTR, and increase COUNT for correct
2435; line number
2436;------------------------------------------------------------------------------
2437TRYY: ;AN000;
2438 cmp ah, 'Y' ;AN000;
2439 jne Try0 ;AN000;
2440DoNothing:
2441 dec CHRPTR ;AN000;
2442 inc COUNT ;AN000;
2443 jmp COFF ;AN000;
2444
2445;------------------------------------------------------------------------------
2446; REM command
2447;------------------------------------------------------------------------------
2448Try0: ;AN003;do nothing with this line.
2449 cmp ah, '0' ;AN003;
2450 je DoNothing ;AN003;
2451
2452;------------------------------------------------------------------------------
2453; SWITCHES command
2454;------------------------------------------------------------------------------
2455;*******************************************************************************
2456; *
2457; Function: Parse the option switches specified. *
2458; Note - This command is intended for the future use also. When we need to *
2459; to set system data flag, use this command. *
2460; *
2461; Input : *
2462; ES:SI -> parameters in command line. *
2463; Output: *
2464; P_Swit_K set if /K option chosen. *
2465; *
2466; Subroutines to be called: *
2467; Sysinit_Parse *
2468; Logic: *
2469; { *
2470; Set DI points to Swit_Parms; /*Parse control definition*/ *
2471; Set DX,CX to 0; *
2472; While (End of command line) *
2473; { Sysinit_parse; *
2474; if (no error) then *
2475; if (Result_Val.$P_SYNONYM_ptr == Swit_K) then *
2476; P_Swit_K = 1 *
2477; endif *
2478; else {Show Error message;Error Exit} *
2479; }; *
2480; }; *
2481; *
2482;*******************************************************************************
2483
2484 cmp ah, '1' ;AN019;Switches= command entered?
2485 jne Tryz ;AN019;
2486
2487 mov di, offset Swit_Parms ;AN019;
2488 xor cx, cx ;AN019;
2489 mov dx, cx ;AN019;
2490
2491; $SEARCH ;AN019;
2492$$DO107:
2493 call Sysinit_Parse ;AN019;
2494; $EXITIF C ;AN019; Parse Error,
2495 JNC $$IF107
2496 call Badparm_p ;AN019; and Show messages and end the search loop.
2497; $ORELSE ;AN019;
2498 JMP SHORT $$SR107
2499$$IF107:
2500 cmp ax, $P_RC_EOL ;AN019; End of Line?
2501; $LEAVE E ;AN019; then jmp to $Endloop for semantic check.
2502 JE $$EN107
2503 cmp Result_Val.$P_SYNONYM_PTR, offset Swit_K ;AN019;
2504; $IF E ;AN019;
2505 JNE $$IF111
2506 mov P_Swit_K, 1 ;AN019; set the flag
2507; $ENDIF ;AN019;
2508$$IF111:
2509; $ENDLOOP ;AN019;
2510 JMP SHORT $$DO107
2511$$EN107:
2512 cmp P_Swit_K, 1 ;AN019;If /K entered,
2513 push ds ;AN019;
2514 mov ax, Code ;AN019;
2515 mov ds, ax ;AN019;
2516 assume ds:Code ;AN019;
2517; $IF E ;AN019;
2518 JNE $$IF114
2519 mov KEYRD_Func, 0 ;AN019;Use the conventional keyboard functions
2520 mov KEYSTS_Func, 1 ;AN019;
2521; $ENDIF ;AN019;
2522$$IF114:
2523 pop ds ;AN019;
2524 assume ds:SYSINITSEG ;AN019;
2525; $ENDSRCH ;AN019;
2526$$SR107:
2527 jmp Coff ;AN019;
2528
2529;------------------------------------------------------------------------------
2530; Bogus command
2531;------------------------------------------------------------------------------
2532TRYZ:
2533 cmp ah, 0FFh ;AN029;
2534 je TryFF ;AN029;
2535 dec CHRPTR
2536 inc COUNT
2537 JMP BADOP
2538
2539;------------------------------------------------------------------------------
2540; Null command
2541;------------------------------------------------------------------------------
2542TryFF: ;AN029;Skip this command.
2543 jmp DoNothing ;AN029;
2544
2545GETCHR:
2546 PUSH CX
2547 MOV CX,COUNT
2548 JCXZ NOCHAR
2549 MOV SI,CHRPTR
2550 MOV AL,ES:[SI]
2551 DEC COUNT
2552 INC CHRPTR
2553 CLC
2554GET_RET:
2555 POP CX
2556 return
2557NOCHAR: STC
2558 JMP SHORT GET_RET
2559
2560Incorrect_Order proc near ;AN000;
2561;Show "Incorrect order in CONFIG.SYS ..." message.
2562 mov dx, offset BADORDER ;AN000;
2563 call print ;AN000;
2564 call ShowLineNum ;AN000;
2565 ret ;AN000;
2566Incorrect_Order endp ;AN000;
2567;
2568 public Error_Line
2569Error_Line proc near ;AN000;
2570;Show "Error in CONFIG.SYS ..." message.
2571 push cs ;AN000;
2572 pop ds ;AN000;
2573 mov dx, offset ErrorCmd ;AN000;
2574 call print ;AN000;
2575 call ShowLineNum ;AN000;
2576 ret ;AN000;
2577Error_Line endp ;AN000;
2578;
2579ShowLineNum proc near ;AN000;
2580;J.K. Convert the binary LineCount to Decimal ASCII string in ShowCount
2581;and Display Showcount at the current curser position.
2582;In.) LineCount
2583;
2584;Out) the number is printed.
2585 push es ;AN000;
2586 push ds ;AN000;
2587 push di ;AN000;
2588
2589 push cs ;AN000;
2590 pop es ;AN000; es=cs
2591 push cs ;AN000;
2592 pop ds ;AN000;
2593
2594; mov ax, ' '
2595; mov di, offset ShowCount ;clean it up.
2596; stosw
2597; stosw
2598; stosb ;lenght of ShowCount is 5.
2599; dec di ;let DI points to the least significant ASCII field.
2600
2601 mov di, offset ShowCount+4 ;AN000; DI -> the least significant decimal field.
2602 mov cx, 10 ;AN000; decimal devide factor
2603 mov ax, cs:LineCount ;AN000;
2604SLN_Loop: ;AN000;
2605 cmp ax, 10 ;AN000; < 10?
2606 jb SLN_Last ;AN000;
2607 xor dx,dx ;AN000;
2608 div cx ;AN000;
2609 or dl, 30h ;AN000; add "0" (= 30h) to make it an ascii.
2610 mov [di],dl ;AN000;
2611 dec di ;AN000;
2612 jmp SLN_Loop ;AN000;
2613SLN_Last: ;AN000;
2614 or al, 30h ;AN000;
2615 mov [di],al ;AN000;
2616 mov dx, di ;AN000;
2617 call print ;AN000; show it.
2618 pop di ;AN000;
2619 pop ds ;AN000;
2620 pop es ;AN000;
2621 ret ;AN000;
2622ShowLineNum endp ;AN000;
2623
2624
2625CallIFS proc near ;AN000;
2626;*******************************************************************************
2627; Function: Interface to IFS call. This procedure will call IFS_CALL@ *
2628; *
2629; Input : *
2630; Entry_Point - Segment:Offset of loaded IFS. *
2631; BX = IFS_CALL@ (offset of IFS_CALL@ from the IFS header) *
2632; ES = Segment of IFS request header *
2633; IFS_Packet - IFS Request packet *
2634; *
2635; Output: Nothing *
2636;*******************************************************************************
2637 push ax ;AN000;
2638 mov ds, word ptr cs:[Entry_Point+2] ;AN000;
2639 add bx, word ptr cs:[Entry_Point] ;AN000; DS:[BX] = Real IFS_CALL@ addr.
2640 mov ax, ds:[bx] ;AN000; save it
2641 push word ptr cs:[Entry_Point] ;AN000; save Entry point offset
2642 mov word ptr cs:[Entry_Point], ax ;AN000; set for the call
2643 mov bx, offset IFS_RH ;AN000; Now, ES:BX -> Request packet
2644 call cs:[Entry_Point] ;AN000; Far call
2645 pop word ptr cs:[Entry_Point] ;AN000; Restore Entry point offset
2646 pop ax ;AN000;
2647 ret ;AN000;
2648CallIFS endp ;AN000;
2649
2650
2651Set_DevMark proc near ;AN004;
2652;*******************************************************************************
2653; Function: Set a paragraph of informations infront of a Device file or *
2654; an IFS file to be loaded for MEM command. *
2655; The structure is: *
2656; DEVMARK_ID byte "D" for device, "I" for IFS *
2657; DEVMARK_SIZE size in para for the device loaded *
2658; DEVMARK_FILENAME 11 bytes. Filename *
2659; *
2660; Input : *
2661; [MEMHI] = address to set up DEVMARK. *
2662; [MEMLO] = 0 *
2663; ES:SI -> pointer to [drive][path]filename,0 *
2664; [IFS_Flag] = IS_IFS bit set if IFS= command. *
2665; *
2666; Output: DEVMARK_ID, DEVMARK_FILENAME set *
2667; cs:[DevMark_addr] set. *
2668; AX, CX register destroyed. *
2669;*******************************************************************************
2670 push ds ;AN004;
2671 push si ;AN004;
2672 push es ;AN004;
2673 push di ;AN004;
2674
2675 mov di, cs:[MEMHI] ;AN004;
2676 mov ds, di ;AN004;
2677 assume ds:nothing ;AN004;
2678 mov [DevMark_Addr], di ;AN004; save the DEVMARK address for the future.
2679 test [IFS_Flag], IS_IFS ;AN004;
2680 jnz SDVMK_IFS ;AN004;
2681 mov al, DEVMARK_DEVICE ;AN004; ='D'
2682 jmp short SDVMK_ID ;AN004;
2683SDVMK_IFS:
2684 mov al, DEVMARK_IFS ;AN004; ='I'
2685SDVMK_ID: ;AN004;
2686 mov ds:[DEVMARK_ID], al ;AN004;
2687 inc di ;AN008;
2688 mov ds:[DEVMARK_SEG], di ;AN008;
2689 xor al,al ;AN004;
2690 push si ;AN004;
2691 pop di ;AN004; now es:si = es:di = [path]filename,0
2692 mov cx, 128 ;AN004; Maximum 128 char
2693 repnz scasb ;AN004; find 0
2694 dec di ;AN020; Now es:di-> 0
2695SDVMK_Backward: ;AN004; find the pointer to the start of the filename.
2696 mov al, byte ptr es:[di] ;AN004;;AN020;We do this by check es:di backward until
2697 cmp al, '\' ;AN004;;AN020; DI = SI or DI -> '\' or DI -> ':'.
2698 je SDVMK_GotFile ;AN004;;AN020;
2699 cmp al, ':' ;AN004;
2700 je SDVMK_GotFile ;AN004;
2701 cmp di, si ;AN004;
2702 je SDVMK_FilePtr ;AN004;
2703 dec di ;AN004;
2704 jmp SDVMK_BackWard ;AN004;
2705SDVMK_GotFile: ;AN004;
2706 inc di ;AN004;
2707SDVMK_FilePtr: ;AN004; now es:di -> start of file name
2708 push di ;AN004;
2709 pop si ;AN004; save di to si.
2710 push ds ;AN004; switch es, ds
2711 push es ;AN004;
2712 pop ds ;AN004;
2713 pop es ;AN004; now, ds:si -> start of filename
2714 mov di, DEVMARK_FILENAME ;AN004;
2715 push di ;AN004;
2716 mov al, ' ' ;AN004;
2717 mov cx, 8 ;AN004;
2718 rep stosb ;AN004; Clean up Memory.
2719 pop di ;AN004;
2720 mov cx, 8 ;AN004; Max 8 char. only
2721SDVMK_Loop: ;AN004;
2722 lodsb ;AN004;
2723 cmp al, '.' ;AN004;
2724 je SDVMK_Done ;AN004;
2725 cmp al, 0 ;AN004;
2726 je SDVMK_Done ;AN004;
2727 stosb ;AN004;
2728 loop SDVMK_Loop ;AN004;
2729SDVMK_Done: ;AN004;
2730 pop di ;AN004;
2731 pop es ;AN004;
2732 pop si ;AN004;
2733 pop ds ;AN004;
2734 ret ;AN004;
2735Set_DevMark endp ;AN004;
2736
2737Chk_XMAEM proc near ;AN029;
2738;Function: Check XMAEM.SYS file name.
2739;In: ES:SI -> path, filename, 0
2740;out: if XMAEM.SYS, then zero flag set.
2741
2742 push es ;AN029;
2743 push si ;AN029;
2744 push ds ;AN029;
2745 push di ;AN029;
2746 push cx ;AN029;
2747 mov di, si ;AN029;save current starting pointer
2748CX_Cmp: ;AN029;
2749 cmp byte ptr es:[si], 0 ;AN029;
2750 je CX_Endfile ;AN029;
2751 inc si ;AN029;
2752 jmp CX_Cmp ;AN029;
2753CX_Endfile: ;AN029;
2754 dec si ;AN029;
2755 cmp byte ptr es:[si], '\' ;AN029;
2756 je CX_Got_Tail ;AN029;
2757 cmp byte ptr es:[si], ':' ;AN029;
2758 je CX_Got_Tail ;AN029;
2759 cmp di, si ;AN029;
2760 je CX_Got_Tail0 ;AN029;
2761 jmp CX_Endfile ;AN029;
2762CX_Got_Tail: ;AN029;
2763 inc si ;AN029;
2764CX_Got_Tail0: ;AN029;
2765 push cs ;AN029;
2766 pop ds ;AN029;
2767 push si ;AN029;
2768 pop di ;AN029;now es:di -> filename,0
2769 mov cx, 9 ;AN029;
2770 mov si, offset XMAEM_File ;AN029;ds:si -> XMAEM.SYS,0
2771 repe cmpsb ;AN029;
2772CX_Ret: ;AN029;
2773 pop cx ;AN029;
2774 pop di ;AN029;
2775 pop ds ;AN029;
2776 pop si ;AN029;
2777 pop es ;AN029;
2778 ret ;AN029;
2779Chk_XMAEM endp
2780
2781;Chk_IBMCACHE proc near ;AN024;AN026; Don't need this any more.
2782 ; IBMDOS is going to handle this through 4Bh call.
2783;Function: IBMCACHE.SYS does not handle a DOS version 4.0 or above.
2784; So, this procedure will check if the device driver is IBMCACHE.SYS.
2785; If it is, through new INT 2fh interface "Set/Restore DOS version"
2786; AX=122Fh
2787; DX= 0 ; reset
2788; otherwise ; DH = minor version, DL = major version
2789; INT 2fh
2790;In: ES:SI -> path, filename, 0
2791;out: if IBMCACHE.SYS, then DOS version changed to 4.00 temporarily.
2792; Reset_Dos_Version proc will later reset it back to current DOS version 4.0.
2793
2794; push es ;AN024;
2795; push si ;AN024;
2796; push ds ;AN024;
2797; push di ;AN024;
2798; push cx ;AN024;
2799; mov di, si ;AN024;save current starting pointer
2800;CIC_Cmp: ;AN024;
2801; cmp byte ptr es:[si], 0 ;AN024;
2802; je CIC_Endfile ;AN024;
2803; inc si ;AN024;
2804; jmp CIC_Cmp ;AN024;
2805;CIC_Endfile: ;AN024;
2806; dec si ;AN024;
2807; cmp byte ptr es:[si], '\' ;AN024;
2808; je CIC_Got_Tail ;AN024;
2809; cmp byte ptr es:[si], ':' ;AN024;
2810; je CIC_Got_Tail ;AN024;
2811; cmp di, si ;AN024;
2812; je CIC_Got_Tail0 ;AN024;
2813; jmp CIC_Endfile ;AN024;
2814;CIC_Got_Tail: ;AN024;
2815; inc si ;AN024;
2816;CIC_Got_Tail0: ;AN024;
2817; push cs ;AN024;
2818; pop ds ;AN024;
2819; push si ;AN024;
2820; pop di ;AN024;now es:di -> filename,0
2821; mov cx, 12 ;AN024;
2822; mov si, offset IBMCACHE_File ;AN024;ds:si -> IBMCACHE.SYS,0
2823; repe cmpsb ;AN024;
2824; jnz CIC_ret ;AN024;
2825; mov ax, 122Fh ;AN024;Change DOS version to
2826; mov dx, 2803h ;AN024; DOS 3.4 temporarily.
2827; int 2fh ;AN024;
2828;CIC_Ret: ;AN024;
2829; pop cx ;AN024;
2830; pop di ;AN024;
2831; pop ds ;AN024;
2832; pop si ;AN024;
2833; pop es ;AN024;
2834; ret ;AN024;
2835;Chk_IBMCACHE endp
2836;
2837
2838Reset_DOS_Version proc near ;AN024;
2839;Function: issue AX=122Fh, DX=0, INT 2fh to restore the DOS version.
2840 push ax ;AN024;
2841 push dx ;AN024;
2842 mov ax, 122Fh ;AN024;
2843 mov dx, 0 ;AN024;
2844 int 2fh ;AN024;
2845 pop dx ;AN024;
2846 pop ax ;AN024;
2847 ret ;AN024;
2848Reset_DOS_Version endp
2849
2850
2851;Int 2F EMS handler + Int 67h handler for EMS
2852;=========================================================================
2853; Int_2F_EMS - This routine provides support for VDISK,
2854; FASTOPEN, and BUFFERS to determine the physical
2855; EMS pages available for their usage.
2856;
2857; Inputs : AH - Function code (18h) to return available phys. page
2858; DI - FEh (Signals to return useable page for VDISK & FASTOPEN)
2859; FFh (Signals to return useable page for BUFFERS)
2860;
2861; AL = 0 is for installation check. - J.K.
2862;
2863; Outputs : ES - Segment value for physical page
2864; DI - Physical Page number
2865; AH - Non-zero (physical page not available)
2866; Zero (valid physical page data returned)
2867;
2868; For installation check, AL = 0FFh for being present. - J.K.
2869; For the other functions, AX = 0 for successful op.
2870; AX = -1 for an error.
2871;
2872; Date : 5/5/88
2873; Release : DOS 4.0
2874;=========================================================================
2875
2876;Int_2F_Handler proc ;traps Int_2f and checks for EMS ;an000; dms;
2877
2878EMS_STUB_START label byte ;AN030;J.K.
2879;Dummy DEVICE HEADER for other dummy ;AN031; Symphony assumes int 67h handler seg as a device driver!
2880 DD -1 ;AN031;becomes pointer to next device header
2881 DW 0C040H ;AN031;attribute (character device)
2882 DW 0000 ;AN031;pointer to harzard area. System will hang.
2883 DW 0000 ;AN031;pointer to harzard area. System will hang.
2884 DB 'EMMXXXX0' ;AN031;device name
2885
2886INTV2F equ $-EMS_STUB_START ;AN030;J.K.pointer to old 2Fh handler ;an000; dms;
2887IntV2FO DW ? ;AN030;;offset ;an000; dms;
2888IntV2FS DW ? ;AN030;;segment ;an000; dms;
2889
2890OLDINT67_VECTOR equ $-EMS_STUB_START ;AN030;J.K.
2891OldInt67 dd ? ;AN030;; save pointer to old INT 67 handler here
2892
2893IF BUFFERFLAG
2894
2895LOCKFLAG equ $-EMS_STUB_START
2896LOCK_FLAG db ?
2897
2898ELSE
2899
2900EMSPAGE_CNT equ $-EMS_STUB_START ;AN030;J.K.
2901EMSPageCount dw ? ;AN030;; save count of EMS mappable pages here
2902
2903EMSReservedArray_X label word ;AN030;;J.K. For initialization routine
2904EMSRESERVEDARRAY equ $-EMS_STUB_START ;AN030;;J.K.
2905 dw 0ffffh,0ffffh ;AN030;; array of reserved pages
2906 dw 0ffffh,0ffffh ;AN030;; phys_page_segment, phys_page_number * 2 entries
2907MappableArray_X label word ;AN030;;J.K. for initialization routine
2908MAPPABLEARRAY equ $-EMS_STUB_START ;AN030;;J.K.
2909 dw 64 dup (0,0) ;AN030;; table to get addresses from old INT 67 handler
2910
2911ENDIF
2912 ; 64 entries * 2 words
2913NEWEMS2F_OFF equ $-EMS_STUB_START;AN030;
2914Int_2F_EMS: ;AN030;;J.K. Name changed.
2915 cmp ah,1Bh ;AN030;;AN032;2Fh trap for Mappable Phys. Add. Array ;an000; dms;
2916 je Int_2F_EMS_MINE ;AN030;;This one we want ;an000; dms;
2917
2918 jmp dword ptr cs:IntV2F ;AN030;;go to old interrupt handler ;an000; dms;
2919
2920Int_2F_EMS_MINE: ;AN030;
2921 or al, al ;AN030;;J.K. Installation check?
2922 jnz Int_2F_5800_Func ;AN030;;J.K.
2923 mov al, 0FFh ;AN030;;J.K. Yes, I am here!
2924 iret ;AN030;;J.K.
2925
2926Int_2F_5800_Func: ;AN030;
2927
2928IF BUFFERFLAG
2929; int 3
2930 cmp di, 80h
2931 jne st_flag
2932 mov byte ptr cs:LOCKFLAG, 0
2933 jmp Int_2f_5800_Good_Exit
2934st_flag:
2935 cmp di, 81h
2936 jne Int_2f_5800_Err_Exit
2937 mov byte ptr cs:LOCKFLAG, 1
2938 jmp Int_2f_5800_Good_Exit
2939ELSE
2940
2941 push si ;AN030;; ;an000; dms;
2942
2943; mov si,offset EMSReservedArray ;point to array containing pages ;an000; dms;
2944 mov si, EMSRESERVEDARRAY ;AN030;;J.K.
2945
2946 cmp di,0feh ;AN030;;VDISK or FASTOPEN request? ;an000; dms;
2947 jne Int_2F_5800_Buff_Ck ;AN030;;no - check for buffers ;an000; dms;
2948
2949 cmp word ptr cs:[si],0ffffh ;AN030;;valid entry? ;an000; dms;
2950 je Int_2F_5800_Err_Exit ;AN030;;no - exit ;an000; dms;
2951
2952 mov es,word ptr cs:[si] ;AN030;;get segment value ;an000; dms;
2953 mov di,word ptr cs:[si+2] ;AN030;;get physical page value ;an000; dms;
2954 jmp Int_2F_5800_Good_Exit ;AN030;;exit routine ;an000; dms;
2955
2956Int_2F_5800_Buff_Ck: ;AN030;
2957
2958 cmp di,0ffh ;AN030;;BUFFERS request? ;an000; dms;
2959 jne Int_2F_5800_Err_Exit ;AN030;;no - exit with error ;an000; dms;
2960
2961 add si,4 ;AN030;;point to second element in array ;an000; dms;
2962
2963 cmp word ptr cs:[si],0ffffh ;AN034;;valid entry? ;an000; dms;
2964 je Int_2F_5800_Err_Exit ;AN034;;no - exit ;an000; dms;
2965
2966 mov es,word ptr cs:[si] ;AN030;;get segment value ;an000; dms;
2967 mov di,word ptr cs:[si+2] ;AN030;;get physical page value ;an000; dms;
2968
2969ENDIF
2970
2971Int_2F_5800_Good_Exit: ;AN030;
2972
2973 xor ax,ax ;AN030;;signal good return ;an000; dms;
2974 jmp Int_2F_Exit ;AN030;;exit routine ;an000; dms;
2975
2976Int_2F_5800_Err_Exit: ;AN030;
2977
2978 mov ax,0ffffh ;AN030;;signal error ;an000; dms;
2979
2980Int_2F_Exit: ;AN030;
2981
2982
2983IF NOT BUFFERFLAG
2984 pop si ;AN030;;restore regs ;an000; dms;
2985ENDIF
2986 iret ;AN030;;return to caller ;an000; dms;
2987
2988
2989
2990;-------------------------------------------------------------------
2991;
2992; INT 67h Filter
2993;
2994; This routine filters INT 67's looking for AH=58h. When initialized,
2995; the original INT 67 handler is called and the mappable address array
2996; is changed to "reserve" two pages for DOS use. This new array is
2997; then returned to the calling program when INT 67 AH=58h is found.
2998;
2999; Information about the two pages "reserved" for DOS is returned
3000; via an unpublished INT 2Fh interface.
3001;
3002; 5/10/88 for DOS 4.0.
3003;-------------------------------------------------------------------
3004
3005IF NOT BUFFERFLAG
3006
3007GetMappableArray equ 58h ; INT 67 function code for Get Mappable Array
3008GetPageFrame equ 41h ; function code for getting the page frame address
3009null equ 0 ; zero value
3010I67Error8F equ 8fh ;AN031;; invalid sub-function error
3011
3012ENDIF
3013
3014;-------------------------------------------------------------------
3015NEW67_OFFSET equ $-EMS_STUB_START ;J.K.
3016Int67Filter: ;AN030;
3017
3018IF BUFFERFLAG
3019; int 3
3020 cmp byte ptr cs:LOCKFLAG, 1
3021 jne PassThru
3022 mov ah, 80h
3023 stc
3024 iret
3025ELSE
3026 cmp ah,GETMAPPABLEARRAY ;AN030;; is this the INT 67 call we are interested in?
3027 jne PassThru ;AN030;; no, pass it to old INT 67 handler
3028 ;AN030;; yes ...
3029 cmp al,0 ;AN031;; AL=0 return count and table
3030 je I67Fcn0
3031
3032 cmp al,1 ;AN031;; AL=1 return count only
3033 jne I67Error ;AN031;; otherwise, error
3034
3035
3036; return count of mappable pages
3037
3038 sti ;AN031;; turn interrupts on
3039
3040 mov cx,word ptr cs:EMSPAGE_CNT ;AN031;J.K. get number of mappable pages in fake table
3041 xor ah,ah ;AN031;; good return code
3042 iret
3043
3044; return invalid sub-function code
3045
3046I67Error:
3047 sti ;AN031;; turn interrupts on
3048 mov ah,I67Error8F ;AN031;; invalid sub-function error
3049 iret
3050
3051
3052I67Fcn0: ;AN031
3053
3054; copy the fake table to user's buffer
3055
3056 sti ;AN030;; turn interrupts on
3057
3058 push ds ;AN030; save some regs
3059 push di ;AN030;
3060 push si ;AN030;
3061
3062 mov cx,word ptr cs:EMSPAGE_CNT ;AN030;J.K. get number of mappable pages in fake table
3063 shl cx,1 ;AN030;; count * 2 = number of words to copy
3064
3065 push cs ;AN030;; point DS:SI to fake table
3066 pop ds ;AN030;
3067; lea si,MappableArray
3068 mov si, MAPPABLEARRAY ;AN030;;J.K.
3069
3070 rep movsw ;AN030;; copy CX words from DS:SI to ES:DI
3071
3072 xor ah,ah ;AN030;; good return code
3073 mov cx,word ptr cs:EMSPAGE_CNT ;AN030;; page count returned to user in CX
3074
3075
3076 pop si ;AN030;; restore some regs
3077 pop di ;AN030;
3078 pop ds ;AN030;
3079
3080 iret ;AN030;; end of INT 67 filter routine
3081
3082ENDIF
3083
3084;-------------------------------------------------------------------
3085;
3086; PassThru - send request to old INT 67 handler
3087;
3088;-------------------------------------------------------------------
3089
3090PassThru:
3091 jmp dword ptr cs:OldINT67_VECTOR ;AN030;;J.K. jump to old INT 67 handler
3092 ; (IRET will return to calling program)
3093
3094
3095EMS_STUB_END label byte ;AN030;
3096;-------------------------------------------------------------------
3097
3098IF NOT BUFFERFLAG
3099;-------------------------------------------------------------------
3100;
3101; Int67FilterInit - This routine is called to initialize the INT 67
3102; filter. It should be called as soon as possible after installation.
3103;
3104;-------------------------------------------------------------------
3105
3106Int67FilterInit: ;AN030;
3107 push es ;AN030;; save caller's ES:DI
3108 push di ;AN030;
3109
3110 push cs ;AN030;; make ES:DI point to our array
3111 pop es ;AN030;
3112 mov di,offset MappableArray_X ;AN030;
3113
3114; call dword ptr cs:OldInt67 ; get mappable array from EMS DD
3115
3116 mov ah, GetMappableArray ;AN030;
3117 xor al,al ;AN030;
3118 int 67h ;AN030;;J.K.
3119
3120
3121;------------------------
3122; scan table looking for highest phys_page_number
3123
3124 xor ax,ax ;AN030;;
3125
3126 cmp cx,0 ;AN033;; are the any pages left?
3127 je NoMoreEMSPages ;AN033;; no, don't bother looking any more
3128
3129 call GetHighestPage ;AN030;; get highest entry from table
3130
3131 mov EMSReservedArray_X+4,bx ;AN030;; phys_page_segment
3132 mov EMSReservedArray_X+6,ax ;AN030;; phys_page_number
3133
3134 cmp cx,0 ;AN033;; are the any pages left?
3135 je NoMoreEMSPages ;AN033;; no, don't bother looking any more
3136
3137 call GetHighestPage ;AN030;; get next highest entry from table
3138
3139 mov EMSReservedArray_X+0,bx ;AN030;; phys_page_segment
3140 mov EMSReservedArray_X+2,ax ;AN030;; phys_page_number
3141
3142NoMoreEMSPages: ;AN033;;
3143 mov EMSPageCount,cx ;AN030;; save new page count for INT 67 filter
3144
3145 pop di
3146 pop es
3147 ret ;AN030;; return to calling program
3148
3149
3150 page
3151;-------------------------------------------------------------------
3152;
3153; GetHighestPage - returns highest physical page number in AX
3154; and segment for it in BX. A -1 means no valid page found.
3155;
3156;-------------------------------------------------------------------
3157GetHighestPage:
3158
3159 xor ax,ax ;AN030;; zero candidate register
3160 mov bx,ax ;AN030;; zero pointer to candidate page
3161
3162 push cx ;AN030;; save count
3163 push dx ;AN030;
3164 push di ;AN030;; save pointer
3165
3166PageScanLoop: ;AN030;
3167 cmp ax,ES:[di+2] ;AN030;; get phys_page_number
3168 ja LookAtNextPage ;AN030;; this one is lower than the one we are holding
3169
3170 cmp es:[di], 0a000h ; Only reserve pages in memory above 640K..
3171 jb LookAtNextPage ; fix for ps2emm and m20emm with motherboard
3172 ; disabled. 7/25/88. HKN.
3173
3174 mov ax,ES:[di+2] ;AN030;; this one is higher, make it new candidate
3175 mov bx,di ;AN030;; pointer to new candidate page, used to zero
3176 ; it later so we don't get the same one again
3177 mov dx,cx ;AN030;; save count where we found candidate
3178
3179LookAtNextPage: ;AN030;
3180 add di,4 ;AN030;; point to next entry in mappable table
3181
3182 loop PageScanLoop ;AN030;; look at next entry
3183
3184 cmp bx,null ;AN030;; did we find any pages?
3185 jne FoundOne ;AN030;; yes, exit
3186
3187 jmp ReturnError ;AN030;
3188
3189;------------------------
3190FoundOne: ;AN030;
3191 cmp ax,3 ;AN030;; could the one we found be part of a page frame
3192 ja NotFrame ;AN030;; no, carry on
3193
3194; yes, find out if it is part of frame
3195
3196 push ax ;AN030;; save physical page number
3197 push bx ;an030;; dms; bx destroyed by call
3198 mov ah,GetPageFrame ;AN030;; function code to get page frame ...
3199; call dword ptr cs:OldInt67 ; ... from the EMS DD
3200 int 67h ;AN030;;J.K.
3201 or ah,ah ;an030;;dms; error?
3202 pop bx ;an030;;dms; restore bx
3203 pop ax ;AN030;; restore phys page number
3204 jnz NotFrame ;AN030;; no frame available, carry on
3205
3206; there is a frame, this page is part of frame, so return -1's
3207
3208ReturnError: ;AN030;
3209 mov ax,0ffffh ;AN030;; indicate failure
3210 mov bx,ax ;AN030;; ax and bx = -1
3211
3212 pop di ;AN030;; restore pointer
3213 pop dx
3214 pop cx ;AN030;; restore count
3215
3216 jmp GHPExit ;AN030;
3217
3218
3219
3220
3221;------------------------
3222; Found a page, and it is not part of a page frame, so re-pack table
3223; and return info. The entry we "reserve" for DOS must be removed
3224; from the table and the other entries moved up to repack the table.
3225; The count must be reduced by 1 to reflect this change.
3226
3227Notframe: ;AN030;
3228
3229 mov di,bx ;AN030;; make ES:DI point to highest page table entry
3230
3231 mov bx,ES:[di] ;AN030;; get segment address of page
3232
3233 mov cx,dx ;AN030;; get count from candidate page
3234
3235 push ax ;AN030;
3236PackLoop: ;AN030;
3237 mov ax, es:[di+4] ;AN030;
3238 mov es:[di+0], ax ;AN030;
3239 mov ax, es:[di+6] ;AN030;
3240 mov es:[di+2], ax ;AN030;
3241 add di, 4 ;AN030;
3242 loop PackLoop ;AN030;; do it until done
3243 pop ax ;AN030;
3244
3245 pop di ;AN030;; restore pointer
3246 pop dx ;AN030;
3247 pop cx ;AN030;; restore count
3248
3249 sub cx,1 ;AN030;; reduce count by one, one less page in table now
3250
3251GHPExit: ;AN030;
3252
3253 ret ;AN030;; return to caller
3254
3255ENDIF
3256
3257;=========================================================================
3258; EMS_Install_Check : THIS MODULE DETERMINES WHETHER OR NOT EMS IS
3259; INSTALLED FOR THIS SESSION.
3260;
3261; INPUTS : NONE
3262;
3263; OUTPUTS : ES:BX - FRAME ARRAY
3264; CY - EMS NOT AVAILABLE
3265; NC - EMS AVAILABLE
3266;
3267; Date : 5/6/88
3268;=========================================================================
3269
3270EMS_Install_Check proc near ;AN030;; check if EMS is installed ;an000; dms;
3271
3272 push ax ;AN030;; save regs ;an000; dms;
3273
3274 push ds ;AN030;; save ds ;an000; dms;
3275 xor ax,ax ;AN030;; set ax to 0 ;an000; dms;
3276 mov ds,ax ;AN030;; set ds to 0 ;an000; dms;
3277 cmp ds:word ptr[067h*4+0],0 ;AN030;; see if int 67h is there ;an000; dms;
3278 pop ds ;AN030;; restore ds ;an000; dms;
3279 je EMS_Install_Ck_Err_Exit ;AN030;; exit routine - EMS not loaded ;an000; dms;
3280
3281 mov ah,40h ;AN030;; Get Status function ;an000; dms;
3282 xor al,al ;AN030;; clear al ;an000; dms;
3283 int 67h ;AN030;; ;an000; dms;
3284 or ah,ah ;AN030;; EMS installed? ;an000; dms;
3285 jnz EMS_Install_Ck_Err_Exit ;AN030;; exit routine - EMS not loaded ;an000; dms;
3286
3287 mov ah,46h ;AN030;; Get Version number ;an000; dms;
3288 xor al,al ;AN030;; clear al ;an000; dms;
3289 int 67h ;AN030;; ;an000; dms;
3290 cmp al,40h ;AN030;; Version 4.0? ;an000; dms;
3291 jb EMS_Install_Ck_Err_Exit ;AN030;; exit routine - wrong EMS loaded ;an000; dms;
3292
3293 clc ;AN030;; signal EMS loaded ;an000; dms;
3294 jmp EMS_Install_Ck_Exit ;AN030;; exit routine ;an000; dms;
3295
3296EMS_Install_Ck_Err_Exit: ;AN030;
3297
3298 stc ;AN030;; signal EMS not loaded ;an000; dms;
3299
3300EMS_Install_Ck_Exit: ;AN030;
3301
3302 pop ax ;AN030;; restore regs ;an000; dms;
3303
3304 ret ;AN030;; return to caller ;an000; dms;
3305
3306EMS_Install_Check endp ; ;an000; dms;
3307
3308EMS_Stub_Handler proc near ;AN030;
3309;At the request of Architecture Group, this logic is implemented.
3310;Function: If (Buffer_Slash_X <> 0 and EMS_Stub_Installed == 0),
3311; then { call Chk_EMS;
3312; if EMS is there, then install EMS_Stub dynamically
3313; and initialize it.}
3314; Note: EMS_Stub consists of INT 2fh EMS handler and INT 67h handler.
3315; When EMS_Stub is installed, EMS_Stub_Installed will be set to 1.
3316
3317 push es ;AN030;
3318 push si ;AN030;
3319 push ds ;AN030;
3320 push di ;AN030;
3321 push ax ;AN030;
3322 push cx ;AN030;
3323 cmp EMS_Stub_Installed, 0 ;AN030;
3324 je EMS_Stub_X ;AN030;
3325 jmp EMS_SH_Ret ;AN030;
3326EMS_Stub_X: ;AN030;
3327 cmp Buffer_Slash_X, 0 ;AN030;
3328 je EMS_SH_Ret ;AN030;
3329 call EMS_Install_Check ;AN030;
3330 jc EMS_SH_Ret ;AN030;
3331;Install EMS_Stub. ;AN030;
3332EMS_Stub_Do:
3333 push es ;AN030;
3334 xor ax,ax ;AN030;save current Int 2fh, 67h vectors.
3335 mov es, ax ;AN030;
3336 mov ax, word ptr es:[2fh*4] ;AN030;
3337 mov IntV2FO, ax ;AN030;
3338 mov ax, word ptr es:[2fh*4+2] ;AN030;
3339 mov IntV2FS, ax ;AN030;
3340 mov ax, word ptr es:[67h*4] ;AN030;
3341 mov word ptr cs:[OldInt67], ax ;AN030;
3342 mov ax, word ptr es:[67h*4+2] ;AN030;
3343 mov word ptr cs:[OldInt67+2], ax ;AN030;
3344 pop es ;AN030;
3345
3346IF NOT BUFFERFLAG
3347;initalize tables in INT 67h handler
3348 call Int67FilterInit ;AN030;
3349 cmp ax, 0ffffh ; if the page found was part of a lim 4.0 page frame
3350 je EMS_SH_ret ; do not install stub. 7/24/88. HKN
3351ENDIF
3352 call Round ;AN030;
3353 mov ax, DEVMARK_EMS_STUB ;AN030;
3354 call SetDevMark ;AN030;
3355 mov ax, [memhi] ;AN030;
3356 mov es, ax ;AN030;
3357 assume es:nothing ;AN030;
3358 xor di, di ;AN030;
3359 push cs ;AN030;
3360 pop ds ;AN030;
3361 mov cx, offset EMS_STUB_END ;AN030;
3362 mov si, offset EMS_STUB_START ;AN030;
3363 sub cx, si ;AN030;cx = size in byte
3364 mov [memlo], cx ;AN030;
3365 rep movsb ;AN030;
3366 or [SetDevMarkFlag], FOR_DEVMARK ;AN030;set the devmark_size for MEM command.
3367 call Round ;AN030;and get the next [memhi] avaiable.
3368 mov EMS_Stub_Installed, 1 ;AN030;
3369
3370 xor ax, ax ;AN030;
3371 mov ds, ax ;AN030;
3372 cli ;AN030;
3373 mov word ptr ds:[2Fh*4],NEWEMS2F_OFF;AN030;set the new int 2fh, 67h vectors.
3374 mov word ptr ds:[2Fh*4+2], es ;AN030;
3375 mov word ptr ds:[67h*4],NEW67_OFFSET;AN030;
3376 mov word ptr ds:[67h*4+2], es ;AN030;
3377 sti ;AN030;
3378EMS_SH_Ret: ;AN030;
3379 pop cx ;AN030;
3380 pop ax ;AN030;
3381 pop di ;AN030;
3382 pop ds ;AN030;
3383 pop si ;AN030;
3384 pop es ;AN030;
3385 ret ;AN030;
3386
3387EMS_Stub_Handler endp ;AN030;
3388
3389
3390SYSINITSEG ENDS
3391 END
3392 \ No newline at end of file