📄 rxdoscpy.asm
字号:
push di
_copyArgument_06:
lodsb ; get character
stosb
cmp al, ' '+1 ; space or control character ?
jc _copyArgument_10 ; yes -->
cmp al, byte ptr [ _SwitchChar ] ; switch character ?
jz _copyArgument_10 ; yes -->
call _CmndParse_SeparatorCheck ; parse break ?
jnz _copyArgument_06 ; no, go to next char -->
_copyArgument_10:
mov byte ptr [ di-1 ], 0 ; place null terminator
pop di
ret
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; LookAhead Add Mode ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Usage: ;
; si points to argument start ;
; di points to destination ;
;...............................................................;
_scanForwardArgArray:
push di
mov di, word ptr [ __argarray ][ bp ] ; get arg pointer to next arg
xor ax, ax ; next is NOT add
_scanForwardArgArray_10:
mov si, word ptr [ di ] ; point to text
or si, si ; null entry ?
jz _scanForwardArgArray_12 ; yes, return -->
add di, 2
cmp byte ptr [ si ], '/'
jz _scanForwardArgArray_10
cmp byte ptr [ si ], '+'
jnz _scanForwardArgArray_12
mov ax, -1 ; next IS add
_scanForwardArgArray_12:
pop di
ret
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Get Starting Cluster Value for a given Handle ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Input: ;
; bx file handle ;
; ;
; Output: ;
; ax starting cluster value ;
;...............................................................;
GetClusterValue:
push es
push di
push bx
Int21 GetPSPAddress ; returns bx with segment
mov es, bx ; set PSP address
pop si ; restore handle offset
push si ; (save handle)
les bx, dword ptr es:[ pspFileHandlePtr ] ; point to file handles
mov bl, byte ptr es:[ bx + si ] ; get real sft offset
xor bh, bh
push bx ; save real SFT handle
Int21 GetDosDataTablePtr ; UNDOCUMENTED DOS CALL
pop ax ; restore real SFT handle
les si, dword ptr es:[ bx + 4 ] ; get address of FT start
GetClusterValue_08:
sub ax, word ptr es:[ numberSFTEntries ][ si ]
jc GetClusterValue_14 ; if in current FT -->
cmp word ptr es:[ nextFTPointer. _pointer ][ si ], -1
jz GetClusterValue_22 ; if error -->
les si, dword ptr es:[ nextFTPointer ][ si ] ; get address of FT start
jmp GetClusterValue_08 ; got to next FT -->
GetClusterValue_14:
add ax, word ptr es:[ numberSFTEntries ][ si ] ; restore offset
mov cx, sizeSFT
mul cx ; offset times size of entries
add si, sizeFT ; move past header
add si, ax ; position at sft
xor ax, ax
xor dx, dx
test word ptr es:[ sftDevInfo ][ si ], sftIsDevice
jnz GetClusterValue_18 ; if device -->
mov ax, word ptr es:[ sftBegCluster ][ si ] ; if file
mov dx, word ptr es:[ sftDevInfo ][ si ]
and dx, sftDrivemask
GetClusterValue_18:
mov cx, ax
or cx, dx ; if all zeroes
jmp short GetClusterValue_26 ; exit -->
GetClusterValue_22:
xor ax, ax
xor dx, dx
stc
GetClusterValue_26:
pop bx
pop di
pop es
ret
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Compare Drive/Cluster Info ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; NZ if not equal ;
;...............................................................;
_compareClusters:
cmp word ptr [ _destCluster. _low ][ bp ], 0000
jz _compareClusters_NotEqual
cmp word ptr [ _srcCluster. _low ][ bp ], 0000
jz _compareClusters_NotEqual
mov ax, word ptr [ _destCluster. _low ][ bp ] ; (cluster)
cmp ax, word ptr [ _srcCluster. _low ][ bp ]
jnz _compareClusters_NotEqual
mov ax, word ptr [ _destCluster. _high ][ bp ] ; (drive )
cmp ax, word ptr [ _srcCluster. _high ][ bp ]
jnz _compareClusters_NotEqual
ret
_compareClusters_NotEqual:
mov ax, -1
or ax, ax
ret
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Make Unique Name ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Usage: ;
; di name expected with wild characters ;
;...............................................................;
_makeUniqueName:
Entry
def _name, di
defbytes _expandedname, sizeExpandedName
push di
mov si, di
lea di, offset [ _expandedname ][ bp ]
call _splitpath
mov cx, sizefnName
mov si, offset [ RxDOS_DTA. findFileName ]
lea di, offset [ _expandedname. expFilename ][ bp ]
call _makeReplacement
inc si
mov cx, sizefnExtension
lea di, offset [ _expandedname. expExtension + 1 ][ bp ]
call _makeReplacement
lea si, offset [ _expandedname ][ bp ]
getarg di, _name
call _makePath
pop di
mov dx, di
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Make Replacement ;
;...............................................................;
_makeReplacement:
Entry
defbytes _tempName, sizeFILENAME
push cx
push di
lea di, offset _tempName [ bp ]
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; make blank filled copy
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_makeReplacement_04:
mov al, byte ptr [ si ]
mov byte ptr [ di ], al ; copy byte
cmp al, '.'
jz _makeReplacement_08
or al, al
jz _makeReplacement_08
inc si
inc di
loop _makeReplacement_04
_makeReplacement_08:
or cx, cx
jz _makeReplacement_12
mov byte ptr [ di ], ' '
inc di
loop _makeReplacement_08
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; copy with wild character replacement
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_makeReplacement_12:
pop di ; real destination
pop cx ; real count
push si ; save this pointer
lea si, offset _tempName [ bp ] ; new source
_makeReplacement_18:
cmp byte ptr [ di ], '?'
jnz _makeReplacement_22
mov al, byte ptr [ si ] ; get character
mov byte ptr [ di ], al ; replace wild character
_makeReplacement_22:
inc di
inc si
loop _makeReplacement_18
mov byte ptr [ di ], 00
pop si
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Replace with Real Name ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Usage: ;
; di full expanded name expected ;
;...............................................................;
_replaceWithRealName:
push di
mov dx, di
_replaceWithRealName_04:
cmp byte ptr [ di ], 0 ; find end of string
jz _replaceWithRealName_08
inc di
jmp _replaceWithRealName_04
_replaceWithRealName_08:
cmp dx, di
jz _replaceWithRealName_12
mov al, byte ptr [ di-1 ]
cmp al, ':'
jz _replaceWithRealName_12
cmp al, '\'
jz _replaceWithRealName_12
cmp al, '/'
jz _replaceWithRealName_12
dec di
jmp _replaceWithRealName_08
_replaceWithRealName_12:
mov si, offset [ RxDOS_DTA. findFileName ] ; expanded name
call _CopyString
pop di
mov dx, di
ret
RxDOSCMD ENDS
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -