📄 rxdosfor.asm
字号:
cmp byte ptr [ si ], ')' ; is arg a ) variable ?
jnz _ForSearchForParen ; keep looking -->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; search for last ) in case ))) ...
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_ForSearchForDoLastParen:
inc di
inc di
mov si, word ptr [ di ] ; point to next arg
or si, si ; end of args ?
ifz _ForError ; if not, then syntax error -->
cmp byte ptr [ si ], ')' ; is arg a ) variable ?
jz _ForSearchForDoLastParen ; keep looking -->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; test for a 'do' argument
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_ForSearchForDo:
push di
mov di, offset RxDOS_ForArgs
call CmndLookup ; lookup command
pop di ; restore arg pointer
ifc _ForError ; if not legit, syntax error -->
cmp bx, _DO ; 'do' returns a 1
ifnz _ForError ; if not found -->
inc di
inc di
storarg __cmdline, di ; where command line is
sub di, 4
storarg __endrepeatArg, di ; end repeat arg
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; get initial DTA address
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Int21 GetDTA
stordarg _CurrentDTA, es, bx
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; sequentially walk through each arg
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_ForNext:
getarg bx, __arg ; point to arg list
cmp bx, word ptr [ __endrepeatArg ][ bp ] ; end repeat arg ?
ifz _ForReturn ; if at end, exit -->
storarg _WildChars, 0000
mov si, word ptr [ bx ]
call _computeLength ; compute length
storarg _length, cx ; save length
call _Seeif_WildCharacter ; see if wild characters in name.
jc _ForNext_30 ; if no -->
lea di, offset _replacement [ bp ] ; where to copy
rep movsb ; copy argument
xor ax, ax ; null terminate
stosb ; null terminate
storarg _WildChars, -1 ; wild characters used.
lea dx, offset [ _DTA ][ bp ]
Int21 SetDTA
lea dx, offset _replacement [ bp ] ; search for argument
Int21 FindFirstFile ; any found ?
jc _ForNext_36 ; if none -->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; create replacement variable
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_ForNext_14:
lea si, offset [ _DTA. findFileName ][ bp ]
lea di, offset _replacement [ bp ] ; search for argument
call _CopyString ; get command line
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; build command line to execute
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_ForNext_30:
getarg di, __cmdline ; ptr->arg array where command line begins
mov si, word ptr [ di ] ; ptr-> text
lea di, offset [ _commandLine + 1 ][ bp ]
call _CopyString ; get command line
mov al, byte ptr [ _letter ][ bp ]
lea bx, offset [ _replacement ][ bp ]
lea si, offset [ _commandLine + 1 ][ bp ]
call ReplaceForVariables ; replace variable letter
call DisplayPrompt ; display prompt
lea dx, offset [ _commandLine + 1 ][ bp ]
call DisplayLine ; echo line
call CRLF
push ds
getdarg ds, dx, _CurrentDTA
Int21 SetDTA ; temp set DTA
pop ds
lea si, offset [ _commandLine ][ bp ]
mov byte ptr [ si ], 128
call _CommandParser ; reparse remainder of line
cmp word ptr [ _WildChars ][ bp ], 0000 ; wild character search ?
jz _ForNext_36 ; no, skip to next arg in set -->
lea dx, offset [ _DTA ][ bp ]
Int21 SetDTA
Int21 FindNextFile ; search for next matching file
jnc _ForNext_14 ; continue -->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; get next argument
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_ForNext_36:
mov di, word ptr [ __arg ][ bp ] ; get current pointer to arg array
mov dx, word ptr [ di ] ; get current reference
add dx, word ptr [ _length ][ bp ] ; offset to past current arg
sub di, 2
_ForNext_38:
add di, 2
mov si, word ptr [ di ] ; get current reference
cmp si, dx ; beyond or equal to current ?
jc _ForNext_38 ; not yet -->
mov word ptr [ __arg ][ bp ], di ; remember reference
jmp _ForNext
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; error
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_ForError:
mov dx, offset CmndError_SyntaxError
call DisplayErrorMessage
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; return
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_ForReturn:
cmp word ptr [ _CurrentDTA. _segment ][ bp ], 0000
jz _ForReturn_08
push ds
getdarg ds, dx, _CurrentDTA
Int21 SetDTA ; temp set DTA
pop ds
_ForReturn_08:
Return
RxDOSCMD ENDS
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -