| 207 | } |
| 208 | |
| 209 | static void SQReload(int x, uint8 V) |
| 210 | { |
| 211 | if(EnabledChannels&(1<<x)) |
| 212 | lengthcount[x]=lengthtable[(V>>3)&0x1f]; |
| 213 | |
| 214 | /* use the low 8 bits data from pulse period |
| 215 | * instead of from the sweep period */ |
| 216 | /* https://forums.nesdev.com/viewtopic.php?t=219&p=1431 */ |
| 217 | curfreq[x]=(curfreq[x] & 0xff)|((V&7)<<8); |
| 218 | RectDutyCount[x]=7; |
| 219 | EnvUnits[x].reloaddec=1; |
| 220 | } |
| 221 | |
| 222 | static DECLFW(Write_PSG) |
| 223 | { |