mode 0: mode 1: function --------- ----------- ----------------------------- - - - f - - - - - IRQ (if bit 6 is clear) - l - l l - l - - Length counter and sweep e e e e e e e e - Envelope and linear counter
()
| 138 | // - l - l l - l - - Length counter and sweep |
| 139 | // e e e e e e e e - Envelope and linear counter |
| 140 | func (apu *APU) stepFrameCounter() { |
| 141 | switch apu.framePeriod { |
| 142 | case 4: |
| 143 | apu.frameValue = (apu.frameValue + 1) % 4 |
| 144 | switch apu.frameValue { |
| 145 | case 0, 2: |
| 146 | apu.stepEnvelope() |
| 147 | case 1: |
| 148 | apu.stepEnvelope() |
| 149 | apu.stepSweep() |
| 150 | apu.stepLength() |
| 151 | case 3: |
| 152 | apu.stepEnvelope() |
| 153 | apu.stepSweep() |
| 154 | apu.stepLength() |
| 155 | apu.fireIRQ() |
| 156 | } |
| 157 | case 5: |
| 158 | apu.frameValue = (apu.frameValue + 1) % 5 |
| 159 | switch apu.frameValue { |
| 160 | case 0, 2: |
| 161 | apu.stepEnvelope() |
| 162 | case 1, 3: |
| 163 | apu.stepEnvelope() |
| 164 | apu.stepSweep() |
| 165 | apu.stepLength() |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | func (apu *APU) stepTimer() { |
| 171 | if apu.cycle%2 == 0 { |
no test coverage detected