📄 rxdosifs.asm
字号:
pop ds
popf ; restore interrupts
ret
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Interrupt 2F ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; We know that the call is for us because no other redirector ;
; interface has claimed this call. ;
; ;
; al contains function request ;
;...............................................................;
Interrupt2F proc far
cmp ah, IFS_INTERFACECODE ; is it the IFS function code ?
jz Interrupt2F_08 ; yes, allow -->
iret
Interrupt2F_08:
FarEntry 1
arg _returnFlag
def _FctAddress
call IFS_SaveRegisters
and word ptr [ _returnFlag ][ bp ], NOT 1 ; clear carry bit.
sti
cld
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; dispatch
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cmp al, _IFS_maxFunctionCode ; max function code ?
jnc Interrupt2F_26 ; if out of range -->
xor ah, ah
mov bx, ax
add bx, bx ; word offset
mov bx, word ptr [ IFS_Dispatch ][ bx ]
mov word ptr [ _FctAddress ][ bp ], bx
lea bx, offset [ _ReturnFlag + 2 ][ bp ] ; ptr to arguments passed on stack
mov cx, word ptr [ bx ] ; if arg passed on stack
call word ptr [ _FctAddress ][ bp ] ; call Function
jnc Interrupt2F_26 ; if carry not set -->
or word ptr [ _returnFlag ][ bp ], 1 ; set carry bit.
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; return
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Interrupt2F_26:
call IFS_RestoreRegisters
mov sp, bp ; part of return
pop bp
iret
Interrupt2F endp
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Save Registers ;
;...............................................................;
IFS_SaveRegisters:
push cx
push dx
push si
push di
push ds
push es
push bp
mov bp, sp
xchg bx, word ptr ss:[ bp + 14 ] ; return address to bx
push bx
mov bx, word ptr ss:[ bp + 14 ] ; restore bx
mov bp, word ptr ss:[ bp ] ; restore bp
ret ; return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Restore Registers ;
;...............................................................;
IFS_RestoreRegisters:
pop bx ; really, its the return address
pop cx ; really discarded bp
pop es
pop ds
pop di
pop si
pop dx
pop cx
push bp
mov bp, sp
xchg bx, word ptr ss:[ bp + 2 ] ; original bx
pop bp ; restore bp
ret ; return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; IFS ;
;...............................................................;
_IFSChangeDirectory:
_IFSCloseAllFiles:
_IFSCloseFile:
_IFSCommitFile:
_IFSCopy:
_IFSDeleteFile:
_IFSExpandedOpen:
_IFSFindFirst:
_IFSFindNext:
_IFSFlushBuffers:
_IFSGetDiskSpace:
_IFSGetFileAttributes:
_IFSGetSegment:
_IFSInstallCheck:
_IFSIOCTL:
_IFSLockRegion:
_IFSMakeDirectory:
_IFSOpenFile:
_IFSPrinterMode:
_IFSPrinterOnOff:
_IFSPrinterSetup:
_IFSQualifyFilename:
_IFSReadFile:
_IFSRemoveDirectory:
_IFSSeekFromEnd:
_IFSSetFileAttributes:
_IFSSetRedirection:
_IFSTerminateProcess:
_IFSUnlockRegion:
_IFSWriteFile:
_IFSUndefined:
_IFSUnsupported:
ret
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; IFS 17h Create File ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; CX attributes ;
; ES:DI pointer to unitialized SFT ;
; SDAFirstName pointer to expanded file/path ;
; SDApCurrentCDS pointer to CDS ;
;...............................................................;
_IFSCreateFile:
Entry
def _Attributes, cx
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; IFS 11h Rename File ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; SDAFirstName first name ;
; SDASecondName second name ;
;...............................................................;
_IFSRenameFile:
Entry
ddef _wherePointer
defbytes _existfileAccess, sizeDIRACCESS
defbytes _renfileAccess, sizeDIRACCESS
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; does existing file exist ?
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mov ax, (FILE_NODEVICENAME + FILECANNOT_BEDIRECTORY)
mov si, offset SDAFirstName
lea di, offset _existfileAccess [ bp ] ; work dir access block
call LocateFile ; check file path
ifc _renameFile_40 ; if file does not exist -->
mov ax, (FILE_NODEVICENAME + FILECANNOT_BEDEFINED + FILECANNOT_BEDIRECTORY)
mov si, offset SDASecondName
lea di, offset _renfileAccess [ bp ] ; renamed file dir access block
call LocateFile ; check file path
ifc _renameFile_40 ; if file does not exist -->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; both files seem ok, so we'll move them
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mov al, byte ptr [ _existfileAccess. fileAcDrive ][ bp ]
cmp al, byte ptr [ _renfileAccess. fileAcDrive ][ bp ]
mov ax, offset pexterrPathNotFound
stc
ifnz _renameFile_40 ; cannot move across drives -->
mov ax, word ptr [ _existfileAccess. fileAcDirCluster ][ bp ]
cmp ax, word ptr [ _renfileAccess. fileAcDirCluster ][ bp ]
jnz _renameFile_22 ; if must move files across dirs -->
setDS ss
mov si, word ptr [ _renfileAccess. fileAcNameOffset ][ bp ]
les di, dword ptr [ _existfileAccess. fileAcBufferPtr ][ bp ]
add di, word ptr [ _existfileAccess. fileAcDirOffset ][ bp ]
call convFilenametoFCBString ; convert name
les si, dword ptr [ _existfileAccess. fileAcBufferPtr ][ bp ]
call locateCCBPHeader
call CCBChanged ; update buffer
jmp short _renameFile_38 ; exit -->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; move entry between directories
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_renameFile_22:
and word ptr [ _renfileAccess. fileAcDrive ][ bp ], 7FFFh
mov ax, word ptr [ _renfileAccess. fileAcDrive ][ bp ]
mov dx, word ptr [ _renfileAccess. fileAcDirCluster ][ bp ]
call LocateFreeDirSlot ; can we find a valid empty entry ?
ifc _renameFile_40 ; if can't find free slot -->
stordarg _wherePointer, es, si
mov di, si ; where entry must be copied to
lds si, dword ptr [ _existfileAccess. fileAcBufferPtr ][ bp ]
add si, word ptr [ _existfileAccess. fileAcDirOffset ][ bp ]
mov cx, ( sizeDIRENTRY / 2 )
rep movsw ; copy entry from source dir
setDS ss
getdarg es, di, _wherePointer
mov si, word ptr [ _renfileAccess. fileAcNameOffset ][ bp ]
call convFilenametoFCBString ; rename file
getdarg es, si, _wherePointer
call locateCCBPHeader
call CCBChanged ; update buffer
les di, dword ptr [ _existfileAccess. fileAcBufferPtr ][ bp ]
mov bx, word ptr [ _existfileAccess. fileAcDirOffset ][ bp ]
mov byte ptr es:[ di + bx ], DIRENTRY_DELETED
call CCBChanged
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; return
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_renameFile_38:
or ax, ax ; no carry
_renameFile_40:
Return
RxDOS ENDS
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -