MCPcopy
hub / github.com/fogleman/nes / stepFrameCounter

Method stepFrameCounter

nes/apu.go:140–168  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

138// - l - l l - l - - Length counter and sweep
139// e e e e e e e e - Envelope and linear counter
140func (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
170func (apu *APU) stepTimer() {
171 if apu.cycle%2 == 0 {

Callers 1

StepMethod · 0.95

Calls 4

stepEnvelopeMethod · 0.95
stepSweepMethod · 0.95
stepLengthMethod · 0.95
fireIRQMethod · 0.95

Tested by

no test coverage detected