home *** CD-ROM | disk | FTP | other *** search
- PAGE 66,132
- ;
- ;
- ;
- ;
- ;
- ;
- ;
- ;
- ; bufcmp.asm
- ;
- ; Efficient compare operation.
- ;
- ; Usage :
- ; bufcmp( soff, sseg, doff, dseg, count )
- ; unsigned int soff; /* source offset */
- ; unsigned int sseg; /* source segment */
- ; unsigned int doff; /* destination offset */
- ; unsigned int dseg; /* destination segment */
- ; unsigned int count; /* byte count */
- ;
- ; (c) 1984 University of Waterloo,
- ; Faculty of Engineering,
- ; Engineering Microcomputer Network Development Office
- ;
- ; version
- ;
- ; 0.1 8-June-1984 B. T. Campbell - handle segment wraps
- ; 0.0 01-May-1984 B. T. Campbell
- ;
- ;
- include masmdefs.hsm
- include model.hsm
-
- codedef BUFCMP
- datadef
-
- cstart BUFCMP
- cpublic bufcmp
-
- push di
- push si
-
- mov DX,DS
- mov BX,ES ;save segment registers
- mov AX,+@AB+0[BP]
- mov CL,4
- shr AX,CL
- add AX,+@AB+2[BP]
- mov DS,AX
- mov AX,+@AB+0[BP]
- and AX,0fh
- mov SI,AX
- mov AX,+@AB+4[BP]
- mov CL,4
- shr AX,CL
- add AX,+@AB+6[BP]
- mov ES,AX
- mov AX,+@AB+4[BP]
- and AX,0fh
- mov DI,AX
- mov CX,@AB+8[BP] ;byte count
- mov AX,CX
- pushf
- cld
- rep cmpsb
- jz okcmp
- sub AX,CX
- jmp nokcmp
- okcmp:
- xor ax,ax
- nokcmp:
- popf
- mov DS,DX
- mov ES,BX
-
- pop si
- pop di
-
- creturn bufcmp
- cend BUFCMP
-
- end