IDEAL
P386
MODEL FLAT

DATASEG

CODESEG

; Input:
;       EDI: dest
;	ECX: NumPixels

PUBLIC  RenderBandScan_
PROC	RenderBandScan_

	; By pels till end or alignment
@@l1:
	test	edi,3
	jz	@@align

	xor	eax,eax
	mov	al,[edi]
	add	al,bl
	mov	[edi],al
	inc	edi
	dec	ecx
	jnz	@@l1
	ret

@@align:
	cmp	ecx,8
	jb	@@bypels

	push	ecx
	shr	ecx,3
	push	edx
@@l4:
	mov	eax,[edi]
	mov	edx,[edi+4]
	add	eax,ebx
	add	edx,ebx
	and	eax,0F0F0F0F0h
	and	edx,0F0F0F0F0h
	mov	[edi],eax
	mov	[edi+4],edx
	add	edi,8
	dec	ecx
	jnz	@@l4

	pop	edx

	pop	ecx
	and	ecx,7
	jz	@@ret

@@bypels:
@@l:	xor	eax,eax
	mov	al,[edi]
	add	al,bl
	mov	[edi],al
	inc	edi
	dec	ecx
	jnz	@@l
@@ret:
	ret
ENDP
END