VDP FILL Function

Ask anything your want about the 32X Mushroom programming.

Moderator: BigEvilCorporation

Post Reply
ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

VDP FILL Function

Post by ob1 » Fri May 21, 2021 6:48 am

Hello to you all.
I've been toying around with the VDP FILL function, and especially, trying to trigger it again while already filling.
Here's my code:

Code: Select all

	MOV.L	!AUTOFILL,R4	; $20004104
	MOV	#LINE_WIDTH,R0	; 40 pixels
	MOV.W	R0,@R4	; Set Length
	MOV.L	!FRAME_BUFFER2,R0	; $24000200+128*FB_WIDTH
	SHLR	R0
	MOV.W	R0,@(2,R4)	; Set Start Address
	MOV	R1,R0	; Red line
	MOV.W	R0,@(4,R4)	; Set Data

	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	MOV	#2,R0
!waitABit:
	DT	R0
	BF	!waitABit

	MOV	R2,R0		; Green line
	MOV.W	R0,@(4,R4)	; Set Data
And here is the result :
IMG_2740.jpg
IMG_2740.jpg (102.37 KiB) Viewed 5347 times
The first red line is a template, 40 pixels long.
The second line is our test. I first draw a blue line, to clearly see things,
then I trigger a FILL with red,
then, during this red FILL, I trigger a green FILL.
What does this picture tell us?
  1. You can trigger a FILL while being already FILLing. Upon that, the current FILL is discarded while the new one starts.
  2. When you trigger a new FILL, the value of length register is read again. I deduce this from the fact that the green line is ~40 pixels long
  3. When you trigger a new FILL, the value of start register is NOT read again. I deduce this from the fact that the green line does NOT start from where the second red line started, that is, we can see some red pixels before the green ones.
It actually is pretty hard to have precise timing. Moreover, I usually see glitches on some frame.

Going further, we may imagine an image where the pixels would be put by FILLing, and changing length and data on the fly.
Pretty useless, but this reminds me of the oerg666 Blast Processing.

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Re: VDP FILL Function

Post by djcouchycouch » Fri May 21, 2021 1:12 pm

In my current 32x experiments, I'm using FILL (multiple times) to clear the background before drawing sprites. Are there any known issues to this?

Alternatively, do you know of faster methods of clearing the framebuffer?

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Re: VDP FILL Function

Post by ob1 » Fri May 21, 2021 8:20 pm

That's exactly the stuff I want to try next.
Beforehand, I would say that the FILL is a bit faster than a well optimized loop, but I'll have us the numbers ^^

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Re: VDP FILL Function

Post by ob1 » Tue May 25, 2021 12:52 pm

done some testing on a real PAL 32X, and FILL is ~36% faster than ASM loops.
Your mileage may vary.

Post Reply