📄 genercfg.a86
字号:
mov init_buf,al ; update if we want more
call separator ; look for ','
jc func_buf4
call atoi ; Get read-ahead buffer size
jc buffer_error
cmp ax,MIN_READ_AHEAD
jb buffer_error
cmp ax,MAX_READ_AHEAD
ja buffer_error
mov num_read_ahead_buf,al
func_buf4:
ret
buffer_error:
xor si,si ; Do not display Failing String
mov dx, offset bad_buffers
jmp config_error
func_files: ; FILES=nn
call atoi ; AX = # of files
jc files_error ; check for error
cmp ax,MIN_NUM_FILES ; check if less than minimum
jae func_fil1
mov ax,MIN_NUM_FILES ; force to use minimum if less
func_fil1:
cmp ax,MAX_NUM_FILES ; check if more than maximum
jbe func_fil2
mov ax,MAX_NUM_FILES ; force to use maximum if more
func_fil2:
mov num_files,ax ; update the number required
ret
files_error:
xor si,si ; Do not display Failing String
mov dx, offset bad_files
jmp config_error
func_fcbs: ; FCBS=nn
call atoi ; AX = # of files
jc fcbs_error ; check for error
cmp ax,MIN_NUM_FCBS ; check if less than minimum
jae func_fcb1
mov ax,MIN_NUM_FCBS ; force to use minimum if less
func_fcb1:
cmp ax,MAX_NUM_FCBS ; check if more than maximum
jbe func_fcb2
mov ax,MAX_NUM_FCBS ; force to use maximum if more
func_fcb2:
mov num_fcbs,ax ; update number of FCB's
ret
fcbs_error:
xor si,si ; Do not display Failing String
mov dx, offset bad_fcbs
jmp config_error
endif ;not ADDDRV
func_common: ; [COMMON]
func_remark: ; REM Comment field
ret
func_switches: ; SWITCHES=...
; /N = disable F5/F8 feature
; /W = zap wina20.386 name
; /K = disable enhanced keyboard support
; /F = skip statup delay
call whitespace ; skip all spaces
lodsw ; get '/x'
cmp al,CR ; check for end-of-line
je func_switches10
cmp ah,CR ; check for end-of-line
je func_switches10
cmp ax,'N/'
jne func_switches
mov boot_options,0 ; disable boot options
func_switches10:
ret
func_stacks: ; STACKS=number,size
;-----------
call atoi ; ax = number of stacks
jc func_stacks20 ; check for error
test ax,ax ; special case ? (disabled)
jz func_stacks10
cmp ax,MIN_NUM_STACKS ; range check for a sensible value
jb func_stacks20
cmp ax,MAX_NUM_STACKS
ja func_stacks20
func_stacks10:
mov num_stacks,ax
call separator ; look for ','
jc func_stacks20
call atoi ; get size of a stack frame
jc func_stacks20
cmp ax,MIN_SIZE_STACK ; range check it
jb func_stacks20
cmp ax,MAX_SIZE_STACK
ja func_stacks20
mov stack_size,ax
func_stacks20:
ret
if not ADDDRV
func_deblock: ; DEBLOCK=xxxx
;------------
call atohex ; read hex number into DX:AX
jc func_deblock10
test dx,dx
jnz func_deblock10
mov DeblockSetByUser,TRUE ; the user has supplied a setting
push ds
mov ds,bios_seg
mov DeblockSeg,ax ; save deblocking segment
pop ds
func_deblock10:
ret
func_fastopen: ; FASTOPEN=nn
call atoi ; AX = # of files to cache
jc fopen_error ; check for error
test ax,ax ; disable fast open?
jz func_fopen2 ; yes, allow to set to 0000
cmp ax,MIN_NUM_FOPEN ; check if less than minimum
jae func_fopen1
mov ax,MIN_NUM_FOPEN ; force to use minimum if less
func_fopen1:
cmp ax,MAX_NUM_FOPEN ; check if more than maximum
jbe func_fopen2
mov ax,MAX_NUM_FOPEN ; force to use maximum if more
func_fopen2:
mov num_fopen,ax ; update if we want more
func_fopen3:
ret
fopen_error:
xor si,si ; Do not display Failing String
mov dx, offset bad_fopen
jmp config_error
func_drivparm: ; DRIVPARM = /d:nn [/c] [/f:ff] [h:hh] [/n] [/s:ss] [/t:tt]
;-------------
; This function specifies the drive parameters for a device
; and overrides the defaults assumed by the device driver.
mov drivp_drv,0FFh ; invalid drive
call get_switch ; get next switch
cmp al,'d' ; first option must be /d:dd
jne drivparm_error
call get_number ; get numeric parameter
mov drivp_drv,al
mov drivp_chg,FALSE
mov drivp_prm,FALSE
mov drivp_trk,80 ; assume 80 tracks
mov bl,drivp_drv ; get drive to set up
cmp bl,'Z'-'A'
ja drivparm_error
inc bl
mov ioctl_pb,0 ; return defaults
mov ax,440Dh ; generic IOCTL
mov cx,0860h ; get device parameters
mov dx,offset ioctl_func
int DOS_INT
jc drivparm_error ; skip if we can't get parameters
mov drivp_ff,2 ; assume 720K 3.5" drive
call set_form_factor ; set defaults for form factor
call get_switch ; get next switch
cmp al,'c' ; is it /c (change line available)
jne drivparm1
mov drivp_chg,TRUE ; disk change line available
call get_switch ; get next switch
drivparm1:
cmp al,'f' ; form factor specification?
jne drivparm2
call get_number ; get numeric parameter
mov drivp_ff,al ; set form factor
call set_form_factor ; set defaults for form factor
jmps drivparm_loop ; get more parameters
drivparm_error:
xor si,si
mov dx,offset bad_drivparm
jmp config_error
drivparm_loop:
call get_switch ; get next switch
drivparm2:
cmp al,'h' ; specify number of heads
jne drivparm3
call get_number ; get numeric parameter
cmp ax,99
ja drivparm_error
mov drivp_heads,ax ; set # of heads
jmps drivparm_loop
drivparm3:
cmp al,'n'
jne drivparm4
mov drivp_prm,TRUE ; non-removable media
jmps drivparm_loop
drivparm4:
cmp al,'s'
jne drivparm5
call get_number ; get numeric parameter
cmp ax,63 ; range check sector per track
ja drivparm_error
mov drivp_spt,ax ; set # of sectors/track
jmps drivparm_loop
drivparm5:
cmp al,'t'
jne drivparm_error
call get_number ; get numeric parameter
cmp ax,999
ja drivparm_error
mov drivp_trk,ax ; set # of sectors/track
jmps drivparm_loop
drivparm_done: ; now set drive parameters
mov bl,drivp_drv
cmp bl,'Z'-'A'
ja drivparm_error
mov ioctl_func,0000$0100b ; normal track layout assumed,
; set device BPB for drive
mov al,drivp_ff ; get form factor
mov ioctl_type,al
sub ax,ax ; assume removable, no disk change
cmp drivp_prm,FALSE
je drivp_d1
or ax,1 ; drive is permanent media
drivp_d1:
cmp drivp_chg,FALSE
je drivp_d2
or ax,2 ; drive supports disk change line
drivp_d2:
mov ioctl_attrib,ax ; set drive attributes
mov ax,drivp_trk ; set # of cylinders
mov ioctl_tracks,ax
mov ioctl_mtype,0 ; assume standard type
mov ax,drivp_spt ; get sectors/track
mov di,offset ioctl_layout
push ds ! pop es ; ES:DI -> layout table
stosw ; set # of sectors
xchg ax,cx ; CX = # of sectors
mov ax,1 ; start with sector 1
drivp_d3:
stosw ; set next sector #
inc ax ; move to next sector
loop drivp_d3 ; repeat for all sectors
mov ax,drivp_heads
mul drivp_spt
mov dx,drivp_trk
mul dx ; AX/DX = # of sectors/disk
mov di,offset ioctl_bpb
mov 8[di],ax ; set sectors per disk
test dx,dx
jz drivp_d4
mov word ptr 8[di],0 ; indicate large partition
mov 21[di],ax ; set disk size in sectors
mov 23[di],dx
drivp_d4:
mov bl,drivp_drv
inc bl
mov ax,440Dh
mov cx,0840h ; set drive parameters
mov dx,offset ioctl_func
int DOS_INT ; tell the BIOS, ignore errors
ret
get_switch: ; get next command line switch
call whitespace ; skip all spaces & tabs
lodsb ; get next character
pop dx ; get return address
cmp al,'/' ; did we get a switch?
je get_swt9 ; yes, return the character
jmp drivparm_done
get_swt9:
lodsb
or al,('a' xor 'A') ; return upper-cased character
jmp dx
get_number:
; entry: SI -> next character (must be ':')
lodsb ; get next character
cmp al,':' ; must be colon
jne get_num_err ; return error if not
call atoi ; get numeric value
jc get_num_err ; must be number
ret ; AX = number
get_num_err:
pop dx
jmp drivparm_error ; reject this command
set_form_factor:
mov bl,drivp_ff
cmp bl,7
ja set_form9
mov bh,0
shl bx,1
push si ! push es
mov si,ff_table[bx] ; SI -> default media BPB
push ds ! pop es
mov di,offset ioctl_bpb ; ES:DI -> local BPB
mov cx,21 ; copy initialized portion
rep movsb
pop es ! pop si
ret
set_form9:
jmp drivparm_error
;
; This function modifies the History buffer support provided by
; DR DOS the defaults are History OFF, 512 byte buffers,
; Insert ON, Search OFF, Matching OFF.
;
func_history: ; HISTORY = ON|OFF[,NNNN[,ON|OFF[,ON|OFF[,ON|OFF]]]]
;------------
mov history_flg,0 ; start with it all off
call check_onoff ; Check for ON|OFF Switch
jc f_hist_err
test al,al ! jz f_hist_exit ; if OFF forget the rest
or history_flg,RLF_ENHANCED+RLF_INS
call separator ; look for ','
jc f_hist_exit ; Buffer Size not Specified
call atoi ; Get the Buffer Size
jc f_hist_err ; Invalid on no existant size
cmp ax,128 ! jb f_hist_err ; Buffer Size to Small
cmp ax,4096 ! ja f_hist_err ; Buffer Size to Large
mov history_size,ax ; Save History Buffer Size
call separator ; look for ','
jc f_hist_exit ; Insert mode not Specified
call check_onoff ; Check for ON|OFF Switch
jc f_hist_err
test al,al ! jnz func_hist10
and history_flg,not RLF_INS ; Insert state OFF
func_hist10:
call separator ; look for ','
jc f_hist_exit ; Search mode not Specified
call check_onoff ; Check for ON|OFF Switch
jc f_hist_err
test al,al ! jz func_hist20
or history_flg,RLF_SEARCH ; Search state ON
func_hist20:
call separator ; look for ','
jc f_hist_exit ; Match mode not Specified
call check_onoff ; Check for ON|OFF Switch
jc f_hist_err
test al,al ! jz func_hist30
or history_flg,RLF_MATCH ; Match state ON
func_hist30:
f_hist_exit:
ret
f_hist_err:
xor si,si ; Do not display Failing String
mov dx, offset bad_history ; Bad or non-existant ON/OFF string
jmp config_error ; in command tail. Display error message.
;
; HIINSTALL filename [Command Line Parameters]
;
; As INSTALL, but uses high memory if possible
;
func_hiinstall:
mov ax,5802h
int DOS_INT ; get upper memory link
cbw
push ax ; save upper memory link
mov ax,5800h
int DOS_INT ; get alloc strategy
push ax ; save alloc strategy
mov ax,5803h
mov bx,1 ; set upper memory link
int DOS_INT ; to 1
mov ax,5801h
mov bx,80h ; set alloc strategy to lowest-upper
int DOS_INT ; if available
call func_install ; try and install it
mov ax,5801h
pop bx ; set alloc strategy
int DOS_INT ; to original value
mov ax,5803h
pop bx ; set upper memory link
int DOS_INT ; to original value
ret
;
; INSTALL filename [Command Line Parameters]
;
; INSTALL will load and execute "FILENAME" with the optional command
; line parameters and continue processing the DCONFIG.SYS file when
; the application terminates.
;
; Entry
; ds:si -> first character of CR terminated filename and option string.
; Exit
; none
;
; WARNING -
; This code make certain assumptions about memory layout.
; If memory gets fragmented then it all starts falling apart.
;
func_install:
;------------
push ds ! push es
;
; Shrink the previously allocated memory block to MEM_CURRENT
; in preparation of the INSTALL EXEC function.
;
mov es,mem_current_base ; ES: Base Allocated Memory
mov bx,mem_current ; Get the currently allocated memory
sub bx,mem_current_base ; and subtract mem_current_base to
mov ah,MS_M_FREE ; give the number of paragraphs used
jz func_i10 ; if none, free it all up
mov ah,MS_M_SETBLOCK ; else modify block accordingly
func_i10:
int DOS_INT
; Now to protect the CONFIG code in high memory
mov ah,MS_M_ALLOC ; we now try to find base of TPA
mov bx,0ffffh ; ASSUME it is the biggest bit
int 21h ; of free memory about
mov ah,MS_M_ALLOC ; give it to me please
int 21h ; ax:0 -> exec memory
push bx ; we have allocated BX para's
mov es,ax ; ES -> exec memory
mov bx,init_dseg ; we want to protect BX:0 and above
dec bx ; allow for DMD
sub bx,ax ; we can spare this many paras
mov ah,MS_M_SETBLOCK ; for the exec so grow the
int 21h ; block accordingly
pop ax ; AX = total, BX = amount for install
sub ax,bx ; AX = amount we just freed
dec ax ; allow for DMD
xchg ax,bx ; BX = freed portion (the Init code)
mov ah,MS_M_ALLOC ; ASSUME an allocation of this size
int 21h ; will contain SYSDAT/CONFIG
push ax ; save seg so we can free mem later
mov ah, MS_M_FREE ; now free up the bit we prepared
int 21h ; earlier so exec has something
push ds ! pop es ; to work in
mov di,offset dev_name ; Copy the filename into a local
call copy_file ; buffer
; Calculate the command line length
mov di,si ; by scanning the command line for
mov al,CR ; the terminating CR
mov cx,128
repnz scasb
dec di
mov ax,di
sub ax,si
dec si ; Point to the byte before the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -