;d0=# of words to DMA
;d1=srce address
;d5=dest character indx
add2dma	module
	movem.l d0/d1/d5,-(sp)
	lea	dmalist,a5
	moveq	#0,d2
	move.w	num_dmas,d2
	lsl.w	#3,d2
	add.l	d2,a5
	lsr.l	#1,d1
	lsl.w	#5,d5
	move.w	d0,(a5)+		;dma len (words)
	move.l	d1,(a5)+		;dma source address/2
	move.w	d5,(a5)+		;dma destination
	add.w	d0,d1		;check for overflow
	bcs.s	@2
@3	addq.w	#1,num_dmas
	bra.s	@add2end
@2	beq.s	@3
	sub.w	d1,d0
	move.w	d0,-8(a5)
	add.w	d0,d0
	add.w	d5,d0
	move.w	d1,(a5)+		;dma len (words)
	clr.w	d1
	add.l	#$10000,d1
	move.l	d1,(a5)+		;dma source address/2
	move.w	d0,(a5)+		;dma destination
	addq.w	#2,num_dmas
@add2end	movem.l (sp)+,d0/d1/d5
	rts
	modend

