⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rxdosfor.asm

📁 dos source
💻 ASM
📖 第 1 页 / 共 2 页
字号:
        TITLE   'For - RxDOS Command Shell For Function'
        PAGE 59, 132
        .LALL

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  RxDOS Command Shell For                                      ;
        ;...............................................................;

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  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                                        ;
        ;...............................................................;

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  RxDOS Command Shell                                          ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  Programmer's Notes:                                          ;
        ;                                                               ;
        ;  Command Shell consists of  two parts bound  together into a  ;
        ;  single executable load.  There  exists  a  single  resident  ;
        ;  command shell which is accessible by an Int 2Eh.             ;
        ;                                                               ;
        ;...............................................................;

        include rxdosmac.asm
        include rxdosdef.asm
        include rxdoscin.asm

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  RxDOS Command Shell                                          ;
        ;...............................................................;

RxDOSCMD SEGMENT PUBLIC 'CODE'
         assume cs:RxDOSCMD, ds:RxDOSCMD, es:RxDOSCMD, ss:RxDOSCMD

        public _For

        extrn CheckOptOneArg                            : near
        extrn CountArgs                                 : near
        extrn CmndLookup                                : near
        extrn CmndError_SyntaxError                     : near
        extrn CRLF                                      : near
        extrn DisplayErrorMessage                       : near
        extrn DisplayLine                               : near
        extrn DisplayPrompt                             : near
        extrn _CopyString                               : near
        extrn ReplaceForVariables                       : near
        extrn _CommandParser                            : far

        extrn RxDOS_ForArgs                             : near
        extrn _lowerCase                                : near
        extrn _lowerCaseString                          : near

        extrn _computeLength                            : near
        extrn _Seeif_WildCharacter                      : near

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  FOR %variable IN (set) DO command [command-parameters]       ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  Replace %var in command.                                     ;
        ;                                                               ;
        ;...............................................................;

_For:

        Entry
        def __argarray, di
        def __arg
        def __cmdline
        def __endrepeatArg

        def _letter
        def _length
        def _WildChars
        ddef _CurrentDTA, 0000, 0000

        defbytes _DTA, sizeFINDENTRY
        defbytes _commandLine, 128
        defbytes _replacement, 128

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;  get variable arg letter 
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        call CountArgs                                  ; must have min of 8 args
        cmp ax, 8                                       ; min args 
        jge _For_08                                     ; if at leats 8 -->
        jmp _ForError                                   ; else if less, syntax error -->

_For_08:
        mov si, word ptr [ forVarIdent ][ di ]          ; point to arg
        cmp byte ptr [ si ], '%'                        ; is arg a % variable ?
        ifnz _ForError                                  ; if not, then syntax error -->

        mov al, byte ptr [ si + 1 ]                     ; get letter
        call _lowerCase
        cbw
        storarg _letter, ax

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;  check for 'in' argument
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        mov si, word ptr [ forInArg ][ di ]             ; point to next arg
        mov di, offset RxDOS_ForArgs
        call CmndLookup                                 ; lookup command
        ifc _ForError                                   ; if not, then syntax error -->

        cmp bx, _IN                                     ; 'in' returns a zero
        ifnz _ForError                                  ; if not 'in', then syntax error -->

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;  check for ( argument
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        getarg di, __argarray
        add di, forInStartParen + 2
        mov si, word ptr [ di - 2 ]                     ; point to next arg
        cmp byte ptr [ si ], '('                        ; is arg a ( variable ?
        ifnz _ForError                                  ; if not, then syntax error -->

        storarg __arg, di                               ; di points to an argument

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;  search for ) do ...
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        dec di
        dec di

_ForSearchForParen:
        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 -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -