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

📄 rxdosstr.asm

📁 dos source
💻 ASM
📖 第 1 页 / 共 4 页
字号:
        TITLE   'str - string functions for rxdos'
        PAGE 59, 132
        .LALL

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  String Functions for RxDOS                                   ;
        ;...............................................................;

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

        include rxdosmac.asm
        include rxdosdef.asm

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

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  String Managers                                              ;
        ;...............................................................;

        public upperCase
        public upperCaseName
        public lowerCase
        public skipToNextName
        public skipToLast
        public skipSpaces
        public ifPathSeparator
        public scanInvalidFilenameChars
        public CompareString
        public CopyString
        public CopyBlock
        public StringLength                     ; StrLen
        public condStringLength
        public convFilenametoFCBString
        public convFCBNametoASCIZ
        public getSysDateinDirFormat
        public __ascii_stosb
        public getMonthDayYear
        public getDaysSince1980
        public getSystemDateValue

        extrn getActualDrive                    : near
        extrn sizeInvFnChars                    : abs
        extrn _invalidFnCharacters              : byte
        extrn getSysDate                        : near
        extrn getExpandedDateTime               : near
        extrn DaysInMonthTable                  : byte
        extrn AccumDaysPerMonthTable            : word

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  String Functions                                             ;
        ;...............................................................;

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Upper Case                                                   ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  al    character                                              ;
        ;...............................................................;

upperCase:
        cmp al, 'a'                                     ;** add language support
        jc upperCase_08
        cmp al, 'z'+1
        jnc upperCase_08

        and al, NOT 20h

upperCase_08:
        or al, al
        ret

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Lower Case                                                   ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  al    character                                              ;
        ;...............................................................;

lowerCase:
        cmp al, 'A'                                     ;** add language support
        jc lowerCase_08
        cmp al, 'Z'+1
        jnc lowerCase_08

        or al, 20h

lowerCase_08:
        or al, al
        ret

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Upper case FCB format filename                               ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  Usage:                                                       ;
        ;  es:si pointer to buffer                                      ;
        ;...............................................................;

UpperCaseName:
        push si
        mov cx, sizeFILENAME

UpperCaseName_08:
        mov al, byte ptr es:[ si ]
        call upperCase
        mov byte ptr es:[ si ], al
        inc si
        loop UpperCaseName_08

        pop si
        ret

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Skip To Start of Name                                        ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  This is a simple routine that skips any \ and spaces to a    ;
        ;  name.  It will not parse drives or anything else.            ;
        ;                                                               ;
        ;  es:si pointer to buffer                                      ;
        ;...............................................................;

skipToNextName:

        cmp byte ptr [ si ], ' '
        jz skipToNextName_04                            ; if space -->
        cmp byte ptr [ si ], '/'
        jz skipToNextName_04                            ; if slash -->
        cmp byte ptr [ si ], '\'
        jnz skipToNextName_08                           ; if anything but name -->

skipToNextName_04:
        inc si
        jmp skipToNextName

skipToNextName_08:
        mov al, byte ptr [ si ]
        or al, al
        ret

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Skip To Start of Last Name in path string                    ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  This routine skips any components of a name until it reaches ;
        ;  the last name.                                               ;
        ;                                                               ;
        ;  es:si pointer to buffer                                      ;
        ;...............................................................;

skipToLast:
        push bx
        mov bx, si

skipToLast_04:
        mov al, byte ptr es:[ si ]
        or al, al
        jz skipToLast_12

        inc si
        cmp al, '/'
        jz skipToLast_08                                ; if slash -->
        cmp al, '\'
        jnz skipToLast_04                               ; if anything but slash -->

skipToLast_08:
        mov bx, si                                      ; remember last /
        jmp skipToLast_04

skipToLast_12:
        mov si, bx
        mov al, byte ptr es:[ si ]
        or al, al
        pop bx
        ret

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Skip Spaces                                                  ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  es:si pointer to buffer                                      ;
        ;...............................................................;

skipSpaces:

        cmp byte ptr es:[ si ], ' '
        jnz skipSpaces_04                               ; non-space -->

        inc si
        jmp skipSpaces

skipSpaces_04:
        mov al, byte ptr es:[ si ]
        or al, al
        ret

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Check For Path Separator                                     ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  al    character                                              ;
        ;...............................................................;

ifPathSeparator:

        cmp al, '/'
        jnz ifPathSeparator_08
        mov al, '\'                                     ; convert / to \

ifPathSeparator_08:
        cmp al, '\'
        ret

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Scan Invalid Filename Chars                                  ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  es:si pointer to buffer                                      ;
        ;...............................................................;

scanInvalidFilenameChars:

        saveSegments di, si
        setDS es
        currSegment es

scanInvalidFnChars_08:
        lodsb                                           ; get character
        or al, al                                       ; end of file name ?
        jz scanInvalidFnChars_12                        ; yes -->

        cmp al, ' '                                     ; make sure its not a control character
        jc scanInvalidFnChars_10                        ; if invalid character ->

        mov di, offset _invalidFnCharacters
        mov cx, sizeInvFnChars
        repnz scasb                                     ; any in invalid character list ?
        jnz scanInvalidFnChars_08                       ; if valid character ->

scanInvalidFnChars_10:
        stc

scanInvalidFnChars_12:
        restoreSegments si, di
        ret

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Compare String                                               ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  Emulates rep cmpsb instruction except that it matches '?'    ;
        ;  characters.  No character conversions.                       ;
        ;                                                               ;
        ;  Input:                                                       ;
        ;   ds:si  source string (may contain ? character )             ;

⌨️ 快捷键说明

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