2 ; SCCSID = @(#)sysconf.asm 0.0 86/10/20
3 TITLE BIOS SYSTEM INITIALIZATION
6 ;==============================================================================
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 ;==============================================================================
57 STACKSW EQU TRUE
;Include Switchable Hardware Stacks
58 IBMJAPVER EQU FALSE
;If TRUE set KANJI true also
60 ALTVECT EQU FALSE
;Switch to build ALTVECT version
63 HAVE_INSTALL_CMD equ
00000001b ;AN018; CONFIG.SYS has INSTALL= commands
64 HAS_INSTALLED equ
00000010b ;AN018; SYSINIT_BASE installed.
66 IS_IFS equ
00000001b ;IFS command?
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;
84 ;dossize equ 0C000H ;J.K. for the debugging version of IBMDOS.
88 include smdossym
.inc ;J.K. Reduced version of DOSSYM.INC
92 include smifssym
.inc ;AN000; Reduced version of IFSSYM.INC.
93 include DEVMARK
.inc ;AN004;
103 ;J.K. 6/29/87 External variable defined in IBMBIO module for Multi-track
104 MULTRK_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.
107 MULTRK_OFF1 EQU
00000000B ;initial value. No "Multitrack=" command entered.
108 MULTRK_OFF2 EQU
00000001B ;User specified Multitrack=off.
110 CODE segment public 'code'
111 EXTRN MulTrk_flag
:word ;AN002;
112 extrn KEYRD_Func
:byte ;AN019;
113 extrn KEYSTS_Func
:byte ;AN019;
115 ;J.K. 6/29/87 End of Multi-track definition.
117 SYSINITSEG
SEGMENT PUBLIC 'SYSTEM_INIT'
119 ASSUME
CS:SYSINITSEG
,DS:NOTHING
,ES:NOTHING
,SS:NOTHING
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
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;
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;
163 ;AN016; Undo the extended attribute handling
164 ; extrn Get_Ext_Attribute:near ;AN009;
168 ; Internal Stack Parameters
179 extrn stack_count
:word
180 extrn stack_size
:word
181 extrn stack_addr
:dword
187 public Multi_Pass
;AN018;AN026;
189 public MultDeviceFlag
190 MultDeviceFlag db 0 ;AN001;
192 DevMark_Addr dw ?
;AN004;Segment address for DEVMARK.
193 public SetDevMarkFlag
194 SetDevMarkFlag db 0 ;AN004;Flag used for DEVMARK
196 EMS_Stub_Installed db 0 ;AN030;
198 Badparm_Ptr
label dword
199 Badparm_Off dw 0 ;AN007;
200 Badparm_Seg dw 0 ;AN007;
202 XMAEM_file db 'XMAEM.SYS',0 ;AN029;
204 ;IBMCACHE_file db 'IBMCACHE.SYS',0;AN024;AN026;To cope with the IBMCACHE.SYS
205 ; problem of DOS version checking.
207 ;******************************************************************************
208 ;Take care of Config.sys file.
209 ;SYSTEM parser data and code.
210 ;******************************************************************************
212 include PSOPTION
.INC ;Parsing options for SYSCONF.
213 include PARSE
.ASM
;together with PSDATA.INC
215 ;Control block definitions for PARSER.
216 ;---------------------------------------------------
217 ; BUFFER = [n | n,m] {/E}
219 Buf_Parms
label byte ;AN000;
220 dw Buf_Parmsx
;AN000;
221 db 1 ;AN000; An extra delimeter list
222 db 1 ;AN000; length is 1
225 Buf_Parmsx
label byte ;AN000;
226 db 1,2 ;AN000; Min 1, Max 2 positional
229 db 1 ;AN000; 1 switch
230 dw SW_X_Ctrl
;AN000;AN025; /X control
231 db 0 ;AN000; no keywords
233 Buf_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
240 Buf_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
246 Buf_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
253 Buf_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.
259 SW_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
265 Switch_X
label byte ;AN000;AN025;
266 db '/X',0 ;AN000;AN025;
268 P_Buffers dw 0 ;AN000;
269 P_H_Buffers dw 0 ;AN000;
270 P_Buffer_Slash_X db 0 ;AN000;AN025;
271 Buffer_Pre_Scan db 0 ;AN030;
273 ;Common definitions -------------
276 Result_Val
label byte ;AN000;
277 db ?
;AN000; type returned
278 db ?
;AN000; item tag returned
279 dw ?
;AN000; ES:offset of the switch defined
280 RV_Byte
label byte ;AN000;
281 RV_Dword
label dword ;AN000;
282 dd ?
;AN000; value if number, or seg:offset to string.
283 ;--------------------------------
285 ; BREAK = [ ON | OFF ]
287 Brk_Parms
label byte ;AN000;
288 dw Brk_Parmsx
;AN000;
289 db 1 ;AN000; An extra delimeter list
290 db 1 ;AN000; length is 1
293 Brk_Parmsx
label byte ;AN000;
294 db 1,1 ;AN000; Min 1, Max 1 positional
296 db 0 ;AN000; no switches
297 db 0 ;AN000; no keywords
299 Brk_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
306 On_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
313 db 2 ;AN000; the 2nd string tag
314 dw Off_String
;AN000;
316 On_String db "ON",0 ;AN000;
317 Off_String db "OFF",0 ;AN000;
319 P_Ctrl_Break db 0 ;AN000; local variable
321 ;--------------------------------
323 ; COUNTRY = n {m {path}}
327 Cntry_Parms
label byte ;AN000;
328 dw Cntry_Parmsx
;AN000;
329 db 1 ;AN000; An extra delimeter list
330 db 1 ;AN000; length is 1
333 Cntry_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
341 Cntry_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
348 Cntry_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
354 Cntry_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
361 Cntry_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
369 P_Cntry_Code dw 0 ;AN000;
370 P_Code_Page dw 0 ;AN000;
372 ;--------------------------------
376 Files_Parms
label byte ;AN000;
377 dw Files_Parmsx
;AN000;
378 db 1 ;AN000; An extra delimeter list
379 db 1 ;AN000; length is 1
382 Files_Parmsx
label byte ;AN000;
383 db 1,1 ;AN000; Min 1, Max 1 positional
385 db 0 ;AN000; no switches
386 db 0 ;AN000; no keywords
388 Files_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
395 Files_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
403 ;--------------------------------
407 FCBS_Parms
label byte ;AN000;
408 dw FCBS_Parmsx
;AN000;
409 db 1 ;AN000; An extra delimeter list
410 db 1 ;AN000; length is 1
413 FCBS_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
420 FCBS_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
427 FCBS_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
433 FCBS_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
440 FCBS_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
449 ;--------------------------------
453 LDRV_Parms
label byte ;AN000;
454 dw LDRV_Parmsx
;AN000;
455 db 1 ;AN000; An extra delimeter list
456 db 1 ;AN000; length is 1
459 LDRV_Parmsx
label byte ;AN000;
460 db 1,1 ;AN000; Min 1, Max 1 positional
462 db 0 ;AN000; no switches
463 db 0 ;AN000; no keywords
465 LDRV_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
474 ;--------------------------------
478 STKS_Parms
label byte ;AN000;
479 dw STKS_Parmsx
;AN000;
480 db 1 ;AN000; An extra delimeter list
481 db 1 ;AN000; length is 1
484 STKS_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
491 STKS_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
498 STKS_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
504 STKS_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
511 STK_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
517 P_Stack_Count dw 0 ;AN000;
518 P_Stack_Size dw 0 ;AN000;
520 ;--------------------------------
522 ; MULTITRACK = [ ON | OFF ]
524 MTrk_Parms
label byte ;AN002;
525 dw MTrk_Parmsx
;AN002;
526 db 1 ;AN002; An extra delimeter list
527 db 1 ;AN002; length is 1
530 MTrk_Parmsx
label byte ;AN002;
531 db 1,1 ;AN002; Min 1, Max 1 positional
533 db 0 ;AN002; no switches
534 db 0 ;AN002; no keywords
536 MTrk_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
545 ;--------------------------------
547 ; CPSW = [ ON | OFF ]
549 CPSW_Parms
label byte ;AN002;
550 dw CPSW_Parmsx
;AN002;
551 db 1 ;AN002; An extra delimeter list
552 db 1 ;AN002; length is 1
555 CPSW_Parmsx
label byte ;AN002;
556 db 1,1 ;AN002; Min 1, Max 1 positional
558 db 0 ;AN002; no switches
559 db 0 ;AN002; no keywords
561 CPSW_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
571 ;--------------------------------
574 Swit_Parms
label byte ;AN019;
575 dw Swit_Parmsx
;AN019;
576 db 1 ;AN019; An extra delimeter list
577 db 1 ;AN019; length is 1
580 Swit_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
586 Swit_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
592 Swit_K
label byte ;AN019;
595 P_Swit_K db 0 ;AN019;
597 ;******************************************************************************
604 MOV AX,(CHAR_OPER
SHL 8) ;GET SWITCH CHARACTER
606 MOV [COMMAND_LINE
+1],DL ; Set in default command line
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
615 No_Config_sys: ;AN028;
616 mov Multi_Pass_Id
, 11 ;AN028; set it to unreasonable number
621 BADOP: MOV DX,OFFSET BADOPM
;WANT TO PRINT COMMAND ERROR "Unrecognized command..."
623 call Error_Line
;show "Error in CONFIG.SYS ..." .
626 Badop_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.
630 pop ds ;set ds to CONFIGSYS seg.
631 mov dx, offset badopm
637 Badparm_p proc
near ;AN007;
638 ;Show "Bad command or parameters - xxxxxx"
639 ;In Badparm_seg, Badparm_off -> xxxxx
641 cmp cs:Buffer_Pre_Scan
, 1 ;AN030; Pre scanning Buffers ... /X?
642 je BadParmp_Ret
;AN030; then do not show any message.
649 mov dx, offset Badparm
;AN007;
650 invoke PRINT
;AN007;"Bad command or parameters - "
651 lds si, Badparm_ptr
;AN007;
652 Badparm_Prt: ;AN007;print "xxxx" until CR.
653 mov dl, byte ptr [si] ;AN007;
654 mov ah,STD_CON_OUTPUT
;AN007;
658 jne Badparm_Prt
;AN007;
661 mov dx, offset CRLFM
;AN007;
663 call Error_Line
;AN007;
667 BadParmp_Ret: ;AN030;
671 NOPROB: ;GET FILE SIZE (NOTE < 64K!!)
675 MOV AX,(LSEEK
SHL 8) OR 2
679 MOV AX,LSEEK
SHL 8 ;Reset pointer to beginning of file
682 mov dx, [ConfBot
] ;AN022;Use current CONFBOT value
684 mov [config_size
], ax ;save the size of config.sys file.
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
690 ASSUME
DS:NOTHING
,ES:NOTHING
698 STC ;IN CASE OF INT 24
699 INT 21H
;Function request
702 ; Find the EOF mark in the file. If present, then trim length.
705 MOV AL,1
Ah ; 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
711 ; We found a 1A. Back up
713 DEC DI ; backup past 1A
715 ; Just for the halibut, stick in an extra EOL
722 SUB DI,DX ; difference moved
723 MOV Count
,DI ; new count
727 RestoreReg
<CX,DI,AX>
737 JC CONFERR
;IF NOT WE'VE GOT A PROBLEM
739 JZ GETCOM
;COULDN'T READ THE FILE
741 MOV DX,OFFSET CONFIG
;WANT TO PRINT CONFIG ERROR
745 Multi_Pass: ;AN018;AN026; called to execute IFS=, INSTALL= commands
748 cmp Multi_Pass_id
, 10 ;J.K.
749 jae Endconv
;J.K. Do nothing. Just return.
751 pop es ;AN018; ES -> Confbot
752 mov si, Org_Count
;AN018;
753 mov Count
, si ;AN018; set Count
755 mov Chrptr
, si ;AN018; reset Chrptr, LineCount
756 mov LineCount
, si ;AN018;
760 invoke ORGANIZE
;ORGANIZE THE FILE
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.
768 call EMS_Stub_handler
;AN030;
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.
780 cmp Multi_Pass_ID
, 2 ;AN026;
781 jae Endconv
;AN026;Do not show Badop again for multi_pass.
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
803 ;------------------------------------------------------------------------------
805 ;------------------------------------------------------------------------------
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
818 Multi_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.
825 Multi_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.
832 cmp ah, 'J' ;AN026; IFS= command?
833 jne Multi_Pass_Filter
;AN026; No. Ignore this.
834 jmp GotJ
;AN026; Handles IFS= command.
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.
842 Multi_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.
849 Multi_Pass_Adjust: ;AN023; These commands need to
850 dec Chrptr
;AN023; adjust chrptr, count
851 inc Count
;AN023; for NEWLINE proc.
852 Multi_Pass_Coff: ;AN023;
853 jmp Coff ;AN018; To handle next INSTALL= commands.
855 ;------------------------------------------------------------------------------
858 ;Set up registers for SysParse
859 ;In) ES:SI -> command line in CONFBOT
860 ; DI -> offset of the parse control defintion.
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
872 ; BL - TErminated delimeter code
873 ; CX - new positional ordinal
874 ; SI - set to pase scanned operand
875 ; DX - selected result buffer
881 pop ds ;now DS:SI -> command line
883 pop es ;now ES:DI -> control definition
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.
889 cmp ax, $P_NO_ERROR
;no error
892 cmp ax, $P_RC_EOL
;or the end of line?
904 pop es ;restore es,ds
908 ;------------------------------------------------------------------------------
910 ;------------------------------------------------------------------------------
911 ;*******************************************************************************
913 ; Function: Parse the parameters of buffers= command. *
916 ; ES:SI -> parameters in command line. *
919 ; Buffer_Slash_X flag set if /X option chosen. *
920 ; H_Buffers set if secondary buffer cache specified. *
922 ; Subroutines to be called: *
926 ; Set DI points to Buf_Parms; /*Parse control definition*/ *
928 ; Reset Buffer_Slash_X; *
929 ; While (End of command line) *
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} *
939 ; If (Buffer_Slash_X is off & Buffers > 99) then Show_Error; *
942 ;*******************************************************************************
943 ;TryB: CMP AH,'B' ;BUFFER COMMAND?
946 ; JZ TryBBad ; Gotta have at least one
947 ; CMP AX,100 ; check for max number
957 mov P_Buffer_Slash_X
, 0 ;AN000;AN025;
958 mov di, offset Buf_Parms
;AN000;
964 call Sysinit_Parse
;AN000;
965 ; $EXITIF C ;AN000; Parse Error,
967 call Badparm_p
;AN007; and Show messages and end the search loop.
971 cmp ax, $P_RC_EOL
;AN000; End of Line?
972 ; $LEAVE E ;AN000; then jmp to $Endloop for semantic check.
974 cmp Result_Val
.$P_SYNONYM_PTR
, offset Switch_X
;AN000;AN025;
977 mov P_Buffer_Slash_X
, 1 ;AN000;AN025; set the flag
981 mov ax, word ptr Result_Val
.$P_PICKED_VAL
;AN000;
985 mov P_Buffers
, ax ;AN000;
989 mov P_H_Buffers
, ax ;AN000;
997 cmp P_Buffers
, 99 ;AN000;
1000 cmp P_Buffer_Slash_X
, 0 ;AN000;AN025;
1003 call Badparm_p
;AN000;
1004 mov P_H_Buffers
, 0 ;AN000;
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.
1022 ;------------------------------------------------------------------------------
1024 ;------------------------------------------------------------------------------
1025 ;*******************************************************************************
1027 ; Function: Parse the parameters of Break = command. *
1030 ; ES:SI -> parameters in command line. *
1032 ; Turn the Control-C check on or off. *
1034 ; Subroutines to be called: *
1038 ; Set DI to Brk_Parms; *
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; *
1046 ; Set P_Ctrl_Break, off; *
1047 ; else {Show message;Error_Exit}; *
1049 ; If (no error) then *
1050 ; DOS function call to set Ctrl_Break check according to *
1053 ;********************************************************************************
1058 ; CMP AL,'O' ;FIRST LETTER OF "ON" or "OFF"
1062 ; CMP AL,'N' ;SECOND LETTER OF "ON"
1064 ; MOV AH,SET_CTRL_C_TRAPPING ;TURN ON CONTROL-C CHECK
1070 ; JNZ TryCBad ; Check for "OFF"
1080 mov di, offset Brk_Parms
;AN000;
1085 call Sysinit_Parse
;AN000;
1086 ; $EXITIF C ;AN000; Parse error
1088 call Badparm_p
;AN007; Show message and end the serach loop.
1092 cmp ax, $P_RC_EOL
;AN000; End of Line?
1093 ; $LEAVE E ;AN000; then end the $ENDLOOP
1095 cmp Result_Val
.$P_ITEM_TAG
, 1 ;AN000;
1098 mov P_Ctrl_Break
, 1 ;AN000; Turn it on
1102 mov P_Ctrl_Break
, 0 ;AN000; Turn it off
1105 ; $ENDLOOP ;AN000; we actually set the ctrl break
1108 mov ah, SET_CTRL_C_TRAPPING
;AN000; if we don't have any parse error.
1110 mov dl, P_Ctrl_Break
;AN000;
1116 ;------------------------------------------------------------------------------
1117 ; MultiTrack command
1118 ;------------------------------------------------------------------------------
1119 ;*******************************************************************************
1121 ; Function: Parse the parameters of MultiTrack= command. *
1124 ; ES:SI -> parameters in command line. *
1126 ; Turn MulTrk_Flag on or off. *
1128 ; Subroutines to be called: *
1132 ; Set DI to Brk_Parms; *
1134 ; While (End of command line) *
1135 ; { Sysinit_Parse; *
1136 ; if (no error) then *
1137 ; if (Result_Val.$P_Item_Tag == 1) then /*ON */ *
1140 ; Set P_Mtrk, off; *
1141 ; else {Show message;Error_Exit}; *
1143 ; If (no error) then *
1144 ; DOS function call to set MulTrk_Flag according to P_Mtrk. *
1148 ;********************************************************************************
1152 mov di, offset Mtrk_Parms
;AN002;
1157 call Sysinit_Parse
;AN002;
1158 ; $EXITIF C ;AN002; Parse error
1160 call Badparm_p
;AN007; Show message and end the serach loop.
1164 cmp ax, $P_RC_EOL
;AN002; End of Line?
1165 ; $LEAVE E ;AN002; then end the $ENDLOOP
1167 cmp Result_Val
.$P_ITEM_TAG
, 1 ;AN002;
1170 mov P_Mtrk
, 1 ;AN002; Turn it on temporarily.
1174 mov P_Mtrk
, 0 ;AN002; Turn it off temporarily.
1177 ; $ENDLOOP ;AN002; we actually set the MulTrk_Flag here.
1181 mov ax, Code ;AN002;
1184 cmp P_Mtrk
, 0 ;AN002;
1187 mov MulTrk_Flag
, MULTRK_OFF2
;AN002; 0001h
1191 mov MulTrk_Flag
, MULTRK_ON
;AN002; 8000h
1195 assume
ds:SYSINITSEG
1200 ;------------------------------------------------------------------------------
1202 ;------------------------------------------------------------------------------
1203 ;*******************************************************************************
1205 ; Function: Parse the parameters of CPSW= command. *
1208 ; ES:SI -> parameters in command line. *
1210 ; Turn CPSW on or off. *
1212 ; Subroutines to be called: *
1216 ; Set DI to CPSW_Parms; *
1218 ; While (End of command line) *
1219 ; { Sysinit_Parse; *
1220 ; if (no error) then *
1221 ; if (Result_Val.$P_Item_Tag == 1) then /*ON */ *
1224 ; Set P_CPSW, off; *
1225 ; else {Show message;Error_Exit}; *
1227 ; If (no error) then *
1228 ; DOS function call to set CPSW according to P_CPSW. *
1231 ;********************************************************************************
1235 mov di, offset CPSW_Parms
;AN002;
1240 call Sysinit_Parse
;AN002;
1241 ; $EXITIF C ;AN002; Parse error
1243 call Badparm_p
;AN007; Show message and end the serach loop.
1247 cmp ax, $P_RC_EOL
;AN002; End of Line?
1248 ; $LEAVE E ;AN002; then end the $ENDLOOP
1250 cmp Result_Val
.$P_ITEM_TAG
, 1 ;AN002;
1253 mov P_CPSW
, 1 ;AN002; Turn it on temporarily.
1257 mov P_CPSW
, 0 ;AN002; Turn it off temporarily.
1260 ; $ENDLOOP ;AN002; we actually set the MulTrk_Flag here.
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
1271 ;------------------------------------------------------------------------------
1273 ;------------------------------------------------------------------------------
1275 and cs:IFS_Flag
, NOT_IFS
;AN000; Reset the flag
1281 GOTJ: ;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.
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.
1295 MOV BX,CS ;DEVICE= or IFS= command.
1298 MOV WORD PTR [BPB_ADDR
],SI
1299 MOV WORD PTR [BPB_ADDR
+2],ES
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;
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!!.
1314 MOV WORD PTR [ENTRY_POINT
],AX
1316 MOV WORD PTR [ENTRY_POINT
+2],AX ;SET ENTRY POINT
1319 MOV [LDOFF
],AX ;SET LOAD OFFSET
1325 MOV DX,SI ;DS:DX POINTS TO FILE NAME
1328 LES BX,DWORD PTR CS:[MEMLO
]
1329 CALL LDFIL
;LOAD IN THE DEVICE DRIVER
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
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;
1359 ; jmp BadLdReset ;AN012;
1360 ;Ext_Attr_Ok: ;AN009;
1361 PUSH DX ; Save pointer to name
1364 MOV AX,(LSEEK
SHL 8) OR 2
1365 STC ;IN CASE OF INT 24
1366 INT 21H
; Get file size in DX:AX
1368 MOV AH,CLOSE
; Close file
1370 POP DX ; Clean stack
1371 STC ; Close may clear carry
1372 JMP SHORT BADLDRESET
1375 ; Convert size in DX:AX to para in AX
1376 ADD AX,15 ; Round up size for conversion to para
1381 SHL DX,CL ; Low nibble of DX to high nibble
1382 OR AX,DX ; AX is now # of para for file
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
]
1393 POP DX ; Recover name pointer
1394 MOV AH,CLOSE
; Close file
1398 MOV BX,OFFSET PRMBLK
;ES:BX POINTS TO PARAMETERS
1401 STC ;IN CASE OF INT 24
1402 INT 21H
;LOAD IN THE DEVICE DRIVER
1407 POP ES ;ES:SI BACK TO CONFIG.SYS
1409 POP DS ;DS BACK TO SYSINIT
1410 ASSUME
DS:SYSINITSEG
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.
1417 cmp byte ptr es:[si], CR
;file name is CR? (Somebody entered "device=" without filename)
1419 jmp BADOP
;show "Unrecognized command in CONFIG.SYS"
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;
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;
1441 Skip_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.
1444 Restore:MOV BL,ES:[SI] ; while ((c=*p) != 0)
1449 Got: MOV BYTE PTR ES:[SI],' ' ; *p = ' ';
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
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;
1470 pop si ;AN017;clear the stack
1472 jmp BadNumBlock
;AN017;
1473 Got_Device_Com_Cont: ;AN017;
1477 invoke CALLDEV
; CallDev (SDevStrat);
1479 invoke CALLDEV
; CallDev (SDevInt);
1482 MOV BYTE PTR [SI],0 ; *p = 0;
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.
1501 jc Erase_Dev_do
;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.
1513 ; mov cs:[IFS_Flag], HAD_IFS ;AN014; Set the flag.
1516 ERASE_DEV_do: ;AC000;; Modified to show message "Error in CONFIG.SYS..."
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.
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.
1529 No_Error_Line_Msg: ;AN015;
1532 Was_Device_Com: ;AN000;
1533 MOV AX,WORD PTR [BREAK_ADDR
+2]
1534 CMP AX,[MEMORY_SIZE
]
1541 LDS DX,[ENTRY_POINT
] ;SET DS:DX TO HEADER
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
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?
1553 MOV WORD PTR ES:[DI.SYSI_CON
],DX
1554 MOV WORD PTR ES:[DI.SYSI_CON
+2],DS
1556 TRYCLK: TEST AX,ISCLOCK
;IS IT A CLOCK DEVICE?
1558 MOV WORD PTR ES:[DI+SYSI_CLOCK
],DX
1559 MOV WORD PTR ES:[DI+SYSI_CLOCK
+2],DS
1563 MOV AL,CS:[UNITCOUNT
] ;IF NO UNITS FOUND, erase the device
1571 CBW ; WARNING NO DEVICE > 127 UNITS
1574 MOV DL,ES:[DI.SYSI_NUMIO
] ;GET NUMBER OF DEVICES
1576 ADD AH,AL ; Check for too many devices
1577 CMP AH,26 ; 'A' - 'Z' is 26 devices
1579 BadNumBlock: ;AN017;
1582 MOV DX,OFFSET BADBLOCK
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
1594 LES BP,DWORD PTR ES:[BP.SYSI_DPB
] ;GET FIRST DPB
1596 SCANDPB:CMP WORD PTR ES:[BP.DPB_NEXT_DPB
],-1
1598 LES BP,ES:[BP.DPB_NEXT_DPB
]
1602 MOV WORD PTR ES:[BP.DPB_NEXT_DPB
],AX
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
1612 MOV SI,[BX] ;DS:SI POINTS TO BPB
1614 INC BX ;POINT TO NEXT GUY
1615 MOV WORD PTR ES:[BP.DPB_DRIVE
],DX
1616 MOV AH,SETDPB
;HIDDEN SYSTEM CALL
1618 MOV AX,ES:[BP.DPB_SECTOR_SIZE
]
1620 LES DI,CS:[DOSINFO
] ;ES:DI POINT TO DOS INFO
1621 CMP AX,ES:[DI.SYSI_MAXSEC
]
1623 ja Bad_BPB_Size_Sector
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
1636 CALL TEMPCDS
; Set CDS for new drives
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]
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
1649 MOV WORD PTR DS:[SI],CX ;LINK IN THE DRIVER
1650 MOV WORD PTR DS:[SI+2],DX
1654 INC AX ;AX = FFFF (no more devs if YES)?
1656 inc cs:MultDeviceFlag
;AN001; Possibly multiple device driver.
1657 JMP GOODLD
;OTHERWISE PRETEND WE LOADED IT IN
1658 COFFJ3: mov cs:MultDeviceFlag
, 0 ;AN001; Reset the flag
1661 Bad_BPB_Size_Sector:
1664 MOV DX,OFFSET BADSIZ_PRE
1665 ; MOV BX,OFFSET BADSIZ_POST
1666 mov bx, offset CRLFM
;AN???;
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.
1675 ;------------------------------------------------------------------------------
1677 ; J.K. The syntax is:
1678 ; COUNTRY=country id {,codepage {,path}}
1679 ; COUNTRY=country id {,,path} :Default CODEPAGE ID in DOS
1680 ;------------------------------------------------------------------------------
1688 ; JZ TryQBad ; 0 is never a valid code, or number is
1690 ; MOV BX,AX ; Country code in BX
1693 ; MOV DX,0 ; assume no code page id
1695 ; invoke skip_delim ;skip the delimeters after the first num
1696 ; jc TryQ_Def_File ;no more characters left? then use default file
1700 ; jne TRYQ_YES_EXTENDED
1701 ; inc [COUNT] ;This is for NEWLINE routine in COFF.
1704 ; JMP TryQ_Def_File ;O.K. no code page, no path specified. Use default path.
1707 ; cmp al, ',' ;was the second comma?
1709 ; invoke skip_delim ;Yes, skip ',' and other possible delim
1710 ; jmp short TRYQ_PATH ;and No code page id entered.
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
1724 ; jne TryQ_PATH ;path entered.
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
1733 ;TryQBad: ;"Invalid country code or code page"
1735 ; MOV DX,OFFSET BADCOUNTRY
1738 ;TryQBadCOM: ;Error in COUNTRY command
1740 ; MOV DX,OFFSET BADCOUNTRYCOM
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
1747 ;TRYQ_PATH_LOOP: ;find the end of path to put 0 after that.
1748 ; mov AL, byte ptr ES:[DI]
1754 ; jmp short TRYQ_PATH_LOOP
1755 ;TryQBad_Brg:jmp short TryQBad
1757 ; mov es:byte ptr [di], 0 ;make it a ASCIIZ string. (Organize did not handle this string)
1758 ; push ds ;switch ds,es
1763 ; mov di, offset CNTRY_DRV ;move the user specified path to CNTRY_DRV
1766 ; push ds ;restore ds,es
1771 ;; call Set_Country_Path ;set CNTRY_DRV
1774 ; mov dx, offset CNTRY_DRV ;Now DS:DX -> CNTRY_DRV
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;
1783 call Sysinit_Parse
;AN000;
1784 ; $EXITIF C ;AN000; Parse error, check the error code and
1786 call Cntry_Error
;AN000; Show message and end the serach loop.
1787 mov P_Cntry_Code
, -1 ;AN000; Signals that parse error.
1791 cmp ax, $P_RC_EOL
;AN000; End of Line?
1792 ; $LEAVE E ;AN000; then end the $SEARCH LOOP
1794 cmp Result_Val
.$P_TYPE
, $P_NUMBER
;AN000; Numeric?
1797 mov ax, word ptr Result_Val
.$P_PICKED_VAL
;AN000;
1801 mov P_Cntry_Code
, ax ;AN000;
1805 mov P_Code_Page
, ax ;AN000;
1808 ; $ELSE ;AN000; Path entered.
1817 lds si, RV_Dword
;AN000; Move the path to known place.
1818 mov di, offset CNTRY_Drv
;AN000;
1819 call Move_ASCIIZ
;AN000;
1831 cmp P_Cntry_Code
, -1 ;AN000; Had a parse error?
1832 jne TRYQ_OPEN
;AN000;
1835 TryQBad: ;"Invalid country code or code page"
1837 MOV DX,OFFSET BADCOUNTRY
1841 cmp CNTRY_Drv
, 0 ;AC000;
1843 mov dx, offset CNTRY_Drv
;AC000;
1844 jmp TryQ_Openit
;AC000;
1846 mov dx, offset CNTRY_Root
;AC000;
1848 mov ax, 3d00h
;open a file
1851 jc TryQFileBad
;open failure
1853 mov cs:CntryFileHandle
, ax ;save file handle
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
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
1863 mov si, offset CNTRY_DRV
;DS:SI -> CNTRY_DRV
1864 cmp byte ptr [si],0 ;default path?
1865 jne TRYQ_Set_for_DOS
1867 inc si ;DS:SI -> CNTRY_ROOT
1869 les di, cs:SYSI_Country
;ES:DI -> country info tab in DOS
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.
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"
1884 cmp cs:CNTRY_DRV
,0 ;Is the default file used?
1886 ; mov si, cs:[CONFBOT]
1888 ; mov si, cs:[CHRPTR]
1889 ; dec si ;ES:SI -> path in CONFBOT
1890 mov si, offset CNTRY_Drv
1891 jmp short TryQBADLOAD
1892 TryQDefBad: ;Default file has been used.
1895 mov si, offset CNTRY_ROOT
;ES:SI -> \COUNTRY.SYS in SYSINIT_SEG
1897 call BADLOAD
;DS will be restored to SYSINIT_SEG
1898 mov cx, cs:[CONFBOT
]
1899 mov es, cx ;Restore ES -> CONFBOT.
1902 MOV DX,OFFSET INSUFMEMORY
1904 mov cx, cs:[CONFBOT
]
1905 mov es, cx ;restore ES -> CONFBOT seg
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;
1912 mov bx, CntryFileHandle
1914 int 21h
;close a file. Don't care even if it fails.
1917 Cntry_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
1924 ;Out: Show message. DX destroyed.
1926 cmp ax, $P_OUT_OF_RANGE
1929 mov dx, offset BadCountry
;"Invalid country code or code page"
1933 mov dx, offset BadCountryCom
;"Error in CONTRY command"
1941 ;------------------------------------------------------------------------------
1943 ;------------------------------------------------------------------------------
1944 ;*******************************************************************************
1945 ; Function: Parse the parameters of FILES= command. *
1948 ; ES:SI -> parameters in command line. *
1950 ; Variable FILES set. *
1952 ; Subroutines to be called: *
1956 ; Set DI points to FILES_Parms; *
1958 ; While (End of command line) *
1959 ; { Sysinit_parse; *
1960 ; if (no error) then *
1961 ; Files = Result_Val.$P_Picked_Val *
1967 ;*******************************************************************************
1973 ; CMP AX,5 ;j.k. change it to 8!!!!!!!!
1974 ; JB TryFBad ; Gotta have at least 5
1976 ; JAE TryFBad ; Has to be a byte
1981 mov di, offset Files_Parms
;AN000;
1987 call Sysinit_Parse
;AN000;
1988 ; $EXITIF C ;AN000; Parse Error,
1990 call Badparm_p
;AN007; and Show messages and end the search loop.
1994 cmp ax, $P_RC_EOL
;AN000; End of Line?
1995 ; $LEAVE E ;AN000; then end the $ENDLOOP
1997 mov al, byte ptr Result_Val
.$P_PICKED_VAL
;AN000;
1998 mov P_Files
, al ;AN000; Save it temporarily
2002 mov al, P_Files
;AN000;
2003 mov Files
, al ;AN000; No error. Really set the value now.
2008 ;------------------------------------------------------------------------------
2010 ;------------------------------------------------------------------------------
2011 ;*******************************************************************************
2012 ; Function: Parse the parameters of LASTDRIVE= command. *
2015 ; ES:SI -> parameters in command line. *
2017 ; Set the variable NUM_CDS. *
2019 ; Subroutines to be called: *
2023 ; Set DI points to LDRV_Parms; *
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*/ *
2034 ;*******************************************************************************
2043 ; CMP AL,26 ; a-z are allowed
2049 mov di, offset LDRV_Parms
;AN000;
2055 call Sysinit_Parse
;AN000;
2056 ; $EXITIF C ;AN000; Parse Error,
2058 call Badparm_p
;AN007; and Show messages and end the search loop.
2062 cmp ax, $P_RC_EOL
;AN000; End of Line?
2063 ; $LEAVE E ;AN000; then end the $ENDLOOP
2065 mov al, RV_Byte
;AN000; Pick up the drive number
2066 mov P_Ldrv
, al ;AN000; Save it temporarily
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.
2079 ;-------------------------------------------------------------------------------
2080 ; Setting Drive Parameters
2081 ;-------------------------------------------------------------------------------
2092 ;-------------------------------------------------------------------------------
2093 ; Setting Internal Stack Parameters
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 ;*******************************************************************************
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.) *
2112 ; ES:SI -> parameters in command line. *
2114 ; Set the variables STACK_COUNT, STACK_SIZE. *
2116 ; Subroutines to be called: *
2120 ; Set DI points to STKS_Parms; *
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; *
2130 ; else /*Error exit*/ *
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; *
2137 ;*******************************************************************************
2146 ; INVOKE GetNum ; Get number of stacks
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
2155 ; MOV [STACK_COUNT], AX
2157 ; Skip delimiters after the first number.
2159 ; invoke Skip_delim ;J.K.
2162 ; INVOKE GetNum ; Get size of individual stack
2163 ; JC TryKBad ; Number bad
2165 ; cmp ax, 0 ;J.K. 5/5/86
2166 ; je TRYK_SIZE0 ;J.K. 5/5/86. Accept 0
2168 ; CMP AX, MinSize ; 32 <= Stack Size <= 512
2173 ; MOV [STACK_SIZE], AX
2177 ; mov word ptr [stack_addr], -1 ;set the flag that the user entered stacks= command.
2180 ; cmp [STACK_COUNT],0 ;stack_size = 0. Stack_Count = 0 too?
2181 ; je TRYK_OK ;yes. accepted.
2183 ; MOV DX, OFFSET BADSTACK ;J.K. 5/26/86 "Invalid stack parameter"
2188 mov di, offset STKS_Parms
;AN000;
2194 call Sysinit_Parse
;AN000;
2195 ; $EXITIF C ;AN000; Parse Error,
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;
2203 cmp ax, $P_RC_EOL
;AN000; End of Line?
2204 ; $LEAVE E ;AN000; then end the $ENDLOOP
2206 mov ax, word ptr Result_Val
.$P_PICKED_VAL
;AN000;
2210 mov P_Stack_Count
, ax ;AN000;
2214 mov P_Stack_Size
, ax ;AN000;
2220 cmp P_Stack_Count
, 0 ;AN000;
2223 cmp P_Stack_Count
, MINCOUNT
;AN000;
2226 cmp P_Stack_Size
, MINSIZE
;AN000;
2230 mov P_Stack_Count
, -1 ;AN000; Invalid
2236 cmp P_Stack_Size
, 0 ;AN000;
2239 mov P_Stack_Count
, -1 ;AN000; Invalid
2244 cmp P_Stack_Count
, -1 ;AN000; Invalid?
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;
2252 call Error_Line
;AN006;
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.
2267 ;------------------------------------------------------------------------------
2268 ; Switch command ;No longer supported.
2269 ;------------------------------------------------------------------------------
2273 ; JMP BadOp ; no longer implemented
2275 ; MOV AX,(CHAR_OPER SHL 8) OR 1 ;SET SWITCH CHARACTER
2276 ; MOV [COMMAND_LINE+1],DL
2279 ;------------------------------------------------------------------------------
2280 ; Availdev command ;No longer supported.
2281 ;------------------------------------------------------------------------------
2285 ; JMP BadOp ; NO LONGER IMPLEMENTED
2286 ; CMP AL,'F' ;FIRST LETTER OF "FALSE"
2288 ; MOV AX,(CHAR_OPER SHL 8) OR 3 ;TURN ON "/DEV" PREFIX
2293 ;------------------------------------------------------------------------------
2295 ;------------------------------------------------------------------------------
2299 MOV [COMMAND_LINE
+1],0
2300 MOV DI,OFFSET COMMND
+ 1
2322 MOV DI,OFFSET COMMAND_LINE
+1
2331 ;------------------------------------------------------------------------------
2333 ;------------------------------------------------------------------------------
2334 ;*******************************************************************************
2335 ; Function: Parse the parameters of FCBS= command. *
2338 ; ES:SI -> parameters in command line. *
2340 ; Set the variables FCBS, KEEP. *
2342 ; Subroutines to be called: *
2346 ; Set DI points to FCBS_Parms; *
2348 ; While (End of command line) *
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; *
2356 ; else /*Error exit*/ *
2360 ;*******************************************************************************
2365 ; JZ TryXBad ; gotta have at least one
2367 ; JAE TryXBad ; Can't be more than 8 bits worth
2370 ; Skip delimiters after the first number including ","
2372 ; invoke Skip_delim ;J.K.
2375 ; JC TryXBad ; Number bad (Zero is OK here)
2384 mov di, offset FCBS_Parms
;AN000;
2390 call Sysinit_Parse
;AN000;
2391 ; $EXITIF C ;AN000; Parse Error,
2393 call Badparm_p
;AN007; and Show messages and end the search loop.
2397 cmp ax, $P_RC_EOL
;AN000; End of Line?
2398 ; $LEAVE E ;AN000; then end the $ENDLOOP
2400 mov al, byte ptr Result_Val
.$P_PICKED_VAL
;AN000;
2401 cmp cx, 1 ;AN000; The first positional?
2404 mov P_Fcbs
, al ;AN000;
2408 mov P_Keep
, al ;AN000;
2414 mov al, P_Fcbs
;AN005;make sure P_Fcbs >= P_Keep
2415 cmp al, P_Keep
;AN005;
2418 ; call Badop_p ;AN005;
2419 call Badparm_p
;AN011;show "Bad parameter -" msg.
2420 mov P_Keep
, 0 ;AN005;
2424 mov Fcbs
, al ;AN000; No error. Really set the value now.
2425 mov al, P_Keep
;AN000;
2426 mov Keep
, al ;AN000;
2433 ;------------------------------------------------------------------------------
2434 ; Comment= Do nothing. Just decrese CHRPTR, and increase COUNT for correct
2436 ;------------------------------------------------------------------------------
2445 ;------------------------------------------------------------------------------
2447 ;------------------------------------------------------------------------------
2448 Try0: ;AN003;do nothing with this line.
2450 je DoNothing
;AN003;
2452 ;------------------------------------------------------------------------------
2454 ;------------------------------------------------------------------------------
2455 ;*******************************************************************************
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. *
2462 ; ES:SI -> parameters in command line. *
2464 ; P_Swit_K set if /K option chosen. *
2466 ; Subroutines to be called: *
2470 ; Set DI points to Swit_Parms; /*Parse control definition*/ *
2472 ; While (End of command line) *
2473 ; { Sysinit_parse; *
2474 ; if (no error) then *
2475 ; if (Result_Val.$P_SYNONYM_ptr == Swit_K) then *
2478 ; else {Show Error message;Error Exit} *
2482 ;*******************************************************************************
2484 cmp ah, '1' ;AN019;Switches= command entered?
2487 mov di, offset Swit_Parms
;AN019;
2493 call Sysinit_Parse
;AN019;
2494 ; $EXITIF C ;AN019; Parse Error,
2496 call Badparm_p
;AN019; and Show messages and end the search loop.
2500 cmp ax, $P_RC_EOL
;AN019; End of Line?
2501 ; $LEAVE E ;AN019; then jmp to $Endloop for semantic check.
2503 cmp Result_Val
.$P_SYNONYM_PTR
, offset Swit_K
;AN019;
2506 mov P_Swit_K
, 1 ;AN019; set the flag
2512 cmp P_Swit_K
, 1 ;AN019;If /K entered,
2514 mov ax, Code ;AN019;
2516 assume
ds:Code ;AN019;
2519 mov KEYRD_Func
, 0 ;AN019;Use the conventional keyboard functions
2520 mov KEYSTS_Func
, 1 ;AN019;
2524 assume
ds:SYSINITSEG
;AN019;
2529 ;------------------------------------------------------------------------------
2531 ;------------------------------------------------------------------------------
2533 cmp ah, 0FFh ;AN029;
2539 ;------------------------------------------------------------------------------
2541 ;------------------------------------------------------------------------------
2542 TryFF: ;AN029;Skip this command.
2543 jmp DoNothing
;AN029;
2560 Incorrect_Order proc
near ;AN000;
2561 ;Show "Incorrect order in CONFIG.SYS ..." message.
2562 mov dx, offset BADORDER
;AN000;
2564 call ShowLineNum
;AN000;
2566 Incorrect_Order endp
;AN000;
2569 Error_Line proc
near ;AN000;
2570 ;Show "Error in CONFIG.SYS ..." message.
2573 mov dx, offset ErrorCmd
;AN000;
2575 call ShowLineNum
;AN000;
2577 Error_Line endp
;AN000;
2579 ShowLineNum 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.
2584 ;Out) the number is printed.
2590 pop es ;AN000; es=cs
2595 ; mov di, offset ShowCount ;clean it up.
2598 ; stosb ;lenght of ShowCount is 5.
2599 ; dec di ;let DI points to the least significant ASCII field.
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;
2605 cmp ax, 10 ;AN000; < 10?
2609 or dl, 30h
;AN000; add "0" (= 30h) to make it an ascii.
2612 jmp SLN_Loop
;AN000;
2617 call print
;AN000; show it.
2622 ShowLineNum endp
;AN000;
2625 CallIFS proc
near ;AN000;
2626 ;*******************************************************************************
2627 ; Function: Interface to IFS call. This procedure will call IFS_CALL@ *
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 *
2636 ;*******************************************************************************
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
2648 CallIFS endp
;AN000;
2651 Set_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 *
2661 ; [MEMHI] = address to set up DEVMARK. *
2663 ; ES:SI -> pointer to [drive][path]filename,0 *
2664 ; [IFS_Flag] = IS_IFS bit set if IFS= command. *
2666 ; Output: DEVMARK_ID, DEVMARK_FILENAME set *
2667 ; cs:[DevMark_addr] set. *
2668 ; AX, CX register destroyed. *
2669 ;*******************************************************************************
2675 mov di, cs:[MEMHI
] ;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;
2684 mov al, DEVMARK_IFS
;AN004; ='I'
2686 mov ds:[DEVMARK_ID
], al ;AN004;
2688 mov ds:[DEVMARK_SEG
], di ;AN008;
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
2695 SDVMK_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;
2700 je SDVMK_GotFile
;AN004;
2702 je SDVMK_FilePtr
;AN004;
2704 jmp SDVMK_BackWard
;AN004;
2705 SDVMK_GotFile: ;AN004;
2707 SDVMK_FilePtr: ;AN004; now es:di -> start of file name
2709 pop si ;AN004; save di to si.
2710 push ds ;AN004; switch es, ds
2713 pop es ;AN004; now, ds:si -> start of filename
2714 mov di, DEVMARK_FILENAME
;AN004;
2718 rep stosb ;AN004; Clean up Memory.
2720 mov cx, 8 ;AN004; Max 8 char. only
2724 je SDVMK_Done
;AN004;
2726 je SDVMK_Done
;AN004;
2728 loop SDVMK_Loop
;AN004;
2735 Set_DevMark endp
;AN004;
2737 Chk_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.
2747 mov di, si ;AN029;save current starting pointer
2749 cmp byte ptr es:[si], 0 ;AN029;
2750 je CX_Endfile
;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;
2760 je CX_Got_Tail0 ;AN029;
2761 jmp CX_Endfile ;AN029;
2762 CX_Got_Tail: ;AN029;
2764 CX_Got_Tail0: ;AN029;
2768 pop di ;AN029;now es:di -> filename,0
2770 mov si, offset XMAEM_File ;AN029;ds:si -> XMAEM.SYS,0
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"
2788 ; otherwise ; DH = minor version, DL = major version
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.
2799 ; mov di, si ;AN024;save current starting pointer
2801 ; cmp byte ptr es:[si], 0 ;AN024;
2802 ; je CIC_Endfile ;AN024;
2804 ; jmp CIC_Cmp ;AN024;
2805 ;CIC_Endfile: ;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;
2816 ;CIC_Got_Tail0: ;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.
2838 Reset_DOS_Version proc
near ;AN024;
2839 ;Function: issue AX=122Fh, DX=0, INT 2fh to restore the DOS version.
2842 mov ax, 122Fh
;AN024;
2848 Reset_DOS_Version endp
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.
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)
2861 ; AL = 0 is for installation check. - J.K.
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)
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.
2874 ;=========================================================================
2876 ;Int_2F_Handler proc ;traps Int_2f and checks for EMS ;an000; dms;
2878 EMS_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
2886 INTV2F equ
$-EMS_STUB_START
;AN030;J.K.pointer to old 2Fh handler ;an000; dms;
2887 IntV2FO
DW ?
;AN030;;offset ;an000; dms;
2888 IntV2FS
DW ?
;AN030;;segment ;an000; dms;
2890 OLDINT67_VECTOR equ
$-EMS_STUB_START
;AN030;J.K.
2891 OldInt67 dd ?
;AN030;; save pointer to old INT 67 handler here
2895 LOCKFLAG equ
$-EMS_STUB_START
2900 EMSPAGE_CNT equ
$-EMS_STUB_START
;AN030;J.K.
2901 EMSPageCount dw ?
;AN030;; save count of EMS mappable pages here
2903 EMSReservedArray_X
label word ;AN030;;J.K. For initialization routine
2904 EMSRESERVEDARRAY 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
2907 MappableArray_X
label word ;AN030;;J.K. for initialization routine
2908 MAPPABLEARRAY equ
$-EMS_STUB_START
;AN030;;J.K.
2909 dw 64 dup (0,0) ;AN030;; table to get addresses from old INT 67 handler
2912 ; 64 entries * 2 words
2913 NEWEMS2F_OFF equ
$-EMS_STUB_START
;AN030;
2914 Int_2F_EMS: ;AN030;;J.K. Name changed.
2915 cmp ah,1
Bh ;AN030;;AN032;2Fh trap for Mappable Phys. Add. Array ;an000; dms;
2916 je Int_2F_EMS_MINE
;AN030;;This one we want ;an000; dms;
2918 jmp dword ptr cs:IntV2F
;AN030;;go to old interrupt handler ;an000; dms;
2920 Int_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!
2926 Int_2F_5800_Func: ;AN030;
2932 mov byte ptr cs:LOCKFLAG
, 0
2933 jmp Int_2f_5800_Good_Exit
2936 jne Int_2f_5800_Err_Exit
2937 mov byte ptr cs:LOCKFLAG
, 1
2938 jmp Int_2f_5800_Good_Exit
2941 push si ;AN030;; ;an000; dms;
2943 ; mov si,offset EMSReservedArray ;point to array containing pages ;an000; dms;
2944 mov si, EMSRESERVEDARRAY
;AN030;;J.K.
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;
2949 cmp word ptr cs:[si],0ffffh ;AN030;;valid entry? ;an000; dms;
2950 je Int_2F_5800_Err_Exit
;AN030;;no - exit ;an000; dms;
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;
2956 Int_2F_5800_Buff_Ck: ;AN030;
2958 cmp di,0ffh ;AN030;;BUFFERS request? ;an000; dms;
2959 jne Int_2F_5800_Err_Exit
;AN030;;no - exit with error ;an000; dms;
2961 add si,4 ;AN030;;point to second element in array ;an000; dms;
2963 cmp word ptr cs:[si],0ffffh ;AN034;;valid entry? ;an000; dms;
2964 je Int_2F_5800_Err_Exit
;AN034;;no - exit ;an000; dms;
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;
2971 Int_2F_5800_Good_Exit: ;AN030;
2973 xor ax,ax ;AN030;;signal good return ;an000; dms;
2974 jmp Int_2F_Exit
;AN030;;exit routine ;an000; dms;
2976 Int_2F_5800_Err_Exit: ;AN030;
2978 mov ax,0ffffh ;AN030;;signal error ;an000; dms;
2980 Int_2F_Exit: ;AN030;
2984 pop si ;AN030;;restore regs ;an000; dms;
2986 iret ;AN030;;return to caller ;an000; dms;
2990 ;-------------------------------------------------------------------
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.
2999 ; Information about the two pages "reserved" for DOS is returned
3000 ; via an unpublished INT 2Fh interface.
3002 ; 5/10/88 for DOS 4.0.
3003 ;-------------------------------------------------------------------
3007 GetMappableArray equ 58h
; INT 67 function code for Get Mappable Array
3008 GetPageFrame equ 41h
; function code for getting the page frame address
3009 null equ
0 ; zero value
3010 I67Error8F equ 8fh
;AN031;; invalid sub-function error
3014 ;-------------------------------------------------------------------
3015 NEW67_OFFSET equ
$-EMS_STUB_START
;J.K.
3016 Int67Filter: ;AN030;
3020 cmp byte ptr cs:LOCKFLAG
, 1
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
3029 cmp al,0 ;AN031;; AL=0 return count and table
3032 cmp al,1 ;AN031;; AL=1 return count only
3033 jne I67Error
;AN031;; otherwise, error
3036 ; return count of mappable pages
3038 sti ;AN031;; turn interrupts on
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
3044 ; return invalid sub-function code
3047 sti ;AN031;; turn interrupts on
3048 mov ah,I67Error8F
;AN031;; invalid sub-function error
3054 ; copy the fake table to user's buffer
3056 sti ;AN030;; turn interrupts on
3058 push ds ;AN030; save some regs
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
3065 push cs ;AN030;; point DS:SI to fake table
3067 ; lea si,MappableArray
3068 mov si, MAPPABLEARRAY
;AN030;;J.K.
3070 rep movsw ;AN030;; copy CX words from DS:SI to ES:DI
3072 xor ah,ah ;AN030;; good return code
3073 mov cx,word ptr cs:EMSPAGE_CNT
;AN030;; page count returned to user in CX
3076 pop si ;AN030;; restore some regs
3080 iret ;AN030;; end of INT 67 filter routine
3084 ;-------------------------------------------------------------------
3086 ; PassThru - send request to old INT 67 handler
3088 ;-------------------------------------------------------------------
3091 jmp dword ptr cs:OldINT67_VECTOR
;AN030;;J.K. jump to old INT 67 handler
3092 ; (IRET will return to calling program)
3095 EMS_STUB_END
label byte ;AN030;
3096 ;-------------------------------------------------------------------
3099 ;-------------------------------------------------------------------
3101 ; Int67FilterInit - This routine is called to initialize the INT 67
3102 ; filter. It should be called as soon as possible after installation.
3104 ;-------------------------------------------------------------------
3106 Int67FilterInit: ;AN030;
3107 push es ;AN030;; save caller's ES:DI
3110 push cs ;AN030;; make ES:DI point to our array
3112 mov di,offset MappableArray_X
;AN030;
3114 ; call dword ptr cs:OldInt67 ; get mappable array from EMS DD
3116 mov ah, GetMappableArray
;AN030;
3118 int 67h
;AN030;;J.K.
3121 ;------------------------
3122 ; scan table looking for highest phys_page_number
3126 cmp cx,0 ;AN033;; are the any pages left?
3127 je NoMoreEMSPages
;AN033;; no, don't bother looking any more
3129 call GetHighestPage
;AN030;; get highest entry from table
3131 mov EMSReservedArray_X
+4,bx ;AN030;; phys_page_segment
3132 mov EMSReservedArray_X
+6,ax ;AN030;; phys_page_number
3134 cmp cx,0 ;AN033;; are the any pages left?
3135 je NoMoreEMSPages
;AN033;; no, don't bother looking any more
3137 call GetHighestPage
;AN030;; get next highest entry from table
3139 mov EMSReservedArray_X
+0,bx ;AN030;; phys_page_segment
3140 mov EMSReservedArray_X
+2,ax ;AN030;; phys_page_number
3142 NoMoreEMSPages: ;AN033;;
3143 mov EMSPageCount
,cx ;AN030;; save new page count for INT 67 filter
3147 ret ;AN030;; return to calling program
3151 ;-------------------------------------------------------------------
3153 ; GetHighestPage - returns highest physical page number in AX
3154 ; and segment for it in BX. A -1 means no valid page found.
3156 ;-------------------------------------------------------------------
3159 xor ax,ax ;AN030;; zero candidate register
3160 mov bx,ax ;AN030;; zero pointer to candidate page
3162 push cx ;AN030;; save count
3164 push di ;AN030;; save pointer
3166 PageScanLoop: ;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
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.
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
3179 LookAtNextPage: ;AN030;
3180 add di,4 ;AN030;; point to next entry in mappable table
3182 loop PageScanLoop
;AN030;; look at next entry
3184 cmp bx,null
;AN030;; did we find any pages?
3185 jne FoundOne
;AN030;; yes, exit
3187 jmp ReturnError
;AN030;
3189 ;------------------------
3191 cmp ax,3 ;AN030;; could the one we found be part of a page frame
3192 ja NotFrame
;AN030;; no, carry on
3194 ; yes, find out if it is part of frame
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
3206 ; there is a frame, this page is part of frame, so return -1's
3208 ReturnError: ;AN030;
3209 mov ax,0ffffh ;AN030;; indicate failure
3210 mov bx,ax ;AN030;; ax and bx = -1
3212 pop di ;AN030;; restore pointer
3214 pop cx ;AN030;; restore count
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.
3229 mov di,bx ;AN030;; make ES:DI point to highest page table entry
3231 mov bx,ES:[di] ;AN030;; get segment address of page
3233 mov cx,dx ;AN030;; get count from candidate page
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;
3242 loop PackLoop
;AN030;; do it until done
3245 pop di ;AN030;; restore pointer
3247 pop cx ;AN030;; restore count
3249 sub cx,1 ;AN030;; reduce count by one, one less page in table now
3253 ret ;AN030;; return to caller
3257 ;=========================================================================
3258 ; EMS_Install_Check : THIS MODULE DETERMINES WHETHER OR NOT EMS IS
3259 ; INSTALLED FOR THIS SESSION.
3263 ; OUTPUTS : ES:BX - FRAME ARRAY
3264 ; CY - EMS NOT AVAILABLE
3265 ; NC - EMS AVAILABLE
3268 ;=========================================================================
3270 EMS_Install_Check proc
near ;AN030;; check if EMS is installed ;an000; dms;
3272 push ax ;AN030;; save regs ;an000; dms;
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;
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;
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;
3293 clc ;AN030;; signal EMS loaded ;an000; dms;
3294 jmp EMS_Install_Ck_Exit
;AN030;; exit routine ;an000; dms;
3296 EMS_Install_Ck_Err_Exit: ;AN030;
3298 stc ;AN030;; signal EMS not loaded ;an000; dms;
3300 EMS_Install_Ck_Exit: ;AN030;
3302 pop ax ;AN030;; restore regs ;an000; dms;
3304 ret ;AN030;; return to caller ;an000; dms;
3306 EMS_Install_Check endp
; ;an000; dms;
3308 EMS_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.
3323 cmp EMS_Stub_Installed
, 0 ;AN030;
3324 je EMS_Stub_X
;AN030;
3325 jmp EMS_SH_Ret
;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;
3334 xor ax,ax ;AN030;save current Int 2fh, 67h vectors.
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;
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
3353 mov ax, DEVMARK_EMS_STUB
;AN030;
3354 call SetDevMark
;AN030;
3355 mov ax, [memhi
] ;AN030;
3357 assume
es:nothing
;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;
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;
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;
3387 EMS_Stub_Handler endp
;AN030;