📄 rxdosdev.asm
字号:
TITLE 'dev - device interface and search support'
PAGE 59, 132
.LALL
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; DEV Device Interface for RxDOS ;
;...............................................................;
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Real Time Dos ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; This material was created as a published version of a DOS ;
; equivalent product. This program logically functions in ;
; the same way as MSDOS functions and it is internal data ;
; structure compliant with MSDOS 6.0 ;
; ;
; This product is distributed AS IS and contains no warranty ;
; whatsoever, including warranty of merchantability or ;
; fitness for a particular purpose. ;
; ;
; ;
; (c) Copyright 1990, 1997. Api Software and Mike Podanoffsky ;
; All Rights Reserved Worldwide. ;
; ;
; This product is protected under copyright laws and may not ;
; be reproduced in whole or in part, in any form or media, ;
; included but not limited to source listing, facsimile, data ;
; transmission, cd-rom, or floppy disk without the expressed ;
; written consent of the author. ;
; ;
; License for distribution for commercial use or resale ;
; required from: ;
; ;
; Api Software ;
; 12 South Walker Street ;
; Lowell, MA 01851 ;
; ;
; internet: mikep@world.std.com ;
; ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; Compile with MASM 5.1 ;
;...............................................................;
include rxdosmac.asm
include rxdosdef.asm
RxDOS SEGMENT PUBLIC 'CODE'
assume cs:RxDOS, ds:RxDOS, es:RxDOS, ss:RxDOS
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Driver Support ;
;...............................................................;
public checkforDeviceType
public checkforDeviceName
public maxBlockDevices
public DevMediaRequest
public DevRead
public DevWrite
public devCharRead
public devCharWrite
public devCharReadLine
public devCharWriteLine
public initReqBlock
public BlockedDevRequest
public getDPB
public getAddrDPB
public DefineDPB
public incorrectDiskMedia
public getSysDate
public setSysDate
public getExpandedDateTime
public getExpandedDate
public readConsoleIn
public writeConsoleOut
public CharDevRequest
public _callCriticalError
extrn upperCase : near
extrn _bitShiftTable : near
extrn sizeShiftTable : abs
extrn _RxDOS_bLastDrive : byte
extrn _RxDOS_NULLDev : dword
extrn _RxDOS_pCDS : dword
extrn _RxDOS_pCLOCKdriver : dword
extrn _RxDOS_pCONdriver : dword
extrn _RxDOS_Verify : word
extrn _RxDOS_AbortInProgress : word
extrn _RxDOS_StackLongJump : word
extrn _RxDOS_bCtrlBreakCheck : byte
extrn RxDOS_StackProtect : word
extrn RxDOS_StackTop : word
extrn _RxDOS_CurrentInstance : word
extrn _RxDOS_CurrentStackTop : word
extrn _RxDOS_INDOSFlag : word
extrn _RxDOS_CurrentPSP : word
extrn SDAInt24_SPSave : dword
extrn _RetCallersStackFrame : near
extrn updateAllChangedCCBBuffers : near
extrn invalidateBuffers : near
extrn AmountFreeSpace : near
extrn _TerminateProcess : near
extrn LogTraceBlockDevRequest : near
extrn LogTraceBlockDevReturn : near
extrn LogTraceCharDevRequest : near
extrn LogTraceCharDevReturn : near
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Default Stdin Access ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Input: ;
; es:bx buffer address. ;
; cx length. ;
; ;
;...............................................................;
readConsoleIn:
or cx, cx
jz readConsoleIn_08
mov di, bx
push word ptr ss:[ _RxDOS_pCONdriver. _segment ]
push word ptr ss:[ _RxDOS_pCONdriver. _pointer ]
call devCharReadLine ; read til cr or eof.
readConsoleIn_08:
ret
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Default Stdout Access ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Input: ;
; es:bx buffer address. ;
; cx length. ;
; ;
;...............................................................;
writeConsoleOut:
or cx, cx
jz writeConsoleOut_08
mov di, bx
push word ptr ss:[ _RxDOS_pCONdriver. _segment ]
push word ptr ss:[ _RxDOS_pCONdriver. _pointer ]
call devCharWrite
writeConsoleOut_08:
ret
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Locate Device Driver By Type ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Input: ;
; ax type to match. must match all bits set. ;
; ;
; Output: ;
; es:bx pointer to driver header block ;
;...............................................................;
checkforDeviceType:
push es
currSegment es ; point to NULL device
mov bx, offset _RxDOS_NULLDev ; get start of chain
chkDevType_08:
cmp bx, -1 ; end of list ?
stc ; set error
jz chkDevType_16 ; if end of list -->
mov cx, word ptr es:[ devAttributes ][ bx ]
and cx, ax ; strip away only mask bits
cmp cx, ax ; all bits match ?
jnz chkDevType_14 ; no, go to next -->
add sp, 2 ; pop old es:
push es ; save current es: for return
jmp short chkDevType_16 ; return -->
chkDevType_14:
les bx, dword ptr es:[ devLink ][ bx ]
jmp chkDevType_08 ; go to next ->
chkDevType_16:
pop es
ret
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Locate Device Driver By Name ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Input: ;
; es:di name to match. character devices only. ;
; ;
; Output: ;
; es:bx pointer to driver header block ;
; cy driver was not located ;
;...............................................................;
checkforDeviceName:
Entry
defbytes _tempdevname, sizedevName
push ds
push di
push si
push es
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; init by creating a blank filled upper case mask
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mov si, di
lea di, offset _tempdevname [ bp ]
mov cx, sizedevName
chkDevName_08:
mov al, byte ptr es:[ si ]
call upperCase
cmp al, ' ' + 1 ; null or special character ?
jle chkDevName_12
cmp al, ':' ; colon ?
jz chkDevName_12
mov byte ptr ss:[ di ], al ; store character
inc si
inc di
loop chkDevName_08
chkDevName_12:
or cx, cx
jz chkDevName_14
mov byte ptr ss:[ di ], ' ' ; blank fill
inc di
loop chkDevName_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; match against all known driver names
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
chkDevName_14:
setDS ss
currSegment es
mov bx, offset _RxDOS_NULLDev ; get start of chain
chkDevName_20:
cmp bx, -1 ; end of list ?
stc ; set error
jz chkDevName_26 ; if end of list -->
test word ptr es:[ devAttributes ][ bx ], ( DEV_CHAR )
jz chkDevName_24 ; not a character device ->
lea si, offset _tempdevname [ bp ]
lea di, offset [ devName ][ bx ]
mov cx, sizedevName
rep cmpsb ; compare names
jnz chkDevName_24 ; if not equal, go to next -->
clc ; no carry means we have a valid device
pop si ; remove old es:
push es ; return this es:
jmp short chkDevName_26
chkDevName_24:
les bx, dword ptr es:[ devLink ][ bx ]
jmp chkDevName_20 ; go to next ->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; return
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
chkDevName_26:
pop es
pop si
pop di
pop ds
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Locate Blocked Devices ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; Input: ;
; al drive ;
; ;
; Output: ;
; dx:cx pointer to driver header block ;
;...............................................................;
findInstalledBlockDevice:
Entry
def _drive, ax
push es
push bx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -