This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

DMC and sprite0/timed code

DMC and sprite0/timed code
by on (#92121)
The wiki page for the DMC says that when the sample buffer is empty, that "The CPU is suspend for up to four clock cycles." So if I have a timed loop after a sprite0 hit like so...

Code:
         ldx #2
_loop:   nop
         nop   ; <-- buffer is empty here on the first iteration
         nop
         dex
         bne _loop


...will the rest of the loop be delayed for four cycles (or more, if it becomes empty again)?

by on (#92122)
I hope this topic gives some help...

by on (#92127)
Since this is NESdev and not NESEMdev, I imagine you are more concerned about how your timed loop will get screwed. Yes, it will screw up your timed code, and there's no way around that AFAIK.

by on (#92131)
You can always write your code so that being off by 12 pixels won't matter.

by on (#92137)
Dwedit wrote:
You can always write your code so that being off by 12 pixels won't matter.

HBlank has 85 pixels, so depending on what you want to do, the extra delay won't matter at all. For changing the scroll, for example, only the last couple PPU writes must actually fall inside HBlank, so there's quite a lot of wiggling room. Changing the palette, however, needs more HBlank time.