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

 
Output of file : STRCHR.ASM contained in archive : RHSTDLIB.ZIP
stdlib segment para public 'slcode'
assume cs:stdlib
;
;
; strchr- Returns the position of a single character in a string.
;
; inputs:
;
; al- character to search for.
; es:di- address of string.
;
; returns:
;
; cx- position of character in string (if present).
; carry=0 if character found.
; carry=1 if character is not present in string.
;
public sl_strchr
;
sl_strchr proc far
pushf
push ds
push si
push ax
cld
;
mov si, es ;Setup ds:si to use LODSB
mov ds, si
mov si, di
;
mov ah, al ;ah=char to search for.
strchrlp: lodsb
cmp al, ah
jz FndChr
cmp al, 0
jne strchrlp
;
xor cx, cx
pop ax
pop si
pop ds
popf
stc
ret
;
FndChr: pop ax
mov cx, si
sub cx, di
dec cx
pop si
pop ds
popf
clc
ret
sl_strchr endp
;
;
stdlib ends
end


  3 Responses to “Category : Assembly Language Source Code
Archive   : RHSTDLIB.ZIP
Filename : STRCHR.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/