include	clib.inc
include	conio.inc

PPROC	rcxyrow, rc:dword, x:word, y:word
	push	dx
	mov	al,byte ptr y
	mov	ah,byte ptr x
	mov	dl,rc.rc_x
	mov	dh,rc.rc_y
	cmp	ah,dl
	jb	rcxyrow_01
	cmp	al,dh
	jb	rcxyrow_01
	add     dl,rc.rc_col
	cmp	ah,dl
	jae	rcxyrow_01
	mov	ah,dh
	add     dh,rc.rc_row
	cmp	al,dh
	jae	rcxyrow_01
	sub	al,ah
	inc	al
	mov	ah,0
    rcxyrow_00:
	pop	dx
	ret
    rcxyrow_01:
	xor	ax,ax
	jmp	rcxyrow_00
PEND	rcxyrow

	END
