home *** CD-ROM | disk | FTP | other *** search
- ;put into the public domain by Russell Nelson, nelson@clutx.clarkson.edu
-
- find_signature:
- ;find a signature somewhere in memory.
- ;enter with ds:si -> our signature, al = first letter of signature.
- ;exit with es:di -> their signature, zr if we found ourselves.
- mov [si],al ;set the proper first char.
- mov ax,60h ;can't possibly be lower than this.
- find_signature_1:
- mov es,ax ;go to the current paragraph.
- mov di,si
- and di,0fh
- find_signature_3:
- push si ;see if this is the signature string.
- push di
- push cx
- repe cmpsb
- pop cx
- pop di
- pop si
- je find_signature_2 ;we found it!
- add di,10h ;move up a paragraph.
- cmp di,0fffh ;have we searched far enough?
- jb find_signature_3 ;not yet.
- add ax,100h
- jmp find_signature_1 ;we'll eventually find our own.
- find_signature_2:
- not byte ptr [si] ;invert the first letter.
- mov al,[si] ;if the signature still matches,
- cmp al,es:[di] ;return zr if we found ours.
- ret
-
-