APU Envelope Question

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
APU Envelope Question
by on (#81265)
I have a question regarding the APU's envelope module: http://wiki.nesdev.com/w/index.php/APU_Envelope

Specifically regarding the "start flag". What happens if the CPU writes to register #4 at the exact same time that the frame seqeuncer clocks the envelope module? Which condition (i.e. frame seq clock or CPU write) has higher priority? In other words, does the start flag get set (due to CPU write), or is the CPU write ignored (and thus the start flag is not set)?

Thanks all!

Jonathon

by on (#81266)
I don't think the write is ignored under any circumstnaces, the start flag will get set no matter what. I've never encountered a situation where writing to the fourth register doesn't reset the envelope. However, the envelope may restart immediately, or it might wait until the next time the sequencer clocks it, I'm not sure on that.

by on (#81306)
Yeah, it seems like no one is really sure what the answer is (including on #nesdev). I'll just leave it the way i have it for now until I find that it causes a bug somewhere.... Thanks for your help!