pub enum WriteOrigin {
Instruction,
Reset,
}Expand description
What performed a register write.
Not every write to $4000-$4017 comes from an instruction, and a
provenance tool that pretends otherwise is worse than no tool. Apu::reset
performs an internal write_register($4015, 0) modelling the warm-reset
silencing of the channels. That is real hardware behaviour with no CPU
instruction behind it, and attributing it to whatever PC happened to be
latched would print a confident, specific, wrong answer — the exact failure
this feature exists to prevent, reproduced by the feature itself.
Found in review of the PR that introduced audio provenance, before it shipped. The alternative fixes were both worse: suppressing the record entirely would leave the slot advertising the register’s previous value after reset genuinely changed it, and a sentinel PC would be indistinguishable from a real write to address zero.
Variants§
Instruction
A CPU instruction wrote it; pc names that instruction.
Reset
The APU’s own reset sequence wrote it. pc is not meaningful.
Trait Implementations§
Source§impl Clone for WriteOrigin
impl Clone for WriteOrigin
Source§fn clone(&self) -> WriteOrigin
fn clone(&self) -> WriteOrigin
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more