Page 2 of 2

Posted: Mon Jul 12, 2010 7:36 pm
by tokumaru
tepples wrote:and it's not even really wasting if you defer computation of some of the written values until that line.
The code I use takes significantly less than a scanline:

Code: Select all

	;start setting the scroll before the horizontal blank (48 cycles)
	lda ScrollX+1
	lsr
	lda ScrollY+1
	rol
	asl
	asl
	sta PPUADDR
	lda ScrollY+0
	sta PPUSCROLL
	asl
	asl
	and #%11100000
	ldx ScrollX+0
	sta ScrollX+0
	txa
	lsr
	lsr
	lsr
	ora ScrollX+0

	;finish setting the scroll during HBlank (11 cycles)
	stx PPUSCROLL
	sta PPUADDR
	stx ScrollX+0
But yeah, it makes sense to do these operations as the scanline is rendered, and have the final writes fall within HBlank. That way only a portion of the time will be wasted.

Posted: Mon Jul 12, 2010 7:42 pm
by Banshaku
I see. I will need to check what was the issue in details once I can remember the code since I didn't touch for 7 months. I was just prototyping at the time so the code is not stable yet.

As for wasting time, this is not much an issue in my case since I only need to do this during screen transition so nothing intensive happen during that phase.

Re: PPU synchronization from NMI

Posted: Thu Jul 23, 2015 12:31 am
by thefox
Broken link in the original post, can somebody repost in an attachment? (Preferably a mod or blargg should edit the original post to include the attachment...)

Re: PPU synchronization from NMI

Posted: Thu Jul 23, 2015 12:50 am
by freem
this link appears to still work: http://slack.net/~ant/old/nes-code/nmi_sync.zip

I've attached it to this post so it won't get lost in the future.