
; GetPixel32(chunky:a0:PTR TO chunky,x:d0:LONG,y:d1:LONG)(LONG)

	machine	mc68020
	fpu	1

	xdef	_GetPixel32

_GetPixel32
	cmpa.l	#0,a0
	beq.s	.out
	tst.l	d0
	blt.s	.out
	tst.l	d1
	blt.s	.out
	cmp.l	(a0),d0
	bge.s	.out
	cmp.l	(4,a0),d1
	bge.s	.out

	muls.l	(a0),d1
	add.l	d0,d1
	lsl.l	#2,d1		; d1 now contains position in buffer
	movea.l	(8,a0),a1
	move.l	(a1,d1.l),d0
	rts
.out	moveq	#-1,d0
	rts
