All pastes #252942 Raw Edit

AWOSLappy

public text v1 · immutable
#252942 ·published 2006-11-20 03:04 UTC
rendered paste body
; bcmp.asm
; asm i386 bcmp() function

GLOBAL bcmp

bcmp:
	push edi 
	push esi
	mov edi,[12+esp]
	mov esi,[16+esp]
	xor eax,eax		; Clear return value
	cld			; The compare direction must be set forward.

	mov ecx,[20+esp]	; Word compare
	shr ecx,2
	repe cmpsw
	jne .R1

	mov ecx,[20+esp]	; Not enough data to do word compare; preform
	and ecx,3		; byte compare.
	repe cmpsb
	je .R2

.R1: 	
	inc eax
.R2:	
	pop esi
	pop edi
	ret