Category : Assembly Language Source Code
Archive   : RHSTDLIB.ZIP
Filename : STRCSPAN.ASM

 
Output of file : STRCSPAN.ASM contained in archive : RHSTDLIB.ZIP
stdlib segment para public 'slcode'
assume cs:stdlib
;
;
; strcspan- Returns the number of characters at the beginning of a string
; which are NOT from a specified set.
;
; inputs:
;
; ES:DI- Points at string to test.
; DX:SI- Points at set of characters (zero terminated string).
;
; outputs:
;
; CX- Number of characters not in the set which are the prefix of
; the test string.
;
;
;
;
public sl_strcspan
;
sl_strcspan proc far
pushf
push es
push ds
push ax
push bx
push dx
push si
push di
cld
;
mov ax, es
mov es, dx
mov ds, ax
xchg si, di
;
mov bx, di ;Preserve ptr to char set.
mov cx, 0ffffh
mov al, 0
repne scasb ;Compute length of char set.
neg cx
dec cx
dec cx
mov dx, cx ;Save for use later.
;
; Okay, now we can see how many characters from the set match the prefix
; characters in the string.
;
StrLp: lodsb ;Get next char in string.
mov cx, dx ;Get length of char set.
mov di, bx ;Get ptr to char set
repne scasb ;See if in set
jnz StrLp ;Repeat while not in set.
;
pop di
mov cx, di
sub cx, si
neg cx
dec cx
pop si
pop dx
pop bx
pop ax
pop ds
pop es
popf
ret
sl_strcspan endp
;
;
;
;
stdlib ends
end


  3 Responses to “Category : Assembly Language Source Code
Archive   : RHSTDLIB.ZIP
Filename : STRCSPAN.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/