View Single Post
Old 19 September 2014, 12:31   #41
AnimaInCorpore
Registered User
 
Join Date: Nov 2012
Location: Willich/Germany
Posts: 232
Another hint for the DMA usage in Pac-Mania: writing to the address $E84087 initiates a DMA transfer to copy or fill memory blocks. The last instruction of "DMA_BLOCK_COPY" and "DMA_BLOCK_ERASE" are doing this so you need an own copy/fill subroutine to be invoked at that point. Also search for "L_00E84000+0x87.l" within the code and put your subroutine at the right place as well. I am also checking if the target memory lies between $EB8000 and $EB8000+0x6000 because that is the sprite data memory. In fact, the DMA is used for the animation of the characters.

Here's a short example how it works:
Code:
x68k_dma:
	move	#0x2700,sr

	movem.l	d0-d7/a0-a6,-(sp)

	lea		L_00E84000+0x80,a0
	cmp.l	#L_00EB8000,20(a0)
	jlt		1f
	cmp.l	#L_00EB8000+0x6000,20(a0)
	jge		1f
	move	10(a0),d0
	move.l	12(a0),a0
	lsr		#7-1,d0
	jbsr	convert_sprites

1:
	lea		L_00E84000+0x80,a0
	move.l	12(a0),a1
	move.l	20(a0),a2
	move	10(a0),d0

	move	d0,d1
	lsr		#5,d0
	and		#0x1f,d1
	move	#32,d2
	sub		d1,d2
	add		d2,d2

	cmp.b	#0x5,6(a0)
	jne		x68k_dma_not_copy

	jmp		x68k_dma_copy_loop(pc,d2.w)
x68k_dma_copy_loop:
.rept 32
	move	(a1)+,(a2)+
.endr
	dbf		d0,x68k_dma_copy_loop

	jra		x68k_dma_exit

x68k_dma_not_copy:
	move	(a1),d1

	jmp		x68k_dma_fill_loop(pc,d2.w)
x68k_dma_fill_loop:
.rept 32
	move	d1,(a2)+
.endr
	dbf		d0,x68k_dma_fill_loop

x68k_dma_exit:
	movem.l	(sp)+,d0-d7/a0-a6

	move	#0x2300,sr

	rts
AnimaInCorpore is offline  
 
Page generated in 0.08200 seconds with 11 queries