*********************************************************
*	New sprite routine				*
*	New version give ad of sprite structure in A0	*
*********************************************************
putsprite:
	move.w	(a0),d2
	move.w	d2,d0
	move.w	2(a0),d1
	and.w	#15,d2
	move.l	whichscreen,a6
	lsl.w	#5,d1
	add.w	d1,a6
	lsl.w	#2,d1
	add.w	d1,a6
	and.w	#$fff0,d0
	lsr.w	#1,d0
	add.w	d0,a6
	move.l	a6,a2
*************CODE TO ROTATE A SPRITE IMAGE***********************
shiftimages:
	move.w	4(a0),d1
	move.l	10(a0),a1
	lea	gtemp,a2
ssi1:
	move.w	6(a0),d0
	clr.l	(a2)
	clr.l	4(a2)
ssi0:	
	moveq	#0,d4
	moveq	#0,d5
	moveq	#0,d6
	moveq	#0,d7
	move.w	(a1)+,d4
	move.w	(a1)+,d5
	move.w	(a1)+,d6
	move.w	(a1)+,d7
	ror.l	d2,d4
	ror.l	d2,d5
	ror.l	d2,d6
	ror.l	d2,d7
	or.w	d4,(a2)+
	or.w	d5,(a2)+
	or.w	d6,(a2)+
	or.w	d7,(a2)+
	swap	d4
	swap	d5
	swap	d6
	swap	d7
	move.w	d4,(a2)
	move.w	d5,2(a2)
	move.w	d6,4(a2)
	move.w	d7,6(a2)
	dbf	d0,ssi0
	addq.l	#8,a2
	dbf	d1,ssi1

smake_mask:
	move.w	4(a0),d1
	lea	gtemp,a1
	lea	gmask,a2
smm1:
	move.w	6(a0),d0
	addq.w	#1,d0
smm0:	move.w	(a1)+,d2
	or.w	(a1)+,d2
	or.w	(a1)+,d2
	or.w	(a1)+,d2
	move.w	d2,d3
	swap	d2
	move.w	d3,d2
	eor.l	#-1,d2
	move.l	d2,(a2)+
	dbf	d0,smm0
	dbf	d1,smm1

*********code to put sprite on screen********************
sdraw:
	move.w	4(a0),d1
	lea	gtemp,a1
	lea	gmask,a2
	move.l	a6,a3
sdi1:	move.w	6(a0),d0
	addq.w	#1,d0
	move.l	a6,a5
sdi0:	move.l	(a2)+,d3
	move.l	(a1)+,d6
	move.l	(a1)+,d7
	move.l	(a3)+,d4
	move.l	(a3)+,d5
	and.l	d3,d4
	and.l	d3,d5
	or.l	d6,d4
	or.l	d7,d5
	move.l	d4,(a5)+
	move.l	d5,(a5)+
	dbf	d0,sdi0
	lea	160(a6),a6
	add.w	8(a0),a3
	dbf	d1,sdi1
	rts
