I'm getting back into the APU(one way or another) and am curious about a few things, hoping you can help(yeah you! right there!).

- so i need to know if someone can give a C style algo for generating the waves. I didn't find anything about the square in the docs i've read, but i've read that the triangle is 4-bits wide and behaves like so:

Code: Select all

`FEDCBA98765432100123456789ABCDEF`

Code: Select all

```
int inc=1; //two global elements
triangle = [-7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8]; //outside of the output loop
//...somewhere inside the loop
if(!inc){
for(i=0;i<15; i++){
output = triangle[i];
if(i==15)inc=0;
}
}else{
for(i=15;i>0; i--){
output = triangle[i];
if(i==0)inc=0;
}
}
```

- Same for the noise channel. I can do random no problem, but I don't know if there's a special algorithm to make the randomness accurate to the NES that I should be considering.

Had some more questions, but i forgot them after typing this :p

So anyone have any ideas?

Thanks,

Malik