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

📄 rxdosdir.asm

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

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

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  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 PARA PUBLIC 'CODE'
         assume cs:RxDOSCMD, ds:RxDOSCMD, es:RxDOSCMD, ss:RxDOSCMD

        public _Dir
        public _splitpath
        public _makePath

        extrn CheckOptOneArg                            : near
        extrn CmndError_InvalidDrive                    : near
        extrn CmndError_NoFilesFound                    : near
        extrn CRLF                                      : near
        extrn DisplayLine                               : near
        extrn DisplayErrorMessage                       : near
        extrn PreProcessCmndLine                        : near
        extrn RxDOS_AllFiles                            : near
        extrn setPagingMode                             : near
        extrn _AppendPathName                           : near
        extrn _CopyString                               : near

        extrn _DirAttribSwitch                          : near
        extrn _DirBareSwitch                            : near
        extrn _DirLowerCaseSwitch                       : near
        extrn _DirOrderSwitch                           : near
        extrn _DirPauseSwitch                           : near
        extrn _DirSubDirSwitch                          : near
        extrn _DirSwitches                              : near
        extrn _DirWideSwitch                            : near
        extrn _Dir_DirectoryOf                          : near
        extrn _Dir_DirEntry                             : near
        extrn _Dir_FileEntry                            : near
        extrn _Dir_Files                                : near
        extrn _Dir_NoVolumeLabel                        : near
        extrn _Dir_VolumeLabel                          : near
        extrn _Dir_VolumeSerialNumber                   : near

        extrn RxDOS_DTA                                 : near
        extrn _lowerCase                                : near
        extrn _lowerCaseString                          : near
        extrn _endofString                              : near
        extrn _sprintf                                  : near
        extrn returnVolumeName                          : near


        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Dir Time To Ascii (USA Format)                               ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  Input:                                                       ;
        ;   ax     time value                                           ;
        ;   di     address to display time of day                       ;
        ;                                                               ;
        ;...............................................................;


_dirTimeToAscii:

        push di
        
        push ax
        mov ch, 'a'
        mov cl, 11                              ; ch = 0
        shr ax, cl                              ; hours
        cmp ax, 13                              ; 1 pm or greater ?
        jc _dirTimeToAscii_08                   ; no -->

        sub ax, 12                              ; 1 pm or greater
        mov ch, 'p'                             ; set pm flag
        
_dirTimeToAscii_08:
        mov cl, 10
        div cl
        or ax, '00'                             ; conv to ascii
        stosw

        mov al,':'
        stosb

        pop ax
        mov cl, 5
        shr ax, cl                              ; minutes
        and ax, 00111111b                       ; mask off hours
        
        mov cl, 10
        div cl
        or ax, '00'                             ; conv to ascii
        stosw

        xor ah, ah
        mov al, ch
        stosw

        pop di
        cmp byte ptr [ di ], '0'
        jnz _dirTimeToAscii_12
        mov byte ptr [ di ], ' '

_dirTimeToAscii_12:
        ret

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Dir Date To Ascii (USA Format)                               ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  Input:                                                       ;
        ;   ax     date value                                           ;
        ;   di     address to display date of day                       ;
        ;                                                               ;
        ;...............................................................;

_dirDateToAscii:

        push di
        push ax
        mov cl,  5
        shr ax, cl                              ; Month
        and ax, 00001111b                       ; mask off year 

        mov cl, 10
        div cl
        or ax, '00'                             ; conv to ascii
        stosw

        mov al,'-'
        stosb

        pop ax
        push ax
        and ax, 00011111b                       ; mask off everything but day
        
        mov cl, 10
        div cl
        or ax, '00'                             ; conv to ascii
        stosw

        mov al,'-'
        stosb

        pop ax
        mov cl,  9
        shr ax, cl                              ; Year
        and ax, 01111111b                       ; mask
        add ax, 80                              ; 80 plus
        cmp ax, 100                             ; past year 2000 ?
        jc _dirDateToAscii_08                   ; no need to adjust -->

        sub ax, 100                             ; 2000 plus

_dirDateToAscii_08:
        mov cl, 10
        div cl
        or ax, '00'                             ; conv to ascii
        stosw

        xor al, al
        stosb

        pop di
        cmp byte ptr [ di ], '0'
        jnz _dirDateToAscii_12
        mov byte ptr [ di ], ' '

_dirDateToAscii_12:
        ret

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  test drive letter                                            ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  Input:                                                       ;
        ;   al     drive letter or null character                       ;
        ;                                                               ;
        ;  Returned:                                                    ;
        ;   al     drive (0 = A:, 1=B:, ... )                           ;
        ;   cy     if not valid                                         ;
        ;   zr     if null or default drive                             ;
        ;                                                               ;
        ;...............................................................;

_testDriveLetter:
        or al, al                                       ; default drive ?
        jz _testDriveLetter_Return                      ; yes -->

        cmp al, 'A'                                     ; 'A' - 'Z' ?
        jc _testDriveLetter_Return                      ; no -->
        cmp al, 'Z' + 1
        jc _testDriveLetter_Valid                       ; no -->

        cmp al, 'a'                                     ; 'a' - 'z' ?
        jc _testDriveLetter_Return                      ; no -->
        cmp al, 'z' + 1
        jc _testDriveLetter_Valid                       ; no -->

        stc
        jmp short _testDriveLetter_Return

_testDriveLetter_Valid:
        dec al
        and al, 1Fh                                     ; just drive letter

_testDriveLetter_Return:
        ret

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Split Path                                                   ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  Usage:                                                       ;
        ;   si     points to filename to split                          ;
        ;   di     points to expanded name area                         ;
        ;...............................................................;

_splitpath:

        Entry
        
        def _source, si
        def _expandedname, di
        def _extension
        def _wildchars, 0000

        clearMemory sizeExpandedName                    ; clear expand area

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;  examine/ extract drive letter from path
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        cmp byte ptr [ si+1 ],':'                       ; test for drive letter
        jnz _splitpath_08                               ; no drive letter entered -->

        mov al, byte ptr [ si ]
        mov byte ptr [ expDrive ][ di ], al             ; isolate drive letter
        inc si
        inc si

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;  scan string through entire path until extension, if any.

⌨️ 快捷键说明

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