VBLK timing

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

VBLK timing

Post by ob1 » Wed Mar 21, 2007 9:56 am

Hi you all.
I'm currently working on vSync, and experience some strange behaviour.
First of all, here's my V_INT code :

Code: Select all

V_INT:
	mov	#0,R0
	mov.w	R0,@($16,GBR)	; Clear VINT
	rte
	add	#1,R13		; Executes ADD before branching
Then, here's my main loop :

Code: Select all

main:
	bsr	waitForVBLK	; wait for V_INT to happen
	nop

	add	#1,R12

	bsr	waitForDISP	; wait for V_INT to finish, and display to begin
	nop

	bra	main
	nop
with

Code: Select all

waitForVBLK:
	mov.l	REG_VDP,R1
	mov.w	VALUE_8000h,R2
whileDISP:
	mov.w	@($A,R1),R0	; while (FB_CTRL_REG & 8000h == 0) ;
	and	R2,R0
	cmp/eq	#0,R0
	bt	whileDISP
	rts
	nop			; Executes NOP before branching
and

Code: Select all

waitForDISP:
	mov.l	REG_VDP,R1
	mov.w	VALUE_8000h,R2
whileVBLK:
	mov.w	@($A,R1),R0	; while (FB_CTRL_REG & 8000h == 8000h) ;
	and	R2,R0
	cmp/eq	R2,R0
	bt	whileVBLK
	rts
	nop			; Executes NOP before branching
And, guess what ... R12 is sensibly different from R13 !!!
I've benchmarked R13 (the V_INT code) and I know it is true. But R12 is more than twice bigger !!! Does anyone know where this gap come from ?

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: VBLK timing

Post by Stef » Wed Mar 21, 2007 10:26 am

ob1 wrote:Hi you all.
I'm currently working on vSync, and experience some strange behaviour.
First of all, here's my V_INT code :

Code: Select all

V_INT:
	mov	#0,R0
	mov.w	R0,@($16,GBR)	; Clear VINT
	rte
	add	#1,R13		; Executes ADD before branching
Then, here's my main loop :

Code: Select all

main:
	bsr	waitForVBLK	; wait for V_INT to happen
	nop

	add	#1,R12

	bsr	waitForDISP	; wait for V_INT to finish, and display to begin
	nop

	bra	main
	nop
with

Code: Select all

waitForVBLK:
	mov.l	REG_VDP,R1
	mov.w	VALUE_8000h,R2
whileDISP:
	mov.w	@($A,R1),R0	; while (FB_CTRL_REG & 8000h == 0) ;
	and	R2,R0
	cmp/eq	#0,R0
	bt	whileDISP
	rts
	nop			; Executes NOP before branching
and

Code: Select all

waitForDISP:
	mov.l	REG_VDP,R1
	mov.w	VALUE_8000h,R2
whileVBLK:
	mov.w	@($A,R1),R0	; while (FB_CTRL_REG & 8000h == 8000h) ;
	and	R2,R0
	cmp/eq	R2,R0
	bt	whileVBLK
	rts
	nop			; Executes NOP before branching
And, guess what ... R12 is sensibly different from R13 !!!
I've benchmarked R13 (the V_INT code) and I know it is true. But R12 is more than twice bigger !!! Does anyone know where this gap come from ?
Shouldn't your V_INT code having some push pop for R0 register ?

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

Re: VBLK timing

Post by ob1 » Wed Mar 21, 2007 10:53 am

Stef wrote:Shouldn't your V_INT code having some push pop for R0 register ?

Code: Select all

+----------+
| APPLAUSE |
+----------+

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Mar 21, 2007 11:42 am

Does it fixed your problem O_o ?

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

Post by ob1 » Wed Mar 21, 2007 1:03 pm

Sure it did !!
You rock !

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Mar 21, 2007 2:10 pm

hehe, cool :) i though another problem left ^^

Post Reply