📄 rxdosini.asm
字号:
getarg ax, _type
call _findStatementType ; find statement type
ifc processAnyDevice_24 ; if no more -->
push es
push di
lea di, offset [ configStatement ][ di ]
stordarg _CurrentStatement, es, di ; current statement at '='
call ConfigPrompt ; check for ?= or F8 case
ifc processAnyDevice_66 ; if ignore -->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; allocate memory, load device and initialize
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mov ax, DEVICEINIT * 256
lea di, offset reqBlock [ bp ]
call initReqBlock ; initialize request block
mov bx, 0FFFFh
Int21 AllocateMemory ; get largest available memory block
storarg _SegSize, bx ; store size of segment
Int21 AllocateMemory ; else allocate largets available
ifc processAnyDevice_66 ; if can't, should display an error message -->
mov word ptr [ _ExecBlock. loverSegLoadAddress ][ bp ], ax
mov word ptr [ _ExecBlock. loverRelocFactor ][ bp ], ax
storarg _SegAddress, ax ; store address of segment
add ax, word ptr [ _SegSize ][ bp ] ; add alloc size to segment (max size)
dec ax ; protection
mov word ptr [ reqBlock. irEndAddress. _segment ][ bp ], ax
mov word ptr [ reqBlock. irEndAddress. _pointer ][ bp ], 0000
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; scan command line parsing out extra characters at the start of name
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
push ds
push es
getdarg ds, si, _CurrentStatement ; current statement at '='
processAnyDevice_16:
lodsb
or al, al
ifz processAnyDevice_64 ; if no name, can't load
cmp al, '='
jz processAnyDevice_16 ; skip = -->
cmp al, '?'
jz processAnyDevice_16 ; skip ? -->
cmp al, ' '
jz processAnyDevice_16 ; skip space -->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; copy device name and path
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
lea bx, offset _devicename [ bp ]
dec si
push si
processAnyDevice_20:
lodsb
or al, al
jz processAnyDevice_22
cmp al, ' '
jz processAnyDevice_22
mov byte ptr ss:[ bx ], al
inc bx
jmp processAnyDevice_20
processAnyDevice_22:
mov byte ptr ss:[ bx ], 00
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; copy entire line to arguments
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
pop si
lea bx, offset _arguments [ bp ]
mov word ptr [ reqBlock. irParamAddress. _segment ][ bp ], ss
mov word ptr [ reqBlock. irParamAddress. _pointer ][ bp ], bx
processAnyDevice_26:
lodsb
or al, al
jz processAnyDevice_28 ; if end of filename -->
mov byte ptr ss:[ bx ], al
inc bx
jmp processAnyDevice_26
processAnyDevice_28:
mov byte ptr ss:[ bx ], controlM
mov byte ptr ss:[ bx + 1 ], controlM
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; load program
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mov ax, ss
mov es, ax
mov ds, ax
lea bx, offset _ExecBlock [ bp ] ; address of exec block
lea dx, offset _devicename [ bp ] ; address of device name
Int21 ExecuteProgram, 03h ; load overlay
stordarg _loadSize, bx, cx ; load size
jnc processAnyDevice_32 ; if succesful -->
mov si, offset RxDOSmsg_CouldNotLoadDriver
call RxDOSIni_TypeMessage ; say couldn't load ...
lea si, offset _devicename [ bp ] ; address of device name
call RxDOSIni_TypeMessage ; ... say which driver
jmp processAnyDevice_60 ; go release memory when load failed -->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; call device init
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
processAnyDevice_32:
xor bx, bx
getarg es, _SegAddress
mov ax, word ptr es:[ devStrategy ][ bx ]
stordarg _strategy, es, ax
mov ax, word ptr es:[ devInterrupt ][ bx ]
stordarg _interrupt, es, ax
setES ss
lea bx, offset reqBlock [ bp ]
mov word ptr [ reqBlock. rhStatus ][ bp ], OP_DONE
mov al, byte ptr [ _RxDOS_bNumBlockDev ]
mov byte ptr [ reqBlock. irDriveNumber ][ bp ], al
mov byte ptr [ reqBlock. irUnits ][ bp ], 00
push bp
mov ds, word ptr [ _strategy. _segment ][ bp ]
call dword ptr [ _strategy ][ bp ] ; strategy
pop bp
push bp
lea bx, offset reqBlock [ bp ]
mov ds, word ptr [ _strategy. _segment ][ bp ]
call dword ptr [ _interrupt ][ bp ] ; interrupt
pop bp
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; free up any extra memory
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
setDS ss
getarg es, _SegAddress
test word ptr [ reqBlock. rhStatus ][ bp ], OP_ERROR
jnz processAnyDevice_60 ; if error -->
; compute actual size (in bx:cx)
mov bx, word ptr [ reqBlock. irEndAddress. _pointer ][ bp ]
add bx, (sizePARAGRAPH - 1) ; round up to nearest para boundary
shr bx, 1
shr bx, 1
shr bx, 1
shr bx, 1 ; end para
add bx, word ptr [ reqBlock. irEndAddress. _segment ][ bp ]
sub bx, word ptr [ _SegAddress ][ bp ] ; paragraph size
jc processAnyDevice_60 ; no size, go free-up -->
jz processAnyDevice_60 ; no size, go free-up -->
Int21 ModifyAllocatedMemory ; free memory to given size
; is driver a file system or blocked device ?
test word ptr es:[ devAttributes ], DEV_CHAR ; is it a character device ?
jnz processAnyDevice_56 ; yes -->
mov dx, es ; driver address (segment)
mov cl, byte ptr [ reqBlock. irUnits ][ bp ] ; get # device units
call InitializeAttachedFileSystem
mov cl, byte ptr [ reqBlock. irUnits ][ bp ]
add byte ptr [ _RxDOS_bNumBlockDev ], cl
processAnyDevice_56:
mov bx, word ptr [ _RxDOS_NULLDev. _segment ]
mov ax, word ptr [ _RxDOS_NULLDev. _pointer ]
mov word ptr es:[ devLink. _segment ], bx
mov word ptr es:[ devLink. _pointer ], ax
mov word ptr [ _RxDOS_NULLDev. _segment ], es
mov word ptr [ _RxDOS_NULLDev. _pointer ], 0000
jmp short processAnyDevice_64
processAnyDevice_60:
getarg es, _SegAddress
Int21 FreeAllocatedMemory ; if error while loading
processAnyDevice_64:
pop es
pop ds
processAnyDevice_66:
pop di
pop es
or word ptr es:[ configFlags ][ di ], CONFIGFLAG_PROCESSED
add di, word ptr es:[ configLength ][ di ]
jmp processAnyDevice_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; return
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
processAnyDevice_24:
getdarg es, di, _ConfigStatements ; return
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Process DOS Statement ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; es:di start of statements in saved config buffer ;
;...............................................................;
processDOS:
Entry
ddef _ConfigStatements, es, di
def _DOS, 0000 ; no UMB, no HMA
processDOS_08:
mov ax, CONFIGTYPE_DOS
call _findStatementType ; find statement type
jc processDOS_24 ; if no more -->
push es
push di
lea di, offset [ configStatement ][ di ]
call ConfigPrompt ; check for ?= or F8 case
jc processDOS_12 ; ignore statement -->
processDOS_10:
mov si, offset _RxDOS_ConfigDOSOptions
call _findCommand ; locate options like high and umb
jc processDOS_12 ; if none of the above -->
or word ptr [ _DOS ][ bp ], dx ; or options
call _nextArgument ; point to next argument
jnc processDOS_10 ; go porcess -->
processDOS_12:
pop di
pop es
or word ptr es:[ configFlags ][ di ], CONFIGFLAG_PROCESSED
add di, word ptr es:[ configLength ][ di ]
jmp processDOS_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; return
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
processDOS_24:
getarg ax, _DOS ; get DOS
getdarg es, di, _ConfigStatements ;
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Process FCBS Statement(s) ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; es:di start of statements in saved config buffer ;
;...............................................................;
processFCBS:
Entry
ddef _ConfigStatements, es, di
ddef _FCBS, 0, DEFAULT_FCBS
processFCBS_08:
mov ax, CONFIGTYPE_FCBS
call _findStatementType ; find statement type
jc processFCBS_24 ; if no more -->
push es
push di
lea di, offset [ configStatement ][ di ]
call ConfigPrompt ; check for ?= or F8 case
jc processFCBS_16 ; if ignore -->
mov cx, 1
mov dx, CONFIGMAX_FCBS_X
call _getNumber
jc processFCBS_16 ; if beyond range -->
mov word ptr [ _FCBS. _low ][ bp ], ax ; else ok to save
mov cx, 0
mov dx, CONFIGMAX_FCBS_Y
call _getNumber
jc processFCBS_16 ; if beyond range -->
mov word ptr [ _FCBS. _high ][ bp ], ax ; else ok to save
processFCBS_16:
pop di
pop es
or word ptr es:[ configFlags ][ di ], CONFIGFLAG_PROCESSED
add di, word ptr es:[ configLength ][ di ]
jmp processFCBS_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -