	rsreset
spad:		rs.l	1
spyinc:		rs.w	1
spw:		rs.w	1
spx:		rs.w	1
spy:		rs.w	1
spx2:		rs.w	1
spy2:		rs.w	1
spx3:		rs.w	1
spy3:		rs.w	1

dosprite:
	lea	b2,a5

	lea	blitter,a6
	move.l	savemem4,a0
	move.l	viewscreen2,a1
	move.w	spx3(a5),d0		;get last x for restore
	add.w	d0,d0
	add.w	d0,a0
	add.w	d0,a1
	move.w	spy3(a5),d0		;get last y for restore
	mulu.w	#640,d0
	add.l	d0,a0
	add.l	d0,a1

.waitblit:
	btst	#7,line_num(a6)		
	bne	.waitblit

	move.l	a0,src_addr(a6)
	move.l	a1,dst_addr(a6)
	move.w	#2,src_xinc(a6)
	move.w	#2,dst_xinc(a6)
	move.w	spyinc(a5),src_yinc(a6)
	move.w	spyinc(a5),dst_yinc(a6)

	move.w	spw(a5),x_count(a6)
	move.w	spw(a5),y_count(a6)
	move.w	#-1,endmask1(a6)
	move.w	#-1,endmask2(a6)
	move.w	#-1,endmask3(a6)
	move.b	#0,skew(a6)
	move.b	#$3,op(a6)
	move.b	#2,hop(a6)
*	bset	#6,line_num(a6)
	bset	#7,line_num(a6)

	move.w	spx2(a5),spx3(a5)
	move.w	spy2(a5),spy3(a5)
	move.w	spx(a5),spx2(a5)
	move.w	spy(a5),spy2(a5)

	move.w	mx,spx(a5)
	move.w	my,spy(a5)

putsprite:
	move.l	spad(a5),a0
	move.l	viewscreen2,a1
	move.w	spx(a5),d0		;get last x for restore
	add.w	d0,d0
	add.w	d0,a1
	move.w	spy(a5),d0		;get last y for restore
	mulu.w	#640,d0
	add.l	d0,a1
.waitblit:
	btst	#7,line_num(a6)
	bne	.waitblit
	move.l	a0,src_addr(a6)
	move.l	a1,dst_addr(a6)
	move.w	#2,src_xinc(a6)
	move.w	#2,dst_xinc(a6)
	move.w	spyinc(a5),src_yinc(a6)
	move.w	spyinc(a5),dst_yinc(a6)

	move.w	spw(a5),x_count(a6)
	move.w	spw(a5),y_count(a6)
	move.w	#-1,endmask1(a6)
	move.w	#-1,endmask2(a6)
	move.w	#-1,endmask3(a6)
	move.b	#0,skew(a6)
	move.b	#$7,op(a6)
	move.b	#2,hop(a6)
*	bset	#6,line_num(a6)
	bset	#7,line_num(a6)

testw:
.waitblit:
	btst	#7,line_num(a6)
	bne	.waitblit
	rts

*		       y          x	
b1:	dc.l	balls+(1*(2*sw))+(1*2)		;address of ball
	dc.w	(sw*2)-(15*2)+2			;src/dst y inc
	dc.w	15				;width/height
	dc.w	0,0				;x/y location
	dc.w	0,0				;x/y location
	dc.w	0,0				;x/y location
b2:	dc.l	balls+(1*(2*sw))+(25*2)		;address of ball
	dc.w	(sw*2)-(23*2)+2			;src/dst y inc
	dc.w	23				;width/height
	dc.w	0,0				;x/y location
	dc.w	0,0				;x/y location
	dc.w	0,0				;x/y location
b3:	dc.l	balls+(1*(2*sw))+(57*2)		;address of ball
	dc.w	(sw*2)-(31*2)+2			;src/dst y inc
	dc.w	31				;width/height
	dc.w	0,0				;x/y location
	dc.w	0,0				;x/y location
	dc.w	0,0				;x/y location
b4:	dc.l	balls+(1*(2*sw))+(97*2)		;address of ball
	dc.w	(sw*2)-(39*2)+2			;src/dst y inc
	dc.w	39				;width/height
	dc.w	0,0				;x/y location
	dc.w	0,0				;x/y location
	dc.w	0,0				;x/y location
b5:	dc.l	balls+(1*(2*sw))+(145*2)	;address of ball
	dc.w	(sw*2)-(55*2)+2			;src/dst y inc
	dc.w	55				;width/height
	dc.w	0,0				;x/y location
	dc.w	0,0				;x/y location
	dc.w	0,0				;x/y location


