home *** CD-ROM | disk | FTP | other *** search
- NAME memid
-
- include tomlib.equ
-
- ;-----------------------------------------------------
- ; memid(near *dest,near *src)
- ; return number of equal bytes
- ; {
- ; register int loop;
- ; for (loop = 0; *dest++ == *src++; loop++)
- ; ;
- ; return loop;
- ; }
- ;
- ;
- ;
- ;------------------------------------------------------
-
- TEXTSEGMENT
-
- PUBPROC _memid
- ;------------------------------------------------------------------------------
-
- mov dx,di ; protect DI && SI
- mov bx,si
- mov si,sp
-
- mov ax,ds
- mov es,ax
-
- mov di,(2+SPOFF)[si]
- mov si,(4+SPOFF)[si]
- mov cx,0ffffh
- cld
- repe cmpsb
- mov ax,-2
- sub ax,cx
-
- mov di,dx
- mov si,bx
- ret
- ;------------------------------------------------------------------------------
- _memid endp
-
- PUBPROC @memid ; registers in AX,BX
- ;------------------------------------------------------------------------------
-
- xchg ax,si
- xchg bx,di ; protect DI && SI
-
- mov cx,ds
- mov es,cx
-
- mov cx,0ffffh
- cld
- repe cmpsb
-
- xchg ax,si
- xchg bx,di ; unprotect DI && SI
-
- mov ax,-2
- sub ax,cx
-
- ret
- ;------------------------------------------------------------------------------
- @memid endp
-
- TEXTEND
- end
-